public bool ExistsExcept(Model.TradeCategory e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.TradeCategoryId).Id); return(sqlmapper.QueryForObject <bool>("TradeCategory.existsexcept", paras)); }
protected override void MovePrev() { Model.TradeCategory unitGroup = this.tradeCategoryManager.GetPrev(this._tradeCategory); if (unitGroup == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._tradeCategory = unitGroup; }
public void MyClick(ref ChooseItem item) { ChooseTradeCategoryForm f = new ChooseTradeCategoryForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.TradeCategory tradeCategory = f.SelectedItem as Model.TradeCategory; item = new ChooseItem(tradeCategory, tradeCategory.Id, tradeCategory.TradeCategoryName); } }
//protected override string GetInvoiceKind() //{ // return "TradeCategory"; //} //protected override string GetSettingId() //{ // return "TradeCategoryRule"; //} public void Validate(Model.TradeCategory tradeCategory) { if (string.IsNullOrEmpty(tradeCategory.Id)) { throw new Helper.RequireValueException(Model.TradeCategory.PROPERTY_ID); } if (string.IsNullOrEmpty(tradeCategory.TradeCategoryName)) { throw new Helper.RequireValueException(Model.TradeCategory.PROPERTY_TRADECATEGORYNAME); } }
public void MyLeave(ref ChooseItem item) { BL.TradeCategoryManager manager = new Book.BL.TradeCategoryManager(); Model.TradeCategory tradeCategory = manager.GetById(item.ButtonText); if (tradeCategory != null) { item.EditValue = tradeCategory; item.LabelText = tradeCategory.TradeCategoryName; item.ButtonText = tradeCategory.Id; } else { item.ErrorMessage = "行业类别错误"; } }
/// <summary> /// Insert a TradeCategory. /// </summary> public void Insert(Model.TradeCategory tradeCategory) { // // todo:add other logic here // Validate(tradeCategory); if (this.Exists(tradeCategory.Id)) { throw new Helper.InvalidValueException(Model.TradeCategory.PROPERTY_ID); } tradeCategory.TradeCategoryId = Guid.NewGuid().ToString(); tradeCategory.InsertTime = DateTime.Now; accessor.Insert(tradeCategory); }
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.TradeCategory trade = this.bindingSourceTradeCategory.Current as Model.TradeCategory; if (trade != null) { this._tradeCategory = trade; this.action = "view"; this.Refresh(); } } }
protected override void Delete() { if (this._tradeCategory == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this.tradeCategoryManager.Delete(this._tradeCategory.TradeCategoryId); this._tradeCategory = this.tradeCategoryManager.GetNext(this._tradeCategory); if (this._tradeCategory == null) { this._tradeCategory = this.tradeCategoryManager.GetLast(); } }
/// <summary> /// Update a TradeCategory. /// </summary> public void Update(Model.TradeCategory tradeCategory) { // // todo: add other logic here. // Validate(tradeCategory); if (this.ExistsExcept(tradeCategory)) { throw new Helper.InvalidValueException(Model.TradeCategory.PROPERTY_ID); } if (accessor.ExistsExcept(tradeCategory)) { throw new Helper.InvalidValueException("Id"); } tradeCategory.UpdateTime = DateTime.Now; accessor.Update(tradeCategory); }
public override void Refresh() { if (this._tradeCategory == null) { this._tradeCategory = new Book.Model.TradeCategory(); this.action = "insert"; } this.bindingSourceTradeCategory.DataSource = this.tradeCategoryManager.Select(); this.textEditId.EditValue = string.IsNullOrEmpty(this._tradeCategory.Id)?this._tradeCategory.TradeCategoryId:this._tradeCategory.Id; this.textEditTradeCategoryName.EditValue = this._tradeCategory.TradeCategoryName; this.memoEditDescription.Text = this._tradeCategory.Description; switch (this.action) { case "insert": this.textEditId.Properties.ReadOnly = false; this.textEditTradeCategoryName.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "update": // oldId = this.textEditId.EditValue.ToString(); this.textEditId.Properties.ReadOnly = false; this.textEditTradeCategoryName.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "view": this.textEditId.Properties.ReadOnly = true; this.textEditTradeCategoryName.Properties.ReadOnly = true; this.memoEditDescription.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
public void Insert(Model.TradeCategory e) { this.Insert <Model.TradeCategory>(e); }
public bool ExistsExcept(Model.TradeCategory e) { return(accessor.ExistsExcept(e)); }
public bool HasRowsBefore(Model.TradeCategory e) { return(sqlmapper.QueryForObject <bool>("TradeCategory.has_rows_before", e)); }
public void Update(Model.TradeCategory e) { this.Update <Model.TradeCategory>(e); }
public bool HasRowsAfter(Model.TradeCategory e) { return(sqlmapper.QueryForObject <bool>("TradeCategory.has_rows_after", e)); }
public Model.TradeCategory GetNext(Model.TradeCategory e) { return(accessor.GetNext(e)); }
public Model.TradeCategory GetPrev(Model.TradeCategory e) { return(accessor.GetPrev(e)); }
public Model.TradeCategory GetNext(Model.TradeCategory e) { return(sqlmapper.QueryForObject <Model.TradeCategory>("TradeCategory.get_next", e)); }
public Model.TradeCategory GetPrev(Model.TradeCategory e) { return(sqlmapper.QueryForObject <Model.TradeCategory>("TradeCategory.get_prev", e)); }
protected override void AddNew() { this._tradeCategory = new Model.TradeCategory(); //this._tradeCategory.TradeCategoryId = this.tradeCategoryManager.GetId(); }
public bool HasRowsBefore(Model.TradeCategory e) { return(accessor.HasRowsBefore(e)); }
protected override void MoveLast() { this._tradeCategory = this.tradeCategoryManager.GetLast(); }
public bool HasRowsAfter(Model.TradeCategory e) { return(accessor.HasRowsAfter(e)); }