示例#1
0
 /// <summary>
 /// Insert a InvoiceCF.
 /// </summary>
 public void Insert(Model.InvoiceCF invoiceCF)
 {
     //
     // todo:add other logic here
     //
     accessor.Insert(invoiceCF);
 }
示例#2
0
 /// <summary>
 /// Update a InvoiceCF.
 /// </summary>
 public void Update(Model.InvoiceCF invoiceCF)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(invoiceCF);
 }
示例#3
0
 public EditForm(Model.InvoiceCF initCF)
     : this()
 {
     if (initCF == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.invoice = initCF;
     this.action  = "update";
 }
示例#4
0
 public EditForm(string invoiceId)
     : this()
 {
     this.invoice = this.invoiceManager.Get(invoiceId);
     if (this.invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.action = "update";
 }
示例#5
0
        protected override void MovePrev()
        {
            Model.InvoiceCF invoice = this.invoiceManager.GetPrev(this.invoice);
            if (invoice == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
        }
示例#6
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.invoiceManager.TurnNull(this.invoice.InvoiceId);
            this.invoice = this.invoiceManager.GetNext(this.invoice);
            if (this.invoice == null)
            {
                this.invoice = this.invoiceManager.GetLast();
            }
        }
示例#7
0
        protected override void AddNew()
        {
            this.invoice = new Model.InvoiceCF();

            this.invoice.InvoiceId   = this.invoiceManager.GetNewId();
            this.invoice.InvoiceDate = DateTime.Now;

            this.invoice.DetailsIn  = new List <Model.InvoiceCFDetail>();
            this.invoice.DetailsOut = new List <Model.InvoiceCFDetail>();

            if (this.action == "insert")
            {
                Model.InvoiceCFDetail detailOut = new Model.InvoiceCFDetail();
                detailOut.InvoiceCFDetailId       = Guid.NewGuid().ToString();
                detailOut.InvoiceCFDetailKind     = "O";
                detailOut.InvoiceCFDetailNote     = "";
                detailOut.InvoiceCFDetailPrice    = 0;
                detailOut.InvoiceCFDetailQuantity = 0;
                detailOut.InvoiceCFDetailZongji   = 0;
                detailOut.InvoiceProductUnit      = "";
                detailOut.Product = new Book.Model.Product();
                this.invoice.DetailsOut.Add(detailOut);
                this.bindingSourceOut.Position = this.bindingSourceOut.IndexOf(detailOut);

                Model.InvoiceCFDetail detailIn = new Model.InvoiceCFDetail();
                detailIn.InvoiceCFDetailId       = Guid.NewGuid().ToString();
                detailIn.InvoiceCFDetailKind     = "I";
                detailIn.InvoiceCFDetailNote     = "";
                detailIn.InvoiceCFDetailPrice    = 0;
                detailIn.InvoiceCFDetailQuantity = 0;
                detailIn.InvoiceCFDetailZongji   = 0;
                detailIn.InvoiceProductUnit      = "";
                detailIn.Product = new Book.Model.Product();
                this.invoice.DetailsIn.Add(detailIn);
                this.bindingSourceIn.Position = this.bindingSourceIn.IndexOf(detailIn);
            }
        }
示例#8
0
 public Model.InvoiceCF GetPrev(Model.InvoiceCF e)
 {
     return(accessor.GetPrev(e));
 }
示例#9
0
        public override void Refresh()
        {
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceCF();
                this.action  = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
                }
            }
            this.textEditInvoiceId.EditValue  = this.invoice.InvoiceId;
            this.dateEditInvoiceDate.DateTime = this.invoice.InvoiceDate.Value;

            //this.buttonEditEmployee.EditValue = this.invoice.Employee0;

            //this.textEditAbstract.EditValue = this.invoice.InvoiceAbstract;
            this.textEditNote.EditValue = this.invoice.InvoiceNote;

            this.EmpAudit.EditValue      = this.invoice.AuditEmp;
            this.textEditAuditState.Text = this.invoice.AuditStateName;

            //this.buttonEditDepot1.EditValue = this.invoice.Depot2;
            //this.buttonEditDepot0.EditValue = this.invoice.Depot1;

            this.bindingSourceIn.DataSource  = this.invoice.DetailsIn;
            this.bindingSourceOut.DataSource = this.invoice.DetailsOut;

            switch (this.action)
            {
            case "insert":
                this.textEditInvoiceId.Properties.ReadOnly             = false;
                this.dateEditInvoiceDate.Properties.ReadOnly           = false;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = true;

                this.textEditNote.Properties.ReadOnly = false;

                this.buttonEditEmployee.ShowButton = true;
                this.buttonEditDepot0.ShowButton   = true;
                this.buttonEditDepot1.ShowButton   = true;

                this.buttonEditEmployee.ButtonReadOnly = false;
                this.buttonEditDepot0.ButtonReadOnly   = false;
                this.buttonEditDepot1.ButtonReadOnly   = false;

                this.simpleButtonAppendIn.Enabled = true;
                this.simpleButtonRemoveIn.Enabled = true;

                this.simpleButtonAppendOut.Enabled = true;
                this.simpleButtonRemoveOut.Enabled = true;


                this.gridViewIn.OptionsBehavior.Editable  = true;
                this.gridViewOut.OptionsBehavior.Editable = true;
                break;

            case "update":
                this.textEditInvoiceId.Properties.ReadOnly             = true;
                this.dateEditInvoiceDate.Properties.ReadOnly           = true;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false;

                //this.textEditAbstract.Properties.ReadOnly = false;
                this.textEditNote.Properties.ReadOnly = false;

                this.buttonEditEmployee.ShowButton = true;
                this.buttonEditDepot0.ShowButton   = true;
                this.buttonEditDepot1.ShowButton   = true;

                this.buttonEditEmployee.ButtonReadOnly = false;
                this.buttonEditDepot0.ButtonReadOnly   = false;
                this.buttonEditDepot1.ButtonReadOnly   = false;

                this.simpleButtonAppendIn.Enabled = false;
                this.simpleButtonRemoveIn.Enabled = true;

                this.simpleButtonAppendOut.Enabled = true;
                this.simpleButtonRemoveOut.Enabled = true;

                this.gridViewIn.OptionsBehavior.Editable  = true;
                this.gridViewOut.OptionsBehavior.Editable = true;

                break;

            case "view":
                this.textEditInvoiceId.Properties.ReadOnly             = true;
                this.dateEditInvoiceDate.Properties.ReadOnly           = true;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false;

                this.textEditNote.Properties.ReadOnly = true;

                this.buttonEditEmployee.ShowButton = false;
                this.buttonEditDepot0.ShowButton   = false;
                this.buttonEditDepot1.ShowButton   = false;

                this.buttonEditEmployee.ButtonReadOnly = true;
                this.buttonEditDepot0.ButtonReadOnly   = true;
                this.buttonEditDepot1.ButtonReadOnly   = true;

                this.simpleButtonAppendIn.Enabled = false;
                this.simpleButtonRemoveIn.Enabled = false;

                this.simpleButtonAppendOut.Enabled = false;
                this.simpleButtonRemoveOut.Enabled = false;


                this.gridViewIn.OptionsBehavior.Editable  = false;
                this.gridViewOut.OptionsBehavior.Editable = false;
                break;

            default:
                break;
            }

            base.Refresh();
        }
示例#10
0
 protected override void MoveLast()
 {
     this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId);
 }
示例#11
0
 public void Update(Model.InvoiceCF e)
 {
     this.Update <Model.InvoiceCF>(e);
 }
示例#12
0
 public bool HasRowsAfter(Model.InvoiceCF e)
 {
     return(accessor.HasRowsAfter(e));
 }
示例#13
0
 public bool HasRowsBefore(Model.InvoiceCF e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceCF.has_rows_before", e));
 }
示例#14
0
 public bool HasRowsBefore(Model.InvoiceCF e)
 {
     return(accessor.HasRowsBefore(e));
 }
示例#15
0
 public IList <Model.InvoiceCFDetail> Select(string kind, Model.InvoiceCF invoice)
 {
     return(accessor.Select(kind, invoice));
 }
示例#16
0
 public Model.InvoiceCF GetPrev(Model.InvoiceCF e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceCF>("InvoiceCF.get_prev", e));
 }
示例#17
0
 public Model.InvoiceCF GetNext(Model.InvoiceCF e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceCF>("InvoiceCF.get_next", e));
 }
示例#18
0
 public bool HasRowsAfter(Model.InvoiceCF e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceCF.has_rows_after", e));
 }
示例#19
0
 public Model.InvoiceCF GetNext(Model.InvoiceCF e)
 {
     return(accessor.GetNext(e));
 }
示例#20
0
 public void Insert(Model.InvoiceCF e)
 {
     this.Insert <Model.InvoiceCF>(e);
 }