void Add() { //create an instance of the Payment Collenction clsSupportCollection AllSupports = new clsSupportCollection(); //validate the data on the web t 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 = Convert.ToString(txtEmail.Text); AllSupports.ThisSupport.Description = txtDescription.Text; AllSupports.ThisSupport.Name = Convert.ToString(txtName.Text); AllSupports.ThisSupport.Phonenum = Convert.ToString(txtPhonenum.Text); AllSupports.ThisSupport.DateSubmitted = Convert.ToDateTime(txtDateSubmitted.Text); //add the record AllSupports.Add(); } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }
public void InstanceOK() { clsSupportCollection AllSupport = new clsSupportCollection(); // teat to see tha t it exist Assert.IsNotNull(AllSupport); }
public void DeleteMethodOK() { // create an instance for the class we want to create clsSupportCollection AllSupport = new clsSupportCollection(); // create the item of the test data clsSupport TestItem = new clsSupport(); // var to store the primary key Int32 PrimaryKey = 0; // set it properties TestItem.SupportId = 2; TestItem.Email = "*****@*****.**"; TestItem.Name = "GoGo Pro"; TestItem.Description = "A new invention in Camera module"; TestItem.Phonenum = "11111111111"; TestItem.DateSubmitted = DateTime.Now.Date; // set thisAdress to the test data AllSupport.ThisSupport = TestItem; // add the record PrimaryKey = AllSupport.Add(); // set the primary key TestI data TestItem.SupportId = PrimaryKey; // find the record AllSupport.ThisSupport.Find(PrimaryKey); // delete the record AllSupport.Delete(); //now find the record Boolean Found = AllSupport.ThisSupport.Find(PrimaryKey); // test to see that the record was not found Assert.IsFalse(Found); }
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; } }
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 DisplaySupport() { //create an instance of the Support Collection clsSupportCollection AllSupports = new clsSupportCollection(); //find the record from the database to UPDATE AllSupports.ThisSupport.Find(mSupportId); //Display the data for this record txtEmail.Text = AllSupports.ThisSupport.Email; txtUserDescription.Text = AllSupports.ThisSupport.Description; }
void DeleteSupport() { //function to delete the selected record //create an instance of the Support Collection clsSupportCollection AllSupports = new clsSupportCollection(); //find the record to delete AllSupports.ThisSupport.Find(mSupportId); //delete the record AllSupports.Delete(); }
public void DisplaySupport() { //create an instance of the Inventory Collection clsSupportCollection AllSupports = new clsSupportCollection(); //find the record from the database to UPDATE AllSupports.ThisSupport.Find(mSupportId); //Display the data for this record txtSupportId.Text = AllSupports.ThisSupport.SupportId.ToString(); txtEmail.Text = AllSupports.ThisSupport.Email; txtName.Text = AllSupports.ThisSupport.Name; txtPhonenum.Text = AllSupports.ThisSupport.Phonenum; txtDescription.Text = AllSupports.ThisSupport.Description; txtDateSubmitted.Text = AllSupports.ThisSupport.DateSubmitted.ToString("dd/MM/yyyy"); }
Int32 DisplaySupports(string EmailFilter) { clsSupportCollection AllSupports = new clsSupportCollection(); AllSupports.ReportByEmail(EmailFilter); //set the data source to the list of Inventories in the collection lstSupports.DataSource = AllSupports.SupportList; //set the name of the primary Key lstSupports.ValueMember = "SupportId"; //set the data field to display lstSupports.DisplayMember = "AllDetails"; return(AllSupports.Count); }
public void ThisSupportPropertyOK() { // create an instance of the class we want to create clsSupportCollection AllSupport = new clsSupportCollection(); // create some test data to assign the property clsSupport TestSupport = new clsSupport(); // set the properties of the object TestSupport.SupportId = 1; TestSupport.Email = "*****@*****.**"; TestSupport.Name = "GoGo Pro"; TestSupport.Description = "A new invention in Camera module"; TestSupport.Phonenum = "11111111111"; TestSupport.DateSubmitted = DateTime.Now.Date; // assign the data to the property AllSupport.ThisSupport = TestSupport; // test to see that the two values are the same Assert.AreEqual(AllSupport.ThisSupport, TestSupport); }
public void UpdateMethodOK() { // create an instance for the class we want to create clsSupportCollection AllSupport = new clsSupportCollection(); // create the item of the test data clsSupport TestItem = new clsSupport(); // var to store the primary key Int32 PrimaryKey = 0; // set it properties TestItem.SupportId = 2; TestItem.Email = "*****@*****.**"; TestItem.Name = "GoGo Pro"; TestItem.Description = "A new invention in Camera module"; TestItem.Phonenum = "11111111111"; TestItem.DateSubmitted = DateTime.Now.Date; // set thisAdress to the test data AllSupport.ThisSupport = TestItem; // add the record PrimaryKey = AllSupport.Add(); // set the primary key TestI data TestItem.SupportId = PrimaryKey; // modify the test data TestItem.Email = "*****@*****.**"; TestItem.Name = "Samsung CameraPro"; TestItem.Description = "Samsung's Latest Camera"; TestItem.Phonenum = "22222222222"; TestItem.DateSubmitted = DateTime.Now.Date; // set the record based on the new test data AllSupport.ThisSupport = TestItem; // Update the record AllSupport.Update(); // find the record AllSupport.ThisSupport.Find(PrimaryKey); // test to see that the record was not found Assert.AreEqual(AllSupport.ThisSupport, TestItem); }
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; } }