Exemplo n.º 1
0
        public RO1(Model.InvoicePacking model)
            : this()
        {
            //this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            //this.lblReportName.Text = Properties.Resources.InvoicePacking;
            //this.lblReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd");

            //this.lblInvoicePackingId.Text = model.InvoicePackingId;
            this.lblInvoicePackingDate.Text = model.InvoicePackingDate == null ? null : model.InvoicePackingDate.Value.ToString("yyyy-MM-dd");
            this.lblInvoiceOF.Text          = model.XOCustomer == null ? null : model.XOCustomer.ToString();
            this.lblInvoiceTO_1.Text        = model.To1;
            this.lblInvoiceTO_2.Text        = model.To2;
            this.lblShippedBy.Text          = model.ShippedBy == null ? null : model.ShippedBy.CompanyName;
            this.lblPerSS.Text           = model.PerSS;
            this.lblS_O.Text             = model.SorO;
            this.lblShippedON_About.Text = model.ShippedOnAbout;
            this.lblArrivel_ONAbout.Text = model.ArrivelOnAbout;
            this.lblInvoice_AddFrom.Text = model.AddressFrom;
            this.lblInvoice_AddTo.Text   = model.AddressTo;
            //this.RichTextNote.Rtf = model.InvoicePackingNote;
            //this.lblEmployee.Text = model.Employee == null ? "0" : model.Employee.EmployeeName;
            //this.lblJWeight.Text = model.Jweight == null ? "0" : model.Jweight.ToString();
            //this.lblMWeight.Text = model.Mweight == null ? "0" : model.Mweight.ToString();
            //this.lblCaiji.Text = model.Caiji == null ? null : model.Caiji.ToString();

            this.DataSource = model.Details;
            TC_ShippingMarks.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_HandPackingId);
            this.TC_InvoicePackingDetailNO.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_InvoicePackingDetailId);
            this.TC_Description.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_Note);
            this.TC_Quantity.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_PackingNum);
            this.TC_NewWeight.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_AllJweight);
            this.TC_CrossWeight.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_AllMWeight);
            this.TC_UnitPrice.DataBindings.Add("Text", this.DataSource, Model.InvoicePackingDetail.PRO_UnitPrice);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update a InvoicePacking.
        /// </summary>
        public void Update(Model.InvoicePacking invoicePacking)
        {
            //
            // todo: add other logic here.
            //
            try
            {
                BL.V.BeginTransaction();

                this.Validate(invoicePacking);
                invoicePacking.UpdateTime = DateTime.Now;
                accessor.Update(invoicePacking);
                (new BL.InvoicePackingDetailManager()).DeleteByInvoicePackingId(invoicePacking.InvoicePackingId);
                foreach (Model.InvoicePackingDetail detail in invoicePacking.Details)
                {
                    (new BL.InvoicePackingDetailManager()).Insert(detail);
                }
                (new BL.CustomerMarksManager()).DeleteByInvoicePackingId(invoicePacking.InvoicePackingId);
                foreach (Model.CustomerMarks mark in invoicePacking.Marks)
                {
                    (new BL.CustomerMarksManager()).Insert(mark);
                }

                BL.V.CommitTransaction();
            }
            catch (Exception ex)
            {
                BL.V.RollbackTransaction();
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
 protected override void MoveLast()
 {
     if (this.LastFlag == 1)
     {
         this.LastFlag = 0;
         return;
     }
     this._invoicePacking = this._invoicePackingManager.GetLast();
 }
Exemplo n.º 4
0
 protected override void MoveNext()
 {
     Model.InvoicePacking invoicePacking = this._invoicePackingManager.GetNext(this._invoicePacking);
     if (invoicePacking == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._invoicePacking = invoicePacking;
 }
Exemplo n.º 5
0
 protected override Form GetViewForm()
 {
     Model.InvoicePacking invoicePacking = this.bindingSource1.Current as Model.InvoicePacking;
     if (invoicePacking != null)
     {
         return(new EditForm(invoicePacking));
     }
     return(null);
 }
Exemplo n.º 6
0
        protected override void AddNew()
        {
            this._invoicePacking = new Book.Model.InvoicePacking();
            this._invoicePacking.InvoicePackingId = this._invoicePackingManager.GetId();
            this._invoicePackingManager.TiGuiExists(this._invoicePacking);
            this._invoicePacking.Details = new List <Model.InvoicePackingDetail>();

            this.action = "insert";
        }
Exemplo n.º 7
0
 int LastFlag = 0; //页面载 入时是否执行 last方法
 public EditForm(string invoiceId)
     : this()
 {
     this._invoicePacking = this._invoicePackingManager.Get(invoiceId);
     if (this._invoicePacking == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.action = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Exemplo n.º 8
0
 public EditForm(Model.InvoicePacking invoice)
     : this()
 {
     if (invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this._invoicePacking = invoice;
     this.action          = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Exemplo n.º 9
0
        public override void Refresh()
        {
            if (this._invoicePacking == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._invoicePacking = this._invoicePackingManager.Get(this._invoicePacking.InvoicePackingId);
                }
            }

            this.txt_NO.EditValue                    = this._invoicePacking.InvoiceNO;
            this.Date_PackingDate.EditValue          = this._invoicePacking.InvoicePackingDate;
            this.txt_InvoiceOf.EditValue             = this._invoicePacking.InvoiceOf;
            this.txt_Messrs.EditValue                = this._invoicePacking.Messrs;
            this.lookUpEditSHIPPED.EditValue         = this._invoicePacking.ShippedById;
            this.newChooseContorlConsignee.EditValue = this._invoicePacking.CONSIGNEE;
            this.txt_ADDRESS1.EditValue              = this._invoicePacking.ADDRESS1;
            this.txt_ADDRESS2.EditValue              = this._invoicePacking.ADDRESS2;
            this.txt_Sailing.EditValue               = this._invoicePacking.Sailing;
            this.txt_TotalAmount.EditValue           = this._invoicePacking.TotalAmount.ToString();

            this.newChooseContorlAuditEmp.EditValue = this._invoicePacking.AuditEmp;
            this.txt_AuditState.EditValue           = this._invoicePacking.AuditStateName;

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

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

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

            this._invoicePacking.Details        = this._invoicePackingDetailManager.SelectByInvoicePackingId(this._invoicePacking.InvoicePackingId);
            this.bindingSourceDetail.DataSource = this._invoicePacking.Details;

            this._invoicePacking.Marks         = this.customerMarksManager.SelectByInvoicePackingId(this._invoicePacking.InvoicePackingId);
            this.bindingSourceMarks.DataSource = this._invoicePacking.Marks;
            base.Refresh();
        }
Exemplo n.º 10
0
 protected override void TurnNull()
 {
     if (this._invoicePacking == null)
     {
         return;
     }
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         this._invoicePackingManager.Delete(this._invoicePacking.InvoicePackingId);
         this._invoicePacking = this._invoicePackingManager.GetNext(this._invoicePacking);
         if (this._invoicePacking == null)
         {
             this._invoicePacking = this._invoicePackingManager.GetLast();
         }
     }
 }
Exemplo n.º 11
0
        public ROPackingList(Model.InvoicePacking model)
            : this()
        {
            this.lbl_NO.Text                = model.InvoiceNO;
            this.lblInvoiceOF.Text          = model.InvoiceOf;
            this.lblInvoicePackingDate.Text = model.InvoicePackingDate == null ? null : model.InvoicePackingDate.Value.ToString("yyyy-MM-dd");
            this.lbl_For.Text               = model.Messrs;
            this.lblShippedBy.Text          = model.ShippedBy == null ? null : model.ShippedBy.CompanyName;
            this.lblCONSIGNEE.Text          = model.CONSIGNEE == null ? null : model.CONSIGNEE.CustomerShortName;
            this.lblADDRESS1.Text           = model.ADDRESS1;
            this.lblADDRESS2.Text           = model.ADDRESS2;
            this.lbl_Sailing.Text           = model.Sailing;

            this.xrSubreport1.ReportSource = new ROList1(model.Details);
            this.xrSubreport2.ReportSource = new ROList2(model.Marks);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Insert a InvoicePacking.
 /// </summary>
 public void Insert(Model.InvoicePacking invoicePacking)
 {
     //
     // todo:add other logic here
     //
     this.Validate(invoicePacking);
     invoicePacking.InsertTime = DateTime.Now;
     invoicePacking.UpdateTime = DateTime.Now;
     accessor.Insert(invoicePacking);
     foreach (Model.InvoicePackingDetail detail in invoicePacking.Details)
     {
         (new BL.InvoicePackingDetailManager()).Insert(detail);
     }
     foreach (Model.CustomerMarks mark in invoicePacking.Marks)
     {
         (new BL.CustomerMarksManager()).Insert(mark);
     }
 }
Exemplo n.º 13
0
 private void Validate(Model.InvoicePacking model)
 {
     if (string.IsNullOrEmpty(model.InvoiceNO))
     {
         throw new Helper.RequireValueException(Model.InvoicePacking.PRO_InvoiceNO);
     }
     if (model.InvoicePackingDate == null)
     {
         throw new Helper.RequireValueException(Model.InvoicePacking.PRO_InvoicePackingDate);
     }
     foreach (Model.InvoicePackingDetail detail in model.Details)
     {
         if (string.IsNullOrEmpty(detail.HandPackingId))
         {
             throw new Helper.RequireValueException(Model.InvoicePackingDetail.PRO_HandPackingId);
         }
     }
 }
Exemplo n.º 14
0
 public void TiGuiExists(Model.InvoicePacking model)
 {
     if (this.ExistsPrimary(model.InvoicePackingId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, DateTime.Now.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, DateTime.Now.Year, DateTime.Now.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, DateTime.Now.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.InvoicePackingId = this.GetId(DateTime.Now);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
Exemplo n.º 15
0
        public ROInvoice(Model.InvoicePacking model)
            : this()
        {
            //this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            //this.lblReportName.Text = Properties.Resources.InvoicePacking;
            //this.lblReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd");

            //this.lblInvoicePackingId.Text = model.InvoicePackingId;
            this.lbl_NO.Text                = model.InvoiceNO;
            this.lblInvoiceOF.Text          = model.InvoiceOf;
            this.lblInvoicePackingDate.Text = model.InvoicePackingDate == null ? null : model.InvoicePackingDate.Value.ToString("yyyy-MM-dd");
            this.lbl_For.Text               = model.Messrs;
            this.lblShippedBy.Text          = model.ShippedBy == null ? null : model.ShippedBy.CompanyName;
            this.lblCONSIGNEE.Text          = model.CONSIGNEE == null ? null : model.CONSIGNEE.CustomerShortName;
            this.lblADDRESS1.Text           = model.ADDRESS1;
            this.lblADDRESS2.Text           = model.ADDRESS2;
            this.lbl_Sailing.Text           = model.Sailing;

            //this.TCMark.DataBindings.Add("Rtf",model.Marks, Model.CustomerMarks.PRO_CustomerMarksName);

            //因为有子报表该页面不能给Datasource赋值,否则出现循环列印多次现象,故此传值给子报表
            this.xrSubreport1.ReportSource = new ROInvoice1(model.Details);
            this.xrSubreport2.ReportSource = new ROInvoice2(model.Marks);
        }
Exemplo n.º 16
0
 public Model.InvoicePacking GetPrev(Model.InvoicePacking e)
 {
     return(sqlmapper.QueryForObject <Model.InvoicePacking>("InvoicePacking.get_prev", e));
 }
Exemplo n.º 17
0
 public bool HasRowsAfter(Model.InvoicePacking e)
 {
     return(accessor.HasRowsAfter(e));
 }
Exemplo n.º 18
0
 public Model.InvoicePacking GetPrev(Model.InvoicePacking e)
 {
     return(accessor.GetPrev(e));
 }
Exemplo n.º 19
0
 public Model.InvoicePacking GetNext(Model.InvoicePacking e)
 {
     return(accessor.GetNext(e));
 }
Exemplo n.º 20
0
 public void Insert(Model.InvoicePacking e)
 {
     this.Insert <Model.InvoicePacking>(e);
 }
Exemplo n.º 21
0
 protected override void MoveFirst()
 {
     this._invoicePacking = this._invoicePackingManager.GetFirst();
 }
Exemplo n.º 22
0
 public void Update(Model.InvoicePacking e)
 {
     this.Update <Model.InvoicePacking>(e);
 }
Exemplo n.º 23
0
 public bool HasRowsBefore(Model.InvoicePacking e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoicePacking.has_rows_before", e));
 }
Exemplo n.º 24
0
 public bool HasRowsAfter(Model.InvoicePacking e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoicePacking.has_rows_after", e));
 }
Exemplo n.º 25
0
 public bool HasRowsBefore(Model.InvoicePacking e)
 {
     return(accessor.HasRowsBefore(e));
 }
Exemplo n.º 26
0
 public Model.InvoicePacking GetNext(Model.InvoicePacking e)
 {
     return(sqlmapper.QueryForObject <Model.InvoicePacking>("InvoicePacking.get_next", e));
 }