/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { this.lbRecorder.Text = this.SiteUserInfo.Name; //编辑初始化 if (String.Equals(Request.QueryString["dotype"], "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id)) { BGood BLL = new BGood(); MGovGood Model = BLL.GetGovGoodModel(id, this.SiteUserInfo.CompanyId); if (null != Model) { this.txtName.Text = Model.Name; //物品名称 this.txtCount.Text = Convert.ToString(Model.Number); //物品数量 this.hidGoodCount.Value = Convert.ToString(Model.Number); this.hidGoodStock.Value = Model.Stock.ToString(); this.txtInTime.Text = String.Format("{0:yyyy-MM-dd}", Model.Time); //入库时间 this.lbRecorder.Text = Model.Operator; //登记人 this.txtPrice.Text = Utils.FilterEndOfTheZeroDecimal(Model.Price); this.txtRemark.Text = Model.Remark; //备注 this.txtUse.Text = Model.Use; this.hidGoodId.Value = Model.GoodId; if (!this.SiteUserInfo.IsHandleElse && this.SiteUserInfo.UserId != Model.OperatorId) { this.ph_Save.Visible = false; } } } }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { this.txtInTime.Value = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now); this.lbHandler.Text = this.SiteUserInfo.Name; //编辑初始化 if (String.Equals(Request.QueryString["dotype"], "update", StringComparison.InvariantCultureIgnoreCase)) { BGood BLL = new BGood(); //MGovGoodBorrow Model = BLL.GetGovGoodBorrowModel(id); //if (null != Model) //{ // this.lbName.Text = Model.Name; // this.lbOutTime.Text = String.Format("{0:yyyy-MM-dd HH:mm}", Model.Time); // this.lbPart.Text = Model.Dept; // this.lbGetor.Text = Model.User; // this.lbCount.Text = Convert.ToString(Model.Number); // this.lbUse.Text = Model.Use; // this.lbHandler.Text = Model.Operator; // this.lbState.Text =Convert.ToString(EyouSoft.Model.EnumType.GovStructure.BorrowStatus.借阅中); //} } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected void PageSave(String doType, String id) { //数据验证开始 if (String.IsNullOrEmpty(this.txtInTime.Value)) { MessageBox.ResponseScript(this, "alert('归还时间不能为空!');"); return; } //数据验证结束 BGood BLL = new BGood(); //MGovGoodBorrow Model; int result = 0; //Model = BLL.GetGovGoodBorrowModel(id); //if (null != Model) //{ // Model.IssueTime = DateTime.Now; // Model.Operator = this.SiteUserInfo.Name; // Model.OperatorId = this.SiteUserInfo.UserId; // Model.ReturnTime = Utils.GetDateTimeNullable(this.txtInTime.Value); // result = BLL.UpdateGovGoodBorrow(Model); //} string m = "归还"; switch (result) { case 1: Utils.ShowMsgAndCloseBoxy(m + "成功!", Utils.GetQueryStringValue("IframeId"), true); break; case 2: MessageBox.ResponseScript(this, string.Format("alert('{0}失败,借阅数量超过库存!');", m)); break; default: MessageBox.ResponseScript(this, string.Format("alert('{0}失败!');", m)); break; } }
private void PageSave() { #region 表单取值 string goodid = Utils.GetFormValue(hidGoodId.UniqueID); string name = Utils.GetFormValue(hidName.UniqueID); string gettime = Utils.GetFormValue(txtTime.UniqueID); string price = Utils.GetFormValue(hidPrice.UniqueID); string deptid = Utils.GetFormValue(this.SelectSection1.SelectIDClient); string deptname = Utils.GetFormValue(this.SelectSection1.SelectNameClient); string getpersonid = Utils.GetFormValue(this.HrSelect1.HrSelectIDClient); string getpersonname = Utils.GetFormValue(this.HrSelect1.HrSelectNameClient); string count = Utils.GetFormValue(txtCount.UniqueID); string use = Utils.GetFormValue(this.txtUsed.UniqueID); #endregion #region 表单验证 string msg = ""; int result = -1; if (string.IsNullOrEmpty(gettime)) { msg += "-请输入领用时间!"; } if (string.IsNullOrEmpty(deptid) && string.IsNullOrEmpty(deptname)) { msg += "-请选择领用部门!"; } if (string.IsNullOrEmpty(getpersonid) && string.IsNullOrEmpty(getpersonname)) { msg += "-请选择领用人!"; } if (string.IsNullOrEmpty(count)) { msg += "-请输入领用数量!"; } if (!string.IsNullOrEmpty(msg)) { Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result.ToString(), msg)); Response.End(); } #endregion #region 实体赋值 IList <MGovGoodUse> list = new List <MGovGoodUse>(); string[] id = goodid.Split(','); string[] names = name.Split(','); string[] prices = price.Split(','); for (int i = 0; i < id.Length; i++) { MGovGoodUse model = new MGovGoodUse(); model.CompanyId = this.SiteUserInfo.CompanyId; model.Dept = deptname; model.DeptId = Utils.GetInt(deptid); model.GoodId = id[i]; model.GoodName = names[i]; model.IssueTime = DateTime.Now; model.Number = Utils.GetInt(count); model.Operator = this.SiteUserInfo.Name; model.OperatorId = this.SiteUserInfo.UserId; model.Price = Utils.GetDecimal(prices[i]); model.Time = Utils.GetDateTimeNullable(gettime); model.Type = EyouSoft.Model.EnumType.GovStructure.GoodUseType.发放; model.Use = use; model.UserId = getpersonid; model.UserName = getpersonname; list.Add(model); } #endregion #region 提交保存 BGood BLL = new BGood(); result = BLL.AddGovGoodUseList(list); msg = result == 0 ? "物品发放成功!" : result == -1 ? "物品发放失败!" : "发放物品数量超出库存数量!"; Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result.ToString(), msg)); Response.End(); #endregion }
/// <summary> /// 保存 /// </summary> protected void PageSave(string doType) { #region 表单取值 string name = Utils.GetFormValue(txtName.UniqueID); string number = Utils.GetFormValue(txtCount.UniqueID); string price = Utils.GetFormValue(txtPrice.UniqueID); string time = Utils.GetFormValue(txtInTime.UniqueID); string use = Utils.GetFormValue(txtUse.UniqueID); string remark = Utils.GetFormValue(txtRemark.UniqueID); string goodId = Utils.GetFormValue(hidGoodId.UniqueID); string stock = Utils.GetFormValue(hidGoodStock.UniqueID); string oldnumber = Utils.GetFormValue(hidGoodCount.UniqueID); #endregion #region 数据验证 string msg = ""; bool result = false; if (string.IsNullOrEmpty(name)) { msg += "-请输入物品名称!"; } if (string.IsNullOrEmpty(number)) { msg += "-请输入物品数量!"; } if (string.IsNullOrEmpty(time)) { msg += "请输入物品入库时间!"; } if (!string.IsNullOrEmpty(msg)) { Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); return; } #endregion #region 实体赋值 MGovGood model = new MGovGood(); model.Name = name; model.CompanyId = this.SiteUserInfo.CompanyId; model.GoodId = goodId; model.IssueTime = DateTime.Now; model.Number = Utils.GetInt(number); model.Operator = this.SiteUserInfo.Name; model.OperatorId = this.SiteUserInfo.UserId; model.Price = Utils.GetDecimal(price); model.Remark = remark; model.Time = Utils.GetDateTimeNullable(time); model.Stock = Utils.GetInt(number) - Utils.GetInt(oldnumber) + Convert.ToInt32(string.IsNullOrEmpty(stock) ? "0" : stock); model.Use = use; #endregion #region 提交保存 BGood BLL = new BGood(); if (doType == "add") { result = BLL.AddGovGood(model); msg = result ? "添加成功!" : "添加失败!"; } if (doType == "update") { result = BLL.UpdateGovGood(model); msg = result ? "修改成功!" : "修改失败!"; } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); #endregion }