/// <summary>
        /// Update a PCFlameRetardant.
        /// </summary>
        public void Update(Model.PCFlameRetardant pCFlameRetardant)
        {
            //
            // todo: add other logic here.
            //
            try
            {
                this.Validate(pCFlameRetardant);
                BL.V.BeginTransaction();

                pCFlameRetardant.UpdateTime = DateTime.Now;
                accessor.Update(pCFlameRetardant);

                //先删除所有详细再插入新的
                accessorDetail.DeleteByPrimaryId(pCFlameRetardant.PCFlameRetardantId);
                foreach (var item in pCFlameRetardant.Details)
                {
                    item.PCFlameRetardantId = pCFlameRetardant.PCFlameRetardantId;

                    accessorDetail.Insert(item);
                }

                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();

                throw ex;
            }
        }
 public void Validate(Model.PCFlameRetardant model)
 {
     if (model.InvoiceDate == null)
     {
         throw new Helper.InvalidValueException(Model.PCFlameRetardant.PRO_InvoiceDate);
     }
 }
Example #3
0
        public RO(Model.PCFlameRetardant pCFlameRetardant)
        {
            InitializeComponent();

            this.DataSource = pCFlameRetardant.Details;

            this.lbl_CompanyName.Text = BL.Settings.CompanyChineseName;
            this.lbl_ReportName.Text  = "阻燃性測試表";
            this.lbl_ReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd");

            this.lbl_ID.Text          = pCFlameRetardant.PCFlameRetardantId;
            this.lbl_InvoiceDate.Text = pCFlameRetardant.InvoiceDate.Value.ToString("yyyy-MM-dd");
            this.lbl_Employee.Text    = pCFlameRetardant.Employee.ToString();
            this.lbl_Note.Text        = pCFlameRetardant.Note;

            this.TC_NO.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Number);
            this.TC_FromId.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_FromId);
            this.TC_Product.DataBindings.Add("Text", this.DataSource, "Product.ProductName");
            this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Pihao);
            this.TCYanse.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Yanse);
            this.TCQianghua.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Qianghua);
            this.TCFangwu.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Fangwu);
            this.TCWuQianghua.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_WuQianghua);
            this.TCRanshao.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Ranshao);
            this.TCEmployee.DataBindings.Add("Text", this.DataSource, "Employee.EmployeeName");
            this.TCTestQty.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_TestQty);
            this.TCJudge.DataBindings.Add("Text", this.DataSource, Model.PCFlameRetardantDetail.PRO_Judge);
        }
Example #4
0
 protected override void MoveLast()
 {
     if (this.LastFlag == 1)
     {
         this.LastFlag = 0;
         return;
     }
     this._pCFlameRetardant = this._pCFlameRetardantManager.GetLast();
 }
 public Model.PCFlameRetardant GetDetail(string PCFlameRetardantId)
 {
     Model.PCFlameRetardant model = this.Get(PCFlameRetardantId);
     if (model != null)
     {
         model.Details = accessorDetail.SelectByPrimaryId(PCFlameRetardantId);
     }
     return(model);
 }
Example #6
0
 protected override void MovePrev()
 {
     Model.PCFlameRetardant PCFlameRetardant = this._pCFlameRetardantManager.GetPrev(this._pCFlameRetardant);
     if (PCFlameRetardant == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._pCFlameRetardant = PCFlameRetardant;
 }
Example #7
0
        protected override void AddNew()
        {
            this._pCFlameRetardant = new Book.Model.PCFlameRetardant();
            this._pCFlameRetardant.PCFlameRetardantId = this._pCFlameRetardantManager.GetId();
            this._pCFlameRetardant.InvoiceDate        = DateTime.Now;

            this._pCFlameRetardant.Employee   = BL.V.ActiveOperator.Employee;
            this._pCFlameRetardant.EmployeeId = BL.V.ActiveOperator.EmployeeId;

            this.action = "insert";
        }
Example #8
0
 public EditForm(Model.PCFlameRetardant PCFlameRetardant)
     : this()
 {
     if (PCFlameRetardant == null)
     {
         throw new ArithmeticException("PCFlameRetardantId");
     }
     this._pCFlameRetardant = PCFlameRetardant;
     this.action            = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Example #9
0
 int LastFlag = 0; //页面载 入时是否执行 last方法
 public EditForm(string PCFlameRetardantId)
     : this()
 {
     this._pCFlameRetardant = this._pCFlameRetardantManager.Get(PCFlameRetardantId);
     if (this._pCFlameRetardant == null)
     {
         throw new ArithmeticException("PCFlameRetardantId");
     }
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
        /// <summary>
        /// Insert a PCFlameRetardant.
        /// </summary>
        public void Insert(Model.PCFlameRetardant pCFlameRetardant)
        {
            //
            // todo:add other logic here
            //
            try
            {
                pCFlameRetardant.InsertTime = DateTime.Now;
                pCFlameRetardant.UpdateTime = DateTime.Now;

                this.Validate(pCFlameRetardant);
                this.TiGuiExists(pCFlameRetardant);

                BL.V.BeginTransaction();


                accessor.Insert(pCFlameRetardant);

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCFlameRetardant.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCFlameRetardant.InsertTime.Value.Year, pCFlameRetardant.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCFlameRetardant.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);
                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                //插入详细
                foreach (var item in pCFlameRetardant.Details)
                {
                    item.PCFlameRetardantId = pCFlameRetardant.PCFlameRetardantId;

                    accessorDetail.Insert(item);
                }

                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();

                throw ex;
            }
        }
Example #11
0
        protected override void Delete()
        {
            if (this._pCFlameRetardant == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            this._pCFlameRetardantManager.Delete(this._pCFlameRetardant.PCFlameRetardantId);

            this._pCFlameRetardant = this._pCFlameRetardantManager.GetNext(this._pCFlameRetardant);
            if (this._pCFlameRetardant == null)
            {
                this._pCFlameRetardant = this._pCFlameRetardantManager.GetLast();
            }
        }
 private void TiGuiExists(Model.PCFlameRetardant model)
 {
     if (this.ExistsPrimary(model.PCFlameRetardantId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.PCFlameRetardantId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Example #13
0
        public override void Refresh()
        {
            if (this._pCFlameRetardant == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._pCFlameRetardant = this._pCFlameRetardantManager.GetDetail(this._pCFlameRetardant.PCFlameRetardantId);
                }
            }

            this.txt_Id.EditValue       = this._pCFlameRetardant.PCFlameRetardantId;
            this.date_Check.EditValue   = this._pCFlameRetardant.InvoiceDate;
            this.ncc_Employee.EditValue = this._pCFlameRetardant.Employee;

            this.txt_Note.EditValue = this._pCFlameRetardant.Note;
            this.newChooseContorlAuditEmp.EditValue = this._pCFlameRetardant.AuditEmp;
            this.txt_AuditState.EditValue           = this.GetAuditName(this._pCFlameRetardant.AuditState);

            this.bindingSourceDetail.DataSource = this._pCFlameRetardant.Details;

            base.Refresh();

            switch (this.action)
            {
            case "view":
                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                this.gridView1.OptionsBehavior.Editable = true;
                break;
            }

            this.txt_Id.Properties.ReadOnly = true;
        }
Example #14
0
 public bool HasRowsBefore(Model.PCFlameRetardant e)
 {
     return(sqlmapper.QueryForObject <bool>("PCFlameRetardant.has_rows_before", e));
 }
Example #15
0
 protected override void MoveFirst()
 {
     this._pCFlameRetardant = this._pCFlameRetardantManager.GetFirst();
 }
Example #16
0
 public Model.PCFlameRetardant GetPrev(Model.PCFlameRetardant e)
 {
     return(sqlmapper.QueryForObject <Model.PCFlameRetardant>("PCFlameRetardant.get_prev", e));
 }
 public bool HasRowsBefore(Model.PCFlameRetardant e)
 {
     return(accessor.HasRowsBefore(e));
 }
Example #18
0
 public bool HasRowsAfter(Model.PCFlameRetardant e)
 {
     return(sqlmapper.QueryForObject <bool>("PCFlameRetardant.has_rows_after", e));
 }
Example #19
0
 public Model.PCFlameRetardant GetNext(Model.PCFlameRetardant e)
 {
     return(sqlmapper.QueryForObject <Model.PCFlameRetardant>("PCFlameRetardant.get_next", e));
 }
 public bool HasRowsAfter(Model.PCFlameRetardant e)
 {
     return(accessor.HasRowsAfter(e));
 }
Example #21
0
 public void Update(Model.PCFlameRetardant e)
 {
     this.Update <Model.PCFlameRetardant>(e);
 }
Example #22
0
 public void Insert(Model.PCFlameRetardant e)
 {
     this.Insert <Model.PCFlameRetardant>(e);
 }
 public Model.PCFlameRetardant GetNext(Model.PCFlameRetardant e)
 {
     return(accessor.GetNext(e));
 }
 public Model.PCFlameRetardant GetPrev(Model.PCFlameRetardant e)
 {
     return(accessor.GetPrev(e));
 }