示例#1
0
文件: RO.cs 项目: daobataotie/EDNew
        public RO(Model.InvoiceLH invoice)
        {
            InitializeComponent();

            this.DataSource = invoice.Detail;

            lbl_CompanyName.Text      = BL.Settings.CompanyChineseName;
            lbl_InvoiceId.Text        = invoice.InvoiceId;
            lbl_Customer.Text         = invoice.Customer == null ? "" : invoice.Customer.CustomerShortName;
            lbl_ReportDate.Text       = DateTime.Now.ToString("yyyy-MM-dd");
            lbl_ConveyanceMethod.Text = invoice.ConveyanceMethod == null ? "" : invoice.ConveyanceMethod.ConveyanceMethodName;
            lbl_InvoiceDate.Text      = invoice.InvoiceDate.Value.ToString("yyyy-MM-dd");

            TC_No.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_Number);
            TCProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            TCKehuPinhao.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
            TC_InvoiceXOCusId.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_InvoiceXOCusId);
            TCCustomerProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            TC_EstimateQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_EstimateQty);
            TCProductUnit.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_ProductUnit);
            TC_BoxCapacityQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxCapacityQty);
            TCBoxNumber.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxNumber);
            TCBoxQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxQty);
            TCNote.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_Note);

            lbl_EmpCreater.Text = invoice.EmpCreater == null ? "" : invoice.EmpCreater.EmployeeName;
            //lbl_EmpShengguan.Text = invoice.EmpShengguan == null ? "" : invoice.EmpShengguan.EmployeeName;
            //lbl_EmpShechu.Text = invoice.EmpShechu == null ? "" : invoice.EmpShechu.EmployeeName;
            //lbl_EmpPinjian.Text=invoice.EmpPinjian==null?"":invoice.EmpPinjian.EmployeeName;
            //lbl_EmpDepot.Text = invoice.EmpDepot == null ? "" : invoice.EmpDepot.EmployeeName;
        }
示例#2
0
 protected override void MoveLast()
 {
     if (LastFlag == 1)
     {
         LastFlag = 0; return;
     }
     this.invoice = this.invoiceLHManager.Get(this.invoiceLHManager.GetLast() == null ? "" : this.invoiceLHManager.GetLast().InvoiceId);
 }
示例#3
0
        protected override void AddNew()
        {
            this.invoice = new Model.InvoiceLH();

            this.invoice.InvoiceId   = this.invoiceLHManager.GetIdByMonth(DateTime.Now);
            this.invoice.InvoiceDate = DateTime.Now;
            this.invoice.EmpCreater  = BL.V.ActiveOperator.Employee;
        }
示例#4
0
        protected override void MovePrev()
        {
            Model.InvoiceLH invoice = this.invoiceLHManager.GetPrev(this.invoice);
            if (invoice == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.invoice = this.invoiceLHManager.Get(invoice.InvoiceId);
        }
示例#5
0
        public override void Refresh()
        {
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceLH();
                this.action  = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.invoice = this.invoiceLHManager.GetDetail(invoice.InvoiceId);
                }
            }

            this.txt_InvoiceId.EditValue        = this.invoice.InvoiceId;
            this.date_InvoiceDate.EditValue     = this.invoice.InvoiceDate;
            this.ncc_Customer.EditValue         = this.invoice.Customer;
            this.lue_ConveyanceMethod.EditValue = this.invoice.ConveyanceMethodId;
            this.ncc_EmpCreater.EditValue       = this.invoice.EmpCreater;
            //this.ncc_EmpShengguan.EditValue = this.invoice.EmpShengguan;
            //this.ncc_EmpShechu.EditValue = this.invoice.EmpShechu;
            //this.ncc_EmpPinjian.EditValue = this.invoice.EmpPinjian;
            //this.ncc_EmpDepot.EditValue = this.invoice.EmpDepot;
            this.EmpAudit.EditValue      = this.invoice.AuditEmp;
            this.textEditAuditState.Text = this.invoice.AuditStateName;

            this.bindingSourceDetail.DataSource = this.invoice.Detail;

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

            case "update":
                this.gridView1.OptionsBehavior.Editable = true;
                break;

            case "view":
                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                break;
            }
            base.Refresh();

            this.txt_InvoiceId.Properties.ReadOnly = true;
            this.ncc_EmpCreater.Enabled            = false;
        }
示例#6
0
 public EditForm(Model.InvoiceLH invoiceLH)
     : this()
 {
     if (invoiceLH == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.invoice = invoiceLH;
     this.action  = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
示例#7
0
 public EditForm(string invoiceId)
     : this()
 {
     this.invoice = this.invoiceLHManager.Get(invoiceId);
     if (this.invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
示例#8
0
 protected override void TiGuiExists(Book.Model.Invoice model)
 {
     Model.InvoiceLH lh = this.Get(model.InvoiceId);
     if (lh != null)
     {
         //设置KEY值
         string invoiceKind = this.GetInvoiceKind().ToLower();
         //string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         //SequenceManager.Increment(sequencekey_d);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InvoiceDate.Value.Year, model.InvoiceDate.Value.Month);
         SequenceManager.Increment(sequencekey_m);
         model.InvoiceId = this.GetIdByMonth(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
示例#9
0
        public Model.InvoiceLH GetDetail(string invoiceId)
        {
            Model.InvoiceLH invoice = this.Get(invoiceId);
            if (invoice != null)
            {
                invoice.Detail = accessorDetail.SelectByHeaderId(invoiceId);

                if (invoice.Detail == null)
                {
                    invoice.Detail = new List <Model.InvoiceLHDetail>();
                }
            }

            return(invoice);
        }
示例#10
0
        private void Validate(Model.InvoiceLH invoice)
        {
            if (string.IsNullOrEmpty(invoice.InvoiceId))
            {
                throw new Helper.RequireValueException(Model.InvoiceLH.PRO_InvoiceId);
            }

            if (invoice.InvoiceDate == null)
            {
                throw new Helper.RequireValueException(Model.InvoiceLH.PRO_InvoiceDate);
            }

            if (string.IsNullOrEmpty(invoice.CustomerId))
            {
                throw new Helper.RequireValueException(Model.InvoiceLH.PRO_CustomerId);
            }
        }
示例#11
0
        protected override void TurnNull()
        {
            if (this.invoice == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
            {
                return;
            }

            this.invoiceLHManager.Delete(this.invoice.InvoiceId);
            this.invoice = this.invoiceLHManager.GetNext(this.invoice);
            if (this.invoice == null)
            {
                this.invoice = this.invoiceLHManager.GetLast();
            }
        }
示例#12
0
        /// <summary>
        /// Insert a InvoiceLH.
        /// </summary>
        public void _Insert(Model.InvoiceLH invoiceLH)
        {
            //
            // todo:add other logic here
            //

            //Validate(invoiceLH);
            invoiceLH.InsertTime = DateTime.Now;
            invoiceLH.UpdateTime = DateTime.Now;

            accessor.Insert(invoiceLH);

            foreach (var item in invoiceLH.Detail)
            {
                item.InvoiceLHId = invoiceLH.InvoiceId;

                accessorDetail.Insert(item);
            }
        }
示例#13
0
        /// <summary>
        /// Update a InvoiceLH.
        /// </summary>
        public void Update(Model.InvoiceLH invoiceLH)
        {
            //
            // todo: add other logic here.
            //

            Validate(invoiceLH);

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

            accessorDetail.DeleteByHeaderId(invoiceLH.InvoiceId);
            foreach (var item in invoiceLH.Detail)
            {
                item.InvoiceLHId = invoiceLH.InvoiceId;

                accessorDetail.Insert(item);
            }
        }
示例#14
0
        public void Delete(string id)
        {
            #region 编号递减
            Model.InvoiceLH model         = this.Get(id);
            string          invoiceKind   = "LH".ToLower();
            string          sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InvoiceDate.Value.Year, model.InvoiceDate.Value.Month);
            Model.Sequence  sequence      = new SequenceAccessor().Get(sequencekey_m);
            if (sequence != null)
            {
                if (Convert.ToInt32(id.Substring(4)) >= sequence.Val)
                {
                    sequence.Val--;
                    sequence.Val = sequence.Val < 0 ? 0 : sequence.Val;

                    new SequenceAccessor().Update(sequence);
                }
            }
            #endregion

            this.Delete <Model.InvoiceLH>(id);
        }
示例#15
0
 public Model.InvoiceLH GetPrev(Model.InvoiceLH e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceLH>("InvoiceLH.get_prev", e));
 }
示例#16
0
 public void Update(Model.InvoiceLH e)
 {
     this.Update <Model.InvoiceLH>(e);
 }
示例#17
0
 public bool HasRowsAfter(Model.InvoiceLH e)
 {
     return(accessor.HasRowsAfter(e));
 }
示例#18
0
 public Model.InvoiceLH GetPrev(Model.InvoiceLH e)
 {
     return(accessor.GetPrev(e));
 }
示例#19
0
 protected override void MoveFirst()
 {
     this.invoice = this.invoiceLHManager.Get(this.invoiceLHManager.GetFirst() == null ? "" : this.invoiceLHManager.GetFirst().InvoiceId);
 }
示例#20
0
 public Model.InvoiceLH GetNext(Model.InvoiceLH e)
 {
     return(accessor.GetNext(e));
 }
示例#21
0
 public Model.InvoiceLH GetNext(Model.InvoiceLH e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceLH>("InvoiceLH.get_next", e));
 }
示例#22
0
 public void Insert(Model.InvoiceLH e)
 {
     this.Insert <Model.InvoiceLH>(e);
 }
示例#23
0
 public bool HasRowsBefore(Model.InvoiceLH e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceLH.has_rows_before", e));
 }
示例#24
0
 public bool HasRowsAfter(Model.InvoiceLH e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceLH.has_rows_after", e));
 }
示例#25
0
 public bool HasRowsBefore(Model.InvoiceLH e)
 {
     return(accessor.HasRowsBefore(e));
 }