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

                Validate(pCEarplugsDecibelCheck);
                pCEarplugsDecibelCheck.UpdateTime = DateTime.Now;
                accessor.Update(pCEarplugsDecibelCheck);

                accessorDetail.DeleteByHeaderId(pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId);
                foreach (var item in pCEarplugsDecibelCheck.Details)
                {
                    item.PCEarplugsDecibelCheckId = pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId;

                    accessorDetail.Insert(item);
                }

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

                throw ex;
            }
        }
 public void Validate(Model.PCEarplugsDecibelCheck model)
 {
     if (model.PCEarplugsDecibelCheckDate == null)
     {
         throw new Helper.InvalidValueException(Model.PCEarplugsDecibelCheck.PRO_PCEarplugsDecibelCheckDate);
     }
 }
示例#3
0
 protected override void MovePrev()
 {
     Model.PCEarplugsDecibelCheck PCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetPrev(this._pCEarplugsDecibelCheck);
     if (PCEarplugsDecibelCheck == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._pCEarplugsDecibelCheck = PCEarplugsDecibelCheck;
 }
 public Model.PCEarplugsDecibelCheck GetDetail(string pCEarplugsDecibelCheckId)
 {
     Model.PCEarplugsDecibelCheck model = this.Get(pCEarplugsDecibelCheckId);
     if (model != null)
     {
         model.Details = accessorDetail.SelectByHeaderId(pCEarplugsDecibelCheckId);
     }
     return(model);
 }
示例#5
0
 protected override void MoveLast()
 {
     if (this.LastFlag == 1)
     {
         this.LastFlag = 0;
         return;
     }
     this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetLast();
 }
示例#6
0
 int LastFlag = 0; //页面载 入时是否执行 last方法
 public EditFormDecibel(string pCEarplugsDecibelCheckId)
     : this()
 {
     this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.Get(pCEarplugsDecibelCheckId);
     if (this._pCEarplugsDecibelCheck == null)
     {
         throw new ArithmeticException("PCEarplugsDecibelCheckId");
     }
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
示例#7
0
 public EditFormDecibel(Model.PCEarplugsDecibelCheck pCEarplugsDecibelCheck)
     : this()
 {
     if (pCEarplugsDecibelCheck == null)
     {
         throw new ArithmeticException("PCEarplugsDecibelCheckId");
     }
     this._pCEarplugsDecibelCheck = pCEarplugsDecibelCheck;
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
示例#8
0
        protected override void AddNew()
        {
            this._pCEarplugsDecibelCheck = new Book.Model.PCEarplugsDecibelCheck();
            this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId   = this._pCEarplugsDecibelCheckManager.GetId();
            this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckDate = DateTime.Now;

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

            if (this.cob_TestCondition.Properties.Items.Count > 0)
            {
                this._pCEarplugsDecibelCheck.TestCondition = this.cob_TestCondition.Properties.Items[0].ToString();
            }

            this.action = "insert";
        }
示例#9
0
        protected override void Delete()
        {
            if (this._pCEarplugsDecibelCheck == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            this._pCEarplugsDecibelCheckManager.Delete(this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId);

            this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetNext(this._pCEarplugsDecibelCheck);
            if (this._pCEarplugsDecibelCheck == null)
            {
                this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetLast();
            }
        }
 private void TiGuiExists(Model.PCEarplugsDecibelCheck model)
 {
     if (this.ExistsPrimary(model.PCEarplugsDecibelCheckId))
     {
         //设置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.PCEarplugsDecibelCheckId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
        /// <summary>
        /// Insert a PCEarplugsDecibelCheck.
        /// </summary>
        public void Insert(Model.PCEarplugsDecibelCheck pCEarplugsDecibelCheck)
        {
            //
            // todo:add other logic here
            //
            try
            {
                BL.V.BeginTransaction();

                pCEarplugsDecibelCheck.InsertTime = DateTime.Now;
                pCEarplugsDecibelCheck.UpdateTime = DateTime.Now;

                Validate(pCEarplugsDecibelCheck);
                this.TiGuiExists(pCEarplugsDecibelCheck);

                accessor.Insert(pCEarplugsDecibelCheck);
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCEarplugsDecibelCheck.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCEarplugsDecibelCheck.InsertTime.Value.Year, pCEarplugsDecibelCheck.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCEarplugsDecibelCheck.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 pCEarplugsDecibelCheck.Details)
                {
                    item.PCEarplugsDecibelCheckId = pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId;

                    accessorDetail.Insert(item);
                }

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

                throw ex;
            }
        }
示例#12
0
        public override void Refresh()
        {
            if (this._pCEarplugsDecibelCheck == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetDetail(this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId);
                }
            }

            this.txt_Id.EditValue       = this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckId;
            this.date_Check.EditValue   = this._pCEarplugsDecibelCheck.PCEarplugsDecibelCheckDate;
            this.ncc_Employee.EditValue = this._pCEarplugsDecibelCheck.Employee;
            this.cob_TestCondition.Text = this._pCEarplugsDecibelCheck.TestCondition;
            this.txt_Note.EditValue     = this._pCEarplugsDecibelCheck.Note;

            this.bindingSourceDetail.DataSource = this._pCEarplugsDecibelCheck.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;


            this.colParameter.Caption = "音頻  " + this._pCEarplugsDecibelCheck.TestCondition;
        }
示例#13
0
        public RODecibel(Model.PCEarplugsDecibelCheck pCEarplugsDecibelCheck)
        {
            InitializeComponent();

            this.DataSource = pCEarplugsDecibelCheck.Details;

            this.lbl_Parameter.Text = pCEarplugsDecibelCheck.TestCondition;

            this.lbl_CompanyName.Text = BL.Settings.CompanyChineseName;
            this.lbl_ReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd");
            this.lbl_Note.Text        = pCEarplugsDecibelCheck.Note;
            this.lbl_Employee.Text    = pCEarplugsDecibelCheck.Employee == null ? "" : pCEarplugsDecibelCheck.Employee.ToString();

            this.TCDate.DataBindings.Add("Text", this.DataSource, "PCEarplugsDecibelCheck." + Model.PCEarplugsDecibelCheck.PRO_PCEarplugsDecibelCheckDate, "{0:yyyy-MM-dd}");
            this.TCFromId.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_FromId);
            this.TCCusXOId.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerInvoiceXOId);
            this.TCInvoiceQuantity.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_InvoiceXOQuantity);
            this.TCProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.TCProductUnit.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_ProductUnit);
            this.TCCheckedStandard.DataBindings.Add("Text", this.DataSource, "InvoiceXO.xocustomer." + Model.Customer.PRO_CheckedStandard);
            this.TCTestQuantity.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_TestQuantity);
            this.TCYinpin.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_Yinpin, "{0:0.#}");
            this.TCJudge.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsDecibelCheckDetail.PRO_Judge);
        }
示例#14
0
 public Model.PCEarplugsDecibelCheck GetPrev(Model.PCEarplugsDecibelCheck e)
 {
     return(sqlmapper.QueryForObject <Model.PCEarplugsDecibelCheck>("PCEarplugsDecibelCheck.get_prev", e));
 }
示例#15
0
 public bool HasRowsAfter(Model.PCEarplugsDecibelCheck e)
 {
     return(sqlmapper.QueryForObject <bool>("PCEarplugsDecibelCheck.has_rows_after", e));
 }
示例#16
0
 public bool HasRowsBefore(Model.PCEarplugsDecibelCheck e)
 {
     return(sqlmapper.QueryForObject <bool>("PCEarplugsDecibelCheck.has_rows_before", e));
 }
示例#17
0
 public void Update(Model.PCEarplugsDecibelCheck e)
 {
     this.Update <Model.PCEarplugsDecibelCheck>(e);
 }
示例#18
0
 public void Insert(Model.PCEarplugsDecibelCheck e)
 {
     this.Insert <Model.PCEarplugsDecibelCheck>(e);
 }
 public Model.PCEarplugsDecibelCheck GetNext(Model.PCEarplugsDecibelCheck e)
 {
     return(accessor.GetNext(e));
 }
 public bool HasRowsAfter(Model.PCEarplugsDecibelCheck e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public bool HasRowsBefore(Model.PCEarplugsDecibelCheck e)
 {
     return(accessor.HasRowsBefore(e));
 }
示例#22
0
 protected override void MoveFirst()
 {
     this._pCEarplugsDecibelCheck = this._pCEarplugsDecibelCheckManager.GetFirst();
 }