Пример #1
0
        protected override void AddNew()
        {
            this.invoice = new Model.InvoiceQK();

            this.invoice.InvoiceId   = this.invoiceManager.GetNewId();
            this.invoice.InvoiceDate = DateTime.Now;
        }
Пример #2
0
        private void _Update(Model.InvoiceQK invoice)
        {
            _ValidateForUpdate(invoice);

            Model.InvoiceQK invoiceOriginal = this.Get(invoice.InvoiceId);

            switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus)
            {
            case Helper.InvoiceStatus.Draft:
                switch ((Helper.InvoiceStatus)invoice.InvoiceStatus)
                {
                case Helper.InvoiceStatus.Draft:
                    invoice.UpdateTime  = DateTime.Now;
                    invoice.CustomerId  = invoice.Customer.CustomerId;
                    invoice.Employee0Id = invoice.Employee0.EmployeeId;
                    accessor.Update(invoice);
                    break;

                case Helper.InvoiceStatus.Normal:
                    invoice.UpdateTime    = DateTime.Now;
                    invoice.CustomerId    = invoice.Customer.CustomerId;
                    invoice.Employee0Id   = invoice.Employee0.EmployeeId;
                    invoice.Employee1Id   = invoice.Employee1.EmployeeId;
                    invoice.Employee2Id   = invoice.Employee2.EmployeeId;
                    invoice.InvoiceGZTime = DateTime.Now;

                    accessor.Update(invoice);
                    break;

                case Helper.InvoiceStatus.Null:
                    throw new InvalidOperationException();
                }
                break;

            case Helper.InvoiceStatus.Normal:

                switch ((Helper.InvoiceStatus)invoice.InvoiceStatus)
                {
                case Helper.InvoiceStatus.Draft:
                    throw new InvalidOperationException();

                case Helper.InvoiceStatus.Normal:
                    invoice.UpdateTime = DateTime.Now;
                    accessor.Update(invoice);
                    break;

                case Helper.InvoiceStatus.Null:
                    invoice.UpdateTime     = DateTime.Now;
                    invoice.Employee3Id    = invoice.Employee3.EmployeeId;
                    invoice.InvoiceZFTime  = DateTime.Now;
                    invoice.InvoiceZFCause = "";
                    accessor.Update(invoice);
                    break;
                }
                break;

            case Helper.InvoiceStatus.Null:
                throw new InvalidOperationException();
            }
        }
Пример #3
0
        protected override Form GetViewForm()
        {
            Model.InvoiceQK invoice = this.SelectedItem as Model.InvoiceQK;
            if (invoice != null)
            {
                return(new ViewForm(invoice.InvoiceId));
            }

            return(null);
        }
Пример #4
0
        protected override void MovePrev()
        {
            Model.InvoiceQK invoice = this.invoiceManager.GetPrev(this.invoice);
            if (invoice == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
        }
Пример #5
0
 public EditForm(Model.InvoiceQK invoice)
     : this()
 {
     if (invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
     this.action  = "update";
 }
Пример #6
0
        public EditForm(string invoiceId)
            : this()
        {
            this.invoice = this.invoiceManager.Get(invoiceId);

            if (this.invoice == null)
            {
                throw new ArithmeticException("invoiceid");
            }
            this.action = "update";
        }
Пример #7
0
        private void Validate(Model.InvoiceQK invoice)
        {
            if (string.IsNullOrEmpty(invoice.InvoiceId))
            {
                throw new Helper.RequireValueException("Id");
            }

            if (invoice.Employee0 == null)
            {
                throw new Helper.RequireValueException("Employee0");
            }
        }
Пример #8
0
        public R01(string invoiceId)
        {
            InitializeComponent();

            this.invoice = this.invoiceManager.Get(invoiceId);

            if (this.invoice == null)
            {
                throw new ArgumentException();
            }

            this.xrTableCellCompany.Text = this.invoice.Customer.ToString();
            this.xrTableCellTotal0.Text  = this.invoice.InvoiceTotal0.ToString();
            this.xrTableCellTotal1.Text  = this.invoice.InvoiceTotal1.ToString();
            this.xrLabelInvoiceId.Text   = this.invoice.InvoiceId;
            this.xrLabelInvoiceDate.Text = this.invoice.InvoiceDate.Value.ToShortDateString();
        }
Пример #9
0
        //public EditForm(Model.Company company)
        //    : this()
        //{
        //    if (company == null)
        //        throw new ArgumentNullException("company");

        //    this.invoice = new Book.Model.InvoiceQK();
        //    ////this.invoice.InvoiceId = this.invoiceManager.GetNewId();
        //    this.invoice.InvoiceDate = DateTime.Today;
        //    this.invoice.Company = company;
        //    this.invoice.InvoiceTotal0 = company.CompanyR1;
        //    this.invoice.InvoiceTotal1 = company.CompanyR1;
        //}

        #endregion

        #region FormLoad

        private void EditForm_Load(object sender, EventArgs e)
        {
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceQK();
                ////this.invoice.InvoiceId = this.invoiceManager.GetNewId();
                this.invoice.InvoiceDate = DateTime.Today;
            }

            this.textEditInvoiceId.Text        = this.invoice.InvoiceId;
            this.dateEditInvoiceDate.EditValue = this.invoice.InvoiceDate;
            this.buttonEditEmployee.EditValue  = this.invoice.Employee0;
            //this.textEditAbstract.Text = this.invoice.InvoiceAbstract;
            this.textEditNote.Text           = this.invoice.InvoiceNote;
            this.buttonEditCompany.EditValue = this.invoice.Customer;
            this.calcEditMoney0.EditValue    = this.invoice.InvoiceTotal0;
            this.calcEditMoney1.EditValue    = this.invoice.InvoiceTotal1;
        }
Пример #10
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();
            }
        }
Пример #11
0
        private void _Insert(Model.InvoiceQK invoice)
        {
            _ValidateForInsert(invoice);

            invoice.InsertTime  = DateTime.Now;
            invoice.UpdateTime  = DateTime.Now;
            invoice.CustomerId  = invoice.Customer.CustomerId;
            invoice.Employee0Id = invoice.Employee0.EmployeeId;
            invoice.Employee1Id = invoice.Employee1.EmployeeId;

            if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal)
            {
                //过账人
                invoice.Employee2Id = invoice.Employee2.EmployeeId;
                //过账时间
                invoice.InvoiceGZTime = DateTime.Now;
            }
            accessor.Insert(invoice);
        }
Пример #12
0
 public bool HasRowsAfter(Model.InvoiceQK e)
 {
     return(accessor.HasRowsAfter(e));
 }
Пример #13
0
        public override void Refresh()
        {
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceQK();
                this.action  = "insert";
            }
            this.textEditInvoiceId.Text        = this.invoice.InvoiceId;
            this.dateEditInvoiceDate.EditValue = this.invoice.InvoiceDate;

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

            this.buttonEditEmployee.EditValue = this.invoice.Employee0;
            this.buttonEditCompany.EditValue  = this.invoice.Customer;

            this.calcEditMoney0.EditValue = this.invoice.InvoiceTotal0;
            this.calcEditMoney1.EditValue = this.invoice.InvoiceTotal1;

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

                this.buttonEditCompany.ShowButton  = true;
                this.buttonEditEmployee.ShowButton = true;

                this.buttonEditCompany.ButtonReadOnly  = false;
                this.buttonEditEmployee.ButtonReadOnly = false;

                break;

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

                this.buttonEditCompany.ShowButton  = true;
                this.buttonEditEmployee.ShowButton = true;

                this.buttonEditCompany.ButtonReadOnly  = false;
                this.buttonEditEmployee.ButtonReadOnly = false;

                break;

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

                this.buttonEditCompany.ShowButton  = false;
                this.buttonEditEmployee.ShowButton = false;

                this.buttonEditCompany.ButtonReadOnly  = true;
                this.buttonEditEmployee.ButtonReadOnly = true;
                break;

            default:
                break;
            }
            base.Refresh();
        }
Пример #14
0
 protected override void MoveLast()
 {
     this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId);
 }
Пример #15
0
 public Model.InvoiceQK GetPrev(Model.InvoiceQK e)
 {
     return(accessor.GetPrev(e));
 }
Пример #16
0
 public Model.InvoiceQK GetNext(Model.InvoiceQK e)
 {
     return(accessor.GetNext(e));
 }
Пример #17
0
 public bool HasRowsAfter(Model.InvoiceQK e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceQK.has_rows_after", e));
 }
Пример #18
0
 private void _TurnNormal(Model.InvoiceQK invoice)
 {
     invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal;
     _Update(invoice);
 }
Пример #19
0
 public void Update(Model.InvoiceQK e)
 {
     this.Update <Model.InvoiceQK>(e);
 }
Пример #20
0
 public ViewForm(string invoiceid)
     : this()
 {
     this.invoice = this.invoiceManager.Get(invoiceid);
 }
Пример #21
0
 public Model.InvoiceQK GetPrev(Model.InvoiceQK e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceQK>("InvoiceQK.get_prev", e));
 }
Пример #22
0
 public Model.InvoiceQK GetNext(Model.InvoiceQK e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceQK>("InvoiceQK.get_next", e));
 }
Пример #23
0
 public bool HasRowsBefore(Model.InvoiceQK e)
 {
     return(accessor.HasRowsBefore(e));
 }
Пример #24
0
 public void Insert(Model.InvoiceQK e)
 {
     this.Insert <Model.InvoiceQK>(e);
 }
Пример #25
0
 public ViewForm(Model.InvoiceQK invoice)
     : this()
 {
     this.invoice = invoice;
 }
Пример #26
0
 public bool HasRowsBefore(Model.InvoiceQK e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceQK.has_rows_before", e));
 }