public override void Refresh() { if (this._bGProductDepotOut == null) { this.AddNew(); } else { if (this.action == "view") { this._bGProductDepotOut = this.manager.Select(this._bGProductDepotOut.BGProductDepotOutId); } } this.txt_BGProductDepotOutId.EditValue = this._bGProductDepotOut.BGProductDepotOutId; this.Date_BGProductDepotOutDate.EditValue = this._bGProductDepotOut.BGProductDepotOutDate; this.txt_DeclareCustomsId.EditValue = this._bGProductDepotOut.DeclareCustomsId; this.txt_InvoiceXSId.EditValue = this._bGProductDepotOut.InvoiceXSId; this.bindingSource1.DataSource = this._bGProductDepotOut.Detail; base.Refresh(); //switch (this.action) //{ // case "view": // this.gridView1.OptionsBehavior.Editable = false; // break; // default: // this.gridView1.OptionsBehavior.Editable = true; // break; //} this.gridView1.OptionsBehavior.Editable = false; }
protected override void AddNew() { this._bGProductDepotOut = new Book.Model.BGProductDepotOut(); this._bGProductDepotOut.BGProductDepotOutId = this.manager.GetId(); this._bGProductDepotOut.BGProductDepotOutDate = DateTime.Now; this.action = "insert"; }
public Model.BGProductDepotOut Select(string bGProductDepotOutId) { Model.BGProductDepotOut model = this.Get(bGProductDepotOutId); if (model != null) { model.Detail = detailaccessor.SelectByBGProductDepotOutId(bGProductDepotOutId); } return(model); }
protected override void MoveLast() { if (flag == 1) { flag = 0; return; } this._bGProductDepotOut = this.manager.GetLast(); }
protected override void MovePrev() { Model.BGProductDepotOut model = this.manager.GetPrev(this._bGProductDepotOut); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._bGProductDepotOut = model; }
/// <summary> /// Insert a BGProductDepotOut. /// </summary> public void Insert(Model.BGProductDepotOut bGProductDepotOut) { // // todo:add other logic here // Validate(bGProductDepotOut); if (this.IsExistsDeclareCustomsIdInsert(bGProductDepotOut.DeclareCustomsId)) { throw new Helper.MessageValueException("已存在相同报关单号!"); } try { BL.V.BeginTransaction(); this.TiGuiExists(bGProductDepotOut); 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); bGProductDepotOut.InsertTime = DateTime.Now; bGProductDepotOut.UpdateTime = DateTime.Now; accessor.Insert(bGProductDepotOut); //修改手册成品 Model.BGHandbookDetail1 detail; foreach (var item in bGProductDepotOut.Detail) { detail = this.bGHandbookDetail1Manager.SelectBGProduct(item.BGHandbookId, item.BGHandbookProductId); if (detail != null) { if (detail.BeeQuantity == null) { detail.BeeQuantity = 0; } detail.BeeQuantity += Convert.ToDouble(item.Quantity); this.bGHandbookDetail1Manager.Update(detail); this.bGHandbookDetail1Manager.UpdateUpQuantity(detail); } item.BGProductDepotOutId = bGProductDepotOut.BGProductDepotOutId; detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public void Validate(Model.BGProductDepotOut 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() + " 项,手册料件号不能为空!"); //} if (string.IsNullOrEmpty(model.DeclareCustomsId)) { throw new Helper.InvalidValueException(Model.BGProductDepotOut.PRO_DeclareCustomsId); } }
protected override void Delete() { if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.manager.Delete(this._bGProductDepotOut.BGProductDepotOutId); this._bGProductDepotOut = this.manager.GetNext(this._bGProductDepotOut); if (this._bGProductDepotOut == null) { this._bGProductDepotOut = this.manager.GetLast(); } MessageBox.Show(Properties.Resources.DeleteSuccess); } }
public void TiGuiExists(Model.BGProductDepotOut model) { if (this.ExistsPrimary(model.BGProductDepotOutId)) { //设置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.BGProductDepotOutId = this.GetId(DateTime.Now); TiGuiExists(model); } }
public void Delete(Model.BGProductDepotOut model) { Model.BGHandbookDetail1 detail = new Book.Model.BGHandbookDetail1(); foreach (var item in model.Detail) { detail = this.bGHandbookDetail1Manager.SelectBGProduct(item.BGHandbookId, item.BGHandbookProductId); if (detail != null) { if (detail.BeeQuantity == null) { detail.BeeQuantity = 0; } detail.BeeQuantity -= Convert.ToDouble(item.Quantity); this.bGHandbookDetail1Manager.Update(detail); this.bGHandbookDetail1Manager.UpdateUpQuantity(detail); } detailaccessor.Delete(item.BGProductDepotOutDetailId); } accessor.Delete(model.BGProductDepotOutId); }
public bool HasRowsAfter(Model.BGProductDepotOut e) { return(sqlmapper.QueryForObject <bool>("BGProductDepotOut.has_rows_after", e)); }
public bool HasRowsBefore(Model.BGProductDepotOut e) { return(sqlmapper.QueryForObject <bool>("BGProductDepotOut.has_rows_before", e)); }
public void Update(Model.BGProductDepotOut e) { this.Update <Model.BGProductDepotOut>(e); }
public void Insert(Model.BGProductDepotOut e) { this.Insert <Model.BGProductDepotOut>(e); }
public Model.BGProductDepotOut GetNext(Model.BGProductDepotOut e) { return(accessor.GetNext(e)); }
/// <summary> /// Update a BGProductDepotOut. /// </summary> public void Update(Model.BGProductDepotOut bGProductDepotOut) { // // todo: add other logic here. // this.Validate(bGProductDepotOut); if (this.IsExistsDeclareCustomsIdUpdate(bGProductDepotOut.DeclareCustomsId, bGProductDepotOut.BGProductDepotOutId)) { throw new Helper.MessageValueException("已存在相同报关单号!"); } try { BL.V.BeginTransaction(); bGProductDepotOut.UpdateTime = DateTime.Now; accessor.Update(bGProductDepotOut); Model.BGHandbookDetail1 detail; //删除详细 IList <Model.BGProductDepotOutDetail> detailList = detailaccessor.SelectByBGProductDepotOutId(bGProductDepotOut.BGProductDepotOutId); foreach (var item in detailList) { detail = this.bGHandbookDetail1Manager.SelectBGProduct(item.BGHandbookId, item.BGHandbookProductId); if (detail != null) { if (detail.BeeQuantity == null) { detail.BeeQuantity = 0; } detail.BeeQuantity -= Convert.ToDouble(item.Quantity); this.bGHandbookDetail1Manager.Update(detail); this.bGHandbookDetail1Manager.UpdateUpQuantity(detail); } detailaccessor.Delete(item.BGProductDepotOutDetailId); } //添加详细 foreach (var item in bGProductDepotOut.Detail) { detail = this.bGHandbookDetail1Manager.SelectBGProduct(item.BGHandbookId, item.BGHandbookProductId); if (detail != null) { if (detail.BeeQuantity == null) { detail.BeeQuantity = 0; } detail.BeeQuantity += Convert.ToDouble(item.Quantity); this.bGHandbookDetail1Manager.Update(detail); this.bGHandbookDetail1Manager.UpdateUpQuantity(detail); } item.BGProductDepotOutId = bGProductDepotOut.BGProductDepotOutId; detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
protected override void MoveFirst() { this._bGProductDepotOut = this.manager.GetFirst(); }
public bool HasRowsAfter(Model.BGProductDepotOut e) { return(accessor.HasRowsAfter(e)); }
public Model.BGProductDepotOut GetNext(Model.BGProductDepotOut e) { return(sqlmapper.QueryForObject <Model.BGProductDepotOut>("BGProductDepotOut.get_next", e)); }
public Model.BGProductDepotOut GetPrev(Model.BGProductDepotOut e) { return(sqlmapper.QueryForObject <Model.BGProductDepotOut>("BGProductDepotOut.get_prev", e)); }
public bool HasRowsBefore(Model.BGProductDepotOut e) { return(accessor.HasRowsBefore(e)); }