public bool ExistsExcept(Model.CustomerCategory e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.CustomerCategoryId).Id);
            return(sqlmapper.QueryForObject <bool>("CustomerCategory.existsexcept", paras));
        }
Esempio n. 2
0
        protected override void MoveNext()
        {
            Model.CustomerCategory customerCategory = this.customerCategoryManager.GetNext(this.customerCategory);
            if (customerCategory == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.customerCategory = customerCategory;
        }
        public void MyClick(ref ChooseItem item)
        {
            ChooseCustomerCategoryForm f = new ChooseCustomerCategoryForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.CustomerCategory customerCategory = f.SelectedItem as Model.CustomerCategory;
                item = new ChooseItem(customerCategory, customerCategory.Id, customerCategory.CustomerCategoryName);
            }
        }
Esempio n. 4
0
 private void Validate(Model.CustomerCategory customerCategory)
 {
     if (string.IsNullOrEmpty(customerCategory.Id))
     {
         throw new Helper.RequireValueException(Model.CustomerCategory.PROPERTY_ID);
     }
     if (string.IsNullOrEmpty(customerCategory.CustomerCategoryName))
     {
         throw new Helper.RequireValueException(Model.CustomerCategory.PROPERTY_CUSTOMERCATEGORYNAME);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Update a CustomerCategory.
        /// </summary>
        public void Update(Model.CustomerCategory customerCategory)
        {
            //
            // todo: add other logic here.
            //
            Validate(customerCategory);

            if (this.ExistsExcept(customerCategory))
            {
                throw new Helper.InvalidValueException(Model.CustomerCategory.PROPERTY_ID);
            }

            accessor.Update(customerCategory);
        }
Esempio n. 6
0
        /// <summary>
        /// Insert a CustomerCategory.
        /// </summary>
        public void Insert(Model.CustomerCategory customerCategory)
        {
            //
            // todo:add other logic here
            //
            Validate(customerCategory);

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

            customerCategory.CustomerCategoryId = Guid.NewGuid().ToString();
            accessor.Insert(customerCategory);
        }
 public void MyLeave(ref ChooseItem item)
 {
     BL.CustomerCategoryManager manager          = new Book.BL.CustomerCategoryManager();
     Model.CustomerCategory     customerCategory = manager.GetById(item.ButtonText);
     if (customerCategory != null)
     {
         item.EditValue  = customerCategory;
         item.LabelText  = customerCategory.CustomerCategoryName;
         item.ButtonText = customerCategory.Id;
     }
     else
     {
         item.ErrorMessage = "客户分类错误";
     }
 }
Esempio n. 8
0
        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.CustomerCategory customerCategory = this.bindingSource1.Current as Model.CustomerCategory;
                if (customerCategory != null)
                {
                    this.customerCategory = customerCategory;
                    this.action           = "view";
                    this.Refresh();
                }
            }
        }
Esempio n. 9
0
 protected override void Delete()
 {
     if (this.customerCategory == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     this.customerCategoryManager.Delete(this.customerCategory);
     this.customerCategory = this.customerCategoryManager.GetNext(this.customerCategory);
     if (this.customerCategory == null)
     {
         this.customerCategory = this.customerCategoryManager.GetLast();
     }
 }
Esempio n. 10
0
        public override void Refresh()
        {
            if (this.customerCategory == null)
            {
                this.customerCategory = new Book.Model.CustomerCategory();
                this.action           = "insert";
            }
            bindingSource1.DataSource = new BL.CustomerCategoryManager().Select();

            this.textEditId.Text = string.IsNullOrEmpty(this.customerCategory.Id) ? this.customerCategory.CustomerCategoryId : this.customerCategory.Id;
            this.CustomerCategoryNameTextEdit.Text   = this.customerCategory.CustomerCategoryName;
            this.CustomerCategorydetailTextEdit.Text = this.customerCategory.CustomerCategoryDescription;
            switch (this.action)
            {
            case "insert":
                this.textEditId.Properties.ReadOnly = false;
                this.CustomerCategoryNameTextEdit.Properties.ReadOnly   = false;
                this.CustomerCategorydetailTextEdit.Properties.ReadOnly = false;
                break;

            case "update":

                this.textEditId.Properties.ReadOnly = false;
                this.CustomerCategoryNameTextEdit.Properties.ReadOnly   = false;
                this.CustomerCategorydetailTextEdit.Properties.ReadOnly = false;
                break;

            case "view":

                this.textEditId.Properties.ReadOnly = true;
                this.CustomerCategoryNameTextEdit.Properties.ReadOnly   = true;
                this.CustomerCategorydetailTextEdit.Properties.ReadOnly = true;

                break;

            default:
                break;
            }
            base.Refresh();
        }
Esempio n. 11
0
 public bool HasRowsAfter(Model.CustomerCategory e)
 {
     return(accessor.HasRowsAfter(e));
 }
Esempio n. 12
0
 /// <summary>
 /// 兩個參數
 /// </summary>
 /// <param name="custom">model對象</param>
 /// <param name="action">當前呢動作</param>
 public EditForm(Model.CustomerCategory custom, string action)
     : this()
 {
     this.customerCategory = custom;
     this.action           = action;
 }
Esempio n. 13
0
 /// <summary>
 /// 一個參數(model 對象)
 /// </summary>
 /// <param name="custom">model對象</param>
 public EditForm(Model.CustomerCategory custom)
     : this()
 {
     this.customerCategory = custom;
     this.action           = "update";
 }
 public void Update(Model.CustomerCategory e)
 {
     this.Update <Model.CustomerCategory>(e);
 }
Esempio n. 15
0
 public Model.CustomerCategory GetPrev(Model.CustomerCategory e)
 {
     return(accessor.GetPrev(e));
 }
Esempio n. 16
0
 public bool HasRowsBefore(Model.CustomerCategory e)
 {
     return(accessor.HasRowsBefore(e));
 }
Esempio n. 17
0
 public Model.CustomerCategory GetNext(Model.CustomerCategory e)
 {
     return(accessor.GetNext(e));
 }
 public Model.CustomerCategory GetPrev(Model.CustomerCategory e)
 {
     return(sqlmapper.QueryForObject <Model.CustomerCategory>("CustomerCategory.get_prev", e));
 }
 public Model.CustomerCategory GetNext(Model.CustomerCategory e)
 {
     return(sqlmapper.QueryForObject <Model.CustomerCategory>("CustomerCategory.get_next", e));
 }
 public bool HasRowsAfter(Model.CustomerCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("CustomerCategory.has_rows_after", e));
 }
 public bool HasRowsBefore(Model.CustomerCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("CustomerCategory.has_rows_before", e));
 }
Esempio n. 22
0
 public void Delete(Model.CustomerCategory customercategory)
 {
     accessor.Delete(customercategory.CustomerCategoryId);
 }
Esempio n. 23
0
 protected override void MoveLast()
 {
     this.customerCategory = this.customerCategoryManager.GetLast();
 }
 public void Insert(Model.CustomerCategory e)
 {
     this.Insert <Model.CustomerCategory>(e);
 }
Esempio n. 25
0
 protected override void AddNew()
 {
     this.customerCategory = new Model.CustomerCategory();
 }
Esempio n. 26
0
 public bool ExistsExcept(Model.CustomerCategory e)
 {
     return(accessor.ExistsExcept(e));
 }