public bool ExistsExcept(Model.BGProduct e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.BGProductId) == null?null:Get(e.BGProductId).Id); return(sqlmapper.QueryForObject <bool>("BGProduct.existsexcept", paras)); }
protected override void MovePrev() { Model.BGProduct model = this._manager.GetPrev(this._bGProduct); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._bGProduct = model; }
private void Validate(Model.BGProduct bGProduct) { if (bGProduct.Id == null) { throw new Helper.RequireValueException(Model.BGProduct.PRO_Id + "NULL"); } if (this.Exists(bGProduct.Id)) { throw new Helper.InvalidValueException(Model.BGProduct.PRO_Id); } }
public override void Refresh() { if (this._bGProduct == null) { this.AddNew(); } else { if (this.action == "view") { this._bGProduct = this._manager.Get(this._bGProduct.BGProductId); } } this.txt_QiYeNeibuId.Text = this._bGProduct.QiYeNeiId; this.txt_BGProductId.Text = this._bGProduct.Id; this.txt_CustomsClearance.Text = this._bGProduct.ZhuGuanHaiGuan; this.txt_JingYingDanWeiId.Text = this._bGProduct.JingYingDanWeiId; this.txt_JingYingDanWeiName.Text = this._bGProduct.JingYingDanWeiName; this.txt_fertility.Text = this._bGProduct.ShengChanNengLi.ToString(); this.txt_JiaGongDanWeiId.Text = this._bGProduct.JiaGongDanWeiId; this.txt_JiaGongDanWeiName.Text = this._bGProduct.JiaGongDanWeiName; this.comboBoxEditManagerObject.EditValue = this._bGProduct.GuanLiDuiXiang; this.txt_ShenBaoDanWeiId.Text = this._bGProduct.ShenBaoDanWeiId; this.txt_ShenBaoDanWeiName.Text = this._bGProduct.ShenBaoDanWeiName; this.date_ShenBaoDate.EditValue = this._bGProduct.ShenBaoDate; this.newChooseContorlEmployee.EditValue = this._bGProduct.Employee; this.txt_Note.Text = this._bGProduct.Desc; this.newChooseContorlAuditEmp.EditValue = this._bGProduct.AuditEmp; this.txt_AuditState.EditValue = this.GetAuditName(this._bGProduct.AuditState); this._bGProduct.DetailProduct = this._detailManager.SelectProductByBGProductId(this._bGProduct.BGProductId); this._bGProduct.DetailMaterial = this._detailManager.SelectMaterialByBGProductId(this._bGProduct.BGProductId); this.bindingSourceProduct.DataSource = this._bGProduct.DetailProduct; this.bindingSourceMaterial.DataSource = this._bGProduct.DetailMaterial; base.Refresh(); switch (this.action) { case "view": this.gridView1.OptionsBehavior.Editable = false; this.gridView2.OptionsBehavior.Editable = false; break; default: this.gridView1.OptionsBehavior.Editable = true; this.gridView2.OptionsBehavior.Editable = true; break; } }
protected override void Delete() { if (this._bGProduct == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Model.BGProduct model = this._manager.GetNext(this._bGProduct); this._manager.Delete(this._bGProduct.BGProductId); if (model != null) { this._bGProduct = model; } else { this._bGProduct = this._manager.GetLast(); } MessageBox.Show(Properties.Resources.DeleteSuccess); } }
/// <summary> /// Update a BGProduct. /// </summary> public void Update(Model.BGProduct bGProduct) { // // todo: add other logic here. // Validate(bGProduct); bGProduct.UpdateTime = DateTime.Now; accessor.Update(bGProduct); (new BL.BGProductDetaiManager()).DeleteByBGProductId(bGProduct.BGProductId); foreach (Model.BGProductDetai model in bGProduct.DetailProduct) { model.BGProductId = bGProduct.BGProductId; model.ProType = true; (new BL.BGProductDetaiManager()).Insert(model); } foreach (Model.BGProductDetai model in bGProduct.DetailMaterial) { model.BGProductId = bGProduct.BGProductId; model.ProType = false; (new BL.BGProductDetaiManager()).Insert(model); } }
public bool HasRowsBefore(Model.BGProduct e) { return(sqlmapper.QueryForObject <bool>("BGProduct.has_rows_before", e)); }
protected override void AddNew() { this._bGProduct = new Book.Model.BGProduct(); this._bGProduct.BGProductId = Guid.NewGuid().ToString(); this.action = "insert"; }
public bool HasRowsAfter(Model.BGProduct e) { return(accessor.HasRowsAfter(e)); }
protected override void MoveLast() { this._bGProduct = this._manager.GetLast(); }
public Model.BGProduct GetPrev(Model.BGProduct e) { return(sqlmapper.QueryForObject <Model.BGProduct>("BGProduct.get_prev", e)); }
public Model.BGProduct GetNext(Model.BGProduct e) { return(sqlmapper.QueryForObject <Model.BGProduct>("BGProduct.get_next", e)); }
public bool HasRowsBefore(Model.BGProduct e) { return(accessor.HasRowsBefore(e)); }
public void Update(Model.BGProduct e) { this.Update <Model.BGProduct>(e); }
public void Insert(Model.BGProduct e) { this.Insert <Model.BGProduct>(e); }
public Model.BGProduct GetPrev(Model.BGProduct e) { return(accessor.GetPrev(e)); }
public Model.BGProduct GetNext(Model.BGProduct e) { return(accessor.GetNext(e)); }
public bool HasRowsAfter(Model.BGProduct e) { return(sqlmapper.QueryForObject <bool>("BGProduct.has_rows_after", e)); }
public bool ExistsExcept(Model.BGProduct e) { return(accessor.ExistsExcept(e)); }