public void Delete(Model.CustomInspectionRule customInspectionRule)
 {
     //
     // todo:add other logic here
     //
     accessor.Delete(customInspectionRule.CustomInspectionRuleId);
 }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 /// <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;
 }
Beispiel #4
0
        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);
            }
        }
Beispiel #6
0
        protected override void MoveNext()
        {
            Model.CustomInspectionRule customInspection = this.customInspectionRuleManager.GetNext(this.customInspection);
            if (customInspection == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.customInspection = customInspection;
        }
Beispiel #7
0
 /// <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);
 }
Beispiel #12
0
 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();
     }
 }
Beispiel #13
0
 public bool HasRowsAfter(Model.CustomInspectionRule e)
 {
     return(sqlmapper.QueryForObject <bool>("CustomInspectionRule.has_rows_after", e));
 }
Beispiel #14
0
 public Model.CustomInspectionRule GetPrev(Model.CustomInspectionRule e)
 {
     return(sqlmapper.QueryForObject <Model.CustomInspectionRule>("CustomInspectionRule.get_prev", e));
 }
Beispiel #15
0
 public void Update(Model.CustomInspectionRule e)
 {
     this.Update <Model.CustomInspectionRule>(e);
 }
Beispiel #16
0
 protected override void MoveLast()
 {
     this.customInspection = this.customInspectionRuleManager.GetLast();
 }
 public bool ExistsExcept(Model.CustomInspectionRule e)
 {
     return(accessor.ExistsExcept(e));
 }
Beispiel #18
0
 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));
 }
Beispiel #21
0
 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));
 }
Beispiel #23
0
 public void Insert(Model.CustomInspectionRule e)
 {
     this.Insert <Model.CustomInspectionRule>(e);
 }
Beispiel #24
0
 public bool HasRowsBefore(Model.CustomInspectionRule e)
 {
     return(sqlmapper.QueryForObject <bool>("CustomInspectionRule.has_rows_before", e));
 }