private void Validate(Model.AreaCategory areaCategory)
 {
     if (string.IsNullOrEmpty(areaCategory.AreaCategoryName))
     {
         throw new Helper.RequireValueException(Model.AreaCategory.PROPERTY_AREACATEGORYNAME);
     }
 }
Exemple #2
0
        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);
            }
        }
Exemple #4
0
        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 = "地区类别错误";
     }
 }
Exemple #8
0
        //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();
                }
            }
        }
Exemple #9
0
 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();
     }
 }
Exemple #10
0
        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();
        }
Exemple #11
0
 protected override void AddNew()
 {
     this._areaCategory = new Model.AreaCategory();
 }
Exemple #12
0
 public Model.AreaCategory GetPrev(Model.AreaCategory e)
 {
     return(sqlmapper.QueryForObject <Model.AreaCategory>("AreaCategory.get_prev", e));
 }
Exemple #13
0
 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));
 }
Exemple #15
0
 public bool HasRowsBefore(Model.AreaCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("AreaCategory.has_rows_before", e));
 }
Exemple #16
0
 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));
 }
Exemple #20
0
 protected override void MoveLast()
 {
     this._areaCategory = this.areaCategoryManager.GetLast();
 }
Exemple #21
0
 public bool HasRowsAfter(Model.AreaCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("AreaCategory.has_rows_after", e));
 }
Exemple #22
0
 public void Insert(Model.AreaCategory e)
 {
     this.Insert <Model.AreaCategory>(e);
 }
 public Model.AreaCategory GetPrev(Model.AreaCategory e)
 {
     return(accessor.GetPrev(e));
 }