/// <summary> /// 修改奖励通知单 /// </summary> /// <param name="incentiveNotice"></param> public static void UpdateIncentiveNotice(Model.Check_IncentiveNotice incentiveNotice) { Model.SUBHSSEDB db = Funs.DB; Model.Check_IncentiveNotice newIncentiveNotice = db.Check_IncentiveNotice.FirstOrDefault(e => e.IncentiveNoticeId == incentiveNotice.IncentiveNoticeId); if (newIncentiveNotice != null) { //newIncentiveNotice.ProjectId = incentiveNotice.ProjectId; //newIncentiveNotice.IncentiveNoticeCode = incentiveNotice.IncentiveNoticeCode; newIncentiveNotice.UnitId = incentiveNotice.UnitId; newIncentiveNotice.IncentiveDate = incentiveNotice.IncentiveDate; newIncentiveNotice.TeamGroupId = incentiveNotice.TeamGroupId; newIncentiveNotice.PersonId = incentiveNotice.PersonId; newIncentiveNotice.BasicItem = incentiveNotice.BasicItem; newIncentiveNotice.IncentiveMoney = incentiveNotice.IncentiveMoney; newIncentiveNotice.TitleReward = incentiveNotice.TitleReward; newIncentiveNotice.MattleReward = incentiveNotice.MattleReward; newIncentiveNotice.FileContents = incentiveNotice.FileContents; newIncentiveNotice.AttachUrl = incentiveNotice.AttachUrl; newIncentiveNotice.CompileMan = incentiveNotice.CompileMan; newIncentiveNotice.CompileDate = incentiveNotice.CompileDate; newIncentiveNotice.States = incentiveNotice.States; newIncentiveNotice.SignMan = incentiveNotice.SignMan; newIncentiveNotice.ApproveMan = incentiveNotice.ApproveMan; newIncentiveNotice.RewardType = incentiveNotice.RewardType; newIncentiveNotice.Currency = incentiveNotice.Currency; db.SubmitChanges(); } }
/// <summary> /// 添加奖励通知单 /// </summary> /// <param name="incentiveNotice"></param> public static void AddIncentiveNotice(Model.Check_IncentiveNotice incentiveNotice) { Model.SUBHSSEDB db = Funs.DB; Model.Check_IncentiveNotice newIncentiveNotice = new Model.Check_IncentiveNotice { IncentiveNoticeId = incentiveNotice.IncentiveNoticeId, ProjectId = incentiveNotice.ProjectId, IncentiveNoticeCode = incentiveNotice.IncentiveNoticeCode, UnitId = incentiveNotice.UnitId, TeamGroupId = incentiveNotice.TeamGroupId, IncentiveDate = incentiveNotice.IncentiveDate, PersonId = incentiveNotice.PersonId, BasicItem = incentiveNotice.BasicItem, IncentiveMoney = incentiveNotice.IncentiveMoney, TitleReward = incentiveNotice.TitleReward, MattleReward = incentiveNotice.MattleReward, FileContents = incentiveNotice.FileContents, AttachUrl = incentiveNotice.AttachUrl, CompileMan = incentiveNotice.CompileMan, CompileDate = incentiveNotice.CompileDate, States = incentiveNotice.States, SignMan = incentiveNotice.SignMan, ApproveMan = incentiveNotice.ApproveMan, RewardType = incentiveNotice.RewardType, Currency = incentiveNotice.Currency }; db.Check_IncentiveNotice.InsertOnSubmit(newIncentiveNotice); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectIncentiveNoticeMenuId, incentiveNotice.ProjectId, null, incentiveNotice.IncentiveNoticeId, incentiveNotice.CompileDate); }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.Check_IncentiveNotice incentiveNotice = new Model.Check_IncentiveNotice { ProjectId = this.ProjectId, IncentiveNoticeCode = this.txtIncentiveNoticeCode.Text.Trim(), UnitId = this.drpUnit.SelectedValue, IncentiveDate = Funs.GetNewDateTime(this.txtIncentiveDate.Text.Trim()) }; if (this.drpTeamGroup.SelectedValue != BLL.Const._Null) { incentiveNotice.TeamGroupId = this.drpTeamGroup.SelectedValue; } if (this.drpPerson.SelectedValue != BLL.Const._Null) { incentiveNotice.PersonId = this.drpPerson.SelectedValue; } incentiveNotice.BasicItem = this.txtBasicItem.Text.Trim(); if (this.drpRewardType.SelectedValue != BLL.Const._Null) { incentiveNotice.RewardType = this.drpRewardType.SelectedValue; } incentiveNotice.IncentiveMoney = Funs.GetNewDecimalOrZero(this.txtPayMoney.Text.Trim()); incentiveNotice.TitleReward = this.txtTitleReward.Text.Trim(); incentiveNotice.MattleReward = this.txtMattleReward.Text.Trim(); incentiveNotice.FileContents = HttpUtility.HtmlEncode(this.txtFileContents.Text); incentiveNotice.AttachUrl = this.AttachUrl; incentiveNotice.CompileMan = this.CurrUser.UserId; incentiveNotice.CompileDate = Funs.GetNewDateTime(this.txtIncentiveDate.Text.Trim()); if (this.drpSignMan.SelectedValue != BLL.Const._Null) { incentiveNotice.SignMan = this.drpSignMan.SelectedValue; } if (this.drpApproveMan.SelectedValue != BLL.Const._Null) { incentiveNotice.ApproveMan = this.drpApproveMan.SelectedValue; } incentiveNotice.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { incentiveNotice.States = this.ctlAuditFlow.NextStep; } incentiveNotice.Currency = this.txtCurrency.Text.Trim(); if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { incentiveNotice.IncentiveNoticeId = this.IncentiveNoticeId; BLL.IncentiveNoticeService.UpdateIncentiveNotice(incentiveNotice); BLL.LogService.AddSys_Log(this.CurrUser, incentiveNotice.IncentiveNoticeCode, incentiveNotice.IncentiveNoticeId, BLL.Const.ProjectIncentiveNoticeMenuId, BLL.Const.BtnModify); } else { this.IncentiveNoticeId = SQLHelper.GetNewID(typeof(Model.Check_IncentiveNotice)); incentiveNotice.IncentiveNoticeId = this.IncentiveNoticeId; BLL.IncentiveNoticeService.AddIncentiveNotice(incentiveNotice); BLL.LogService.AddSys_Log(this.CurrUser, incentiveNotice.IncentiveNoticeCode, incentiveNotice.IncentiveNoticeId, BLL.Const.ProjectIncentiveNoticeMenuId, BLL.Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectIncentiveNoticeMenuId, this.IncentiveNoticeId, (type == BLL.Const.BtnSubmit ? true : false), incentiveNotice.IncentiveNoticeCode, "../Check/IncentiveNoticeView.aspx?IncentiveNoticeId={0}"); }
/// <summary> /// 保存Check_IncentiveNotice /// </summary> /// <param name="newItem">奖励通知单</param> /// <returns></returns> public static void SaveIncentiveNotice(Model.IncentiveNoticeItem newItem) { Model.SUBHSSEDB db = Funs.DB; Model.Check_IncentiveNotice newIncentiveNotice = new Model.Check_IncentiveNotice { IncentiveNoticeId = newItem.IncentiveNoticeId, IncentiveNoticeCode = newItem.IncentiveNoticeCode, ProjectId = newItem.ProjectId, IncentiveDate = Funs.GetNewDateTime(newItem.IncentiveDate), UnitId = newItem.UnitId, PersonId = newItem.PersonId, RewardType = newItem.RewardTypeId, BasicItem = newItem.BasicItem, IncentiveMoney = newItem.IncentiveMoney, Currency = newItem.Currency, TitleReward = newItem.TitleReward, MattleReward = newItem.MattleReward, SignMan = newItem.SignManId, ApproveMan = newItem.ApproveManId, FileContents = System.Web.HttpUtility.HtmlEncode(newItem.FileContents), CompileMan = newItem.CompileManId, AttachUrl = newItem.AttachUrl, States = Const.State_2, }; if (!string.IsNullOrEmpty(newItem.TeamGroupId)) { newIncentiveNotice.TeamGroupId = newItem.TeamGroupId; } if (newItem.States != "1") { newIncentiveNotice.States = Const.State_0; } var updateIncentiveNotice = Funs.DB.Check_IncentiveNotice.FirstOrDefault(x => x.IncentiveNoticeId == newItem.IncentiveNoticeId); if (updateIncentiveNotice == null) { newIncentiveNotice.CompileDate = DateTime.Now; newIncentiveNotice.IncentiveNoticeId = SQLHelper.GetNewID(); newIncentiveNotice.IncentiveNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectIncentiveNoticeMenuId, newIncentiveNotice.ProjectId, newIncentiveNotice.UnitId); IncentiveNoticeService.AddIncentiveNotice(newIncentiveNotice); } else { IncentiveNoticeService.UpdateIncentiveNotice(newIncentiveNotice); } if (newIncentiveNotice.States == "1") { CommonService.btnSaveData(newIncentiveNotice.ProjectId, Const.ProjectIncentiveNoticeMenuId, newIncentiveNotice.IncentiveNoticeId, newIncentiveNotice.CompileMan, true, newIncentiveNotice.IncentiveNoticeCode, "../Check/IncentiveNoticeView.aspx?IncentiveNoticeId={0}"); } }
/// <summary> /// 根据主键删除奖励通知单 /// </summary> /// <param name="incentiveNoticeId"></param> public static void DeleteIncentiveNoticeById(string incentiveNoticeId) { Model.SUBHSSEDB db = Funs.DB; Model.Check_IncentiveNotice incentiveNotice = db.Check_IncentiveNotice.FirstOrDefault(e => e.IncentiveNoticeId == incentiveNoticeId); if (incentiveNotice != null) { CodeRecordsService.DeleteCodeRecordsByDataId(incentiveNoticeId); //删除编号 UploadFileService.DeleteFile(Funs.RootPath, incentiveNotice.AttachUrl); //删除附件 ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == incentiveNotice.IncentiveNoticeId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(incentiveNotice.ProjectId, item.OperaterId, item.OperaterTime, "210", "奖励通知单", Const.BtnDelete, 1); } ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(incentiveNotice.IncentiveNoticeId); } db.Check_IncentiveNotice.DeleteOnSubmit(incentiveNotice); db.SubmitChanges(); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.IncentiveNoticeId = Request.Params["IncentiveNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { Model.Check_IncentiveNotice incentiveNotice = BLL.IncentiveNoticeService.GetIncentiveNoticeById(this.IncentiveNoticeId); if (incentiveNotice != null) { this.txtIncentiveNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.IncentiveNoticeId); if (!string.IsNullOrEmpty(incentiveNotice.UnitId)) { var unit = UnitService.GetUnitByUnitId(incentiveNotice.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } if (!string.IsNullOrEmpty(incentiveNotice.TeamGroupId)) { var teamGroup = TeamGroupService.GetTeamGroupById(incentiveNotice.TeamGroupId); if (teamGroup != null) { this.txtTeamGroup.Text = teamGroup.TeamGroupName; } } if (!string.IsNullOrEmpty(incentiveNotice.PersonId)) { var person = BLL.PersonService.GetPersonById(incentiveNotice.PersonId); if (person != null) { this.txtPerson.Text = person.PersonName; } } if (incentiveNotice.IncentiveDate != null) { this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", incentiveNotice.IncentiveDate); } this.txtBasicItem.Text = incentiveNotice.BasicItem; if (!string.IsNullOrEmpty(incentiveNotice.RewardType)) { Model.Sys_Const c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_RewardType).FirstOrDefault(x => x.ConstValue == incentiveNotice.RewardType); if (c != null) { this.txtRewardType.Text = c.ConstText; } } if (incentiveNotice.IncentiveMoney != null) { this.txtPayMoney.Text = Convert.ToString(incentiveNotice.IncentiveMoney); this.rbtnIncentiveWay1.Checked = true; this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPayMoney.Text));//转换大写 } if (!string.IsNullOrEmpty(incentiveNotice.TitleReward)) { this.txtTitleReward.Text = incentiveNotice.TitleReward; this.rbtnIncentiveWay2.Checked = true; } if (!string.IsNullOrEmpty(incentiveNotice.MattleReward)) { this.txtMattleReward.Text = incentiveNotice.MattleReward; this.rbtnIncentiveWay3.Checked = true; } this.AttachUrl = incentiveNotice.AttachUrl; this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(incentiveNotice.FileContents); if (!string.IsNullOrEmpty(incentiveNotice.Currency)) { this.txtCurrency.Text = incentiveNotice.Currency; } } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectIncentiveNoticeMenuId; this.ctlAuditFlow.DataId = this.IncentiveNoticeId; } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); BLL.UserService.InitUserDropDownList(this.drpSignMan, this.CurrUser.LoginProjectId, true); BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true); Funs.FineUIPleaseSelect(this.drpTeamGroup); Funs.FineUIPleaseSelect(this.drpPerson); BLL.UserService.InitUserDropDownList(this.drpApproveMan, this.CurrUser.LoginProjectId, true); BLL.ConstValue.InitConstValueDropDownList(this.drpRewardType, BLL.ConstValue.Group_RewardType, true); BindGrid(string.Empty); this.IncentiveNoticeId = Request.Params["IncentiveNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { Model.Check_IncentiveNotice incentiveNotice = BLL.IncentiveNoticeService.GetIncentiveNoticeById(this.IncentiveNoticeId); if (incentiveNotice != null) { this.ProjectId = incentiveNotice.ProjectId; this.txtIncentiveNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.IncentiveNoticeId); if (!string.IsNullOrEmpty(incentiveNotice.UnitId)) { this.drpUnit.SelectedValue = incentiveNotice.UnitId; BLL.TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroup, this.ProjectId, incentiveNotice.UnitId, true); if (!string.IsNullOrEmpty(incentiveNotice.TeamGroupId)) { this.drpTeamGroup.SelectedValue = incentiveNotice.TeamGroupId; } BLL.PersonService.InitPersonByProjectUnitDropDownList(this.drpPerson, this.ProjectId, incentiveNotice.UnitId, true); if (!string.IsNullOrEmpty(incentiveNotice.PersonId)) { this.drpPerson.SelectedValue = incentiveNotice.PersonId; } } this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", incentiveNotice.IncentiveDate); this.txtBasicItem.Text = incentiveNotice.BasicItem; if (!string.IsNullOrEmpty(incentiveNotice.RewardType)) { this.drpRewardType.SelectedValue = incentiveNotice.RewardType; } if (incentiveNotice.IncentiveMoney.HasValue) { this.txtPayMoney.Text = Convert.ToString(incentiveNotice.IncentiveMoney); this.rbtnIncentiveWay1.Checked = true; this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(this.txtPayMoney.Text));//转换大写 } if (!string.IsNullOrEmpty(incentiveNotice.TitleReward)) { this.txtTitleReward.Text = incentiveNotice.TitleReward; this.rbtnIncentiveWay2.Checked = true; } if (!string.IsNullOrEmpty(incentiveNotice.MattleReward)) { this.txtMattleReward.Text = incentiveNotice.MattleReward; this.rbtnIncentiveWay3.Checked = true; } this.AttachUrl = incentiveNotice.AttachUrl; this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(incentiveNotice.FileContents); if (!string.IsNullOrEmpty(incentiveNotice.SignMan)) { this.drpSignMan.SelectedValue = incentiveNotice.SignMan; } if (!string.IsNullOrEmpty(incentiveNotice.ApproveMan)) { this.drpApproveMan.SelectedValue = incentiveNotice.ApproveMan; } if (!string.IsNullOrEmpty(incentiveNotice.Currency)) { this.txtCurrency.Text = incentiveNotice.Currency; } } } else { this.drpSignMan.SelectedValue = this.CurrUser.UserId; this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectIncentiveNoticeMenuId, this.ProjectId); if (codeTemplateRule != null) { this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } ////自动生成编码 this.txtIncentiveNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectIncentiveNoticeMenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectIncentiveNoticeMenuId; this.ctlAuditFlow.DataId = this.IncentiveNoticeId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }