void UpdateUser() { //create an instance of TNovation clsClientCollection TNovation = new clsClientCollection(); //validate the data on the webform Boolean OK = TNovation.ThisClient.Valid(textboxClientName.Text, textboxClientEmail.Text, textboxClientAddress.Text, textboxClientPosition.Text, textboxClientQualification.Text, textboxClientTel.Text, textboxClientService.Text, textboxDate.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.ThisClient.ClientNo = Convert.ToInt32(textboxClientNo.Text); TNovation.ThisClient.ClientName = textboxClientName.Text; TNovation.ThisClient.ClientEmail = textboxClientEmail.Text; TNovation.ThisClient.ClientAddress = textboxClientAddress.Text; TNovation.ThisClient.ClientPosition = textboxClientPosition.Text; TNovation.ThisClient.ClientQualification = textboxClientQualification.Text; TNovation.ThisClient.ClientTel = Convert.ToInt32(textboxClientTel.Text); TNovation.ThisClient.ClientService = textboxClientService.Text; TNovation.ThisClient.DateAdded = Convert.ToDateTime(textboxDate.Text); TNovation.ThisClient.Active = checkBoxActive.Checked; //update the record TNovation.Update(); } else { //report an error labelUpdateError.Text = "The ClientNo entered does not exist. Return to Client List box to find the ClientNo to update."; } }
Int32 DisplayClients() { //create an instance of the client collection clsClientCollection Clients = new clsClientCollection(); //see the data source to the list of clients in the collection listboxClient.DataSource = Clients.ClientList; //set the name of the primary key value listboxClient.ValueMember = "ClientNo"; //set the data field to be displayed listboxClient.DisplayMember = "ClientName"; //return the count of records in the list return Clients.Count; }
void DeleteClient() { //function to delete the selected record //create a new instance of the client book clsClientCollection TNovation = new clsClientCollection(); //find the record to delete TNovation.ThisClient.Find(ClientNo); //delete the record TNovation.Delete(); }