Example #1
0
 public EditForm(Model.PayMethod pmethod) : this()
 {
     //if (paymethod == null)
     //    throw new ArithmeticException();
     this.paymethod = pmethod;
     this.action    = "update";
 }
Example #2
0
        public bool ExistsExcept(Model.PayMethod e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.PayMethodId).Id);
            return(sqlmapper.QueryForObject <bool>("PayMethod.existsexcept", paras));
        }
Example #3
0
 public EditForm(Book.Model.PayMethod pmethod, string action)
     : this()
 {
     //if(cmpy == null)
     //    throw new ArithmeticException();
     this.paymethod = pmethod;
     this.action    = action;
 }
Example #4
0
 /// <summary>
 /// Update a PayMethod.
 /// </summary>
 public void Update(Model.PayMethod payMethod)
 {
     this.Validate(payMethod);
     if (this.ExistsExcept(payMethod))
     {
         throw new Helper.InvalidValueException(Model.PayMethod.PROPERTY_PAYMETHODNAME);
     }
     payMethod.UpdateTime = DateTime.Now;
     accessor.Update(payMethod);
 }
Example #5
0
        public void Validate(Model.PayMethod paymethod)
        {
            //if (string.IsNullOrEmpty(paymethod.Id))
            //    throw new Helper.RequireValueException(Model.PayMethod.PROPERTY_ID);

            if (string.IsNullOrEmpty(paymethod.PayMethodName))
            {
                throw new Helper.RequireValueException(Model.PayMethod.PROPERTY_PAYMETHODNAME);
            }
        }
Example #6
0
        public void MyClick(ref ChooseItem item)
        {
            ChoosePayMethodForm f = new ChoosePayMethodForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.PayMethod paymethod = f.SelectedItem as Model.PayMethod;
                item = new ChooseItem(paymethod, paymethod.Id, paymethod.PayMethodName);
            }
        }
Example #7
0
        protected override void MovePrev()
        {
            Model.PayMethod paymethod = this.paymethodManager.GetPrev(this.paymethod);
            if (paymethod == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.paymethod = paymethod;
        }
Example #8
0
 public void InsertUpdate(Model.PayMethod paymethod)
 {
     if (accessor.HasRows(paymethod.PayMethodId))
     {
         this.Update(paymethod);
     }
     else
     {
         this.Insert(paymethod);
     }
 }
Example #9
0
        /// <summary>
        /// Insert a PayMethod.
        /// </summary>
        public void Insert(Model.PayMethod payMethod)
        {
            this.Validate(payMethod);

            if (this.Exists(payMethod.Id))
            {
                throw new Helper.InvalidValueException(Model.PayMethod.PROPERTY_ID);
            }

            payMethod.PayMethodId = Guid.NewGuid().ToString();
            payMethod.InsertTime  = DateTime.Now;
            accessor.Insert(payMethod);
        }
Example #10
0
 public void MyLeave(ref ChooseItem item)
 {
     BL.PayMethodManager manager   = new Book.BL.PayMethodManager();
     Model.PayMethod     paymethod = manager.GetById(item.ButtonText);
     if (paymethod != null)
     {
         item.EditValue  = paymethod;
         item.LabelText  = paymethod.PayMethodName;
         item.ButtonText = paymethod.Id;
     }
     else
     {
         item.ErrorMessage = Properties.Resources.ChoosePayMethodError;
     }
 }
Example #11
0
 protected override void Delete()
 {
     if (this.paymethod == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     this.paymethodManager.Delete(this.paymethod);
     this.paymethod = this.paymethodManager.GetNext(this.paymethod);
     if (this.paymethod == null)
     {
         this.paymethod = this.paymethodManager.GetLast();
     }
 }
Example #12
0
        public override void Refresh()
        {
            if (this.paymethod == null)
            {
                this.paymethod = new Book.Model.PayMethod();
                this.action    = "insert";
            }

            //this.TextEditId.Text =(string.IsNullOrEmpty(this.paymethod.Id)?this.paymethod.PayMethodId:this.paymethod.Id);
            this.PayMethodNameTextEdit.Text = this.paymethod.PayMethodName;
            //this.PayMethodDescriptionMemoEdit.Text = this.paymethod.PayMethodDescription;

            //switch (this.action)
            //{
            //    case "insert":
            //        this.TextEditId.Properties.ReadOnly = false;
            //        this.PayMethodNameTextEdit.Properties.ReadOnly = false;
            //        this.PayMethodDescriptionMemoEdit.Properties.ReadOnly = false;
            //        break;

            //    case "update":

            //        this.TextEditId.Properties.ReadOnly = false ;
            //        this.PayMethodNameTextEdit.Properties.ReadOnly = false;
            //        this.PayMethodDescriptionMemoEdit.Properties.ReadOnly = false;
            //        break;

            //    case "view":

            //        this.TextEditId.Properties.ReadOnly = true;
            //        this.PayMethodNameTextEdit.Properties.ReadOnly = true;
            //        this.PayMethodDescriptionMemoEdit.Properties.ReadOnly = true;
            //        break;

            //    default:
            //        break;
            //}
            base.Refresh();
        }
Example #13
0
 public bool HasRowsBefore(Model.PayMethod e)
 {
     return(accessor.HasRowsBefore(e));
 }
Example #14
0
 public void Insert(Model.PayMethod e)
 {
     this.Insert <Model.PayMethod>(e);
 }
Example #15
0
 public void Update(Model.PayMethod e)
 {
     this.Update <Model.PayMethod>(e);
 }
Example #16
0
 public bool HasRowsBefore(Model.PayMethod e)
 {
     return(sqlmapper.QueryForObject <bool>("PayMethod.has_rows_before", e));
 }
Example #17
0
 protected override void MoveLast()
 {
     this.paymethod = this.paymethodManager.GetLast();
 }
Example #18
0
 public bool HasRowsAfter(Model.PayMethod e)
 {
     return(sqlmapper.QueryForObject <bool>("PayMethod.has_rows_after", e));
 }
Example #19
0
 protected override void AddNew()
 {
     this.paymethod = new Model.PayMethod();
     //this.paymethod.PayMethodId = this.paymethodManager.GetId();
 }
Example #20
0
 public Model.PayMethod GetNext(Model.PayMethod e)
 {
     return(accessor.GetNext(e));
 }
Example #21
0
 public Model.PayMethod GetNext(Model.PayMethod e)
 {
     return(sqlmapper.QueryForObject <Model.PayMethod>("PayMethod.get_next", e));
 }
Example #22
0
 public Model.PayMethod GetPrev(Model.PayMethod e)
 {
     return(accessor.GetPrev(e));
 }
Example #23
0
 public bool HasRowsAfter(Model.PayMethod e)
 {
     return(accessor.HasRowsAfter(e));
 }
Example #24
0
 public Model.PayMethod GetPrev(Model.PayMethod e)
 {
     return(sqlmapper.QueryForObject <Model.PayMethod>("PayMethod.get_prev", e));
 }
Example #25
0
 public bool ExistsExcept(Model.PayMethod e)
 {
     return(accessor.ExistsExcept(e));
 }
Example #26
0
 public void Delete(Model.PayMethod payMethod)
 {
     this.Delete(payMethod.PayMethodId);
 }