public CustomerItem(Customer c) : this() { lID.Text = c.ID.ToString(); lName.Text = c.Name; lPhone.Text = c.Phone; bEdit.Tag = c; bEdit.Click += Program.EditClick; bDel.Tag = c; }
public CustomerEdit(Customer c) : this() { tID.Text = c.ID.ToString(); tName.Text = c.Name; tAddress.Text = c.Address; tCity.Text = c.City; tCountry.Text = c.Country; tPostalCode.Text = c.PostalCode; tCompany.Text = c.Company; tEmail.Text = c.Email; tPhone.Text = c.Phone; tDoB.Value = c.DoB; Tag = EditType.CustomerEdit; }
private void tPhone_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { IProgress<Customer> customerProgess = new Progress<Customer>( c => { this.c = c; ceView.tName.Text = c.Name; ceView.tCompany.Text = c.Company; ceView.tAddress.Text = c.Address; ceView.tCity.Text = c.City; ceView.tCountry.Text = c.Country; ceView.tPostalCode.Text = c.PostalCode; ceView.tPhone.Text = c.Phone; ceView.tDoB.Value = c.DoB; ceView.tID.Text = c.ID.ToString(); ceView.tEmail.Text = c.Email; bPay.Click -= bPay_NoCustomer; bPay.Click += bPay_Click; }); new Loading("Loading customer", () => { var phone = tPhone.Text; var phone2 = string.Format("1-{0}-{1}-{2}", phone.Substring(0, 3), phone.Substring(3, 3), phone.Substring(6)); #if DEBUG Console.WriteLine(phone2); #endif uint cid = 0; if (uint.TryParse("" + DB.Instance.SelectSingleValue("select id from customer where phone = '" + phone2 + "'"), out cid)) { customerProgess.Report(new Customer(cid)); } else { if (MessageBox.Show("No Customer Found!\nWould you like to rigister?", "Customer", MessageBoxButtons.YesNo) == DialogResult.Yes) { CustomerEdit ce = new CustomerEdit(); ce.tPhone.Text = phone2; if ((new EditWindow(ce).ShowDialog()) == DialogResult.OK) { cid = (uint)DB.Instance.SelectSingleValue("select id from customer where phone = '" + phone2 + "'"); customerProgess.Report(new Customer(cid)); } } } }); } }
public CustomerEdit(Customer c) : this() { }