SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/RewardAndPunish/RewardAndPunishView.aspx.cs

203 lines
7.3 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.CQMS.RewardAndPunish
{
public partial class RewardAndPunishView : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string RewardAndPunishId
{
get
{
return (string)ViewState["RewardAndPunishId"];
}
set
{
ViewState["RewardAndPunishId"] = value;
}
}
/// <summary>
/// 办理类型
/// </summary>
public string State
{
get
{
return (string)ViewState["State"];
}
set
{
ViewState["State"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RewardAndPunishId = Request.Params["RewardAndPunishId"];
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
if (!string.IsNullOrEmpty(RewardAndPunishId))
{
Model.RewardAndPunish_RewardAndPunish RewardAndPunish = BLL.RewardAndPunishService.GetRewardAndPunishById(RewardAndPunishId);
hdId.Text = this.RewardAndPunishId;
if (!string.IsNullOrEmpty(RewardAndPunish.UnitId))
{
this.drpUnit.SelectedValue = RewardAndPunish.UnitId;
}
txtRewardAndPunishCode.Text = RewardAndPunish.RewardAndPunishCode;
if (!string.IsNullOrEmpty(RewardAndPunish.Type))
{
this.rblType.SelectedValue = RewardAndPunish.Type;
if (RewardAndPunish.Type == "1") //奖励
{
BLL.RewardTypeService.InitRewardTypeDropDownList(drpRewardAndPunishType, true);
}
else //处罚
{
BLL.PunishTypeService.InitPunishTypeDropDownList(drpRewardAndPunishType, true);
}
}
txtRewardAndPunishBasis.Text = RewardAndPunish.RewardAndPunishBasis;
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishTypeId))
{
drpRewardAndPunishType.SelectedValue = RewardAndPunish.RewardAndPunishTypeId;
drpRewardAndPunishType_SelectedIndexChanged(null, null);
}
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishDecision))
{
this.txtRewardAndPunishDecision.Text = RewardAndPunish.RewardAndPunishDecision;
}
gvApprove.DataSource = BLL.RewardAndPunishApproveService.getListData(this.RewardAndPunishId);
gvApprove.DataBind();
}
}
}
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
}
/// <summary>
/// 时间转换
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public string ConvertDate(object date)
{
if (date != null)
{
return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date));
}
else
{
return null;
}
}
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
protected string ConvertState(object state)
{
if (state != null)
{
if (state.ToString() == BLL.Const.RewardAndPunish_ReCompile)
{
return "重新编制";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Compile)
{
return "编制";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Audit1)
{
return "质量经理审核";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Audit2)
{
return "项目经理批准";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Complete)
{
return "审批完成";
}
else
{
return "";
}
}
return "";
}
protected void imgBtnFile_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(hdId.Text))
{
hdId.Text = SQLHelper.GetNewID();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/RewardAndPunish&menuId={1}", hdId.Text, BLL.Const.RewardAndPunishMenuId)));
}
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpUnit.SelectedValue != BLL.Const._Null)
{
string prefix = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId) + "-" + BLL.UnitService.GetUnitCodeByUnitId(this.drpUnit.SelectedValue) + "-ZLJC-";
txtRewardAndPunishCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "RewardAndPunish_RewardAndPunish", "RewardAndPunishCode", this.CurrUser.LoginProjectId, prefix);
}
else
{
this.txtRewardAndPunishCode.Text = string.Empty;
}
}
protected void drpRewardAndPunishType_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpRewardAndPunishType.SelectedValue != BLL.Const._Null)
{
Model.Base_RewardType rt = BLL.RewardTypeService.GetRewardTypeById(this.drpRewardAndPunishType.SelectedValue);
Model.Base_PunishType pt = BLL.PunishTypeService.GetPunishTypeById(this.drpRewardAndPunishType.SelectedValue);
if (rt != null)
{
this.txtRewardAndPunishDecision.Text = rt.RewardDecision;
}
else
{
this.txtRewardAndPunishDecision.Text = pt.PunishDecision;
}
}
else
{
this.txtRewardAndPunishDecision.Text = string.Empty;
}
}
protected void rblType_SelectedIndexChanged(object sender, EventArgs e)
{
if (rblType.SelectedValue == "1") //奖励
{
BLL.RewardTypeService.InitRewardTypeDropDownList(drpRewardAndPunishType, true);
}
else //处罚
{
BLL.PunishTypeService.InitPunishTypeDropDownList(drpRewardAndPunishType, true);
}
this.drpRewardAndPunishType.SelectedValue = BLL.Const._Null;
}
}
}