/// <summary>
        /// Update a PCAssemblyInspection.
        /// </summary>
        public void Update(Model.PCAssemblyInspection pCAssemblyInspection)
        {
            //
            // todo: add other logic here.
            //
            try
            {
                BL.V.BeginTransaction();
                Validate(pCAssemblyInspection);
                pCAssemblyInspection.UpdateTime = DateTime.Now;
                accessor.Update(pCAssemblyInspection);

                accessorDetail.DeleteByHeaderId(pCAssemblyInspection.PCAssemblyInspectionId);
                foreach (var item in pCAssemblyInspection.Details)
                {
                    accessorDetail.Insert(item);
                }
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
 public void Delete(Model.PCAssemblyInspection model)
 {
     if (model != null)
     {
         this.Delete(model.PCAssemblyInspectionId);
     }
 }
示例#3
0
 protected override void MoveLast()
 {
     if (LastFlag == 1)
     {
         LastFlag = 0; return;
     }
     this._pCAssemblyInspection = this.manager.GetLast();
 }
示例#4
0
        protected override Book.UI.Settings.BasicData.BaseEditForm GetEditForm(object[] args)
        {
            Type type = typeof(EditForm);

            Model.PCAssemblyInspection model = this.pCAssemblyInspectionManager.Get((args[0] as Model.PCAssemblyInspectionDetail) == null ? "" : (args[0] as Model.PCAssemblyInspectionDetail).PCAssemblyInspectionId);
            args[0] = model;
            return((EditForm)type.Assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, args, null, null));
        }
 public Model.PCAssemblyInspection GetDetail(string id)
 {
     Model.PCAssemblyInspection model = this.Get(id);
     if (model != null)
     {
         model.Details = accessorDetail.SelectByHeaderId(id);
     }
     return(model);
 }
示例#6
0
        protected override void AddNew()
        {
            this._pCAssemblyInspection = new Book.Model.PCAssemblyInspection();
            this._pCAssemblyInspection.PCAssemblyInspectionId   = this.manager.GetId();
            this._pCAssemblyInspection.PCAssemblyInspectionDate = DateTime.Now;
            this._pCAssemblyInspection.Employee = BL.V.ActiveOperator.Employee;

            this.action = "insert";
        }
示例#7
0
 protected override void MoveNext()
 {
     Model.PCAssemblyInspection p = this.manager.GetNext(this._pCAssemblyInspection);
     if (p == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._pCAssemblyInspection = p;
 }
示例#8
0
 public EditForm_Backup(string PCAssemblyInspectionId)
     : this()
 {
     this._pCAssemblyInspection = this.manager.Get(PCAssemblyInspectionId);
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
 public void Validate(Model.PCAssemblyInspection model)
 {
     if (model.PCAssemblyInspectionDate == null)
     {
         throw new Helper.InvalidValueException(Model.PCAssemblyInspection.PRO_PCAssemblyInspectionDate);
     }
     if (string.IsNullOrEmpty(model.CustomerId))
     {
         throw new Helper.InvalidValueException(Model.PCAssemblyInspection.PRO_CustomerId);
     }
 }
示例#10
0
 public EditForm_Backup(Model.PCAssemblyInspection model)
     : this()
 {
     if (model == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this._pCAssemblyInspection = model;
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
 private void TiGuiExists(Model.PCAssemblyInspection model)
 {
     if (this.ExistsPrimary(model.PCAssemblyInspectionId))
     {
         //设置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.PCAssemblyInspectionId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
示例#12
0
 protected override void Delete()
 {
     if (this._pCAssemblyInspection == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Model.PCAssemblyInspection model = this.manager.GetNext(this._pCAssemblyInspection);
         this.manager.Delete(this._pCAssemblyInspection.PCAssemblyInspectionId);
         if (model == null)
         {
             this._pCAssemblyInspection = this.manager.GetLast();
         }
         else
         {
             this._pCAssemblyInspection = model;
         }
     }
 }
示例#13
0
        public override void Refresh()
        {
            if (this._pCAssemblyInspection == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._pCAssemblyInspection = this.manager.GetDetail(this._pCAssemblyInspection.PCAssemblyInspectionId);
                }
            }

            this.txt_PCAssemblyInspectionId.Text         = this._pCAssemblyInspection.PCAssemblyInspectionId;
            this.date_PCAssemblyInspectionDate.EditValue = this._pCAssemblyInspection.PCAssemblyInspectionDate;
            this.txt_PronoteHeaderId.Text       = this._pCAssemblyInspection.PronoteHeaderId;
            this.txt_InvoiceCusId.Text          = this._pCAssemblyInspection.InvoiceCusId;
            this.nccEmployee.EditValue          = this._pCAssemblyInspection.Employee;
            this.txt_Note.Text                  = this._pCAssemblyInspection.Note;
            this.nccEmployee1.EditValue         = this._pCAssemblyInspection.Employee1;
            this.bindingSourceDetail.DataSource = this._pCAssemblyInspection.Details;

            base.Refresh();

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

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

            this.txt_PronoteHeaderId.Properties.ReadOnly        = true;
            this.txt_PCAssemblyInspectionId.Properties.ReadOnly = true;
        }
示例#14
0
        public RO(Model.PCAssemblyInspection model)
            : this()
        {
            Model.PCAssemblyInspection pCAssemblyInspection = new BL.PCAssemblyInspectionManager().GetDetail(model.PCAssemblyInspectionId);
            this.DataSource = pCAssemblyInspection.Details;

            this.lblCompanyName.Text               = BL.Settings.CompanyChineseName;
            this.lbl_ReportName.Text               = "品管抽检日报表";
            this.lblReportDate.Text               += DateTime.Now.ToString("yyyy-MM-dd");
            this.lbl_PCAssemblyInspectionId.Text   = pCAssemblyInspection.PCAssemblyInspectionId;
            this.lbl_PCAssemblyInspectionDate.Text = pCAssemblyInspection.PCAssemblyInspectionDate.Value.ToString("yyyy-MM-dd");
            //this.lbl_PronoteHeaderId.Text = pCAssemblyInspection.PronoteHeaderId;
            this.lbl_CustomerId.Text   = pCAssemblyInspection.Customer.CustomerShortName;
            this.lbl_InvoiceCusId.Text = pCAssemblyInspection.InvoiceCusId;
            this.lbl_Note.Text         = pCAssemblyInspection.Note;
            this.lbl_Employee.Text     = pCAssemblyInspection.Employee == null ? "" : pCAssemblyInspection.Employee.EmployeeName;
            this.lblEmployee1.Text     = pCAssemblyInspection.Employee1 == null ? "" : pCAssemblyInspection.Employee1.EmployeeName;

            TCProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
            TCCheckDate.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_PCAssemblyInspectionDetailDate, "{0:HH:mm}");
            //TCPronoteHeaderId.DataBindings.Add("Text", this.DataSource, "Customer." + Model.Customer.PRO_CustomerShortName);
            TCPronoteHeaderId.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_PronoteHeaderId);
            TCCheckNum.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_CheckNum, "{0:0}");
            TCWaiguan.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Waiguan);
            //TCJiagongbie.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Jiagongbie);
            TCJiao.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Jiao);
            TCShensuojiao.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Shensuojiao);
            TCSuoluosi.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Luosi);
            TCCashang.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Cashang);
            TCKuang.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Kuang);
            TCBidian.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Bidian);
            TCBaozhuangdai.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Baozhuangdai);
            TCTiaomabiao.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Tiaomabiao);
            TCZhengcemai.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Zhengcemai);
            TCChongji.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Chongji);
            TCEmoloyee.DataBindings.Add("Text", this.DataSource, "Employee." + Model.Employee.PROPERTY_EMPLOYEENAME);
            TCNote.DataBindings.Add("Text", this.DataSource, Model.PCAssemblyInspectionDetail.PRO_Note);
            this.lblJiagongbie.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
        }
        /// <summary>
        /// Insert a PCAssemblyInspection.
        /// </summary>
        public void Insert(Model.PCAssemblyInspection pCAssemblyInspection)
        {
            //
            // todo:add other logic here
            //BL.V.BeginTransaction();
            try
            {
                BL.V.BeginTransaction();
                this.Validate(pCAssemblyInspection);
                this.TiGuiExists(pCAssemblyInspection);

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

                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
 public Model.PCAssemblyInspection GetNext(Model.PCAssemblyInspection e)
 {
     return(accessor.GetNext(e));
 }
 public bool HasRowsBefore(Model.PCAssemblyInspection e)
 {
     return(accessor.HasRowsBefore(e));
 }
 public bool HasRowsAfter(Model.PCAssemblyInspection e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public bool HasRowsBefore(Model.PCAssemblyInspection e)
 {
     return(sqlmapper.QueryForObject <bool>("PCAssemblyInspection.has_rows_before", e));
 }
 public void Update(Model.PCAssemblyInspection e)
 {
     this.Update <Model.PCAssemblyInspection>(e);
 }
 public bool HasRowsAfter(Model.PCAssemblyInspection e)
 {
     return(sqlmapper.QueryForObject <bool>("PCAssemblyInspection.has_rows_after", e));
 }
 public Model.PCAssemblyInspection GetNext(Model.PCAssemblyInspection e)
 {
     return(sqlmapper.QueryForObject <Model.PCAssemblyInspection>("PCAssemblyInspection.get_next", e));
 }
 public Model.PCAssemblyInspection GetPrev(Model.PCAssemblyInspection e)
 {
     return(sqlmapper.QueryForObject <Model.PCAssemblyInspection>("PCAssemblyInspection.get_prev", e));
 }
 public void Insert(Model.PCAssemblyInspection e)
 {
     this.Insert <Model.PCAssemblyInspection>(e);
 }
示例#25
0
 protected override void MoveFirst()
 {
     this._pCAssemblyInspection = this.manager.GetFirst();
 }