Example #1
0
        public statementForm(Context context, Statement statement)
        {
            this.context = context;
            this.statement = statement;

            InitializeComponent();
            populateFields();
        }
Example #2
0
        public statementForm(Context context, Customer customer, DateTime startdate, DateTime enddate)
        {
            this.context = context;

            InitializeComponent();

            this.statement = new Statement(customer, false, startdate, enddate);
            populateFields();
        }
Example #3
0
        public statementForm(Context context, Customer customer, Boolean zerobased)
        {
            this.context = context;

            InitializeComponent();

            this.statement = new Statement(customer, zerobased);
            populateFields();
        }
Example #4
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);
            }
        }