示例#1
0
        public bool ExistsExcept(Model.BGProduct e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.BGProductId) == null?null:Get(e.BGProductId).Id);
            return(sqlmapper.QueryForObject <bool>("BGProduct.existsexcept", paras));
        }
示例#2
0
 protected override void MovePrev()
 {
     Model.BGProduct model = this._manager.GetPrev(this._bGProduct);
     if (model == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._bGProduct = model;
 }
示例#3
0
 private void Validate(Model.BGProduct bGProduct)
 {
     if (bGProduct.Id == null)
     {
         throw new Helper.RequireValueException(Model.BGProduct.PRO_Id + "NULL");
     }
     if (this.Exists(bGProduct.Id))
     {
         throw new Helper.InvalidValueException(Model.BGProduct.PRO_Id);
     }
 }
示例#4
0
        public override void Refresh()
        {
            if (this._bGProduct == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._bGProduct = this._manager.Get(this._bGProduct.BGProductId);
                }
            }
            this.txt_QiYeNeibuId.Text                = this._bGProduct.QiYeNeiId;
            this.txt_BGProductId.Text                = this._bGProduct.Id;
            this.txt_CustomsClearance.Text           = this._bGProduct.ZhuGuanHaiGuan;
            this.txt_JingYingDanWeiId.Text           = this._bGProduct.JingYingDanWeiId;
            this.txt_JingYingDanWeiName.Text         = this._bGProduct.JingYingDanWeiName;
            this.txt_fertility.Text                  = this._bGProduct.ShengChanNengLi.ToString();
            this.txt_JiaGongDanWeiId.Text            = this._bGProduct.JiaGongDanWeiId;
            this.txt_JiaGongDanWeiName.Text          = this._bGProduct.JiaGongDanWeiName;
            this.comboBoxEditManagerObject.EditValue = this._bGProduct.GuanLiDuiXiang;
            this.txt_ShenBaoDanWeiId.Text            = this._bGProduct.ShenBaoDanWeiId;
            this.txt_ShenBaoDanWeiName.Text          = this._bGProduct.ShenBaoDanWeiName;
            this.date_ShenBaoDate.EditValue          = this._bGProduct.ShenBaoDate;
            this.newChooseContorlEmployee.EditValue  = this._bGProduct.Employee;
            this.txt_Note.Text = this._bGProduct.Desc;
            this.newChooseContorlAuditEmp.EditValue = this._bGProduct.AuditEmp;
            this.txt_AuditState.EditValue           = this.GetAuditName(this._bGProduct.AuditState);

            this._bGProduct.DetailProduct         = this._detailManager.SelectProductByBGProductId(this._bGProduct.BGProductId);
            this._bGProduct.DetailMaterial        = this._detailManager.SelectMaterialByBGProductId(this._bGProduct.BGProductId);
            this.bindingSourceProduct.DataSource  = this._bGProduct.DetailProduct;
            this.bindingSourceMaterial.DataSource = this._bGProduct.DetailMaterial;
            base.Refresh();
            switch (this.action)
            {
            case "view":
                this.gridView1.OptionsBehavior.Editable = false;
                this.gridView2.OptionsBehavior.Editable = false;
                break;

            default:
                this.gridView1.OptionsBehavior.Editable = true;
                this.gridView2.OptionsBehavior.Editable = true;
                break;
            }
        }
示例#5
0
 protected override void Delete()
 {
     if (this._bGProduct == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Model.BGProduct model = this._manager.GetNext(this._bGProduct);
         this._manager.Delete(this._bGProduct.BGProductId);
         if (model != null)
         {
             this._bGProduct = model;
         }
         else
         {
             this._bGProduct = this._manager.GetLast();
         }
         MessageBox.Show(Properties.Resources.DeleteSuccess);
     }
 }
示例#6
0
        /// <summary>
        /// Update a BGProduct.
        /// </summary>
        public void Update(Model.BGProduct bGProduct)
        {
            //
            // todo: add other logic here.
            //
            Validate(bGProduct);
            bGProduct.UpdateTime = DateTime.Now;
            accessor.Update(bGProduct);

            (new BL.BGProductDetaiManager()).DeleteByBGProductId(bGProduct.BGProductId);
            foreach (Model.BGProductDetai model in bGProduct.DetailProduct)
            {
                model.BGProductId = bGProduct.BGProductId;
                model.ProType     = true;
                (new BL.BGProductDetaiManager()).Insert(model);
            }
            foreach (Model.BGProductDetai model in bGProduct.DetailMaterial)
            {
                model.BGProductId = bGProduct.BGProductId;
                model.ProType     = false;
                (new BL.BGProductDetaiManager()).Insert(model);
            }
        }
示例#7
0
 public bool HasRowsBefore(Model.BGProduct e)
 {
     return(sqlmapper.QueryForObject <bool>("BGProduct.has_rows_before", e));
 }
示例#8
0
 protected override void AddNew()
 {
     this._bGProduct             = new Book.Model.BGProduct();
     this._bGProduct.BGProductId = Guid.NewGuid().ToString();
     this.action = "insert";
 }
示例#9
0
 public bool HasRowsAfter(Model.BGProduct e)
 {
     return(accessor.HasRowsAfter(e));
 }
示例#10
0
 protected override void MoveLast()
 {
     this._bGProduct = this._manager.GetLast();
 }
示例#11
0
 public Model.BGProduct GetPrev(Model.BGProduct e)
 {
     return(sqlmapper.QueryForObject <Model.BGProduct>("BGProduct.get_prev", e));
 }
示例#12
0
 public Model.BGProduct GetNext(Model.BGProduct e)
 {
     return(sqlmapper.QueryForObject <Model.BGProduct>("BGProduct.get_next", e));
 }
示例#13
0
 public bool HasRowsBefore(Model.BGProduct e)
 {
     return(accessor.HasRowsBefore(e));
 }
示例#14
0
 public void Update(Model.BGProduct e)
 {
     this.Update <Model.BGProduct>(e);
 }
示例#15
0
 public void Insert(Model.BGProduct e)
 {
     this.Insert <Model.BGProduct>(e);
 }
示例#16
0
 public Model.BGProduct GetPrev(Model.BGProduct e)
 {
     return(accessor.GetPrev(e));
 }
示例#17
0
 public Model.BGProduct GetNext(Model.BGProduct e)
 {
     return(accessor.GetNext(e));
 }
示例#18
0
 public bool HasRowsAfter(Model.BGProduct e)
 {
     return(sqlmapper.QueryForObject <bool>("BGProduct.has_rows_after", e));
 }
示例#19
0
 public bool ExistsExcept(Model.BGProduct e)
 {
     return(accessor.ExistsExcept(e));
 }