private DataTable approveCoordinatordata(Coordinator coordinator)
 {
     DataTable dt = new DataTable();
     dt = Coordinator.ApproveCoordinator(UserRole, UserLogin, coordinator);
     return dt;
 }
        private void dgvListCoordinator_SelectionChanged(object sender, EventArgs e)
        {
            int IndexSelected = dgvListCoordinator.CurrentRow.Index;
            row = dgvListCoordinator.Rows[IndexSelected];
            BIT.frmEdit.TabPageSelected = "tabPageEditCoordinator";

            coordinator = new Coordinator();
            coordinator.CoordinatorID = Convert.ToInt32(row.Cells[6].Value.ToString());
            coordinator.CoordinatorPosition = row.Cells[0].Value.ToString();
            coordinator.CoordinatorPhonePrimary = row.Cells[1].Value.ToString();
            coordinator.CoordinatorPhoneMobile = row.Cells[2].Value.ToString();
            coordinator.CoordinatorFirstName = row.Cells[3].Value.ToString();
            coordinator.CoordinatorLastName = row.Cells[4].Value.ToString();
            coordinator.CoordinatorEmailPrimary = row.Cells[5].Value.ToString();
        }
        private Coordinator populateCoordinatorUIdata(Coordinator coordinator)
        {
            coordinator.CoordinatorTitle = txtNewCoordinatorTitle.Text;
            coordinator.CoordinatorFirstName = txtNewCoordinatorFirstName.Text;
            coordinator.CoordinatorLastName = txtNewCoordinatorLastName.Text;
            coordinator.CoordinatorEmailPrimary = txtNewCoordinatorEmailP.Text;
            coordinator.CoordinatorEmailAlternate = txtNewCoordinatorEmailA.Text;
            coordinator.CoordinatorFax = txtNewCoordinatorFax.Text;
            coordinator.CoordinatorPhonePrimary = txtNewCoordinatorPhoneP.Text;
            coordinator.CoordinatorPhoneHome = txtNewCoordinatorPhoneH.Text;
            coordinator.CoordinatorPhoneMobile = txtNewCoordinatorPhoneM.Text;
            coordinator.CoordinatorPhoneWork = txtNewCoordinatorPhoneW.Text;
            coordinator.CoordinatorPhoneEmergency = txtNewCoordinatorPhoneE.Text;
            coordinator.CoordinatorCompanyName = txtNewCoordinatorCompany.Text;
            coordinator.CoordinatorPosition = txtNewCoordinatorPosition.Text;
            coordinator.CoordinatorDescription = txtNewCoordinatorDescription.Text;

            return coordinator;
        }
 private DataTable insertCoordinatorData(Coordinator coordinator)
 {
     DataTable dt = new DataTable();
     dt = Coordinator.InsertCoordinator(UserRole, UserLogin, coordinator);
     return dt;
 }
        private void btnNewSave_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            string msg = "MESSAGE: ";

            switch (TabPageSelected)
            {
                case "tabPageNewClient":                    // Client* selected
                    client = new Client();
                    dt = insertClientData(populateClientUIdata(client));
                    msg = msg + "Client Created! ";
                    client.ClientID = Convert.ToInt32(dt.Rows[0][0]);
                    break;
                case "tabPageNewContractor":                // Contractor* selected
                    contractor = new Contractor();
                    dt = insertContractorData(populateContractorUIdata(contractor));
                    msg = msg + "Contractor Created! ";
                    contractor.ContractorID = Convert.ToInt32(dt.Rows[0][0]);
                    break;
                case "tabPageNewCoordinator":               // Coordinator* selected
                    coordinator = new Coordinator();
                    dt = insertCoordinatorData(populateCoordinatorUIdata(coordinator));
                    msg = msg + "Coordinator Created! ";
                    coordinator.CoordinatorID = Convert.ToInt32(dt.Rows[0][0]);
                    break;
                case "tabPageNewRequest":                   // Request* selected

                    break;
                case "tabPageNewJob":                       // Job* selected

                    break;
                case "tabPageNewContractorSkill":          // ContractorSkill* selected

                    break;
                case "tabPageNewSkill":                     // Skill* selected

                    break;
                case "tabPageNewLocation":                  // Location* selected

                    break;
                case "tabPageNewAvailability":              // Availability* selected

                    break;
                // ... unauthorized user...
                default:
                    break;
            }

            if (dt.Rows.Count > 0)
                msg = msg + "with ID: " + Convert.ToString(dt.Rows[0][0]);

            lblNewMessage.Text = msg;

            btnNewSave.Visible = false;
            btnNewApprove.Visible = true;
        }
 public PersonEntity Entity(Coordinator coordinator)
 {
     PersonEntity entity = new PersonEntity();
     entity.PersonID = coordinator.CoordinatorID;
     entity.PersonType = 3;      // "Coordinator"
     entity.PersonTitle = coordinator.CoordinatorTitle;
     entity.PersonFirstName = coordinator.CoordinatorFirstName;
     entity.PersonLastName = coordinator.CoordinatorLastName;
     entity.PersonEmailPrimary = coordinator.CoordinatorEmailPrimary;
     entity.PersonEmailAlternate = coordinator.CoordinatorEmailAlternate;
     entity.PersonFax = coordinator.CoordinatorFax;
     entity.PersonPhonePrimary = coordinator.CoordinatorPhonePrimary;
     entity.PersonPhoneHome = coordinator.CoordinatorPhoneHome;
     entity.PersonPhoneMobile = coordinator.CoordinatorPhoneMobile;
     entity.PersonPhoneWork = coordinator.CoordinatorPhoneWork;
     entity.PersonPhoneEmergency = coordinator.CoordinatorPhoneEmergency;
     entity.PersonCompanyName = coordinator.CoordinatorCompanyName;
     entity.PersonPosition = coordinator.CoordinatorPosition;
     entity.PersonDescription = coordinator.CoordinatorDescription;
     entity.PersonIsActive = coordinator.CoordinatorIsActive;
     return entity;
 }
 public static DataTable UpdateCoordinator(string userRole, string userLogin, Coordinator coordinator)
 {
     IPersonData coordinatorData = new PersonData();
     coordinator.CoordinatorIsActive = false;
     DataTable tb = coordinatorData.UpdatePerson(userRole, "Coordinator", userLogin, coordinator.Entity(coordinator));
     return tb;
 }