public bool ExistsExcept(Model.CustomerCategory e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.CustomerCategoryId).Id); return(sqlmapper.QueryForObject <bool>("CustomerCategory.existsexcept", paras)); }
protected override void MoveNext() { Model.CustomerCategory customerCategory = this.customerCategoryManager.GetNext(this.customerCategory); if (customerCategory == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.customerCategory = customerCategory; }
public void MyClick(ref ChooseItem item) { ChooseCustomerCategoryForm f = new ChooseCustomerCategoryForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.CustomerCategory customerCategory = f.SelectedItem as Model.CustomerCategory; item = new ChooseItem(customerCategory, customerCategory.Id, customerCategory.CustomerCategoryName); } }
private void Validate(Model.CustomerCategory customerCategory) { if (string.IsNullOrEmpty(customerCategory.Id)) { throw new Helper.RequireValueException(Model.CustomerCategory.PROPERTY_ID); } if (string.IsNullOrEmpty(customerCategory.CustomerCategoryName)) { throw new Helper.RequireValueException(Model.CustomerCategory.PROPERTY_CUSTOMERCATEGORYNAME); } }
/// <summary> /// Update a CustomerCategory. /// </summary> public void Update(Model.CustomerCategory customerCategory) { // // todo: add other logic here. // Validate(customerCategory); if (this.ExistsExcept(customerCategory)) { throw new Helper.InvalidValueException(Model.CustomerCategory.PROPERTY_ID); } accessor.Update(customerCategory); }
/// <summary> /// Insert a CustomerCategory. /// </summary> public void Insert(Model.CustomerCategory customerCategory) { // // todo:add other logic here // Validate(customerCategory); if (this.Exists(customerCategory.Id)) { throw new Helper.InvalidValueException(Model.CustomerCategory.PROPERTY_ID); } customerCategory.CustomerCategoryId = Guid.NewGuid().ToString(); accessor.Insert(customerCategory); }
public void MyLeave(ref ChooseItem item) { BL.CustomerCategoryManager manager = new Book.BL.CustomerCategoryManager(); Model.CustomerCategory customerCategory = manager.GetById(item.ButtonText); if (customerCategory != null) { item.EditValue = customerCategory; item.LabelText = customerCategory.CustomerCategoryName; item.ButtonText = customerCategory.Id; } else { item.ErrorMessage = "客户分类错误"; } }
private void gridView1_Click(object sender, EventArgs e) { GridView view = sender as GridView; GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(Cursor.Position)); if (hitInfo.InRow && !view.IsGroupRow(hitInfo.RowHandle)) { Model.CustomerCategory customerCategory = this.bindingSource1.Current as Model.CustomerCategory; if (customerCategory != null) { this.customerCategory = customerCategory; this.action = "view"; this.Refresh(); } } }
protected override void Delete() { if (this.customerCategory == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } this.customerCategoryManager.Delete(this.customerCategory); this.customerCategory = this.customerCategoryManager.GetNext(this.customerCategory); if (this.customerCategory == null) { this.customerCategory = this.customerCategoryManager.GetLast(); } }
public override void Refresh() { if (this.customerCategory == null) { this.customerCategory = new Book.Model.CustomerCategory(); this.action = "insert"; } bindingSource1.DataSource = new BL.CustomerCategoryManager().Select(); this.textEditId.Text = string.IsNullOrEmpty(this.customerCategory.Id) ? this.customerCategory.CustomerCategoryId : this.customerCategory.Id; this.CustomerCategoryNameTextEdit.Text = this.customerCategory.CustomerCategoryName; this.CustomerCategorydetailTextEdit.Text = this.customerCategory.CustomerCategoryDescription; switch (this.action) { case "insert": this.textEditId.Properties.ReadOnly = false; this.CustomerCategoryNameTextEdit.Properties.ReadOnly = false; this.CustomerCategorydetailTextEdit.Properties.ReadOnly = false; break; case "update": this.textEditId.Properties.ReadOnly = false; this.CustomerCategoryNameTextEdit.Properties.ReadOnly = false; this.CustomerCategorydetailTextEdit.Properties.ReadOnly = false; break; case "view": this.textEditId.Properties.ReadOnly = true; this.CustomerCategoryNameTextEdit.Properties.ReadOnly = true; this.CustomerCategorydetailTextEdit.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
public bool HasRowsAfter(Model.CustomerCategory e) { return(accessor.HasRowsAfter(e)); }
/// <summary> /// 兩個參數 /// </summary> /// <param name="custom">model對象</param> /// <param name="action">當前呢動作</param> public EditForm(Model.CustomerCategory custom, string action) : this() { this.customerCategory = custom; this.action = action; }
/// <summary> /// 一個參數(model 對象) /// </summary> /// <param name="custom">model對象</param> public EditForm(Model.CustomerCategory custom) : this() { this.customerCategory = custom; this.action = "update"; }
public void Update(Model.CustomerCategory e) { this.Update <Model.CustomerCategory>(e); }
public Model.CustomerCategory GetPrev(Model.CustomerCategory e) { return(accessor.GetPrev(e)); }
public bool HasRowsBefore(Model.CustomerCategory e) { return(accessor.HasRowsBefore(e)); }
public Model.CustomerCategory GetNext(Model.CustomerCategory e) { return(accessor.GetNext(e)); }
public Model.CustomerCategory GetPrev(Model.CustomerCategory e) { return(sqlmapper.QueryForObject <Model.CustomerCategory>("CustomerCategory.get_prev", e)); }
public Model.CustomerCategory GetNext(Model.CustomerCategory e) { return(sqlmapper.QueryForObject <Model.CustomerCategory>("CustomerCategory.get_next", e)); }
public bool HasRowsAfter(Model.CustomerCategory e) { return(sqlmapper.QueryForObject <bool>("CustomerCategory.has_rows_after", e)); }
public bool HasRowsBefore(Model.CustomerCategory e) { return(sqlmapper.QueryForObject <bool>("CustomerCategory.has_rows_before", e)); }
public void Delete(Model.CustomerCategory customercategory) { accessor.Delete(customercategory.CustomerCategoryId); }
protected override void MoveLast() { this.customerCategory = this.customerCategoryManager.GetLast(); }
public void Insert(Model.CustomerCategory e) { this.Insert <Model.CustomerCategory>(e); }
protected override void AddNew() { this.customerCategory = new Model.CustomerCategory(); }
public bool ExistsExcept(Model.CustomerCategory e) { return(accessor.ExistsExcept(e)); }