public ModifyCustomerForm(Customer c) //initialize the inputs for textboxes using existing data { InitializeComponent(); lblCustomerIDMod.Text = c.CustomerID.ToString(); tbCustomerFNameMod.Text = c.Forename; tbCustomerLNameMod.Text = c.Surname; tbCustomerAddressMod.Text = c.Address; tbCustomerPostalMod.Text = c.Postal; tbCustomerPostOfficeMod.Text = PostUtils.GetPostOffice(c.Postal); tbCustomerEmailMod.Text = c.Email; tbCustomerPhoneMod.Text = c.Phone; }
private void Fill_customer_values() // Fill customer data function { if (tbBookCustomerEmail.Text == "") { tbBookCustomerEmail.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("email").ToString(), tbBookCustomerEmail.MaxLength); } else if (tbBookCustomerPhone.Text == "") { tbBookCustomerPhone.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("puhelinnro"), tbBookCustomerPhone.MaxLength); } tbBookCustomerName.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("etunimi").ToString(), tbBookCustomerName.MaxLength); tbBookCustomerLastname.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("sukunimi").ToString(), tbBookCustomerLastname.MaxLength); tbBookCustomerAddress.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("lahiosoite").ToString(), tbBookCustomerAddress.MaxLength); tbBookCustomerPostnumber.Text = TextBoxUtils.ModifyInput(dt.Rows[currentcustomer].Field <string>("postinro").ToString(), tbBookCustomerPostnumber.MaxLength); tbBookCustomerPostOffice.Text = TextBoxUtils.ModifyInput(PostUtils.GetPostOffice(dt.Rows[currentcustomer].Field <string>("postinro").ToString()), tbBookCustomerPostOffice.MaxLength); customerid = dt.Rows[currentcustomer].Field <int>("asiakas_id"); lblBookCustomerID.Visible = true; lblBookCustomerID.Text = "Asiakas ID: " + customerid.ToString(); }