升级
This commit is contained in:
@@ -7,48 +7,41 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Check
|
||||
{
|
||||
public partial class RewardAndPunish : PageBase
|
||||
{
|
||||
#region 项目主键
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get { return (string)ViewState["ProjectId"]; }
|
||||
set { ViewState["ProjectId"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string RewardAndPunishID
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["RewardAndPunishID"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["RewardAndPunishID"] = value;
|
||||
}
|
||||
get { return (string)ViewState["RewardAndPunishID"]; }
|
||||
set { ViewState["RewardAndPunishID"] = value; }
|
||||
}
|
||||
public string SysTemType
|
||||
{
|
||||
get { return (string)ViewState["SysTemType"]; }
|
||||
set { ViewState["SysTemType"] = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) &&
|
||||
Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
@@ -61,7 +54,9 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
}
|
||||
btnNew.OnClientClick = Window1.GetShowReference("RewardAndPunishEdit.aspx") + "return false;";
|
||||
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpResponseUnit, this.CurrUser.LoginProjectId, "", true);
|
||||
this.SysTemType = Request.Params["type"] ?? "1";
|
||||
btnNew.OnClientClick = Window1.GetShowReference(String.Format("RewardAndPunishEdit.aspx?sysTemType={0}",SysTemType, "编辑 - ")) + "return false;";
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
@@ -75,25 +70,25 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
|
||||
this.GetButtonPower();
|
||||
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
btnNew.Hidden = true;
|
||||
}
|
||||
this.GetButtonPower();
|
||||
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
|
||||
public void BindGrid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DataTable tb = ChecklistData();
|
||||
|
||||
// 2.获取当前分页数据
|
||||
@@ -105,7 +100,6 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -114,23 +108,52 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
string strSql = @" SELECT RewardAndPunishID
|
||||
,Type
|
||||
,ResponseUnit
|
||||
,NoticeUnit
|
||||
,Description
|
||||
,Money
|
||||
,Date
|
||||
,CreateMan
|
||||
,ProjectId
|
||||
,ProjectId,RewardAndPunishCode,Remark,DataSource,RewardAndPunishType,RewardAndPunishMan,TeamGroupId
|
||||
FROM dbo.Check_RewardAndPunish
|
||||
where ProjectId=@ProjectId";
|
||||
where ProjectId=@ProjectId and SysTemType = @SysTemType ";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
listStr.Add(new SqlParameter("@SysTemType", this.SysTemType));
|
||||
|
||||
if (drpType.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND Type=@Type";
|
||||
strSql += " AND Type = @Type";
|
||||
listStr.Add(new SqlParameter("@Type", drpType.SelectedValue));
|
||||
}
|
||||
|
||||
|
||||
if (drpRewardAndPunishType.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpRewardAndPunishType.SelectedValue))
|
||||
{
|
||||
strSql += " AND RewardAndPunishType = @RewardAndPunishType";
|
||||
listStr.Add(new SqlParameter("@RewardAndPunishType", drpRewardAndPunishType.SelectedValue));
|
||||
}
|
||||
|
||||
if (this.drpDataSource.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
if (this.drpDataSource.SelectedValue == "0")
|
||||
{
|
||||
strSql += " AND (DataSource is null or DataSource = @DataSource) ";
|
||||
listStr.Add(new SqlParameter("@DataSource", drpDataSource.SelectedValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
strSql += " AND DataSource = @DataSource";
|
||||
listStr.Add(new SqlParameter("@DataSource", drpDataSource.SelectedValue));
|
||||
}
|
||||
}
|
||||
|
||||
if (drpResponseUnit.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpRewardAndPunishType.SelectedValue))
|
||||
{
|
||||
strSql += " AND ResponseUnit = @ResponseUnit";
|
||||
listStr.Add(new SqlParameter("@ResponseUnit", drpResponseUnit.SelectedValue));
|
||||
}
|
||||
strSql += " ORDER BY Date DESC";
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
return tb;
|
||||
@@ -138,6 +161,7 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
|
||||
|
||||
#region 过滤表头、排序、分页、关闭窗口
|
||||
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
@@ -181,7 +205,9 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//<summary>
|
||||
//获取办理人姓名
|
||||
//</summary>
|
||||
@@ -193,29 +219,86 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
{
|
||||
return BLL.UserService.GetUserByUserId(userid.ToString()).UserName;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
protected string ConvertUnitName(object userid)
|
||||
|
||||
protected string ConvertRewardAndPunishType(object Type,object RewardAndPunishType)
|
||||
{
|
||||
if (userid != null && !string.IsNullOrEmpty(userid.ToString()))
|
||||
Model.Sys_Const model;
|
||||
if (Type != null && Type.ToString() == "1")
|
||||
{
|
||||
return BLL.UnitService.GetUnitByUnitId(userid.ToString()).UnitName;
|
||||
model = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == "RewardType" && x.ConstValue == RewardAndPunishType.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
model = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == "PunishType" && x.ConstValue == RewardAndPunishType.ToString());
|
||||
}
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return model.ConstText;
|
||||
}
|
||||
|
||||
|
||||
protected string ConvertUnitName(object uintid)
|
||||
{
|
||||
if (uintid != null && !string.IsNullOrEmpty(uintid.ToString()))
|
||||
{
|
||||
return BLL.UnitService.GetUnitByUnitId(uintid.ToString()).UnitName;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected string ConvertPersionName(object persionid)
|
||||
{
|
||||
if (persionid != null && !string.IsNullOrEmpty(persionid.ToString()))
|
||||
{
|
||||
return BLL.PersonService.GetPersonById(persionid.ToString()).PersonName;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected string ConvertTeamGroupName(object teamGroupid)
|
||||
{
|
||||
if (teamGroupid != null && !string.IsNullOrEmpty(teamGroupid.ToString()))
|
||||
{
|
||||
return BLL.TeamGroupService.getTeamGroupNameById(teamGroupid.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected string ConvertDataSource(object dataSource)
|
||||
{
|
||||
string data = "常规";
|
||||
if (dataSource != null)
|
||||
{
|
||||
if (dataSource.ToString() == "1")
|
||||
{
|
||||
data = "巡检";
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
protected string ConvertType(object type)
|
||||
{
|
||||
if (type != null)
|
||||
{
|
||||
if (type.ToString() == "0")
|
||||
return "奖励通知单";
|
||||
if (type.ToString() == "1")
|
||||
return "奖励";
|
||||
else
|
||||
return "处罚通知单";
|
||||
return "处罚";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
#region Grid双击事件
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
@@ -239,6 +322,7 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string codes = Grid1.SelectedRowID.Split(',')[0];
|
||||
var checks = BLL.RewardAndPunishService.GetRewardAndPunishById(codes);
|
||||
|
||||
@@ -252,11 +336,10 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RewardAndPunishEdit.aspx?RewardAndPunishID={0}", codes, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(
|
||||
String.Format("RewardAndPunishEdit.aspx?RewardAndPunishID={0}", codes, "编辑 - ")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -264,8 +347,11 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
@@ -277,32 +363,35 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.RewardAndPunishMenuId);
|
||||
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId,
|
||||
BLL.Const.RewardAndPunishMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
|
||||
}
|
||||
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDel.Hidden = false;
|
||||
}
|
||||
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuModify.Hidden = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void drpType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
@@ -310,16 +399,20 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string codes = Grid1.SelectedRowID.Split(',')[0];
|
||||
|
||||
BLL.RewardAndPunishService.DeleteRewardAndPunishById(codes);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, "", codes, BLL.Const.CheckListMenuId, "删除奖罚通知单(定稿)");
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string codes = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.RewardAndPunishService.DeleteRewardAndPunishById(codes);
|
||||
//删除对应的附件
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, AttachFileService.getFileUrl(codes));
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, "", codes, BLL.Const.CheckListMenuId, "删除奖罚通知单(定稿)");
|
||||
}
|
||||
Grid1.DataBind();
|
||||
BindGrid();
|
||||
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
||||
@@ -334,5 +427,39 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void drpType_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpType.SelectedText == "奖励")
|
||||
{
|
||||
ConstValue.InitConstValueDropDownList(this.drpRewardAndPunishType, "RewardType", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConstValue.InitConstValueDropDownList(this.drpRewardAndPunishType, "PunishType", true);
|
||||
}
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
|
||||
protected string ConvertAttachFile(object rewardAndPunishID)
|
||||
{
|
||||
string fileUrl = "";
|
||||
var model = BLL.RewardAndPunishService.GetRewardAndPunishById(rewardAndPunishID.ToString());
|
||||
if (model != null)
|
||||
{
|
||||
if (model.DataSource == "1")
|
||||
{
|
||||
fileUrl = BLL.AttachFileService.GetBtnFileUrl(model.HazardRegisterId);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileUrl = BLL.AttachFileService.GetBtnFileUrl(model.RewardAndPunishID);
|
||||
}
|
||||
}
|
||||
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user