protected override bool LoadData() { var custs = SqlHandler.GetCustomers(false).ToArray(); this.TryInvoke(() => DD_Customer.Items = custs); var amps = SqlHandler.GetAmperTypes().ToArray(); this.TryInvoke(() => DD_Ampere.Items = amps); return(true); }
public PC_NewInvoice() : base(true) { InitializeComponent(); DD_Month.Conversion = (i) => (int)i == 0 ? "All" : new DateTime(1, i.ToString().SmartParse(), 1).ToString("MMMM"); DD_Year.Items = SqlHandler.GetInvoiceYears(); DD_Year.Conversion = (i) => (int)i == -1 ? "All" : i.ToString(); DD_Month.SelectedItem = DateTime.Now.Month; DD_Year.SelectedItem = DateTime.Now.Year; }
protected override bool LoadData() { var amps = SqlHandler.GetAmperTypes().ToArray(); this.TryInvoke(() => DD_Ampere.Items = amps); var divs = SqlHandler.GetDivisions(); this.TryInvoke(() => DD_Division.Items = divs); return(true); }
private void DD_Customer_TextChanged(object sender, EventArgs e) { var id = Regex.Match(DD_Customer.Text, "#(\\d+)$").Groups[1].Value.SmartParse(-1); if (id >= 0) { var customer = SqlHandler.GetCustomerById(id); TB_Mobile.Text = customer.Mobile; TB_Address.Text = customer.Address; DD_Ampere.Text = customer.AmpereNumber.ToString("0.##") + " A"; TB_LastCounter.Text = customer.CurrentCounter.ToString("0.##"); } }
private void TB_NewCounter_TextChanged(object sender, EventArgs e) { var id = Regex.Match(DD_Customer.Text, "#(\\d+)$").Groups[1].Value.SmartParse(-1); if (id >= 0 && DD_Year.SelectedItem != null && DD_Month.SelectedItem != null) { TB_Price.Text = new InvoicePrint() { ExtraInfo = TB_ExtraFee.Text, ExtraCost = TB_ExtraFeeAmount.Text.SmartParseD(), CustAmpPrice = SqlHandler.GetInvoicePrice(id, TB_LastCounter.Text.SmartParseD(), TB_NewCounter.Text.SmartParseD(), new DateTime((int)DD_Year.SelectedItem, (int)DD_Month.SelectedItem, DateTime.Now.Day)) }.TotPrice; } }
private void B_Delete_Click(object sender, EventArgs e) { if (ShowPrompt("Are you sure you want to delete this customer?", PromptButtons.YesNo, PromptIcons.Hand) == DialogResult.Yes) { try { SqlHandler.DeleteCustomer(Customer); Form.PushBack(); if (Form.CurrentPanel is PC_ViewCustomers vi) { vi.Customers.Remove(Customer); vi.TB_Search_TextChanged(null, null); } } catch (Exception ex) { ShowPrompt("An error occurred while deleting the customer.\n\n" + ex.Message, PromptButtons.OK, PromptIcons.Error); } } }
private void B_Print_Click(object sender, EventArgs e) { InvoicePrint.Print(Form, SqlHandler.GetInvoicesPrint(new[] { Invoice })); }