//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++;
     }
 }
 //public constructor for the class
 public clsCompanyCollection()
 {
     //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_tblCompany_SelectAll");
     //get the count of records
     RecordCount = DB.Count;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create a blank address
         clsCompany ACompany = new clsCompany();
         //read in the fields from the current record
         ACompany.CompanyCode = Convert.ToInt32(DB.DataTable.Rows[Index]["CompanyCode"]);
         ACompany.CompanyAddress = Convert.ToString(DB.DataTable.Rows[Index]["CompanyAddress"]);
         ACompany.CompanyEmailAddress = Convert.ToString(DB.DataTable.Rows[Index]["CompanyEmailAddress"]);
         ACompany.InvolvedClient = Convert.ToString(DB.DataTable.Rows[Index]["InvolvedClient"]);
         ACompany.InvolvedProject = Convert.ToString(DB.DataTable.Rows[Index]["InvolvedProject"]);
         ACompany.MobileNumber = Convert.ToString(DB.DataTable.Rows[Index]["MobileNumber"]);
         ACompany.PhoneNumber = Convert.ToString(DB.DataTable.Rows[Index]["PhoneNumber"]);
         //add the record to the private data member
         companyList.Add(ACompany);
         //point at the next record
         Index++;
     }
 }
 //public constructor for the class
 public clsEventCollection()
 {
     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_tblEvent_SelectAll");
       //get the count of records
       RecordCount = DB.Count;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create an isntance of the event class
         clsEvent AnEvent = new clsEvent();
         //get the event code
         AnEvent.EventCode = Convert.ToInt32(DB.DataTable.Rows[Index]["EventCode"]);
         //get the event name
         AnEvent.EventName = Convert.ToString(DB.DataTable.Rows[Index]["EventName"]);
         //
         AnEvent.CompanyName = Convert.ToString(DB.DataTable.Rows[Index]["CompanyName"]);
         //
         AnEvent.ConsultantAttending = Convert.ToString(DB.DataTable.Rows[Index]["ConsultantAttending"]);
         //
         AnEvent.Contact = Convert.ToString(DB.DataTable.Rows[Index]["Contact"]);
         //
         AnEvent.StartDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["StartDate"]);
         //
         AnEvent.GuestSpeaker = Convert.ToString(DB.DataTable.Rows[Index]["GuestSpeaker"]);
         //
         AnEvent.Location= Convert.ToString(DB.DataTable.Rows[Index]["Location"]);
         //
         AnEvent.TypeOfEvent = Convert.ToString(DB.DataTable.Rows[Index]["TypeOfEvent"]);
         //add the event to the array list
         eventList.Add(AnEvent);
         //increment index
         Index++;
     }
 }
        //public constructor for the class
        public clsConsultantCollection()
        {
            //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_tblConsultant_SelectAll");
            //get the count of records
            RecordCount = DB.Count;
            //while there are records to process
            while (Index < RecordCount)
            {
                //create a blank Consultant
                clsConsultant AConsultant = new clsConsultant();
                //read in the fields from the current record
                AConsultant.ConsultantNo = Convert.ToInt32(DB.DataTable.Rows[Index]["ConsultantNo"]);
                AConsultant.FirstName = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]);
                AConsultant.LastName = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]);
                AConsultant.Address = Convert.ToString(DB.DataTable.Rows[Index]["Address"]);
                AConsultant.Email = Convert.ToString(DB.DataTable.Rows[Index]["Email"]);
                AConsultant.TelephoneNo = Convert.ToString(DB.DataTable.Rows[Index]["TelephoneNo"]);
                AConsultant.EmergencyContact = Convert.ToString(DB.DataTable.Rows[Index]["EmergencyContact"]);
                AConsultant.HoursOfWork = Convert.ToInt32(DB.DataTable.Rows[Index]["HoursOfWork"]);
                AConsultant.DateOfBirth = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateOfBirth"]);
                AConsultant.EmploymentDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["EmploymentDate"]);
                AConsultant.Status = Convert.ToBoolean(DB.DataTable.Rows[Index]["Status"]);
                AConsultant.DateAdded = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateAdded"]);

                //add the record to the private data member
                ConsultantList.Add(AConsultant);
                //point at the next record
                Index++;
            }
        }
예제 #5
0
 public bool Find(int EventCode)
 {
     //create an instance of the data connection
     clsDataConnection DB = new clsDataConnection();
     //add the parameter for the event code to search for
     DB.AddParameter("EventCode", EventCode);
     //execute the stored procedure
     DB.Execute("sproc_tblEvent_FilterByEventCode");
     //if one record is found ,there should be either one or zero!
     if (DB.Count == 1)
     {
         //copy the data from the databse to the private data members
         eventCode = Convert.ToInt32(DB.DataTable.Rows[0]["EventCode"]);
         eventName = Convert.ToString(DB.DataTable.Rows[0]["EventName"]);
         companyName = Convert.ToString(DB.DataTable.Rows[0]["CompanyName"]);
         contact = Convert.ToString(DB.DataTable.Rows[0]["Contact"]);
         startDate = Convert.ToDateTime(DB.DataTable.Rows[0]["StartDate"]);
         guestSpeaker = Convert.ToString(DB.DataTable.Rows[0]["GuestSpeaker"]);
         location = Convert.ToString(DB.DataTable.Rows[0]["Location"]);
         typeOfEvent = Convert.ToString(DB.DataTable.Rows[0]["TypeOfEvent"]);
         consultantAttending = Convert.ToString(DB.DataTable.Rows[0]["ConsultantAttending"]);
         //return that everything worked ok
         return true;
     }
     //if no record was found
     else
     {
         //return false indicating a problem
         return false;
     }
 }
 public void Update()
 {
     //connect to the database
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@ConsultantNo", thisConsultant.ConsultantNo);
     DB.AddParameter("@FirstName", thisConsultant.FirstName);
     DB.AddParameter("@LastName", thisConsultant.LastName);
     DB.AddParameter("@DateOfBirth", thisConsultant.DateOfBirth);
     DB.AddParameter("@Address", thisConsultant.Address);
     DB.AddParameter("@Email", thisConsultant.Email);
     DB.AddParameter("@TelephoneNo", thisConsultant.TelephoneNo);
     DB.AddParameter("@EmergencyContact", thisConsultant.EmergencyContact);
     DB.AddParameter("@EmploymentDate", thisConsultant.EmploymentDate);
     DB.AddParameter("@HoursOfWork", thisConsultant.HoursOfWork);
     DB.AddParameter("@EmploymentHistory", thisConsultant.EmploymentHistory);
     DB.AddParameter("@Status", thisConsultant.Status);
     DB.AddParameter("@DateAdded", thisConsultant.DateAdded);
     //execute the stored procedure to insert data
     DB.Execute("sproc_tblConsultant_Update");
 }
 public void Delete()
 {
     //deletes the record pointed to by thisconsultant
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@ConsultantNo", thisConsultant.ConsultantNo);
     //execute the stored procedure
     DB.Execute("sproc_tblConsultant_Delete");
 }
 public void Update()
 {
     //update an existing record based on the values of thisaddress
     //connect to the database
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@CompanyCode", thisCompany.CompanyCode);
     DB.AddParameter("@CompanyAddress", thisCompany.CompanyAddress);
     DB.AddParameter("@CompanyEmailAddress", thisCompany.CompanyEmailAddress);
     DB.AddParameter("@InvolvedClient", thisCompany.InvolvedClient);
     DB.AddParameter("@InvolvedProject", thisCompany.InvolvedProject);
     DB.AddParameter("@MobileNumber", thisCompany.MobileNumber);
     DB.AddParameter("@PhoneNumber", thisCompany.PhoneNumber);
     //execute the query returning the primary key value
     DB.Execute("sproc_tblCompany_Update");
 }
 public void Delete()
 {
     //deletes the record pointed to by thisCompany
     //connects to the database
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@CompanyCode", thisCompany.CompanyCode);
     //execute the stored procedure
     DB.Execute("sproc_tblCompany_Delete");
 }
예제 #10
0
 public bool Find(int ProjectCode)
 {
     //create an instance of the data connection
     clsDataConnection DB = new clsDataConnection();
     //add the parameter for the event code to search for
     DB.AddParameter("ProjectCode", ProjectCode);
     //execute the stored procedure
     DB.Execute("sproc_tblProject_FilterByProjectCode");
     //if one record is found ,there should be either one or zero!
     if (DB.Count == 1)
     {
         //copy the data from the databse to the private data members
         ProjectCode = Convert.ToInt32(DB.DataTable.Rows[0]["ProjectCode"]);
         ProjectName = Convert.ToString(DB.DataTable.Rows[0]["ProjectName"]);
         CompanyName = Convert.ToString(DB.DataTable.Rows[0]["CompanyName"]);
         ProjectConsultant = Convert.ToString(DB.DataTable.Rows[0]["ProjectConsultant"]);
         CompanyContact = Convert.ToString(DB.DataTable.Rows[0]["CompanyContact"]);
         ExpectedEndDate = Convert.ToDateTime(DB.DataTable.Rows[0]["ExpectedEndDate"]);
         StartDate = Convert.ToDateTime(DB.DataTable.Rows[0]["StartDate"]);
         ProjectLocation = Convert.ToString(DB.DataTable.Rows[0]["ProjectLocation"]);
         //return that everything worked ok
         return true;
     }
     //if no record was found
     else
     {
         //return false indicating a problem
         return false;
     }
 }
 public void Update()
 {
     //update an existing record based on the values of thisaddress
     //connect to the database
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@EventCode", thisEvent.EventCode);
     DB.AddParameter("@EventName", thisEvent.EventName);
     DB.AddParameter("@CompanyName", thisEvent.CompanyName);
     DB.AddParameter("@ConsultantAttending", thisEvent.ConsultantAttending);
     DB.AddParameter("@Contact", thisEvent.Contact);
     DB.AddParameter("@StartDate", thisEvent.StartDate);
     DB.AddParameter("@GuestSpeaker", thisEvent.GuestSpeaker);
     DB.AddParameter("@Location", thisEvent.Location);
     DB.AddParameter("@TypeOfEvent", thisEvent.TypeOfEvent);
     //execute the query returning the primary key value
     DB.Execute("sproc_tblEvent_Update");
 }
        public int Add()
        {
            //adds a new record to the database based on the values of thisEvent
            //set the primary key value pof the new record
            clsDataConnection DB = new clsDataConnection();

               //set the parameters for the stored procedure
            DB.AddParameter("@EventCode", thisEvent.EventCode);
            DB.AddParameter("@EventName", thisEvent.EventName);
            DB.AddParameter("@CompanyName", thisEvent.CompanyName);
            DB.AddParameter("@ConsultantAttending", thisEvent.ConsultantAttending);
            DB.AddParameter("@Contact", thisEvent.Contact);
            DB.AddParameter("@StartDate", thisEvent.StartDate);
            DB.AddParameter("@GuestSpeaker", thisEvent.GuestSpeaker);
            DB.AddParameter("@Location", thisEvent.Location);
            DB.AddParameter("@TypeOfEvent", thisEvent.TypeOfEvent);
            //execute the query returning the primary key value
            return DB.Execute("sproc_tblEvent_Insert");
        }
 public void Update()
 {
     //update an existing record based on the values of thisaddress
     //connect to the database
     clsDataConnection DB = new clsDataConnection();
     //set the parameters for the stored procedure
     DB.AddParameter("@ClientNo", thisClient.ClientNo);
     DB.AddParameter("@ClientName", thisClient.ClientName);
     DB.AddParameter("@ClientEmail", thisClient.ClientEmail);
     DB.AddParameter("@ClientPosition", thisClient.ClientPosition);
     DB.AddParameter("@ClientQualification", thisClient.ClientQualification);
     DB.AddParameter("@ClientService", thisClient.ClientService);
     DB.AddParameter("@ClientAddress", thisClient.ClientAddress);
     DB.AddParameter("@ClientTel", thisClient.ClientTel);
     DB.AddParameter("@DateAdded", thisClient.DateAdded);
     DB.AddParameter("@Active", thisClient.Active);
     //execute the query returning the primary key value
     DB.Execute("sproc_tblClient_Update");
 }
예제 #14
0
        public bool Find(int ClientNo)
        {
            //create an instance of the data connection
            clsDataConnection DB = new clsDataConnection();
            //add the parameter for the clientno to search for
            DB.AddParameter("ClientNo", ClientNo);
            //execute the stored procedure
            DB.Execute("sproc_tblClient_FilterByClientNo");
            //if one record is found (there should be either one or zero!)
            if (DB.Count == 1)
            {

                //set the private data member to the test data value
                clientNo = Convert.ToInt32(DB.DataTable.Rows[0]["ClientNo"]);
                clientName = Convert.ToString(DB.DataTable.Rows[0]["ClientName"]);
                clientEmail = Convert.ToString(DB.DataTable.Rows[0]["ClientEmail"]);
                clientPosition = Convert.ToString(DB.DataTable.Rows[0]["ClientPosition"]);
                clientQualification = Convert.ToString(DB.DataTable.Rows[0]["ClientQualification"]);
                clientService = Convert.ToString(DB.DataTable.Rows[0]["ClientService"]);
                clientAddress = Convert.ToString(DB.DataTable.Rows[0]["ClientAddress"]);
                clientTel = Convert.ToInt32(DB.DataTable.Rows[0]["ClientTel"]);
                dateAdded = Convert.ToDateTime(DB.DataTable.Rows[0]["DateAdded"]);
                active = Convert.ToBoolean(DB.DataTable.Rows[0]["Active"]);
                //always return true
                return true;
            }
            //if no record was found
            else
            {
                //return false indicating a problem
                return false;
            }
        }
예제 #15
0
 public bool Find(int CompanyCode)
 {
     //create an instance of the data connection
     clsDataConnection DB = new clsDataConnection();
     //add the parameter for the event code to search for
     DB.AddParameter("CompanyCode", CompanyCode);
     //execute the stored procedure
     DB.Execute("sproc_tblCompany_FilterByCompanyCode");
     //if one record is found ,there should be either one or zero!
     if (DB.Count == 1)
     {
         //copy the data from the databse to the private data members
         companyCode = Convert.ToInt32(DB.DataTable.Rows[0]["CompanyCode"]);
         companyAddress = Convert.ToString(DB.DataTable.Rows[0]["CompanyAddress"]);
         companyEmailAddress = Convert.ToString(DB.DataTable.Rows[0]["CompanyEmailAddress"]);
         involvedClient = Convert.ToString(DB.DataTable.Rows[0]["InvolvedClient"]);
         involvedProject = Convert.ToString(DB.DataTable.Rows[0]["InvolvedProject"]);
         mobileNumber = Convert.ToString(DB.DataTable.Rows[0]["MobileNumber"]);
         phoneNumber = Convert.ToString(DB.DataTable.Rows[0]["PhoneNumber"]);
         //return that everything worked ok
         return true;
     }
     //if no record was found
     else
     {
     //return false indicating a problem
         return false;
     }
 }