//public constructor for the class
 public clsClientCollection()
 {
     //var for the index
     Int32 Index = 0;
     //var to store the record count
     Int32 RecordCount = 0;
     //object for data connection
     clsDataConnection DB = new clsDataConnection();
     //execute the stored procedure
     DB.Execute("sproc_tblClient_SelectAll");
     //get the count of records
     RecordCount = DB.Count;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create a blank address
         clsClient AClient = new clsClient();
         //read in the fields from the current record
         AClient.ClientNo = Convert.ToInt32(DB.DataTable.Rows[Index]["ClientNo"]);
         AClient.ClientName = Convert.ToString(DB.DataTable.Rows[Index]["ClientName"]);
         AClient.ClientEmail = Convert.ToString(DB.DataTable.Rows[Index]["ClientEmail"]);
         AClient.ClientPosition = Convert.ToString(DB.DataTable.Rows[Index]["ClientPosition"]);
         AClient.ClientQualification = Convert.ToString(DB.DataTable.Rows[Index]["ClientQualification"]);
         AClient.ClientService = Convert.ToString(DB.DataTable.Rows[Index]["ClientService"]);
         AClient.ClientAddress = Convert.ToString(DB.DataTable.Rows[Index]["ClientAddress"]);
         AClient.ClientTel = Convert.ToInt32(DB.DataTable.Rows[Index]["ClientTel"]);
         AClient.DateAdded = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateAdded"]);
         AClient.Active = Convert.ToBoolean(DB.DataTable.Rows[Index]["Active"]);
         //add the record to the private data member
         clientList.Add(AClient);
         //point at the next record
         Index++;
     }
 }
Ejemplo n.º 2
0
 public void ActivePropertyOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     Boolean TestData = true;
     //assign the data to the property
     AClient.Active = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.Active, TestData);
 }
Ejemplo n.º 3
0
 public void ClientAddressMaxLessOne()
 {
     //create an instance of the class we want to create
     clsClient AClient = new clsClient();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to pass to the method
     string ClientName = "freddy";
     string ClientEmail = "*****@*****.**";
     string ClientPosition = "CEO";
     string ClientQualification = "degree";
     string ClientService = "IT support for company";
     string ClientAddress = "";
     ClientAddress = ClientAddress.PadRight(49, '2');
     string ClientTel = "783763";
     string DateAdded = DateTime.Now.Date.ToString();
     //invoke the method
     OK = AClient.Valid(ClientName, ClientEmail, ClientPosition, ClientQualification, ClientService, ClientAddress, ClientTel, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Ejemplo n.º 4
0
 public void ClientQualificationOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     string TestData = "degree";
     //assign the data to the property
     AClient.ClientQualification = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.ClientQualification, TestData);
 }
Ejemplo n.º 5
0
 public void ClientNoPropertyOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     Int32 TestData = 21;
     //assign the data to the property
     AClient.ClientNo = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.ClientNo, TestData);
 }
Ejemplo n.º 6
0
 public void ClientNamePropertyOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     string TestData = "freddy";
     //assign the data to the property
     AClient.ClientName = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.ClientName, TestData);
 }
Ejemplo n.º 7
0
 public void TestDateAddedFound()
 {
     //create an instance of the class we want to create
     clsClient AClient = new clsClient();
     //boolean varibale to store the result of the search
     Boolean Found = false;
     //boolean variable to record if data is ok (assume it is)
     Boolean OK = true;
     //create some test data to use with the method
     Int32 ClientNo = 21;
     //invoke the method
     Found = AClient.Find(ClientNo);
     //check the property
     if (AClient.DateAdded != Convert.ToDateTime("20/02/2016"))
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Ejemplo n.º 8
0
 public void TestClientTelFound()
 {
     //create an instance of the class we want to create
     clsClient AClient = new clsClient();
     //boolean varibale to store the result of the search
     Boolean Found = false;
     //boolean variable to record if data is ok (assume it is)
     Boolean OK = true;
     //create some test data to use with the method
     Int32 ClientNo = 21;
     //invoke the method
     Found = AClient.Find(ClientNo);
     //check the ClientNo
     if (AClient.ClientTel != 783763)
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Ejemplo n.º 9
0
 public void InstanceOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //test to see if that exists
     Assert.IsNotNull(AClient);
 }
Ejemplo n.º 10
0
 public void FindMethodOK()
 {
     //create an instance of the class we want to create
     clsClient AClient = new clsClient();
     //boolean varibale to store the result of the search
     Boolean Found = false;
     //create some test data to use with the method
     Int32 ClientNo = 21;
     //invoke the method
     Found = AClient.Find(ClientNo);
     //test to see that the result is correct
     Assert.IsTrue(Found);
 }
Ejemplo n.º 11
0
 public void DateAddedPropertyOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     DateTime TestData = DateTime.Now.Date;
     //assign the data to the property
     AClient.DateAdded = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.DateAdded, TestData);
 }
Ejemplo n.º 12
0
 public void DateAddedMinPlusOne()
 {
     //create an instance of the class we want to create
     clsClient AClient = new clsClient();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to pass to the method
     string ClientName = "freddy";
     string ClientEmail = "*****@*****.**";
     string ClientPosition = "CEO";
     string ClientQualification = "degree";
     string ClientService = "IT support for company";
     string ClientAddress = "21b";
     string ClientTel = "783763";
     DateTime TestDate;
     //set the date todays date
     TestDate = DateTime.Now.Date;
     //change the date to whatever the date is plus 1 day
     TestDate = TestDate.AddDays(1);
     //convert the date variable to a string variable
     string DateAdded = TestDate.ToString();
     //invoke the method
     OK = AClient.Valid(ClientName, ClientEmail, ClientPosition, ClientQualification, ClientService, ClientAddress, ClientTel, DateAdded);
     //test to see that the result is correct
     Assert.IsFalse(OK);
 }
Ejemplo n.º 13
0
 public void ClientServiceOK()
 {
     //create an instance of the class I want to create
     clsClient AClient = new clsClient();
     //create some test data to assign to the property
     string TestData = "IT support for company";
     //assign the data to the property
     AClient.ClientService = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AClient.ClientService, TestData);
 }