private void Validate(Model.AreaCategory areaCategory) { if (string.IsNullOrEmpty(areaCategory.AreaCategoryName)) { throw new Helper.RequireValueException(Model.AreaCategory.PROPERTY_AREACATEGORYNAME); } }
public bool ExistsExcept(Model.AreaCategory e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.AreaCategoryId) == null?null:Get(e.AreaCategoryId).Id); return(sqlmapper.QueryForObject <bool>("AreaCategory.existsexcept", paras)); }
public void MyClick(ref ChooseItem item) { ChooseAreaCategoryForm f = new ChooseAreaCategoryForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.AreaCategory tradeCategory = f.SelectedItem as Model.AreaCategory; item = new ChooseItem(tradeCategory, tradeCategory.Id, tradeCategory.AreaCategoryName); } }
protected override void MoveNext() { Model.AreaCategory unitGroup = this.areaCategoryManager.GetNext(this._areaCategory); if (unitGroup == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._areaCategory = unitGroup; }
/// <summary> /// Update a AreaCategory. /// </summary> public void Update(Model.AreaCategory areaCategory) { // // todo: add other logic here. // Validate(areaCategory); if (this.ExistsExcept(areaCategory)) { throw new Helper.InvalidValueException("Id"); } areaCategory.UpdateTime = DateTime.Now; accessor.Update(areaCategory); }
/// <summary> /// Insert a AreaCategory. /// </summary> public void Insert(Model.AreaCategory areaCategory) { // // todo:add other logic here // Validate(areaCategory); if (this.Exists(areaCategory.Id)) { throw new Helper.InvalidValueException("Id"); } areaCategory.InsertTime = DateTime.Now; areaCategory.AreaCategoryId = Guid.NewGuid().ToString(); accessor.Insert(areaCategory); }
public void MyLeave(ref ChooseItem item) { BL.AreaCategoryManager manager = new Book.BL.AreaCategoryManager(); Model.AreaCategory tradeCategory = manager.GetById(item.ButtonText); if (tradeCategory != null) { item.EditValue = tradeCategory; item.LabelText = tradeCategory.AreaCategoryName; item.ButtonText = tradeCategory.Id; } else { item.ErrorMessage = "地区类别错误"; } }
//gridview的click事件 ---myj 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.AreaCategory area = this.bindingSourceAreaCategory.Current as Model.AreaCategory; if (area != null) { this._areaCategory = area; this.action = "view"; this.Refresh(); } } }
protected override void Delete() { if (this._areaCategory == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } this.areaCategoryManager.Delete(this._areaCategory.AreaCategoryId); this._areaCategory = this.areaCategoryManager.GetNext(this._areaCategory); if (this._areaCategory == null) { this._areaCategory = this.areaCategoryManager.GetLast(); } }
public override void Refresh() { if (this._areaCategory == null) { this._areaCategory = new Book.Model.AreaCategory(); this.action = "insert"; } this.bindingSourceAreaCategory.DataSource = this.areaCategoryManager.Select(); this.textEditAreaCategoryId.EditValue = this._areaCategory.Id; this.textEditAreaCategoryName.EditValue = this._areaCategory.AreaCategoryName; this.memoEditDescription.Text = this._areaCategory.Description; switch (this.action) { case "insert": this.textEditAreaCategoryId.Properties.ReadOnly = false; this.textEditAreaCategoryName.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "update": this.textEditAreaCategoryId.Properties.ReadOnly = false; this.textEditAreaCategoryName.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "view": this.textEditAreaCategoryId.Properties.ReadOnly = true; this.textEditAreaCategoryName.Properties.ReadOnly = true; this.memoEditDescription.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
protected override void AddNew() { this._areaCategory = new Model.AreaCategory(); }
public Model.AreaCategory GetPrev(Model.AreaCategory e) { return(sqlmapper.QueryForObject <Model.AreaCategory>("AreaCategory.get_prev", e)); }
public Model.AreaCategory GetNext(Model.AreaCategory e) { return(sqlmapper.QueryForObject <Model.AreaCategory>("AreaCategory.get_next", e)); }
public Model.AreaCategory GetNext(Model.AreaCategory e) { return(accessor.GetNext(e)); }
public bool HasRowsBefore(Model.AreaCategory e) { return(sqlmapper.QueryForObject <bool>("AreaCategory.has_rows_before", e)); }
public void Update(Model.AreaCategory e) { this.Update <Model.AreaCategory>(e); }
public bool ExistsExcept(Model.AreaCategory e) { return(accessor.ExistsExcept(e)); }
public bool HasRowsBefore(Model.AreaCategory e) { return(accessor.HasRowsBefore(e)); }
public bool HasRowsAfter(Model.AreaCategory e) { return(accessor.HasRowsAfter(e)); }
protected override void MoveLast() { this._areaCategory = this.areaCategoryManager.GetLast(); }
public bool HasRowsAfter(Model.AreaCategory e) { return(sqlmapper.QueryForObject <bool>("AreaCategory.has_rows_after", e)); }
public void Insert(Model.AreaCategory e) { this.Insert <Model.AreaCategory>(e); }
public Model.AreaCategory GetPrev(Model.AreaCategory e) { return(accessor.GetPrev(e)); }