예제 #1
0
        public bool ExistsExcept(Model.TradeCategory e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.TradeCategoryId).Id);
            return(sqlmapper.QueryForObject <bool>("TradeCategory.existsexcept", paras));
        }
예제 #2
0
        protected override void MovePrev()
        {
            Model.TradeCategory unitGroup = this.tradeCategoryManager.GetPrev(this._tradeCategory);
            if (unitGroup == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this._tradeCategory = unitGroup;
        }
예제 #3
0
        public void MyClick(ref ChooseItem item)
        {
            ChooseTradeCategoryForm f = new ChooseTradeCategoryForm();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Model.TradeCategory tradeCategory = f.SelectedItem as Model.TradeCategory;
                item = new ChooseItem(tradeCategory, tradeCategory.Id, tradeCategory.TradeCategoryName);
            }
        }
예제 #4
0
        //protected override string GetInvoiceKind()
        //{
        //    return "TradeCategory";
        //}

        //protected override string GetSettingId()
        //{
        //    return "TradeCategoryRule";
        //}

        public void Validate(Model.TradeCategory tradeCategory)
        {
            if (string.IsNullOrEmpty(tradeCategory.Id))
            {
                throw new Helper.RequireValueException(Model.TradeCategory.PROPERTY_ID);
            }

            if (string.IsNullOrEmpty(tradeCategory.TradeCategoryName))
            {
                throw new Helper.RequireValueException(Model.TradeCategory.PROPERTY_TRADECATEGORYNAME);
            }
        }
예제 #5
0
 public void MyLeave(ref ChooseItem item)
 {
     BL.TradeCategoryManager manager       = new Book.BL.TradeCategoryManager();
     Model.TradeCategory     tradeCategory = manager.GetById(item.ButtonText);
     if (tradeCategory != null)
     {
         item.EditValue  = tradeCategory;
         item.LabelText  = tradeCategory.TradeCategoryName;
         item.ButtonText = tradeCategory.Id;
     }
     else
     {
         item.ErrorMessage = "行业类别错误";
     }
 }
예제 #6
0
        /// <summary>
        /// Insert a TradeCategory.
        /// </summary>
        public void Insert(Model.TradeCategory tradeCategory)
        {
            //
            // todo:add other logic here
            //
            Validate(tradeCategory);

            if (this.Exists(tradeCategory.Id))
            {
                throw new Helper.InvalidValueException(Model.TradeCategory.PROPERTY_ID);
            }
            tradeCategory.TradeCategoryId = Guid.NewGuid().ToString();
            tradeCategory.InsertTime      = DateTime.Now;
            accessor.Insert(tradeCategory);
        }
예제 #7
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.TradeCategory trade = this.bindingSourceTradeCategory.Current as Model.TradeCategory;
                if (trade != null)
                {
                    this._tradeCategory = trade;
                    this.action         = "view";
                    this.Refresh();
                }
            }
        }
예제 #8
0
 protected override void Delete()
 {
     if (this._tradeCategory == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     this.tradeCategoryManager.Delete(this._tradeCategory.TradeCategoryId);
     this._tradeCategory = this.tradeCategoryManager.GetNext(this._tradeCategory);
     if (this._tradeCategory == null)
     {
         this._tradeCategory = this.tradeCategoryManager.GetLast();
     }
 }
예제 #9
0
        /// <summary>
        /// Update a TradeCategory.
        /// </summary>
        public void Update(Model.TradeCategory tradeCategory)
        {
            //
            // todo: add other logic here.
            //
            Validate(tradeCategory);

            if (this.ExistsExcept(tradeCategory))
            {
                throw new Helper.InvalidValueException(Model.TradeCategory.PROPERTY_ID);
            }
            if (accessor.ExistsExcept(tradeCategory))
            {
                throw new Helper.InvalidValueException("Id");
            }
            tradeCategory.UpdateTime = DateTime.Now;
            accessor.Update(tradeCategory);
        }
예제 #10
0
        public override void Refresh()
        {
            if (this._tradeCategory == null)
            {
                this._tradeCategory = new Book.Model.TradeCategory();
                this.action         = "insert";
            }

            this.bindingSourceTradeCategory.DataSource = this.tradeCategoryManager.Select();

            this.textEditId.EditValue = string.IsNullOrEmpty(this._tradeCategory.Id)?this._tradeCategory.TradeCategoryId:this._tradeCategory.Id;
            this.textEditTradeCategoryName.EditValue = this._tradeCategory.TradeCategoryName;
            this.memoEditDescription.Text            = this._tradeCategory.Description;

            switch (this.action)
            {
            case "insert":
                this.textEditId.Properties.ReadOnly = false;
                this.textEditTradeCategoryName.Properties.ReadOnly = false;
                this.memoEditDescription.Properties.ReadOnly       = false;
                break;

            case "update":
                // oldId = this.textEditId.EditValue.ToString();
                this.textEditId.Properties.ReadOnly = false;
                this.textEditTradeCategoryName.Properties.ReadOnly = false;
                this.memoEditDescription.Properties.ReadOnly       = false;
                break;

            case "view":
                this.textEditId.Properties.ReadOnly = true;
                this.textEditTradeCategoryName.Properties.ReadOnly = true;
                this.memoEditDescription.Properties.ReadOnly       = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
예제 #11
0
 public void Insert(Model.TradeCategory e)
 {
     this.Insert <Model.TradeCategory>(e);
 }
예제 #12
0
 public bool ExistsExcept(Model.TradeCategory e)
 {
     return(accessor.ExistsExcept(e));
 }
예제 #13
0
 public bool HasRowsBefore(Model.TradeCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("TradeCategory.has_rows_before", e));
 }
예제 #14
0
 public void Update(Model.TradeCategory e)
 {
     this.Update <Model.TradeCategory>(e);
 }
예제 #15
0
 public bool HasRowsAfter(Model.TradeCategory e)
 {
     return(sqlmapper.QueryForObject <bool>("TradeCategory.has_rows_after", e));
 }
예제 #16
0
 public Model.TradeCategory GetNext(Model.TradeCategory e)
 {
     return(accessor.GetNext(e));
 }
예제 #17
0
 public Model.TradeCategory GetPrev(Model.TradeCategory e)
 {
     return(accessor.GetPrev(e));
 }
예제 #18
0
 public Model.TradeCategory GetNext(Model.TradeCategory e)
 {
     return(sqlmapper.QueryForObject <Model.TradeCategory>("TradeCategory.get_next", e));
 }
예제 #19
0
 public Model.TradeCategory GetPrev(Model.TradeCategory e)
 {
     return(sqlmapper.QueryForObject <Model.TradeCategory>("TradeCategory.get_prev", e));
 }
예제 #20
0
 protected override void AddNew()
 {
     this._tradeCategory = new Model.TradeCategory();
     //this._tradeCategory.TradeCategoryId = this.tradeCategoryManager.GetId();
 }
예제 #21
0
 public bool HasRowsBefore(Model.TradeCategory e)
 {
     return(accessor.HasRowsBefore(e));
 }
예제 #22
0
 protected override void MoveLast()
 {
     this._tradeCategory = this.tradeCategoryManager.GetLast();
 }
예제 #23
0
 public bool HasRowsAfter(Model.TradeCategory e)
 {
     return(accessor.HasRowsAfter(e));
 }