void UpdateUser() { //create an instance of TNovation clsCompanyCollection TNovation = new clsCompanyCollection(); //validate the data on the webform Boolean OK = TNovation.ThisCompany.Valid(textBoxCompanyAddress.Text, textBoxCompanyEmailAddress.Text, textBoxInvolvedClient.Text, textBoxInvolvedProject.Text, textBoxMobileNumber.Text, textBoxPhoneNumber.Text); //if the data is OK then add it to the object if (OK == true) { //find the record to update //TNovation.ThisClient.Find(ClientNo); //get the data entered by the user TNovation.ThisCompany.CompanyCode = Convert.ToInt32(textBoxCompanyCode.Text); TNovation.ThisCompany.CompanyAddress = textBoxCompanyAddress.Text; TNovation.ThisCompany.CompanyEmailAddress = textBoxCompanyEmailAddress.Text; TNovation.ThisCompany.InvolvedClient = textBoxInvolvedClient.Text; TNovation.ThisCompany.InvolvedProject = textBoxInvolvedProject.Text; TNovation.ThisCompany.MobileNumber = textBoxMobileNumber.Text; TNovation.ThisCompany.PhoneNumber = textBoxPhoneNumber.Text; //update the record TNovation.Update(); } else { //report an error labelUpdateError.Text = "The CompanyCode entered does not exist. Return to Client List box to find the CompanyCode to update."; } }
void Add() { //create an instance of TNovation clsCompanyCollection TNovation = new clsCompanyCollection(); //validate the data on the webform Boolean OK = TNovation.ThisCompany.Valid(textBoxCompanyAddress.Text, textBoxCompanyEmailAddress.Text, textBoxInvolvedClient.Text, textBoxInvolvedProject.Text, textBoxMobileNumber.Text, textBoxPhoneNumber.Text); //if the data is OK then add it to the object if (OK == true) { //get the data entered by the user TNovation.ThisCompany.CompanyCode = Convert.ToInt32(textBoxCompanyCode.Text); TNovation.ThisCompany.CompanyAddress = textBoxCompanyAddress.Text; TNovation.ThisCompany.CompanyEmailAddress = textBoxCompanyEmailAddress.Text; TNovation.ThisCompany.InvolvedClient = textBoxInvolvedClient.Text; TNovation.ThisCompany.InvolvedProject = textBoxInvolvedProject.Text; TNovation.ThisCompany.MobileNumber = textBoxMobileNumber.Text; TNovation.ThisCompany.PhoneNumber = textBoxPhoneNumber.Text; //add the record TNovation.Add(); } }