public void Delete(Model.CustomInspectionRule customInspectionRule) { // // todo:add other logic here // accessor.Delete(customInspectionRule.CustomInspectionRuleId); }
public override void Refresh() { if (this.customInspection == null) { this.customInspection = new Book.Model.CustomInspectionRule(); this.action = "insert"; } this.TextEditId.Text = (string.IsNullOrEmpty(this.customInspection.Id)? this.customInspection.CustomInspectionRuleId:this.customInspection.Id); this.CustomInspectionRuleNamedTextEdit.Text = this.customInspection.CustomInspectionRuleName; switch (this.action) { case "insert": this.TextEditId.Properties.ReadOnly = false; this.CustomInspectionRuleNamedTextEdit.Properties.ReadOnly = false; break; case "update": this.TextEditId.Properties.ReadOnly = false; this.CustomInspectionRuleNamedTextEdit.Properties.ReadOnly = false; break; case "view": this.TextEditId.Properties.ReadOnly = true; this.CustomInspectionRuleNamedTextEdit.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
/// <param name="custom">model對象</param> /// <param name="action">當前動作</param> public EditForm(Model.CustomInspectionRule custom, string action) : this() { //if (custom == null) // throw new ArithmeticException(); this.customInspection = custom; this.action = action; }
public bool ExistsExcept(Model.CustomInspectionRule e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.CustomInspectionRuleId).Id); return(sqlmapper.QueryForObject <bool>("CustomInspectionRule.existsexcept", paras)); }
public void MyClick(ref ChooseItem item) { ChooseCustomInspectionRuleForm f = new ChooseCustomInspectionRuleForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.CustomInspectionRule CustomInspectionRule = f.SelectedItem as Model.CustomInspectionRule; item = new ChooseItem(CustomInspectionRule, CustomInspectionRule.Id, CustomInspectionRule.CustomInspectionRuleName); } }
protected override void MoveNext() { Model.CustomInspectionRule customInspection = this.customInspectionRuleManager.GetNext(this.customInspection); if (customInspection == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.customInspection = customInspection; }
/// <param name="custom">model 對象</param> public EditForm(Model.CustomInspectionRule custom) : this() { //if (custom == null) // throw new ArithmeticException(); //this.invalidValueExceptions.Add(Model.CustomInspectionRule.PROPERTY_CUSTOMINSPECTIONRULEID, new AA("已有相同编号的项存在", this.CustomInspectionRuleIdTextEdit)); //this.invalidValueExceptions.Add(Model.CustomInspectionRule.PROPERTY_CUSTOMINSPECTIONRULENAME, new AA("已有相同名称的项存在", this.CustomInspectionRuleNamedTextEdit)); this.customInspection = custom; this.action = "update"; }
private void Validate(Model.CustomInspectionRule customInspectionRule) { if (string.IsNullOrEmpty(customInspectionRule.Id)) { throw new Helper.RequireValueException(Model.CustomInspectionRule.PROPERTY_ID); } if (string.IsNullOrEmpty(customInspectionRule.CustomInspectionRuleName)) { throw new Helper.RequireValueException(Model.CustomInspectionRule.PROPERTY_CUSTOMINSPECTIONRULENAME); } }
public void MyLeave(ref ChooseItem item) { BL.CustomInspectionRuleManager manager = new Book.BL.CustomInspectionRuleManager(); Model.CustomInspectionRule CustomInspectionRule = manager.GetById(item.ButtonText); if (CustomInspectionRule != null) { item.EditValue = CustomInspectionRule; item.LabelText = CustomInspectionRule.CustomInspectionRuleName; item.ButtonText = CustomInspectionRule.Id; } }
/// <summary> /// Update a CustomInspectionRule. /// </summary> public void Update(Model.CustomInspectionRule customInspectionRule) { // // todo: add other logic here. // this.Validate(customInspectionRule); if (this.ExistsExcept(customInspectionRule)) { throw new Helper.InvalidValueException(Model.CustomInspectionRule.PROPERTY_ID); } accessor.Update(customInspectionRule); }
/// <summary> /// Insert a CustomInspectionRule. /// </summary> public void Insert(Model.CustomInspectionRule customInspectionRule) { // // todo:add other logic here // this.Validate(customInspectionRule); if (this.Exists(customInspectionRule.Id)) { throw new Helper.InvalidValueException(Model.CustomInspectionRule.PROPERTY_ID); } if (this.HasRows(customInspectionRule.CustomInspectionRuleName)) { throw new Helper.InvalidValueException(Model.CustomInspectionRule.PROPERTY_CUSTOMINSPECTIONRULENAME); } customInspectionRule.CustomInspectionRuleId = Guid.NewGuid().ToString(); accessor.Insert(customInspectionRule); }
protected override void Delete() { if (this.customInspection == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this.customInspectionRuleManager.Delete(this.customInspection); this.customInspection = this.customInspectionRuleManager.GetNext(this.customInspection); if (this.customInspection == null) { this.customInspection = this.customInspectionRuleManager.GetLast(); } }
public bool HasRowsAfter(Model.CustomInspectionRule e) { return(sqlmapper.QueryForObject <bool>("CustomInspectionRule.has_rows_after", e)); }
public Model.CustomInspectionRule GetPrev(Model.CustomInspectionRule e) { return(sqlmapper.QueryForObject <Model.CustomInspectionRule>("CustomInspectionRule.get_prev", e)); }
public void Update(Model.CustomInspectionRule e) { this.Update <Model.CustomInspectionRule>(e); }
protected override void MoveLast() { this.customInspection = this.customInspectionRuleManager.GetLast(); }
public bool ExistsExcept(Model.CustomInspectionRule e) { return(accessor.ExistsExcept(e)); }
protected override void AddNew() { this.customInspection = new Model.CustomInspectionRule(); //this.customInspection.CustomInspectionRuleId = this.customInspectionRuleManager.GetId(); }
public bool HasRowsBefore(Model.CustomInspectionRule e) { return(accessor.HasRowsBefore(e)); }
public bool HasRowsAfter(Model.CustomInspectionRule e) { return(accessor.HasRowsAfter(e)); }
public Model.CustomInspectionRule GetNext(Model.CustomInspectionRule e) { return(sqlmapper.QueryForObject <Model.CustomInspectionRule>("CustomInspectionRule.get_next", e)); }
public Model.CustomInspectionRule GetNext(Model.CustomInspectionRule e) { return(accessor.GetNext(e)); }
public void Insert(Model.CustomInspectionRule e) { this.Insert <Model.CustomInspectionRule>(e); }
public bool HasRowsBefore(Model.CustomInspectionRule e) { return(sqlmapper.QueryForObject <bool>("CustomInspectionRule.has_rows_before", e)); }