コード例 #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try
            {

                foreach (ListViewItem item in listView.SelectedItems)
                {
                    int id = Convert.ToInt16(item.Tag);
                    Customer customer = new Customer(id);
                    if (customer.InvoiceCount == 0)
                    {
                        if (MessageBox.Show(this, "Are you sure you want to delete " + customer.Name + "?", Properties.Settings.Default.companyname, MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                        {
                            customer.Delete();
                            loadList();
                        }
                    }
                    else
                    {
                        Tools.ShowInfo("Customer has " + customer.InvoiceCount + " invoices, can not delete this customer");
                    }
                }
            }
            catch (Exception ex)
            {
                Tools.ShowError("Unable to delete customer\n" + ex.Message);
            }
        }
コード例 #2
0
ファイル: statement.cs プロジェクト: Trexis/financemanager
        public Statement(Customer customer, Boolean zeroBased, DateTime startdate, DateTime enddate)
        {
            this.customer = customer;
            this.zerobased = zeroBased;
            this.filtered = true;
            this.startdate = startdate;
            this.enddate = enddate;
            this.openingbalance = 0;
            this.closingbalance = customer.Balance;
            try
            {
                String start_datetimestring = startdate.Year + "-" + startdate.Month + "-" + startdate.Day;
                String end_datetimestring = enddate.Year + "-" + enddate.Month + "-" + enddate.Day;
                dal = new Dal();
                HashSet<Hashtable> results = dal.executeAsHashset("call getStatementByCustomerAndDate(" + this.customer.Id + ", '" + start_datetimestring + "', '" + end_datetimestring + "');");
                populateFromResults(results);

                HashSet<Hashtable> openingresults = dal.executeAsHashset("call getCustomerBalanceByDate(" + this.customer.Id + ", '" + start_datetimestring + "');");
                populateOpeningFromResults(openingresults);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to load statement for customer by id " + this.customer.Id, ex);
            }
        }
コード例 #3
0
ファイル: customerForm.cs プロジェクト: Trexis/financemanager
        public customerForm(Context context)
        {
            this.context = context;

            InitializeComponent();
            customer = new Customer();
            populateFields();
        }
コード例 #4
0
ファイル: customerForm.cs プロジェクト: Trexis/financemanager
        public customerForm(Context context, Customer customer)
        {
            this.context = context;

            InitializeComponent();
            this.customer = customer;
            populateFields();
        }
コード例 #5
0
        public statementForm(Context context, Customer customer, DateTime startdate, DateTime enddate)
        {
            this.context = context;

            InitializeComponent();

            this.statement = new Statement(customer, false, startdate, enddate);
            populateFields();
        }
コード例 #6
0
        public statementForm(Context context, Customer customer, Boolean zerobased)
        {
            this.context = context;

            InitializeComponent();

            this.statement = new Statement(customer, zerobased);
            populateFields();
        }
コード例 #7
0
ファイル: paymentForm.cs プロジェクト: Trexis/financemanager
        public paymentForm(Context context, Customer customer)
        {
            this.context = context;

            InitializeComponent();
            this.customer = customer;
            payment = new Payment(customer);

            populateFields();
        }
コード例 #8
0
ファイル: paymentForm.cs プロジェクト: Trexis/financemanager
        public paymentForm(Context context, Invoice invoice)
        {
            this.context = context;

            InitializeComponent();
            this.invoice = invoice;
            this.customer = invoice.Customer;
            payment = new Payment(invoice);

            populateFields();
        }
コード例 #9
0
ファイル: invoice.cs プロジェクト: Trexis/financemanager
 public Invoice()
 {
     try
     {
         customer = new Customer();
         datetime = DateTime.Now;
     }
     catch (Exception ex)
     {
         throw new Exception("Unable to load invoice", ex);
     }
 }
コード例 #10
0
ファイル: manager.cs プロジェクト: Trexis/financemanager
        public static Customer[] listCustomers()
        {
            Customer[] customers = new Customer[0];

            Dal dal = new Dal();
            HashSet<Hashtable> results = dal.executeAsHashset("call listCustomers();");
            customers = new Customer[results.Count];
            int counter = 0;
            foreach (Hashtable table in results)
            {
                Customer customer = new Customer(table);
                customers[counter] = customer;
                counter++;
            }
            return customers;
        }
コード例 #11
0
ファイル: statement.cs プロジェクト: Trexis/financemanager
 public Statement(Customer customer, Boolean zeroBased)
 {
     this.customer = customer;
     this.zerobased = zeroBased;
     try
     {
         this.openingbalance = 0;
         this.closingbalance = customer.Balance;
         dal = new Dal();
         HashSet<Hashtable> results = dal.executeAsHashset("call getStatementByCustomerAndDate(" + this.customer.Id + ", null, null);");
         populateFromResults(results);
     }
     catch (Exception ex)
     {
         throw new Exception("Unable to load statement for customer by id " + this.customer.Id, ex);
     }
 }
コード例 #12
0
ファイル: payment.cs プロジェクト: Trexis/financemanager
 public Payment(Invoice Invoice)
 {
     this.invoice = Invoice;
     this.customer = invoice.Customer;
 }
コード例 #13
0
        private void buttonEmail_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (ListViewItem item in listView.SelectedItems)
                {
                    int id = Convert.ToInt16(item.Tag);
                    Customer customer = new Customer(id);
                    if (!customer.EmailAddress.Equals(""))
                    {
                        DateTime enddate = DateTime.Now;
                        DateTime begindate = DateTime.Now.AddMonths(-1);
                        begindate = new DateTime(begindate.Year, begindate.Month, 1);
                        Statement statement = new Statement(customer, true, begindate, enddate);

                        Email email = new Email();
                        if (email.Send(customer.EmailAddress, customer.Name, "MeulenFoods Statement: " + begindate.ToShortDateString() + "-" + enddate.ToShortDateString(), statement.EmailHTML))
                        {
                            Tools.ShowInfo("Statement email sent to " + customer.Name + " [" + customer.EmailAddress + "]");
                        }
                        else
                        {
                            Tools.ShowError(email.ErrorMessage);
                        }

                    }
                    else
                    {
                        Tools.ShowInfo("Customer does not have a email address, update the customer email address first.");
                    }
                }
            }
            catch (Exception ex)
            {
                Tools.ShowError("Unable to load customer\n" + ex.Message);
            }
        }
コード例 #14
0
 private void editSelection()
 {
     try
     {
         if(Security.allowCustomerManagement(this.context.User)){
             foreach (ListViewItem item in listView.SelectedItems)
             {
                 int id = Convert.ToInt16(item.Tag);
                 Customer customer = new Customer(id);
                 customerForm form = new customerForm(this.context, customer);
                 form.ShowDialog(this);
                 loadList();
             }
         }
     }
     catch (Exception ex)
     {
         Tools.ShowError("Unable to load customer\n" + ex.Message);
     }
 }
コード例 #15
0
 private void buttonStatement_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (ListViewItem item in listView.SelectedItems)
         {
             int id = Convert.ToInt16(item.Tag);
             Customer customer = new Customer(id);
             statementSearchForm form = new statementSearchForm(this.context, customer);
             form.ShowDialog(this);
         }
     }
     catch (Exception ex)
     {
         Tools.ShowError("Unable to load customer to load statement\n" + ex.Message);
     }
 }
コード例 #16
0
 private void buttonPayment_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Are you sure you want to pay the customer without selecting a invoice?", "Payment direct to customer", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             foreach (ListViewItem item in listView.SelectedItems)
             {
                 int id = Convert.ToInt16(item.Tag);
                 Customer customer = new Customer(id);
                 paymentForm form = new paymentForm(this.context, customer);
                 form.ShowDialog(this);
                 loadList();
             }
         }
     }
     catch (Exception ex)
     {
         Tools.ShowError("Unable to load customer to perform payment\n" + ex.Message);
     }
 }
コード例 #17
0
ファイル: invoiceForm.cs プロジェクト: Trexis/financemanager
 private void populateCustomerFields(Customer customer)
 {
     comboBoxCustomers.Text = customer.Name;
     textBoxStreet.Text = customer.Street;
     textBoxCity.Text = customer.City;
     textBoxZip.Text = customer.Zipcode;
     textBoxVat.Text = customer.VatNumber;
     textBoxPhone.Text = customer.Phone;
     textBoxFax.Text = customer.Fax;
     textBoxContact.Text = customer.Contact;
     textBoxEmail.Text = customer.EmailAddress;
     comboBoxPaymentType.SelectedIndex = Convert.ToInt16(customer.PaymentType);
     calculateDueDate();
     loadListReps(customer.Rep);
 }
コード例 #18
0
ファイル: payment.cs プロジェクト: Trexis/financemanager
 public Payment(Customer Customer)
 {
     this.customer = Customer;
 }