Ejemplo n.º 1
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();
            string   vAcctNum    = objSecurity.KillChars(txtAcctNumber.Text);

            List <clsInstructor> lstInstructors = new List <clsInstructor>();

            lstInstructors = InstructorDAL.SelectDynamicInstructor("IsActive = 1", "InstructorId");
            if (lstInstructors != null)
            {
                if (lstInstructors.Count > 0)
                {
                    for (int i = 0; i < lstInstructors.Count; i++)
                    {
                        showInstructors(pnlInstructors, lstInstructors[i].Instructor_FName + " " + lstInstructors[i].Instructor_LName, lstInstructors[i].Instructor_Email, lstInstructors[i].AccreditationID.ToString(), Convert.ToDateTime(lstInstructors[i].AccreditationExpirationDate).ToShortDateString(), lstInstructors[i].InstructorId.HasValue ? lstInstructors[i].InstructorId.Value : 0);
                    }
                }
            }

            #region Instructor Info
            //string vTPID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
            //string vCategory = objcryptoJS.AES_decrypt(dropCategory.SelectedItem.Value, AppConstants.secretKey, AppConstants.initVec).ToString();
            //string vInstructorFName = objSecurity.KillChars(txtInstructorFName.Text);
            //string vInstructorLName = objSecurity.KillChars(txtInstructorLName.Text);
            //string vInsAccId = objSecurity.KillChars(txtInsAccId.Text);
            //string vInsAccExpire = objSecurity.KillChars(txtAccdExpireDate.Text);
            //string vEmail = objSecurity.KillChars(txtInstEmail.Text);
            #endregion

            // intNewTPID = Convert.ToInt32(vTPID);

            // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Instructor Added successfully!', '', 'success', 'TP_AddInstructor.aspx?desh=active');", true);
        }
        private void BindInstructor()
        {
            int instructorId = Request.QueryString["InstructorId"].ToInt();

            if (instructorId > 0)
            {
                Instructor instructorLookup = InstructorDAL.GetItem(instructorId);

                if (instructorLookup != null)
                {
                    lblInstructorId.Text = instructorLookup.InstructorId.ToString();
                    lblPersonId.Text     = instructorLookup.PersonId.ToString();
                    lblEntityTypeId.Text = instructorLookup.EntityTypeId.ToString();
                    lblHireDate.Text     = instructorLookup.HireDate.ToShortDateString();
                    lblTermDate.Text     = instructorLookup.TermDate.ToShortDateString();
                    lblCreateDate.Text   = instructorLookup.CreateDate.ToShortDateString();
                }
                else
                {
                    lblMessage.Text = "Instructor could not be found.";
                }
            }
            else
            {
                lblMessage.Text = "Invalid Id. Instructor record could not be found.";
            }
        }
Ejemplo n.º 3
0
        public static string Deficient(string cgi)
        {
            CryptoJS objcryptoJS     = new CryptoJS();
            string   strURL          = string.Empty;
            string   ContractorAppId = string.Empty;

            try
            {
                ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString();
                if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0)
                {
                    ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString();
                }

                List <clsInstructor> objSPCont = new List <clsInstructor>();
                objSPCont = InstructorDAL.SelectDynamicInstructor("InstructorId = " + ContractorAppId + "", "InstructorId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 3;
                    if (!InstructorDAL.UpdateInstructor(objSPCont[0]))
                    {
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("MDE_InstructorAppView.aspx?InstructApps=active&cgi=" + cgi + "");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Saves the Instructor object to the database
        /// </summary>
        /// <param name="instructorToSave"></param>
        /// <returns></returns>
        public static int Save(Instructor instructorToSave)
        {
            int personId = SavePerson(instructorToSave);

            instructorToSave.PersonId = personId;

            return(InstructorDAL.Save(instructorToSave));
        }
Ejemplo n.º 5
0
        private void BindInstructorList()
        {
            InstructorCollection instructorList = new InstructorCollection();

            instructorList = InstructorDAL.GetCollection();
            rptInstructorList.DataSource = instructorList;
            rptInstructorList.DataBind();
        }
Ejemplo n.º 6
0
        public static int Save(Instructor instructorToSave)
        {
            int personId = SavePerson(instructorToSave);

            instructorToSave.PersonId = personId;

            //notes: call DAL to save
            return(InstructorDAL.Save(instructorToSave));
        }
Ejemplo n.º 7
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            Instructor loggedInstructor = null;
            Student    loggedStudent    = null;
            Admin      loggedAdmin      = null;

            if (insRadBtn.Checked)
            {
                loggedInstructor = InstructorDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedInstructor == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Instructor");
                }
                else
                {
                    loggedInstructor        = InstructorDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                    MyInstructor.Instructor = loggedInstructor;
                    Instructor_Profile f = new Instructor_Profile();
                    f.Show();
                    this.Hide();
                }
            }
            else if (studRadBtn.Checked)
            {
                loggedStudent = StudentDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedStudent == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Student");
                }
                else
                {
                    MyStudent.Student = loggedStudent;
                    Student_Profile f = new Student_Profile();
                    f.Show();
                    this.Hide();
                }
            }
            else
            {
                loggedAdmin = AdminDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedAdmin == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Admin");
                }
                else
                {
                    MyAdmin.Admin = loggedAdmin;
                    AdminProfile adm = new AdminProfile();
                    adm.Show();
                    this.Hide();
                }
            }
        }
Ejemplo n.º 8
0
        public static bool Delete(int instructorId)
        {
            // Retrieve personId from so we can delete person record
            Instructor toDelete = InstructorManager.GetItem(instructorId);

            if (toDelete != null)
            {
                if (toDelete.PersonId > 0 && toDelete.InstructorId > 0)
                {
                    EmailAddressCollection emailItem = EmailAddressManager.GetCollection(instructorId);
                    if (emailItem != null)
                    {
                        //DElete Email record first

                        if (EmailAddressDAL.DeleteCollection(instructorId))
                        {
                            // delete instructor first
                            if (InstructorDAL.Delete(toDelete.InstructorId))
                            {
                                return(PersonDAL.Delete(toDelete.PersonId));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 9
0
        public static string Disapprove(string cgi)
        {
            CryptoJS objcryptoJS     = new CryptoJS();
            string   strURL          = string.Empty;
            string   ContractorAppId = string.Empty;

            try
            {
                ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString();
                if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0)
                {
                    ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString();
                }

                List <clsInstructor> objSPCont = new List <clsInstructor>();
                objSPCont = InstructorDAL.SelectDynamicInstructor("InstructorId = " + ContractorAppId + "", "InstructorId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 0;
                    if (InstructorDAL.UpdateInstructor(objSPCont[0]))
                    {
                        List <clsUserRole> lstURole = new List <clsUserRole>();
                        lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 3 and AuthorizedUserId = " + objSPCont[0].CreatedBy + "", "UserRoleId");
                        if (lstURole != null)
                        {
                            if (lstURole.Count > 0)
                            {
                                // It should get only one record per ROle.
                                if (!UserRoleDAL.DeleteUserRole(lstURole[0].UserRoleId))
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("MDE_InstructorAppView.aspx?InstructApps=active&cgi=" + cgi + "");
        }
Ejemplo n.º 10
0
        public static bool Delete(int instructorId)
        {
            Instructor toDelete = InstructorManager.GetItem(instructorId);

            if (toDelete != null)
            {
                if (toDelete.PersonId > 0 && toDelete.InstructorId > 0)
                {
                    EmailAddressCollection emailToDelete = EmailAddressManager.GetCollection(instructorId);
                    if (emailToDelete != null)
                    {
                        if (EmailAddressDAL.DeleteCollection(instructorId))
                        {
                            if (InstructorDAL.Delete(toDelete.InstructorId))
                            {
                                return(PersonDAL.Delete(toDelete.PersonId));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 11
0
        public static string Approve(string cgi)
        {
            CryptoJS objcryptoJS     = new CryptoJS();
            string   strURL          = string.Empty;
            string   ContractorAppId = string.Empty;

            try
            {
                ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString();
                if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0)
                {
                    ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString();
                }

                List <clsInstructor> objSPCont = new List <clsInstructor>();
                objSPCont = InstructorDAL.SelectDynamicInstructor("InstructorId = " + ContractorAppId + "", "InstructorId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 1;
                    if (InstructorDAL.UpdateInstructor(objSPCont[0]))
                    {
                        List <clsUserRole> lstURole = new List <clsUserRole>();
                        lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 3 and AuthorizedUserId = " + objSPCont[0].CreatedBy + "", "UserRoleId");
                        if (lstURole != null)
                        {
                            if (lstURole.Count > 0)
                            {
                                //ROLE HAS BEEN ASSIGNED. THEREFORE, DONT ADD ANOTHER ROLE.
                            }
                            else
                            {
                                clsUserRole objURole = new clsUserRole();
                                objURole.RoleId           = 3;
                                objURole.AuthorizedUserId = Convert.ToInt32(objSPCont[0].CreatedBy);
                                objURole.IsActive         = 1;
                                objURole.CreatedDate      = DateTime.Now;
                                objURole.CreatedBy        = HttpContext.Current.Session["UserAuthId"].ToString();
                                objURole.UpdatedDate      = Convert.ToDateTime("1/1/1900");
                                objURole.UpdatedBy        = "";
                                objURole.Notes            = "";
                                if (!UserRoleDAL.InsertUserRole(objURole))
                                {
                                }
                            }
                        }
                        else
                        {
                            clsUserRole objURole = new clsUserRole();
                            objURole.RoleId           = 3;
                            objURole.AuthorizedUserId = Convert.ToInt32(objSPCont[0].CreatedBy);
                            objURole.IsActive         = 1;
                            objURole.CreatedDate      = DateTime.Now;
                            objURole.CreatedBy        = HttpContext.Current.Session["UserAuthId"].ToString();
                            objURole.UpdatedDate      = Convert.ToDateTime("1/1/1900");
                            objURole.UpdatedBy        = "";
                            objURole.Notes            = "";
                            if (!UserRoleDAL.InsertUserRole(objURole))
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("MDE_InstructorAppView.aspx?InstructApps=active&cgi=" + cgi + "");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTPID = string.Empty;

                try
                {
                    strTPID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    if (GlobalMethods.ValueIsNull(strTPID).Length > 0)
                    {
                        strTPID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    }

                    clsInstructor objSPCont = new clsInstructor();
                    objSPCont = InstructorDAL.SelectInstructorById(Convert.ToInt32(strTPID));
                    if (objSPCont != null)
                    {
                        List <clsTP_Instructors> lstTPIns = new List <clsTP_Instructors>();
                        lstTPIns = TP_InstructorsDAL.SelectDynamicTP_Instructors("InstructorId = " + strTPID + " and CreatedBy = '" + HttpContext.Current.Session["UserAuthId"].ToString() + "'", "TP_InstructorsId");
                        if (lstTPIns != null)
                        {
                            if (lstTPIns.Count > 0)
                            {
                                clsTrainingProvider objIns = new clsTrainingProvider();
                                objIns = TrainingProviderDAL.SelectTrainingProviderById(lstTPIns[0].TPId);
                                if (objIns != null)
                                {
                                    lblTP.Text            = objIns.TP_Name;
                                    lblInstructorAss.Text = " associated with " + objIns.TP_Name;
                                }
                                else
                                {
                                    lblTP.Text            = "-";
                                    lblInstructorAss.Text = "-";
                                }
                            }
                            else
                            {
                                lblTP.Text            = "NO TRAINING PROVIDER";
                                lblInstructorAss.Text = " NOT ASSOCIATED WITH TRAINING PROVIDER";
                            }
                        }
                        else
                        {
                            lblTP.Text            = "NO TRAINING PROVIDER";
                            lblInstructorAss.Text = " NOT ASSOCIATED WITH TRAINING PROVIDER";
                        }

                        #region Getting Category Title
                        clsCategory objCat = new clsCategory();
                        objCat = CategoryDAL.SelectCategoryById(objSPCont.ACRDCatID);
                        if (objCat != null)
                        {
                            lblCategory.Text = objCat.CatTitle;
                        }
                        else
                        {
                            lblCategory.Text = "-";
                        }
                        #endregion

                        lblFName.Text          = objSPCont.Instructor_FName;
                        lblLName.Text          = objSPCont.Instructor_LName;
                        lblInstructorApp.Text  = objSPCont.Instructor_FName + " " + objSPCont.Instructor_LName;
                        lblTPEmail.Text        = objSPCont.Instructor_Email;
                        lblTPPhone.Text        = objSPCont.Instructor_Phone;
                        lblTPMobile.Text       = "";
                        lblInsAccId.Text       = objSPCont.AccreditationID;
                        lblAccdExpireDate.Text = Convert.ToDateTime(objSPCont.AccreditationExpirationDate).ToShortDateString();


                        if (objSPCont.IsActive == 1)
                        {
                            pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='Inst_ScheduleClass.aspx?dash=active&cgi=" + Request["cgi"] + "' class='btn btn-primary2'>Schedule A Class</a>" + GlobalMethods.ContractorAppStatus(objSPCont.IsActive.HasValue ? objSPCont.IsActive.Value : -1, "bar", "") + "</div>"));
                        }
                        else
                        {
                            pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(objSPCont.IsActive.HasValue ? objSPCont.IsActive.Value : -1, "bar", "") + "</div>"));
                        }
                    }
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Ejemplo n.º 13
0
 public static Instructor GetItem(int instructorId)
 {
     return(InstructorDAL.GetItem(instructorId));
 }
Ejemplo n.º 14
0
 public static int AddFitnessClass(int instructorId, int fitnessClassId)
 {
     return(InstructorDAL.AddFitnessClass(instructorId, fitnessClassId));
 }
Ejemplo n.º 15
0
 public static bool DeleteFitnessClass(int instructorFitnessClassId)
 {
     return(InstructorDAL.DeleteFitnessClass(instructorFitnessClassId));
 }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strRoleId = string.Empty;
                phGeneral.Visible     = true;
                phTrainee.Visible     = false;
                phInstructors.Visible = false;
                phCertAccedit.Visible = false;
                try
                {
                    strRoleId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();

                    if (GlobalMethods.ValueIsNull(strRoleId).Length > 0)
                    {
                        strRoleId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                        clsRole objRole = new clsRole();
                        objRole = RoleDAL.SelectRoleById(Convert.ToInt32(strRoleId));
                        if (objRole != null)
                        {
                            RoleText        = objRole.Notes;
                            RoleIcon        = objRole.RoleIcon;
                            RoleTitle       = objRole.RoleDispName;
                            RoleRegisterURL = GlobalMethods.ValueIsNull(objRole.RoleRegisterURL);
                        }
                    }

                    #region Now Getting Pending Applications.
                    if (strRoleId == "7") // Contractor Role
                    {
                        #region Now Getting Pending Contractor Applications.
                        List <clsSP_Contractor> lstSPContractor = new List <clsSP_Contractor>();
                        lstSPContractor = SP_ContractorDAL.SelectDynamicSP_Contractor("(CreatedBy = " + HttpContext.Current.Session["UserAuthId"].ToString() + ")", "CreatedDate DESC");
                        if (lstSPContractor != null)
                        {
                            if (lstSPContractor.Count > 0)
                            {
                                for (int i = 0; i < lstSPContractor.Count; i++)
                                {
                                    // showTable(lstSPContractor[i].SPName,lstSPContractor[i].IsActive, lstSPContractor[i].SPContractorID.ToString());
                                }
                            }
                        }
                        #endregion
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "2")// Training Provider
                    {
                        bool   IsApprTP = false;
                        string strTPId  = string.Empty;
                        #region Checking if User have any TP approved.
                        List <clsTrainingProvider> lstTP = new List <clsTrainingProvider>();
                        lstTP = TrainingProviderDAL.SelectDynamicTrainingProvider("CreatedBy = " + HttpContext.Current.Session["UserAuthId"].ToString() + " and IsActive = 1 ", "TPId");
                        if (lstTP != null)
                        {
                            if (lstTP.Count > 0)
                            {
                                IsApprTP = true;
                                strTPId  = lstTP[0].TPId.ToString();
                            }
                        }
                        #endregion

                        #region Now Getting All Training Provider Applications.
                        List <clsTrainingProvider> lstSPContractor = new List <clsTrainingProvider>();
                        lstSPContractor = TrainingProviderDAL.SelectDynamicTrainingProvider("(CreatedBy = " + HttpContext.Current.Session["UserAuthId"].ToString() + ")", "CreatedDate DESC");
                        if (lstSPContractor != null)
                        {
                            if (lstSPContractor.Count > 0)
                            {
                                for (int i = 0; i < lstSPContractor.Count; i++)
                                {
                                    //showTable(lstSPContractor[i].TP_Name, lstSPContractor[i].IsActive, lstSPContractor[i].TPId.ToString());
                                }
                            }
                        }
                        #endregion

                        strTPId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(strTPId.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                        if (IsApprTP)
                        {
                            //<a class='btn btn-primary' href='TP_AddCourses.aspx?dash=active&cgi=" + Request["cgi"] + "'  >Add Courses</a>
                            pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a class='btn btn-primary' href='Inst_ScheduleClass.aspx?dash=active&cgi=" + Request["cgi"] + "'  >Schedule Courses</a><a class='btn btn-primary' href='TP_AddLocations.aspx?dash=active'  >Add Locations</a><a class='btn btn-primary' href='TP_AddInstructor.aspx?dash=active'  >Add Instructors</a>&nbsp;<a class='btn btn-primary' href='TP_MgmtTraineeCards.aspx?dash=active&cgi=" + strTPId + "'  >Manage Trainee Cards</a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                        }
                        else
                        {
                            pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                        }
                        lblLowerTableHead.Text = "Applications";
                    }
                    else if (strRoleId == "3")// Instructor
                    {
                        phGeneral.Visible     = false;
                        phInstructors.Visible = true;
                        phTrainee.Visible     = false;
                        phCertAccedit.Visible = false;
                        string strUserEmail       = string.Empty;
                        bool   blShowCourseButton = false;
                        string UserId             = string.Empty;

                        #region Getting User Email
                        clsUser objUser = new clsUser();
                        objUser = UserDAL.SelectUserById(Convert.ToInt32(HttpContext.Current.Session["UserAuthId"].ToString()));
                        if (objUser != null)
                        {
                            strUserEmail = objUser.EmailId;
                            UserId       = objUser.AuthorisedUserId.ToString();
                        }
                        #endregion

                        #region Checking if Instructor have any assigned Courses and users that applied to the Course.
                        List <dynamic> lstCourses;
                        string         strSQLC = @"SELECT        tbl_Instructor.InstructorId, tbl_CourseSchedule.CourseId, tbl_CourseSchedule.TPLocationId, tbl_CourseSchedule.ClassTitle, tbl_CourseSchedule.StartDate, tbl_CourseSchedule.EndDate, 
                                            tbl_CourseSchedule.InstructionLanguage, tbl_CourseSchedule.CreateDate
                                            FROM            tbl_Instructor INNER JOIN
                                            tbl_CourseSchedule ON tbl_Instructor.InstructorId = tbl_CourseSchedule.InstructorId
                                            WHERE        (tbl_Instructor.Instructor_Email = @Email)";
                        var            objParC = new DynamicParameters();
                        objParC.Add("@Email", strUserEmail, DbType.String);
                        try
                        {
                            using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                            {
                                lstCourses = db.Query <dynamic>(strSQLC, objParC, commandType: CommandType.Text).ToList();
                                if (lstCourses != null)
                                {
                                    if (lstCourses.Count > 0)
                                    {
                                        blShowCourseButton = true;
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorHandler.ErrorLogging(ex, false);
                            ErrorHandler.ReadError();
                        }
                        #endregion

                        #region Now Getting All Instructor Applications.
                        List <clsInstructor> lstSPContractor = new List <clsInstructor>();
                        lstSPContractor = InstructorDAL.SelectDynamicInstructor("IsActive = 1", "CreatedDate");
                        if (lstSPContractor != null)
                        {
                            if (lstSPContractor.Count > 0)
                            {
                                for (int i = 0; i < lstSPContractor.Count; i++)
                                {
                                    showTableInst(lstSPContractor[i].Instructor_FName, lstSPContractor[i].Instructor_LName, lstSPContractor[i].Instructor_Phone, lstSPContractor[i].Instructor_Email, lstSPContractor[i].InstructorId.ToString());
                                }
                            }
                        }
                        #endregion

                        if (blShowCourseButton)
                        {//UserId
                            #region Checking if this user has been added to UserRole as Instructor
                            List <clsUserRole> lstUR = new List <clsUserRole>();
                            lstUR = UserRoleDAL.SelectDynamicUserRole("(AuthorizedUserId = " + UserId + ") and (RoleId = 3)", "UserRoleId");
                            if (lstUR != null)
                            {
                                if (lstUR.Count <= 0)
                                {
                                    // Dont have UserRole as Instructor.
                                    clsUserRole objUR = new clsUserRole();
                                    objUR.RoleId           = 3;
                                    objUR.AuthorizedUserId = Convert.ToInt32(UserId);
                                    objUR.IsActive         = 1;
                                    objUR.CreatedDate      = DateTime.Now;
                                    objUR.CreatedBy        = UserId;
                                    objUR.UpdatedDate      = Convert.ToDateTime("1/1/1900");
                                    objUR.UpdatedBy        = "";
                                    objUR.Notes            = "";
                                    if (!UserRoleDAL.InsertUserRole(objUR))
                                    {
                                    }
                                }
                            }
                            #endregion

                            pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='Inst_MgmtCourses.aspx?dash=active' class='btn btn-primary'>Manage Scores & Attendence Log</a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                        }
                        else
                        {
                            pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                        }

                        lblLowerTableHead.Text = "Applications";
                    }
                    else if (strRoleId == "1")
                    {
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "4")
                    {
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "5")
                    {   // Inspector
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "6")
                    {   // Trainee
                        phGeneral.Visible     = false;
                        phInstructors.Visible = false;
                        phCertAccedit.Visible = false;
                        phTrainee.Visible     = true;
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));

                        #region Getting all the current and future courses.
                        List <dynamic> lstCourseTotal;
                        string         strTagValue = string.Empty;

                        StringBuilder strContent = new StringBuilder("<tr>");
                        string        strSQL3    = @"SELECT DISTINCT 
                         tbl_CourseSchedule.TrainingCourseScheduleId, tbl_MDE_Courses.CourseDescription, tbl_MDE_Courses.InitialOrRenewal, tbl_TrainingProvider.TP_Name, tbl_CourseSchedule.CourseCost, 
                         tbl_MDE_Courses.InstructionLanguage, tbl_MDE_Courses.CourseDuration, tbl_MDE_Courses.PassScore, tbl_Category.ACRDCategory, tbl_TP_Location.TP_Address_Line_1, tbl_TP_Location.TP_City, tbl_TP_Location.TP_State, 
                         tbl_TP_Location.TP_ZipCode, tbl_TrainingProvider.TP_Telephone, tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, tbl_MDE_Courses.CourseId, tbl_CourseSchedule.ClassTitle, tbl_CourseSchedule.StartDate, 
                         tbl_CourseSchedule.EndDate, tbl_CourseSchedule.Notes
FROM            tbl_CourseSchedule INNER JOIN
                         tbl_TrainingProvider ON tbl_CourseSchedule.TPId = tbl_TrainingProvider.TPId INNER JOIN
                         tbl_MDE_Courses ON tbl_CourseSchedule.CourseId = tbl_MDE_Courses.CourseId INNER JOIN
                         tbl_Category ON tbl_MDE_Courses.ACRDCatID = tbl_Category.ACRDCatID INNER JOIN
                         tbl_TP_Location ON tbl_CourseSchedule.TPLocationId = tbl_TP_Location.TPLocationId INNER JOIN
                         tbl_Instructor ON tbl_CourseSchedule.InstructorId = tbl_Instructor.InstructorId";

                        try
                        {
                            var objPar3 = new DynamicParameters();
                            // objPar3.Add("@DateIn", Convert.ToDateTime(DateTime.Now).ToShortDateString(), dbType: DbType.String);

                            using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                            {
                                lstCourseTotal = db.Query <dynamic>(strSQL3, objPar3, commandType: CommandType.Text).ToList();
                                if (lstCourseTotal != null)
                                {
                                    if (lstCourseTotal.Count > 0)
                                    {
                                        for (int i = 0; i < lstCourseTotal.Count; i++)
                                        {
                                            strTagValue = GlobalMethods.ValueIsNull(lstCourseTotal[i].CourseDescription).ToString().Replace("(", "").Replace(" ", "").Replace(")", "");
                                            strContent.Append("<div class='element-item transition " + strTagValue + "' data-category='" + strTagValue + "'>");
                                            if (GlobalMethods.ValueIsNull(lstCourseTotal[i].Notes).Length > 110)
                                            {
                                                strContent.Append("<h3 class='name'>" + GlobalMethods.ValueIsNull(lstCourseTotal[i].Notes).Substring(0, 100) + "...</h3>");
                                            }
                                            else
                                            {
                                                strContent.Append("<h3 class='name'>" + GlobalMethods.ValueIsNull(lstCourseTotal[i].Notes) + "</h3>");
                                            }
                                            strContent.Append("<p class='symbol'><a href='CourseDetails.aspx?dash=active&cgi=" + objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(GlobalMethods.ValueIsNull(lstCourseTotal[i].TrainingCourseScheduleId)), AppConstants.secretKey, AppConstants.initVec).ToString() + "' title='" + GlobalMethods.ValueIsNull(lstCourseTotal[i].ClassTitle) + "'>" + GlobalMethods.ValueIsNull(lstCourseTotal[i].ClassTitle) + "</a></p>");
                                            strContent.Append("<p class='number'>" + GlobalMethods.ValueIsNull(lstCourseTotal[i].InitialOrRenewal) + "</p>");
                                            strContent.Append("<p class='weight' style='align-content:center'><a href='CourseDetails.aspx?dash=active&cgi=" + objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(GlobalMethods.ValueIsNull(lstCourseTotal[i].TrainingCourseScheduleId)), AppConstants.secretKey, AppConstants.initVec).ToString() + "' class='btn btn-xs btn-primary'>View Details</a></p>");
                                            strContent.Append("</div>");
                                        }
                                    }
                                }
                                pnlListofCourses.Controls.Add(new LiteralControl(strContent.ToString()));
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorHandler.ErrorLogging(ex, false);
                            ErrorHandler.ReadError();
                        }
                        #endregion

                        lblLowerTableHead.Text = "Applications";
                    }
                    else if (strRoleId == "8")
                    {
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "9")
                    {   //Oversight
                        lblLowerTableHead.Text = "Applications";
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a><a href='" + RoleRegisterURL + "' class='btn btn-primary' title='Apply for the " + RoleTitle + "'>Apply for the " + RoleTitle + " </a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    else if (strRoleId == "10")
                    {
                        //Certificate
                        phGeneral.Visible      = false;
                        phTrainee.Visible      = false;
                        phInstructors.Visible  = false;
                        phCertAccedit.Visible  = true;
                        lblLowerTableHead.Text = "Applications";
                        #region Now building the table with Courses Information.

                        List <dynamic> lstCourses;
                        string         strSQLC = @"SELECT        tbl_LK_Inst_CourseSchedule.Inst_CourseSchId, tbl_LK_Inst_CourseSchedule.CreatedDate, tbl_LK_Inst_CourseSchedule.ApprovedOn, tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, 
                         tbl_TrainingProvider.TP_Name, tbl_Category.CatTitle, tbl_Course_Result.ClassResultId, tbl_Course_Result.AuthorisedUserId, tbl_Course_Result.IsActive, tbl_CourseSchedule.TPId, tbl_MDE_Courses.ACRDCatID
FROM            tbl_LK_Inst_CourseSchedule INNER JOIN
                         tbl_Instructor ON tbl_LK_Inst_CourseSchedule.InstructorId = tbl_Instructor.InstructorId INNER JOIN
                         tbl_CourseSchedule ON tbl_LK_Inst_CourseSchedule.TrainingCourseScheduleId = tbl_CourseSchedule.TrainingCourseScheduleId INNER JOIN
                         tbl_Course_Result ON tbl_LK_Inst_CourseSchedule.Inst_CourseSchId = tbl_Course_Result.Inst_CourseSchId INNER JOIN
                         tbl_TrainingProvider ON tbl_CourseSchedule.TPId = tbl_TrainingProvider.TPId INNER JOIN
                         tbl_MDE_Courses ON tbl_CourseSchedule.CourseId = tbl_MDE_Courses.CourseId INNER JOIN
                         tbl_Category ON tbl_MDE_Courses.ACRDCatID = tbl_Category.ACRDCatID
WHERE        (tbl_LK_Inst_CourseSchedule.AuthorisedUserId = @AuthorisedUserId) AND (tbl_Course_Result.AuthorisedUserId = @AuthorisedUserId) AND (tbl_Course_Result.IsActive = - 1)";
                        var            objParC = new DynamicParameters();
                        objParC.Add("@AuthorisedUserId", HttpContext.Current.Session["UserAuthId"].ToString(), DbType.String);
                        try
                        {
                            using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                            {
                                lstCourses = db.Query <dynamic>(strSQLC, objParC, commandType: CommandType.Text).ToList();
                                if (lstCourses != null)
                                {
                                    if (lstCourses.Count > 0)
                                    {
                                        for (int i = 0; i < lstCourses.Count; i++)
                                        {
                                            showTableCertAccredit(GlobalMethods.ValueIsNull(lstCourses[i].CourseTitle), GlobalMethods.ValueIsNull(lstCourses[i].Instructor_FName) + " " + GlobalMethods.ValueIsNull(lstCourses[i].Instructor_LName), GlobalMethods.ValueIsNull(lstCourses[i].CatTitle), GlobalMethods.ValueIsNull(lstCourses[i].TP_Name), GlobalMethods.ValueIsNull(lstCourses[i].ClassResultId));
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorHandler.ErrorLogging(ex, false);
                            ErrorHandler.ReadError();
                        }
                        #endregion

                        //pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='#' onclick='return history.back();' class='btn btn-primary'>Back</a></div><div class='alert alert-success' style='padding:8px !important;'>&nbsp;</div></div>"));
                        pnlLogicalButtons.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a href='dashboard.aspx?Dash=active' class='btn btn-primary'>BACK</a><a href='AppContractor.aspx?Dash=active' class='btn btn-primary' title='CONTRACTOR' >CONTRACTOR</a><a href='AppInspector_RiskAssessor.aspx?Dash=active' class='btn btn-primary' title='INSPECTOR AND RISK ASSESSOR'>INSPECTOR AND RISK ASSESSOR</a><a href='AppSupervisor.aspx?Dash=active' class='btn btn-primary' title='SUPERVISOR'>SUPERVISOR</a><a href='AppTrainingCourse.aspx?Dash=active' class='btn btn-primary' title='TRAINING COURSE'>TRAINING COURSE</a><a href='AppTP.aspx?Dash=active' class='btn btn-primary' title='TRAINING PROVIDER'>TRAINING PROVIDER</a><a href='AppInstructor.aspx?Dash=active' class='btn btn-primary' title='INSTRUCTOR'>INSTRUCTOR</a></div><div class='alert' style='background-color:#354A5F;padding:8px !important;'>&nbsp;</div></div>"));
                    }
                    #endregion
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTPID        = string.Empty;
                bool   boolInstVarify = false;

                try
                {
                    strTPID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    if (GlobalMethods.ValueIsNull(strTPID).Length > 0)
                    {
                        strTPID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    }

                    #region Checking if this is AssignedToMe Action
                    bool IsAssignedToMe = false;
                    List <clsTP_Approval> lstContAppr = new List <clsTP_Approval>();
                    lstContAppr = TP_ApprovalDAL.SelectDynamicTP_Approval("TPId = " + strTPID + "", "MDETPApprId");
                    if (lstContAppr != null)
                    {
                        if (lstContAppr.Count > 0)
                        {
                            IsAssignedToMe = true;
                        }
                    }
                    #endregion

                    clsTrainingProvider objSPCont = new clsTrainingProvider();
                    objSPCont = TrainingProviderDAL.SelectTrainingProviderById(Convert.ToInt32(strTPID));
                    if (objSPCont != null)
                    {
                        #region Getting Contractor Info.
                        //clsSP_Contractor objSPC = new clsSP_Contractor();
                        //objSPC = SP_ContractorDAL.SelectSP_ContractorById(objSPCont.SPContractorID);
                        //if (objSPC != null)
                        //{
                        //    lblContractor.Text = objSPC.SPName;
                        //  //  lblCourseName.Text = "<b>" + objSPC.SPName + "</b>"; // for heading
                        //}
                        //else
                        //{
                        //    lblContractor.Text = "";
                        //   // lblCourseName.Text = "";
                        //}
                        #endregion

                        lblTPName.Text        = objSPCont.TP_Name;
                        lblContractorApp.Text = objSPCont.TP_Name;
                        //lblTPPhone.Text = objSPCont.TP_Phone;
                        //lblTPMobile.Text = objSPCont.TP_Mobile;
                        lblTPWebsite.Text = objSPCont.TP_WebSite;

                        List <clsTP_Instructors> lstTPIns = new List <clsTP_Instructors>();
                        lstTPIns = TP_InstructorsDAL.SelectDynamicTP_Instructors("TPId = " + objSPCont.TPId + "", "TP_InstructorsId");
                        if (lstTPIns != null)
                        {
                            if (lstTPIns.Count > 0)
                            {
                                clsInstructor objInstructorIs = new clsInstructor();
                                objInstructorIs = InstructorDAL.SelectInstructorById(lstTPIns[0].TP_InstructorListId);
                                if (objInstructorIs != null)
                                {
                                    //lblApprInsName.Text = objInstructorIs.Instructor_FName + " " + objInstructorIs.Instructor_LName;
                                    //lblApprInsAccNum.Text = objInstructorIs.Instructor_AcctId;
                                    //lblApprInsExpire.Text = objInstructorIs.Instructor_AcctExpire.ToShortDateString();

                                    lblInstructorName.Text = objInstructorIs.Instructor_FName + " " + objInstructorIs.Instructor_LName;
                                    lblInsAccId.Text       = objInstructorIs.NewRenewal_InspecTech_AcctNumber;
                                    lblAccdExpireDate.Text = objInstructorIs.NewRenewal_InspecTech_AcctExpiration;
                                }
                            }
                        }

                        List <clsTP_Location> lstLocation = new List <clsTP_Location>();
                        lstLocation = TP_LocationDAL.SelectDynamicTP_Location("TPId = " + objSPCont.TPId + "", "TPLocationId");
                        if (lstLocation != null)
                        {
                            if (lstLocation.Count > 0)
                            {
                                lblAddress_1.Text = lstLocation[0].TP_Address_Line_1;
                                lblAddress_2.Text = "";
                                lblCity.Text      = lstLocation[0].TP_City;
                                lblCounty.Text    = "";
                                lblState.Text     = lstLocation[0].TP_State;
                                lblZipCode.Text   = lstLocation[0].TP_ZipCode;
                                lblTPEmail.Text   = "";
                            }
                        }

                        //if(objSPCont.IsActive == 1)
                        //{
                        //    #region Approve Training Provider should Add Courses.
                        //    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2' href='TP_AddCourses.aspx?dash=active&cgi="+ objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(objSPCont.TPId.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString() + "'  >Schedule Courses</a>" + GlobalMethods.ContractorAppStatus(objSPCont.IsActive, "bar") + "</div>"));
                        //    #endregion
                        //}
                        //else
                        //{
                        pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(objSPCont.IsActive.HasValue ? objSPCont.IsActive.Value : 0, "bar", "") + "</div>"));
                        // }
                    }
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Ejemplo n.º 18
0
 public static InstructorCollection GetCollection()
 {
     return(InstructorDAL.GetCollection());
 }