public Model.BGHandbookDepotOut Select(string bGHandbookDepotOutId) { Model.BGHandbookDepotOut model = this.Get(bGHandbookDepotOutId); if (model != null) { model.Detail = Detailaccessor.SelectByBGHandbookDepotOutId(bGHandbookDepotOutId); } return(model); }
protected override void MovePrev() { Model.BGHandbookDepotOut model = this.manager.GetPrev(this._bGHandbookDepotOut); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._bGHandbookDepotOut = model; }
/// <summary> /// Update a BGHandbookDepotOut. /// </summary> public void Update(Model.BGHandbookDepotOut bGHandbookDepotOut) { // // todo: add other logic here. // this.Validate(bGHandbookDepotOut); try { BL.V.BeginTransaction(); bGHandbookDepotOut.UpdateTime = DateTime.Now; accessor.Update(bGHandbookDepotOut); Model.BGHandbookDetail2 detail2; //删除详细 IList <Model.BGHandbookDepotOutDetail> DetailList = Detailaccessor.SelectByBGHandbookDepotOutId(bGHandbookDepotOut.BGHandbookDepotOutId); foreach (var item in DetailList) { detail2 = Detail2Manager.SelectByShouceAndId(bGHandbookDepotOut.BGHangbookId, (int)item.BGHandbookProductId); if (detail2 != null) { detail2.ZhuanCeOutQuantity = Convert.ToDouble(detail2.ZhuanCeOutQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.LbejinQuantity = Convert.ToDouble(detail2.LbejinQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.HaiKeJInQuantity = Convert.ToDouble(detail2.HaiKeJInQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.UpQuantity = Convert.ToDouble(detail2.UpQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.JinKouiMoney = Convert.ToDecimal(detail2.LbejinQuantity) * detail2.LPrice; Detail2Manager.Update(detail2); } Detailaccessor.Delete(item.BGHandbookDepotOutDetailId); } //添加详细 foreach (var item in bGHandbookDepotOut.Detail) { detail2 = Detail2Manager.SelectByShouceAndId(bGHandbookDepotOut.BGHangbookId, (int)item.BGHandbookProductId); if (detail2 != null) { detail2.ZhuanCeOutQuantity = Convert.ToDouble(detail2.ZhuanCeOutQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.LbejinQuantity = Convert.ToDouble(detail2.LbejinQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.HaiKeJInQuantity = Convert.ToDouble(detail2.HaiKeJInQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.UpQuantity = Convert.ToDouble(detail2.UpQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.JinKouiMoney = Convert.ToDecimal(detail2.LbejinQuantity) * detail2.LPrice; Detail2Manager.Update(detail2); } item.BGHandbookDepotOutId = bGHandbookDepotOut.BGHandbookDepotOutId; Detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } accessor.Update(bGHandbookDepotOut); }
public void Validate(Model.BGHandbookDepotOut model) { if (string.IsNullOrEmpty(model.BGHangbookId)) { throw new Helper.InvalidValueException(Model.BGHandbookDepotIn.PRO_BGHangbookId); } foreach (var item in model.Detail) { if (item.BGHandbookProductId == null) { throw new Helper.MessageValueException("第 " + (model.Detail.IndexOf(item) + 1).ToString() + " 项,手册料件号不能为空!"); } } }
/// <summary> /// Insert a BGHandbookDepotOut. /// </summary> public void Insert(Model.BGHandbookDepotOut bGHandbookDepotOut) { // // todo:add other logic here // this.Validate(bGHandbookDepotOut); try { BL.V.BeginTransaction(); this.TiGuiExists(bGHandbookDepotOut); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, DateTime.Now.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, DateTime.Now.Year, DateTime.Now.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, DateTime.Now.ToString("yyyy-MM-dd")); string sequencekey = string.Format(invoiceKind); SequenceManager.Increment(sequencekey_y); SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); SequenceManager.Increment(sequencekey); bGHandbookDepotOut.InsertTime = DateTime.Now; bGHandbookDepotOut.UpdateTime = DateTime.Now; accessor.Insert(bGHandbookDepotOut); Model.BGHandbookDetail2 detail2; foreach (var item in bGHandbookDepotOut.Detail) { detail2 = Detail2Manager.SelectByShouceAndId(bGHandbookDepotOut.BGHangbookId, (int)item.BGHandbookProductId); if (detail2 != null) { detail2.ZhuanCeOutQuantity = Convert.ToDouble(detail2.ZhuanCeOutQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.LbejinQuantity = Convert.ToDouble(detail2.LbejinQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.HaiKeJInQuantity = Convert.ToDouble(detail2.HaiKeJInQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.UpQuantity = Convert.ToDouble(detail2.UpQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.JinKouiMoney = Convert.ToDecimal(detail2.LbejinQuantity) * detail2.LPrice; Detail2Manager.Update(detail2); } item.BGHandbookDepotOutId = bGHandbookDepotOut.BGHandbookDepotOutId; Detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public void TiGuiExists(Model.BGHandbookDepotOut model) { if (this.ExistsPrimary(model.BGHandbookDepotOutId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, DateTime.Now.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, DateTime.Now.Year, DateTime.Now.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, DateTime.Now.ToString("yyyy-MM-dd")); string sequencekey = string.Format(invoiceKind); SequenceManager.Increment(sequencekey_y); SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); SequenceManager.Increment(sequencekey); model.BGHandbookDepotOutId = this.GetId(DateTime.Now); TiGuiExists(model); } }
protected override void Delete() { if (this._bGHandbookDepotOut == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //Model.BGHandbookDepotIn model = this.manager.Delete(this._bGHandbookDepotOut.BGHandbookDepotOutId); this._bGHandbookDepotOut = this.manager.GetNext(this._bGHandbookDepotOut); if (this._bGHandbookDepotOut == null) { this._bGHandbookDepotOut = this.manager.GetLast(); } MessageBox.Show(Properties.Resources.DeleteSuccess); } }
public void Delete(Model.BGHandbookDepotOut model) { Model.BGHandbookDetail2 detail2; foreach (var item in model.Detail) { //改变手册料件 detail2 = Detail2Manager.SelectByShouceAndId(model.BGHangbookId, (int)item.BGHandbookProductId); if (detail2 != null) { detail2.ZhuanCeOutQuantity = Convert.ToDouble(detail2.ZhuanCeOutQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.LbejinQuantity = Convert.ToDouble(detail2.LbejinQuantity) + Convert.ToDouble(item.DepotOutQuantity); detail2.HaiKeJInQuantity = Convert.ToDouble(detail2.HaiKeJInQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.UpQuantity = Convert.ToDouble(detail2.UpQuantity) - Convert.ToDouble(item.DepotOutQuantity); detail2.JinKouiMoney = Convert.ToDecimal(detail2.LbejinQuantity) * detail2.LPrice; Detail2Manager.Update(detail2); } Detailaccessor.Delete(item.BGHandbookDepotOutDetailId); } accessor.Delete(model.BGHandbookDepotOutId); }
public Model.BGHandbookDepotOut GetPrev(Model.BGHandbookDepotOut e) { return(sqlmapper.QueryForObject <Model.BGHandbookDepotOut>("BGHandbookDepotOut.get_prev", e)); }
public Model.BGHandbookDepotOut GetNext(Model.BGHandbookDepotOut e) { return(sqlmapper.QueryForObject <Model.BGHandbookDepotOut>("BGHandbookDepotOut.get_next", e)); }
public bool HasRowsAfter(Model.BGHandbookDepotOut e) { return(sqlmapper.QueryForObject <bool>("BGHandbookDepotOut.has_rows_after", e)); }
public bool HasRowsBefore(Model.BGHandbookDepotOut e) { return(sqlmapper.QueryForObject <bool>("BGHandbookDepotOut.has_rows_before", e)); }
public void Update(Model.BGHandbookDepotOut e) { this.Update <Model.BGHandbookDepotOut>(e); }
public void Insert(Model.BGHandbookDepotOut e) { this.Insert <Model.BGHandbookDepotOut>(e); }
public Model.BGHandbookDepotOut GetNext(Model.BGHandbookDepotOut e) { return(accessor.GetNext(e)); }
public bool HasRowsAfter(Model.BGHandbookDepotOut e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.BGHandbookDepotOut e) { return(accessor.HasRowsBefore(e)); }
protected override void MoveLast() { this._bGHandbookDepotOut = this.manager.GetLast(); }
protected override void AddNew() { this._bGHandbookDepotOut = new Book.Model.BGHandbookDepotOut(); this._bGHandbookDepotOut.BGHandbookDepotOutId = this.manager.GetId(); this.action = "insert"; }