/// <summary> /// 添加物资管理 /// </summary> /// <param name="goodsManage"></param> public static void AddGoodsManage(Model.CostGoods_GoodsManage goodsManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsManage newGoodsManage = new Model.CostGoods_GoodsManage { GoodsManageId = goodsManage.GoodsManageId, ProjectId = goodsManage.ProjectId, UnitId = goodsManage.UnitId, GoodsCategoryId = goodsManage.GoodsCategoryId, GoodsCode = goodsManage.GoodsCode, GoodsName = goodsManage.GoodsName, SizeModel = goodsManage.SizeModel, FactoryCode = goodsManage.FactoryCode, CheckDate = goodsManage.CheckDate, EnableYear = goodsManage.EnableYear, CheckPerson = goodsManage.CheckPerson, InTime = goodsManage.InTime, States = goodsManage.States, CompileMan = goodsManage.CompileMan, CompileDate = goodsManage.CompileDate, Remark = goodsManage.Remark }; db.CostGoods_GoodsManage.InsertOnSubmit(newGoodsManage); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GoodsManageMenuId, goodsManage.ProjectId, goodsManage.UnitId, goodsManage.GoodsManageId, goodsManage.CompileDate); }
/// <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(); this.InitDropDownList(); this.GoodsManageId = Request.Params["GoodsManageId"]; if (!string.IsNullOrEmpty(this.GoodsManageId)) { Model.CostGoods_GoodsManage goodsManage = BLL.GoodsManageService.GetGoodsManageById(this.GoodsManageId); if (goodsManage != null) { this.ProjectId = goodsManage.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } this.txtGoodsCode.Text = CodeRecordsService.ReturnCodeByDataId(this.GoodsManageId); this.txtGoodsName.Text = goodsManage.GoodsName; if (!string.IsNullOrEmpty(goodsManage.UnitId)) { this.drpUnitId.SelectedValue = goodsManage.UnitId; } if (!string.IsNullOrEmpty(goodsManage.GoodsCategoryId)) { this.drpGoodsCategory.SelectedValue = goodsManage.GoodsCategoryId; } this.txtSizeModel.Text = goodsManage.SizeModel; this.txtFactoryCode.Text = goodsManage.FactoryCode; this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", goodsManage.CheckDate); this.txtEnableYear.Text = Convert.ToString(goodsManage.EnableYear); if (!string.IsNullOrEmpty(goodsManage.CheckPerson)) { this.drpCheckPerson.SelectedValue = goodsManage.CheckPerson; } this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", goodsManage.InTime); this.txtRemark.Text = goodsManage.Remark; } } else { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.drpCheckPerson.SelectedValue = this.CurrUser.UserId; this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.txtEnableYear.Text = "1"; ////自动生成编码 this.txtGoodsCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.GoodsManageMenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.GoodsManageMenuId; this.ctlAuditFlow.DataId = this.GoodsManageId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <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.GoodsManageId = Request.Params["GoodsManageId"]; if (!string.IsNullOrEmpty(this.GoodsManageId)) { Model.CostGoods_GoodsManage goodsManage = BLL.GoodsManageService.GetGoodsManageById(this.GoodsManageId); if (goodsManage != null) { this.txtGoodsCode.Text = CodeRecordsService.ReturnCodeByDataId(this.GoodsManageId); this.txtGoodsName.Text = goodsManage.GoodsName; if (!string.IsNullOrEmpty(goodsManage.UnitId)) { var unit = BLL.UnitService.GetUnitByUnitId(goodsManage.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } var goodsCategory = BLL.GoodsCategoryService.GetGoodsCategoryById(goodsManage.GoodsCategoryId); if (goodsCategory != null) { this.txtGoodsCategory.Text = goodsCategory.GoodsCategoryName; } this.txtSizeModel.Text = goodsManage.SizeModel; this.txtFactoryCode.Text = goodsManage.FactoryCode; if (goodsManage.CheckDate.HasValue) { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", goodsManage.CheckDate); } this.txtEnableYear.Text = Convert.ToString(goodsManage.EnableYear); if (!string.IsNullOrEmpty(goodsManage.CheckPerson)) { var user = BLL.UserService.GetUserByUserId(goodsManage.CheckPerson); if (user != null) { this.txtCheckPersonName.Text = user.UserName; } } if (goodsManage.InTime != null) { this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", goodsManage.InTime); } this.txtRemark.Text = goodsManage.Remark; } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.GoodsManageMenuId; this.ctlAuditFlow.DataId = this.GoodsManageId; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.CostGoods_GoodsManage goodsManage = new Model.CostGoods_GoodsManage { ProjectId = this.ProjectId, GoodsCode = this.txtGoodsCode.Text.Trim(), GoodsName = this.txtGoodsName.Text.Trim() }; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { goodsManage.UnitId = this.drpUnitId.SelectedValue; } if (this.drpGoodsCategory.SelectedValue != BLL.Const._Null) { goodsManage.GoodsCategoryId = this.drpGoodsCategory.SelectedValue; } goodsManage.SizeModel = this.txtSizeModel.Text.Trim(); goodsManage.FactoryCode = this.txtFactoryCode.Text.Trim(); goodsManage.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text); if (!string.IsNullOrEmpty(this.txtEnableYear.Text.Trim())) { goodsManage.EnableYear = Funs.GetNewIntOrZero(this.txtEnableYear.Text); } if (this.drpCheckPerson.SelectedValue != BLL.Const._Null) { goodsManage.CheckPerson = this.drpCheckPerson.SelectedValue; } goodsManage.InTime = Funs.GetNewDateTime(this.txtInTime.Text.Trim()); goodsManage.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { goodsManage.States = this.ctlAuditFlow.NextStep; } goodsManage.CompileMan = this.CurrUser.UserId; goodsManage.CompileDate = DateTime.Now; goodsManage.Remark = this.txtRemark.Text.Trim(); if (!string.IsNullOrEmpty(this.GoodsManageId)) { goodsManage.GoodsManageId = this.GoodsManageId; BLL.GoodsManageService.UpdateGoodsManage(goodsManage); BLL.LogService.AddSys_Log(this.CurrUser, goodsManage.GoodsCode, goodsManage.GoodsManageId, BLL.Const.GoodsManageMenuId, BLL.Const.BtnAdd); } else { this.GoodsManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_GoodsManage)); goodsManage.GoodsManageId = this.GoodsManageId; BLL.GoodsManageService.AddGoodsManage(goodsManage); BLL.LogService.AddSys_Log(this.CurrUser, goodsManage.GoodsCode, goodsManage.GoodsManageId,BLL.Const.GoodsManageMenuId,BLL.Const.BtnModify); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.GoodsManageMenuId, this.GoodsManageId, (type == BLL.Const.BtnSubmit ? true : false), goodsManage.GoodsName, "../CostGoods/GoodsManageView.aspx?GoodsManageId={0}"); }
/// <summary> /// 根据主键删除物资管理 /// </summary> /// <param name="goodsManageId"></param> public static void DeleteGoodsManageById(string goodsManageId) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsManage goodsManage = db.CostGoods_GoodsManage.FirstOrDefault(e => e.GoodsManageId == goodsManageId); if (goodsManage != null) { CodeRecordsService.DeleteCodeRecordsByDataId(goodsManageId); //删除编号 ProjectDataFlowSetService.DeleteFlowSetByDataId(goodsManageId); //删除流程 ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(goodsManageId); db.CostGoods_GoodsManage.DeleteOnSubmit(goodsManage); db.SubmitChanges(); } }
/// <summary> /// 修改物资管理 /// </summary> /// <param name="goodsManage"></param> public static void UpdateGoodsManage(Model.CostGoods_GoodsManage goodsManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_GoodsManage newGoodsManage = db.CostGoods_GoodsManage.FirstOrDefault(e => e.GoodsManageId == goodsManage.GoodsManageId); if (newGoodsManage != null) { //newGoodsManage.ProjectId = goodsManage.ProjectId; newGoodsManage.UnitId = goodsManage.UnitId; newGoodsManage.GoodsCategoryId = goodsManage.GoodsCategoryId; newGoodsManage.GoodsCode = goodsManage.GoodsCode; newGoodsManage.GoodsName = goodsManage.GoodsName; newGoodsManage.SizeModel = goodsManage.SizeModel; newGoodsManage.FactoryCode = goodsManage.FactoryCode; newGoodsManage.CheckDate = goodsManage.CheckDate; newGoodsManage.EnableYear = goodsManage.EnableYear; newGoodsManage.CheckPerson = goodsManage.CheckPerson; newGoodsManage.InTime = goodsManage.InTime; newGoodsManage.States = goodsManage.States; newGoodsManage.CompileMan = goodsManage.CompileMan; newGoodsManage.CompileDate = goodsManage.CompileDate; newGoodsManage.Remark = goodsManage.Remark; db.SubmitChanges(); } }