ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/common/WelderManage/PersonQualifiedProject.aspx.cs

168 lines
7.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.HJGL.PersonManage
{
public partial class PersonQualifiedProject : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string wED_ID = Request.Params["WED_ID"];
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_PersonManageMenuId, BLL.Const.BtnAdd))
{
btnNew.OnClientClick = Window1.GetShowReference("PersonQualifiedProjectEdit.aspx?WED_ID=" + wED_ID) + "return false;";
}
var qualifiedProjects = (from x in Funs.DB.HJGL_BS_WelderQualifiedProject
join y in Funs.DB.HJGL_BS_Welder
on x.WED_ID equals y.WED_ID
where x.WED_ID == wED_ID
orderby x.LimitDate descending
select new {
x.WelderQualifiedProjectId,
y.WED_Name,
y.WED_Code,
x.QualifiedProjectCode,
x.LimitDate,
}).ToList();
Grid1.DataSource = qualifiedProjects;
Grid1.DataBind();
}
}
#endregion
#region Grid双击事件
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_PersonManageMenuId, BLL.Const.BtnModify))
{
btnMenuEdit_Click(null, null);
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 编辑按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_PersonManageMenuId, BLL.Const.BtnModify))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string welderQualifiedProjectId = Grid1.SelectedRowID;
var welderQualifiedProject = BLL.HJGL_WelderQualifiedProjectService.GetWelderQualifiedProjectById(welderQualifiedProjectId);
if (welderQualifiedProject != null)
{
if (this.btnMenuEdit.Hidden) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonQualifiedProjectView.aspx?welderQualifiedProjectId={0}", welderQualifiedProjectId, "查看 - ")));
}
else
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonQualifiedProjectEdit.aspx?welderQualifiedProjectId={0}", welderQualifiedProjectId, "编辑 - ")));
}
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 批量删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_PersonManageMenuId, BLL.Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
BLL.HJGL_WelderQualifiedProjectService.DeleteWelderQualifiedProjectByWelderQualifiedProjectId(rowID);
BLL.Sys_LogService.AddLog(Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除焊工合格项目信息");
}
var qualifiedProjects = (from x in Funs.DB.HJGL_BS_WelderQualifiedProject
join y in Funs.DB.HJGL_BS_Welder
on x.WED_ID equals y.WED_ID
where x.WED_ID == Request.Params["WED_ID"]
orderby x.LimitDate descending
select new
{
x.WelderQualifiedProjectId,
y.WED_Name,
y.WED_Code,
x.QualifiedProjectCode,
x.LimitDate,
}).ToList();
Grid1.DataSource = qualifiedProjects;
Grid1.DataBind();
ShowNotify("删除数据成功!(表格数据已重新绑定)");
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
/// <summary>
/// 关闭弹出窗
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
var qualifiedProjects = (from x in Funs.DB.HJGL_BS_WelderQualifiedProject
join y in Funs.DB.HJGL_BS_Welder
on x.WED_ID equals y.WED_ID
where x.WED_ID == Request.Params["WED_ID"]
orderby x.LimitDate descending
select new
{
x.WelderQualifiedProjectId,
y.WED_Name,
y.WED_Code,
x.QualifiedProjectCode,
x.LimitDate,
}).ToList();
Grid1.DataSource = qualifiedProjects;
Grid1.DataBind();
}
}
}