using BLL; using Newtonsoft.Json.Linq; using System; using System.Data; using System.Data.SqlClient; using System.Collections.Generic; using System.Linq; using System.Web.UI.WebControls; using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.CQMS.RewardAndPunish { public partial class RewardAndPunishView : PageBase { /// /// 主键 /// public string RewardAndPunishId { get { return (string)ViewState["RewardAndPunishId"]; } set { ViewState["RewardAndPunishId"] = value; } } /// /// 办理类型 /// 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); } 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) { } /// /// 时间转换 /// /// /// public string ConvertDate(object date) { if (date != null) { return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date)); } else { return null; } } /// /// 把状态转换代号为文字形式 /// /// /// 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; } } }