void Add() { //create an instance of the Order Collenction clsSupportCollection AllSupports = new clsSupportCollection(); //validate the data on the web form string Error = AllSupports.ThisSupport.Valid(txtEmail.Text, txtName.Text, txtDescription.Text, txtPhonenum.Text, txtDateSubmitted.Text); //if the data is OK then add it to the object if (Error == "") { //get the data entered by the user AllSupports.ThisSupport.Email = txtEmail.Text; AllSupports.ThisSupport.Name = Convert.ToString(txtName.Text); AllSupports.ThisSupport.Phonenum = Convert.ToString(txtPhonenum.Text); AllSupports.ThisSupport.Description = Convert.ToString(txtDescription.Text); AllSupports.ThisSupport.DateSubmitted = Convert.ToDateTime(txtDateSubmitted.Text); //add the record AllSupports.Add(); //all done so redirect back to the main page SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }
public void Update() { //create an instance of the Inventory Collection clsSupportCollection AllSupports = new clsSupportCollection(); //validate the data on the Windows Form string Error = AllSupports.ThisSupport.Valid(txtEmail.Text, txtName.Text, txtDescription.Text, txtPhonenum.Text, txtDateSubmitted.Text); //if the data is OK then add it to the object if (Error == "") { //find the record to UPDATE AllSupports.ThisSupport.Find(mSupportId); //get the data entered by the user AllSupports.ThisSupport.Email = txtEmail.Text; AllSupports.ThisSupport.Name = Convert.ToString(txtName.Text); AllSupports.ThisSupport.Phonenum = Convert.ToString(txtPhonenum.Text); AllSupports.ThisSupport.Description = Convert.ToString(txtDescription.Text); AllSupports.ThisSupport.DateSubmitted = Convert.ToDateTime(txtDateSubmitted.Text); //UPDATE the record AllSupports.Update(); //All done so redirect back to the main page SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); } else { lblError.Text = "There were problems with the data entered: " + Error; } }
private void btnSupportManagement_Click(object sender, EventArgs e) { SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); }
private void backToManageSupport_Click(object sender, EventArgs e) { SupportManageForm Sm = new SupportManageForm(); this.Hide(); Sm.ShowDialog(); this.Close(); }
private void btnNo_Click(object sender, EventArgs e) { //All done so redirect back to the main page SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); }
private void btnYes_Click(object sender, EventArgs e) { string message = "The Support has been deleted successfully."; string caption = "Deletion Confirmation"; DialogResult result; MessageBoxButtons button = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, button); if (result == DialogResult.OK) { //delete the record DeleteSupport(); //All done so redirect back to the main page SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { clsSupportCollection AllSupports = new clsSupportCollection(); string Error = AllSupports.ThisSupport.Valid(txtEmail.Text, txtName.Text, txtDescription.Text, txtPhonenum.Text, txtDateSubmitted.Text); string message = "Are you sure to Add the new Support to the Database?"; 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 Add(); //all done so redirect back to the main page SupportManageForm SM = new SupportManageForm(); this.Hide(); SM.ShowDialog(); this.Close(); } } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }