void Add() { //create an instance of the Order Collenction clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); //validate the data on the web form string Error = AllReplySupports.ThisReplySupport.Valid(txtEmail.Text, txtDescription.Text, txtDateReplied.Text); //if the data is OK then add it to the object if (Error == "") { //get the data entered by the user AllReplySupports.ThisReplySupport.Email = txtEmail.Text; AllReplySupports.ThisReplySupport.Description = Convert.ToString(txtDescription.Text); AllReplySupports.ThisReplySupport.DateReplied = Convert.ToDateTime(txtDateReplied.Text); //add the record AllReplySupports.Add(); //all done so redirect back to the main page } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }
public void Update() { //create an instance of the Reply Support Collection clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); //validate the data on the Windows Form string Error = AllReplySupports.ThisReplySupport.Valid(txtEmail.Text, txtDescription.Text, txtDateReplied.Text); //if the data is OK then add it to the object if (Error == "") { //find the record to UPDATE AllReplySupports.ThisReplySupport.Find(mReplySupportId); //get the data entered by the user AllReplySupports.ThisReplySupport.Email = txtEmail.Text; AllReplySupports.ThisReplySupport.Description = Convert.ToString(txtDescription.Text); AllReplySupports.ThisReplySupport.DateReplied = Convert.ToDateTime(txtDateReplied.Text); //UPDATE the record AllReplySupports.Update(); //All done so redirect back to the main page ReplySupportManageForm RSM = new ReplySupportManageForm(); this.Hide(); RSM.ShowDialog(); this.Close(); } else { lblError.Text = "There were problems with the data entered: " + Error; } }
void DeleteReplySupport() { //function to delete the selected record //create an instance of the Reply Support collection clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); //find the record to delete AllReplySupports.ThisReplySupport.Find(mReplySupportId); //delete the record AllReplySupports.Delete(); }
public void DisplayReplySupport() { //create an instance of the Reply Support Collection clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); //find the record from the database to UPDATE AllReplySupports.ThisReplySupport.Find(mReplySupportId); //Display the data for this record txtReplySupportId.Text = AllReplySupports.ThisReplySupport.ReplySupportId.ToString(); txtEmail.Text = AllReplySupports.ThisReplySupport.Email; txtDescription.Text = AllReplySupports.ThisReplySupport.Description; txtDateReplied.Text = AllReplySupports.ThisReplySupport.DateReplied.ToString("dd/MM/yyyy"); }
Int32 DisplayReplySupports(string EmailFilter) { clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); AllReplySupports.ReportByEmail(EmailFilter); //set the data source to the list of Inventories in the collection lstReplySupports.DataSource = AllReplySupports.ReplySupportList; //set the name of the primary Key lstReplySupports.ValueMember = "ReplySupportId"; //set the data field to display lstReplySupports.DisplayMember = "AllDetails"; return(AllReplySupports.Count); }
private void btnSubmit_Click(object sender, EventArgs e) { clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); string Error = AllReplySupports.ThisReplySupport.Valid(txtEmail.Text, txtDescription.Text, txtDateReplied.Text); if (Error == "") { //Execute the Add Method Add(); lblError.Text = "Your reply has been submitted successfully. Press 'Check Reply' button to see List of Replies"; } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }
private void btnUpdate_Click(object sender, EventArgs e) { clsReplySupportCollection AllReplySupports = new clsReplySupportCollection(); string Error = AllReplySupports.ThisReplySupport.Valid(txtEmail.Text, txtDescription.Text, txtDateReplied.Text); string message = "Are you sure to Update the existing Reply?"; string caption = "User Confirmation!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; //Displays the MessageBox //if there are no Errors returned if (Error == "") { //show the Message box result = MessageBox.Show(message, caption, buttons); //if "Yes" is pressed if (result == DialogResult.Yes) { //execute the Update method Update(); //All done so redirect back to the main page ReplySupportManageForm RSM = new ReplySupportManageForm(); this.Hide(); RSM.ShowDialog(); this.Close();; } } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }