Beispiel #1
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();
            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();
                //}

                #region "variables"
                string vTPId        = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vCName       = objSecurity.KillChars(txtCTitle.Text);
                string vCategory    = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropCourseCat.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vCDesc       = objSecurity.KillChars(txtCDesc.Text);
                string vCLanguage   = dropLanguage.SelectedItem.Value;
                string vDuration    = dropDuration.SelectedItem.Value;
                string vAttendence  = dropAttendanceReq.SelectedItem.Value;
                string vPassPercent = dropPassPercent.SelectedItem.Value;
                string vInitRenew   = dropInitRenew.SelectedItem.Value;
                #endregion

                #region Object for Training Provider.
                clsCourse objCourse = new clsCourse();
                objCourse.TPId                  = Convert.ToInt32(vTPId);
                objCourse.CourseTitle           = vCName;
                objCourse.Notes                 = vCDesc;
                objCourse.ACRDCatID             = Convert.ToInt32(vCategory);
                objCourse.InstructionLanguage   = vCLanguage;
                objCourse.CourseDuration        = vDuration;
                objCourse.MeasurementUnit       = "percentage";
                objCourse.InitialOrRenewal      = vInitRenew;
                objCourse.AttendanceRequirement = vAttendence;
                objCourse.PassScore             = vPassPercent;
                objCourse.CreateDate            = DateTime.Now;
                objCourse.CreatedBy             = HttpContext.Current.Session["UserAuthId"].ToString();
                objCourse.UpdatedDate           = Convert.ToDateTime("1/1/1900");
                objCourse.UpdatedBy             = "";
                objCourse.IsActive              = 1;
                if (!CourseDAL.InsertCourse(objCourse))
                {
                }
                #endregion

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Your Course has been submitted successfully!', '', 'success', 'TP_AddCourses.aspx?desh=active&cgi=" + Request["cgi"] + "');", true);
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
        }
Beispiel #2
0
        public static string Hold(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 <clsInspector_RiskAssessor> objSPCont = new List <clsInspector_RiskAssessor>();
                objSPCont = Inspector_RiskAssessorDAL.SelectDynamicInspector_RiskAssessor("InspectorRiskAssId = " + ContractorAppId + "", "InspectorRiskAssId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 2;
                    if (!Inspector_RiskAssessorDAL.UpdateInspector_RiskAssessor(objSPCont[0]))
                    {
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("MDE_TrainAppView.aspx?TrainApps=active&cgi=" + cgi + "");
        }
Beispiel #3
0
        public static string CallMgmtRole(string cgi)
        {
            CryptoJS objcryptoJS = new CryptoJS();
            string   AuthUserId  = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString();

            List <clsUserRole> lstURole = new List <clsUserRole>();

            lstURole = UserRoleDAL.SelectDynamicUserRole("UserRoleId = " + AuthUserId + "", "UserRoleId");
            if (lstURole != null)
            {
                if (lstURole.Count > 0)
                {
                    if (lstURole[0].IsActive == 0)
                    {
                        lstURole[0].IsActive = 1;
                    }
                    else
                    {
                        lstURole[0].IsActive = 0;
                    }


                    if (!UserRoleDAL.UpdateUserRole(lstURole[0]))
                    {
                    }
                }
            }

            return("MDE_AddEmp.aspx?mdeacct=active");
        }
Beispiel #4
0
        public static string AssignedToMe(string cgi)
        {
            try
            {
                CryptoJS objcryptoJS     = new CryptoJS();
                string   ContractorAppId = string.Empty;
                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();
                }

                clsTP_Approval objRiskApp = new clsTP_Approval();
                objRiskApp.TPId = Convert.ToInt32(ContractorAppId);
                objRiskApp.MDE_Owner_AuthorisedUserId = Convert.ToInt32(HttpContext.Current.Session["UserAuthId"]);
                objRiskApp.CreatedDate = DateTime.Now;
                objRiskApp.CreatedBy   = HttpContext.Current.Session["UserAuthId"].ToString();
                objRiskApp.UpdatedDate = Convert.ToDateTime("1/1/1900");
                objRiskApp.UpdatedBy   = "";
                objRiskApp.Notes       = "";
                objRiskApp.IsActive    = 1;
                if (!TP_ApprovalDAL.InsertTP_Approval(objRiskApp))
                {
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }

            return("MDE_TPApps.aspx?tpapps=active");
        }
Beispiel #5
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 <clsTrainingProvider> objSPCont = new List <clsTrainingProvider>();
                objSPCont = TrainingProviderDAL.SelectDynamicTrainingProvider("TPId = " + ContractorAppId + "", "TPId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 3;
                    if (!TrainingProviderDAL.UpdateTrainingProvider(objSPCont[0]))
                    {
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("MDE_TPAppView.aspx?tpapps=active&cgi=" + cgi + "");
        }
Beispiel #6
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();

            #region Address 1
            string vTPID      = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
            string vAddress_1 = objSecurity.KillChars(txtAddress_1.Text);
            // string vAddress_2 = objSecurity.KillChars(txtAddress_2.Text);
            string vCity = objSecurity.KillChars(txtCity.Text);
            // string vCounty = objSecurity.KillChars(txtCounty.Text);
            string vState   = objSecurity.KillChars(txtState.Text);
            string vZipCode = objSecurity.KillChars(txtZipCode.Text);
            #endregion

            #region Now saving Location
            clsTP_Location objTPLoc = new clsTP_Location();
            objTPLoc.TPId = Convert.ToInt32(vTPID);
            objTPLoc.TP_Address_Line_1 = vAddress_1;
            //objTPLoc.TP_Address_Line_2 = vAddress_2;
            objTPLoc.TP_City  = vCity;
            objTPLoc.TP_State = vState;
            //objTPLoc.TP_County = vCounty;
            objTPLoc.TP_ZipCode = vZipCode;
            //objTPLoc.Location_Email = "";
            if (!TP_LocationDAL.InsertTP_Location(objTPLoc))
            {
            }
            #endregion

            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Location Added successfully!', '', 'success', 'TP_AddLocations.aspx?desh=active');", true);
        }
Beispiel #7
0
    public string CheckRequest(string strRequest, string DoWhat)
    {
        string   strValue     = "";
        string   strRequestIn = "";
        CryptoJS objcryptoJS  = new CryptoJS();

        strRequestIn = strRequestIn + strRequest;

        if (strRequestIn.Length > 0)
        {
            if (DoWhat == "Encrypt")
            {
                strValue = objcryptoJS.AES_encrypt(strRequestIn.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString();
            }
            else if (DoWhat == "Decrypt")
            {
                strValue = objcryptoJS.AES_decrypt(strRequestIn.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString();
            }
        }
        else
        {
            strValue = "0";
        }
        return(strValue);
    }
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();
            string   strTPID     = string.Empty;
            string   strInstID   = string.Empty;

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

                #region Getting TPId using the InstructorId
                List <clsTP_Instructors> lstTPInst = new List <clsTP_Instructors>();
                lstTPInst = TP_InstructorsDAL.SelectDynamicTP_Instructors("InstructorId = " + strInstID + "", "TPId");
                if (lstTPInst != null)
                {
                    if (lstTPInst.Count > 0)
                    {
                        strTPID = lstTPInst[0].TPId.ToString();
                    }
                }
                #endregion

                #region "variables"
                string vTrainingCourseId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropCourses.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vTPId             = strTPID;
                string vInstID           = strInstID;
                string vCName            = objSecurity.KillChars(txtCTitle.Text);
                //string vCDesc = objSecurity.KillChars(txtCDesc.Text);
                //string vStartDate = objSecurity.KillChars(txtStartDate.Text.ToString());
                //string vEndDate = objSecurity.KillChars(txtEndDate.Text.ToString());
                //string vRegistrationLimit = objSecurity.KillChars(txtRegisterLimit.Text);
                //string vExpectedEnrollment = objSecurity.KillChars(txtMinEnroll.Text);
                //string vCLanguage = dropLanguage.SelectedItem.Value;
                //string vDesc = objSecurity.KillChars(txtCDesc.Text.ToString());
                #endregion

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('You have successfully schedule a class!', '', 'success', 'Inst_ScheduleClass.aspx?desh=active&cgi=" + Request["cgi"] + "');", true);
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strCourseId = string.Empty;
                try
                {
                    strCourseId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    strCourseId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(strCourseId.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    List <dynamic> lstValues;
                    string         strSQL = @"SELECT DISTINCT 
                         tbl_Course.CourseTitle, tbl_Course.ACRDCatID, tbl_Course.TrainingCourseId, tbl_CourseSchedule.InstructorId, tbl_CourseSchedule.TPLocationId, tbl_CourseSchedule.ClassTitle, tbl_CourseSchedule.StartDate, 
                         tbl_CourseSchedule.EndDate, tbl_CourseSchedule.InstructionLanguage, tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, tbl_TrainingProvider.TP_Name, tbl_Course.IsActive, 
                         tbl_CourseSchedule.TrainingCourseScheduleId, tbl_Category.CatTitle, tbl_Course.Notes
FROM            tbl_Course INNER JOIN
                         tbl_TrainingProvider ON tbl_Course.TPId = tbl_TrainingProvider.TPId INNER JOIN
                         tbl_CourseSchedule ON tbl_Course.TrainingCourseId = tbl_CourseSchedule.TrainingCourseId INNER JOIN
                         tbl_Instructor ON tbl_CourseSchedule.InstructorId = tbl_Instructor.InstructorId INNER JOIN
                         tbl_TP_Location ON tbl_CourseSchedule.TPLocationId = tbl_TP_Location.TPLocationId INNER JOIN
                         tbl_Category ON tbl_Course.ACRDCatID = tbl_Category.ACRDCatID
                        WHERE (tbl_CourseSchedule.TrainingCourseScheduleId = @CurrID)";
                    var            objPar = new DynamicParameters();
                    objPar.Add("@CurrID", strCourseId, DbType.Int32);

                    try
                    {
                        using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                        {
                            lstValues = db.Query <dynamic>(strSQL, objPar, commandType: CommandType.Text).ToList();
                            if (lstValues != null)
                            {
                                if (lstValues.Count > 0)
                                {
                                    lblTitle.Text     = GlobalMethods.ValueIsNull(lstValues[0].CourseTitle);
                                    lblDesc.Text      = GlobalMethods.ValueIsNull(lstValues[0].Notes);
                                    lblTP.Text        = GlobalMethods.ValueIsNull(lstValues[0].TP_Name);
                                    lblLanguage.Text  = GlobalMethods.ValueIsNull(lstValues[0].InstructionLanguage);
                                    lblLocation.Text  = "";
                                    lblStartDate.Text = Convert.ToDateTime(GlobalMethods.ValueIsNull(lstValues[0].StartDate)).ToShortDateString();
                                    lblEndDate.Text   = Convert.ToDateTime(GlobalMethods.ValueIsNull(lstValues[0].EndDate)).ToShortDateString();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.ErrorLogging(ex, false);
                        ErrorHandler.ReadError();
                    }
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Beispiel #10
0
        public static string Enroll(string cgi)
        {
            CryptoJS objcryptoJS  = new CryptoJS();
            string   strURL       = string.Empty;
            string   CourseSchdId = string.Empty;
            string   CourseId     = string.Empty;

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

                #region Getting Instructor Id.
                clsCourseSchedule objCourseSch = new clsCourseSchedule();
                objCourseSch = CourseScheduleDAL.SelectCourseScheduleById(Convert.ToInt32(CourseSchdId));
                if (objCourseSch != null)
                {
                    intInstId = objCourseSch.InstructorId.HasValue ? objCourseSch.InstructorId.Value : 0;
                    CourseId  = objCourseSch.TrainingCourseScheduleId.ToString();
                }
                #endregion

                CourseId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(CourseId), AppConstants.secretKey, AppConstants.initVec).ToString();

                #region Adding to LK_Inst_CourseSchedule
                clsLK_Inst_CourseSchedule objInstCS = new clsLK_Inst_CourseSchedule();
                objInstCS.AuthorisedUserId         = Convert.ToInt32(HttpContext.Current.Session["UserAuthId"]);
                objInstCS.TrainingCourseScheduleId = Convert.ToInt32(CourseSchdId);
                objInstCS.InstructorId             = intInstId;
                objInstCS.TP_AuthorisedUserId      = 0;
                objInstCS.IsApproved  = 0;
                objInstCS.CreatedDate = DateTime.Now;
                objInstCS.ApprovedOn  = Convert.ToDateTime("1/1/1900");
                if (!LK_Inst_CourseScheduleDAL.InsertLK_Inst_CourseSchedule(objInstCS))
                {
                }
                #endregion
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            return("CourseDetails.aspx?dash=active&cgi=" + CourseId + "");
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string ClassResultId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    if (GlobalMethods.ValueIsNull(ClassResultId).Length > 0)
                    {
                        ClassResultId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"]), AppConstants.secretKey, AppConstants.initVec).ToString();
                    }

                    #region Getting all the Contractors list
                    List <clsSP_Contractor> lstSPCont = new List <clsSP_Contractor>();
                    lstSPCont = SP_ContractorDAL.SelectDynamicSP_Contractor("IsActive = 1 and ACRDCatID = 13", "SPContractorID");
                    if (lstSPCont != null)
                    {
                        if (lstSPCont.Count > 0)
                        {
                            dropContractors.Items.Add(new ListItem(
                                                          String.Format("{0}", "Select Contractor"), String.Format("{0}", "0")));
                            for (int i = 0; i < lstSPCont.Count; i++)
                            {
                                dropContractors.Items.Add(new ListItem(
                                                              String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstSPCont[i].SPName.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstSPCont[i].SPContractorID.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                            }
                        }
                    }
                    #endregion

                    clsCourse_Result objCR = new clsCourse_Result();
                    objCR = Course_ResultDAL.SelectCourse_ResultById(Convert.ToInt32(ClassResultId));
                    if (objCR != null)
                    {
                        if ((objCR.Acct_Term > 0))
                        {
                            btnAddCourse.Enabled = false;
                            btnAddCourse.Text    = "Applied for C&A Certification";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #12
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 <clsTrainingProvider> objSPCont = new List <clsTrainingProvider>();
                objSPCont = TrainingProviderDAL.SelectDynamicTrainingProvider("TPId = " + ContractorAppId + "", "TPId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 0;
                    if (TrainingProviderDAL.UpdateTrainingProvider(objSPCont[0]))
                    {
                        List <clsUserRole> lstURole = new List <clsUserRole>();
                        lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 2 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_TPAppView.aspx?tpapps=active&cgi=" + cgi + "");
        }
Beispiel #13
0
        public static string Enroll(string cgi)
        {
            CryptoJS objcryptoJS  = new CryptoJS();
            string   strURL       = string.Empty;
            string   CourseSchdId = string.Empty;
            string   CourseId     = string.Empty;

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

                #region Getting the return TrainingCourseId

                #endregion

                clsLK_Inst_CourseSchedule objISC = new clsLK_Inst_CourseSchedule();
                objISC = LK_Inst_CourseScheduleDAL.SelectLK_Inst_CourseScheduleById(Convert.ToInt32(CourseSchdId));
                if (objISC != null)
                {
                    objISC.TP_AuthorisedUserId = Convert.ToInt32(HttpContext.Current.Session["UserAuthId"].ToString());
                    objISC.IsApproved          = 1;
                    CourseId = objISC.TrainingCourseScheduleId.ToString();
                    if (!LK_Inst_CourseScheduleDAL.UpdateLK_Inst_CourseSchedule(objISC))
                    {
                    }
                }
                CourseId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(CourseId), AppConstants.secretKey, AppConstants.initVec).ToString();
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }


            return("Inst_Candidate.aspx?dash=active&cgi=" + CourseId + "");
        }
Beispiel #14
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 <clsTrainingProvider> objSPCont = new List <clsTrainingProvider>();
                objSPCont = TrainingProviderDAL.SelectDynamicTrainingProvider("TPId = " + ContractorAppId + "", "TPId");
                if (objSPCont != null)
                {
                    objSPCont[0].IsActive = 1;
                    if (TrainingProviderDAL.UpdateTrainingProvider(objSPCont[0]))
                    {
                        List <clsUserRole> lstURole = new List <clsUserRole>();
                        lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 2 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           = 2;
                                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           = 2;
                            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_TPAppView.aspx?tpapps=active&cgi=" + cgi + "");
        }
Beispiel #15
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();
                }
            }
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strtpId = string.Empty;
                phWriteComment.Visible = false;

                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 Getting all the Comments by Application Id.
                StringBuilder        strMessenger = new StringBuilder("");
                List <clsTP_Comment> lstComments  = new List <clsTP_Comment>();
                lstComments = TP_CommentDAL.SelectDynamicTP_Comment("TPId = " + strtpId + "", "TPCommentId");
                if (lstComments != null)
                {
                    if (lstComments.Count > 0)
                    {
                        for (int i = 0; i < lstComments.Count; i++)
                        {
                            strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString());
                        }
                    }
                }
                pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString()));
                #endregion

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _tpRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strtpId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _tpRepository.Get(int.Parse(strtpId));
                if (obj != null)
                {
                    txtName.Text         = obj.TP_Name;
                    txtSDATNum.Text      = obj.TP_SDAT;
                    txtAddress_1.Text    = obj.TP_Address_Line_1;
                    txtCity_1.Text       = obj.TP_City;
                    txtState_1.Text      = obj.TP_State;
                    txtZipCode_1.Text    = obj.TP_ZipCode;
                    txtAddress_2.Text    = obj.TP_Address_Line_2;
                    txtCity_2.Text       = obj.TP_City_2;
                    txtState_2.Text      = obj.TP_State_2;
                    txtZipcode_2.Text    = obj.TP_Zipcode_2;
                    txtPhone.Text        = obj.TP_Telephone;
                    txtFax.Text          = obj.TP_Fax;
                    txtEmailAddress.Text = obj.TP_Email;
                    txtEIN.Text          = obj.TP_TaxID.FromByteArray();
                    txtACCID.Text        = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    chkChargeFee.Checked = obj.TP_Fee == 1;
                    if (!string.IsNullOrWhiteSpace(obj.TP_TaxExempt))
                    {
                        chkTaxExempt.Checked = true;
                    }
                    else
                    {
                        chkTaxExempt.Checked = false;
                    }

                    txtTaxExempt.Text = obj.TP_TaxExempt;
                    if (obj.TPWebsiteURL.Length > 0)
                    {
                        chkTPwebsiteYES.Checked = true;
                        chkTPwebsiteNO.Checked  = false;
                    }
                    else
                    {
                        chkTPwebsiteYES.Checked = false;
                        chkTPwebsiteNO.Checked  = true;
                    }

                    txtTPwebsiteURL.Text         = obj.TPWebsiteURL;
                    chkCORiskAssessor.Checked    = obj.RiskAssessor == 1;
                    chkCOProjectDesigner.Checked = obj.ProjectDesign == 1;
                    chkCOInspectorTech.Checked   = obj.InspectorTech == 1;
                    chkCOAbatWorkEnglish.Checked = obj.AbatWorkerEnglish == 1;
                    chkCOVisualInspector.Checked = obj.VisualInspector == 1;
                    chkCOAbatWorkSpanish.Checked = obj.AbatWorkerSpanish == 1;
                    chkCOMainRepaintSup.Checked  = obj.MainRepaint == 1;
                    chkCOStructSteelSup.Checked  = obj.StructSteelSupervisor == 1;
                    chkCORemovalSup.Checked      = obj.RemovalDemo == 1;
                    chkStructSteelWork.Checked   = obj.StructSteelWorker == 1;
                    txtAuthRepContFName.Text     = obj.TPContactFirstName;
                    txtAuthRepContLName.Text     = obj.TPContactLastName;
                    txtAuthRepContTitle.Text     = obj.TPContactTitle;
                    lblContractorApp.Text        = obj.TP_Name;
                    lblSignedBy.Text             = obj.TPContactFirstName + " " + obj.TPContactLastName;
                    chkIAgree.Checked            = obj.Agreed == 1;
                    dropIsRenewal.SelectedValue  = obj.IsRenewal.HasValue ? obj.IsRenewal.Value.ToString() : "-1";

                    if ((dropIsRenewal.SelectedValue == "0") || (dropIsRenewal.SelectedValue == "-1"))
                    {
                        divIsRenewal.Visible = false;
                    }
                    // dropPublicList.Text = obj;
                    lblDateSigned.Text = obj.CreatedDate.ToLongDateString();
                    for (int i = 0; i < obj.Locations.Count; i++)
                    {
                        var element = obj.Locations.ElementAt(i);
                        if (element != null)
                        {
                            var cIndex   = i + 1;
                            var address1 = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_Address_" + cIndex);
                            var city     = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_City_" + cIndex);
                            var state    = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_State_" + cIndex);
                            var zipcode  = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_ZipCode_" + cIndex);
                            if (address1 != null)
                            {
                                address1.Text = element.TP_Address_Line_1;
                                city.Text     = element.TP_City;
                                state.Text    = element.TP_State;
                                zipcode.Text  = element.TP_ZipCode;
                            }
                        }
                    }
                    for (int i = 0; i < obj.Instructors.Count; i++)
                    {
                        var element = obj.Instructors.ElementAt(i);
                        if (element != null)
                        {
                            var cIndex = i + 1;
                            var fn     = (TextBox)Page.FindControl("ctl00$CPMain$txtInstructorFN_" + cIndex);
                            var ln     = (TextBox)Page.FindControl("ctl00$CPMain$txtInstructorLN_" + cIndex);

                            if (fn != null)
                            {
                                fn.Text = element.TP_InstructorFN;
                                ln.Text = element.TP_InstructorLN;
                            }
                        }
                    }

                    #region Getting all the Case files.
                    StringBuilder strMessengerUpload = new StringBuilder("");

                    foreach (var each in obj.Files.OrderByDescending(x => x.Id))
                    {
                        strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString()));
                    #endregion
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    GlobalMethods.DisableControls(this.Page);
                    btnAddCourse.Visible = false;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    phWriteComment.Visible = true;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }

                #region Making all the fields disabled.
                GlobalMethods.DisableControl_CheckBoxByID(chkIAgree);
                GlobalMethods.DisableControl_DropDownByID(dropPublicList);
                GlobalMethods.DisableControl_DropDownByID(dropIsRenewal);
                #endregion
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strSPContractorID = string.Empty;
                try
                {
                    #region Dropdown Categories
                    List <clsCategory> lstCategory = new List <clsCategory>();
                    lstCategory = CategoryDAL.SelectDynamicCategory("(ACRDCategory = 'Contractor Accreditations') AND (IsActive = 1)", "ACRDCatID");
                    if (lstCategory != null)
                    {
                        if (lstCategory.Count > 0)
                        {
                            dropCategory.Items.Clear();
                            for (int i = 0; i < lstCategory.Count; i++)
                            {
                                dropCategory.Items.Add(new ListItem(
                                                           String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].ACRDCatID.ToString()))));
                            }
                        }
                    }
                    #endregion

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

                    clsSP_Contractor objSPCont = new clsSP_Contractor();
                    objSPCont = SP_ContractorDAL.SelectSP_ContractorById(Convert.ToInt32(strSPContractorID));
                    if (objSPCont != null)
                    {
                        lblContractorApp.Text               = objSPCont.SPName;
                        lblName.Text                        = objSPCont.SPName;
                        lblSDATNum.Text                     = objSPCont.SDATDepartmentId;
                        lblEIN.Text                         = objSPCont.SPTaxId;
                        lblMHICNumber.Text                  = objSPCont.SPMHICNumber;
                        dropCategory.SelectedValue          = objSPCont.ACRDCatID.ToString();
                        lblCourseName.Text                  = "<b>" + dropCategory.SelectedItem.Text + "</b>"; // for heading
                        lblACCID.Text                       = objSPCont.AccreditationID;
                        lblAccreditationExpirationDate.Text = objSPCont.AccreditationExpirationDate.HasValue ? objSPCont.AccreditationExpirationDate.Value.ToShortDateString() : "";
                        //lblAddress_1.Text = objSPCont.SPAddress_Line_1;
                        //lblAddress_2.Text = objSPCont.SPAddress_Line_2;
                        //lblCity.Text = objSPCont.SPCity;
                        //lblCounty.Text = objSPCont.SPCounty;
                        //lblState.Text = objSPCont.SPState;
                        //lblZipCode.Text = objSPCont.SPZipCode;
                        lblPhone.Text        = objSPCont.SPPhone;
                        lblMobile.Text       = objSPCont.SPMobile;
                        lblWebSite.Text      = objSPCont.SPWebSite;
                        lblEmailAddress.Text = objSPCont.SPEmail;
                        if (objSPCont.SPFeeStatus == "1")
                        {
                            chkFeeStatus.Checked = true;
                        }

                        if (objSPCont.PublishOnMDEWebsite == 1)
                        {
                            chkPublishOnMDEWebsite.Checked = true;
                        }

                        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 ex)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTrainingCourseAppId = string.Empty;
                phWriteComment.Visible = false;

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

                #region Getting all the Comments by Application Id.
                StringBuilder strMessenger = new StringBuilder("");
                List <clsTrainingCourse_Comment> lstComments = new List <clsTrainingCourse_Comment>();
                lstComments = TrainingCourse_CommentDAL.SelectDynamicTrainingCourse_Comment("TrainingCourseAppId = " + strTrainingCourseAppId + "", "TrainingCourseCommentId");
                if (lstComments != null)
                {
                    if (lstComments.Count > 0)
                    {
                        for (int i = 0; i < lstComments.Count; i++)
                        {
                            strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString());
                        }
                    }
                }
                pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString()));
                #endregion

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _tcRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strTrainingCourseAppId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _tcRepository.Get(int.Parse(strTrainingCourseAppId));
                if (obj != null)
                {
                    txtTPName.Text       = obj.TrainingProviderName;
                    txtAddress_1.Text    = obj.TP_Address_Line_1;
                    txtCity_1.Text       = obj.TP_City;
                    txtState_1.Text      = obj.TP_State;
                    txtZipCode_1.Text    = obj.TP_ZipCode;
                    txtAddress_2.Text    = obj.TP_Address_Line_2;
                    txtCity_2.Text       = obj.TP_City_2;
                    txtState_2.Text      = obj.TP_State_2;
                    txtZipcode_2.Text    = obj.TP_Zipcode_2;
                    txtPhone.Text        = obj.TP_Telephone;
                    txtFax.Text          = obj.TP_Fax;
                    txtEmailAddress.Text = obj.TP_Email;
                    txtSSN.Text          = obj.TP_TaxID.FromByteArray();
                    chkIAgree.Checked    = obj.Agreed == 1;
                    //dropIsRenewal.SelectedValue = obj.IsRenewal.HasValue ? obj.IsRenewal.Value.ToString() : "-1";

                    if ((dropIsRenewal.SelectedValue == "0") || (dropIsRenewal.SelectedValue == "-1"))
                    {
                        divIsRenewal.Visible = false;
                    }
                    txtACCID.Text = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    chkRiskAssessor.Checked             = obj.TC_RiskAssessor == 1;
                    chkInspectorTech.Checked            = obj.TC_InspectorTech == 1;
                    chkVisualInspector.Checked          = obj.TC_VisualInspector == 1;
                    chkMainRepaint.Checked       = obj.TC_Main_Repair == 1;
                    chkRemoval.Checked           = obj.TC_Removal == 1;
                    chkProjectDesign.Checked     = obj.TC_ProjectDesign == 1;
                    chkAbatmentEnglish.Checked   = obj.TC_AbatementWorkerEnglish == 1;
                    chkAbatmentSpanish.Checked   = obj.TC_AbatementWorkerSpanish == 1;
                    chkStructSteelSuper.Checked  = obj.TC_StructSteelSuper == 1;
                    chkStructSteelWorker.Checked = obj.TC_StructSteelWorker == 1;
                    hlnkUpload_1.NavigateUrl     = obj.DocURL_1;
                    hlnkUpload_2.NavigateUrl     = obj.DocURL_2;
                    hlnkUpload_3.NavigateUrl     = obj.DocURL_3;
                    hlnkUpload_4.NavigateUrl     = obj.DocURL_4;
                    hlnkUpload_5.NavigateUrl     = obj.DocURL_5;
                    txtAuthRepContFName.Text     = obj.TPContactFirstName;
                    txtAuthRepContLName.Text     = obj.TPContactLastName;
                    txtAuthRepContTitle.Text     = obj.TPContactTitle;
                    chkIAgree.Checked            = obj.Agreed == 1;
                    lblDateSigned.Text           = obj.CreatedDate.ToShortDateString();
                    lblSignedBy.Text             = obj.TPContactFirstName + " " + obj.TPContactLastName;

                    #region Getting all the Case files.
                    StringBuilder strMessengerUpload = new StringBuilder("");

                    foreach (var each in obj.Files.OrderByDescending(x => x.Id))
                    {
                        strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString()));
                    #endregion
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    GlobalMethods.DisableControls(this.Page);
                    btnAddCourse.Visible = false;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    phWriteComment.Visible = true;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }

                #region Making all the fields disabled.
                GlobalMethods.DisableControl_CheckBoxByID(chkIAgree);
                GlobalMethods.DisableControl_DropDownByID(dropIsRenewal);
                #endregion
            }
        }
Beispiel #19
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity   = new Security();
            CryptoJS objcryptoJS   = new CryptoJS();
            string   ClassResultId = string.Empty;

            #region "variables"
            //// string vSPName = objSecurity.KillChars(txtTPName.Text);
            // string vContractor = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropContractors.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
            // //string vTPPhone = objSecurity.KillChars(txtTPPhone.Text);
            // //string vTPMobile = objSecurity.KillChars(txtTPMobile.Text);
            // //string vTPWebsite = objSecurity.KillChars(txtTPWebsite.Text);
            // //string vTPEmail = objSecurity.KillChars(txtTPEmail.Text);
            // int intNewTPID = 0;
            // int intNewInstructorId = 0;
            #endregion

            #region Instructor Info
            //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 vInstEmail = objSecurity.KillChars(txtInstEmail.Text);
            #endregion

            #region Address 1
            //string vAddress_1 = objSecurity.KillChars(txtAddress_1.Text);
            //string vAddress_2 = objSecurity.KillChars(txtAddress_2.Text);
            //string vCity = objSecurity.KillChars(txtCity.Text);
            //string vCounty = objSecurity.KillChars(txtCounty.Text);
            //string vState = objSecurity.KillChars(txtState.Text);
            //string vZipCode = objSecurity.KillChars(txtZipCode.Text);
            //string vEmail = objSecurity.KillChars(txtTPEmail.Text);
            //string vLocationTitle = objSecurity.KillChars(txtLocTitle.Text);
            #endregion

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

                clsCourse_Result objCR = new clsCourse_Result();
                objCR = Course_ResultDAL.SelectCourse_ResultById(Convert.ToInt32(ClassResultId));
                if (objCR != null)
                {
                    objCR.PaymentAmount = "120.00";
                    objCR.Acct_Term     = Convert.ToInt32(dropYears.SelectedItem.Value);
                    objCR.Notes         = "User Entered Contractor Id: " + dropContractors.SelectedItem.Value;
                    if (!Course_ResultDAL.UpdateCourse_Result(objCR))
                    {
                    }
                }
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
            string strResultId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode("10"), AppConstants.secretKey, AppConstants.initVec).ToString();
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Your Application has been submitted successfully!', '', 'success', 'RoleDesc.aspx?Dash=active&cgi=" + strResultId + "');", true);
        }
        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();
                }
            }
        }
Beispiel #21
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();
                }
            }
        }
Beispiel #22
0
        public static string Login(string strEmail, string strPass)
        {
            CryptoJS objcryptoJS = new CryptoJS();
            bool     PassCheck   = false;
            string   _Error      = string.Empty;

            clsUser objEmp = new clsUser();

            strEmail = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(strEmail), AppConstants.secretKey, AppConstants.initVec).ToString();
            strPass  = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(strPass), AppConstants.secretKey, AppConstants.initVec).ToString();

            if (GlobalMethods.IsEmail(strEmail))
            {
                List <clsUser> lstUser = new List <clsUser>();
                lstUser = UserDAL.SelectDynamicUser("EmailId like '" + strEmail + "'", "AuthorisedUserId");
                if (lstUser != null)
                {
                    if (lstUser.Count > 0)
                    {
                        PassCheck = SecurityObj.SecurityObj.VerifyHash(strPass, "SHA1", lstUser[0].Password, lstUser[0].salt);
                        if (!PassCheck)
                        {
                            #region The Username or Password is bad!
                            _Error = "Username or Password is not valid!";
                            #endregion
                        }
                        else
                        {
                            #region Creating all the User related sessions.
                            HttpContext.Current.Session["UserAuthId"] = lstUser[0].AuthorisedUserId;
                            if (GlobalMethods.ValueIsNull(lstUser[0].IsAdmin) != null)
                            {
                                if (lstUser[0].IsAdmin == 1)
                                {
                                    HttpContext.Current.Session["IsAdmin"] = "1";
                                }
                            }
                            #endregion


                            #region This is a valid account now transfer to a valid location.
                            if (lstUser[0].IsActive == 1)
                            {
                                if (lstUser[0].EmailId == "*****@*****.**")
                                {
                                    #region This is when AdminAdmin account is accessed for the first time.
                                    //  HttpContext.Current.Response.Redirect(AppConstants.ConstAppURL + "AdminReset.aspx");
                                    #endregion
                                }
                                else
                                {
                                    clsSignOnLog objSOL = new clsSignOnLog();
                                    objSOL.AuthorisedUserId = lstUser[0].AuthorisedUserId;
                                    objSOL.SignedOn         = DateTime.Now;
                                    if (!SignOnLogDAL.InsertSignOnLog(objSOL))
                                    {
                                    }

                                    #region This is when everything works as normal. Let the user log's in to the System.
                                    //HttpContext.Current.Response.Redirect(AppConstants.ConstAppURL + "dashboard.aspx?Dash=active");
                                    _Error = AppConstants.ConstAppURL + "dashboard.aspx?Dash=active";
                                    #endregion
                                }
                            }
                            else if (lstUser[0].IsActive == -1)
                            {
                                #region This is when the account is disabled.
                                _Error = "Currently, your account has been disabled. Please, email " + AppConstants.ConstHelpEmail + " or call " + AppConstants.ConstHelpPhone + ".";
                                #endregion
                            }
                            else if (lstUser[0].IsActive == -2)
                            {
                                #region This is where we let the new user create a new password for a first time user.
                                // HttpContext.Current.Response.Redirect(AppConstants.ConstAppURL + "ResetPassword.aspx");
                                _Error = AppConstants.ConstAppURL + "ResetPassword.aspx#login";
                                #endregion
                            }
                            else if (lstUser[0].IsActive == 0)
                            {
                                #region This is when the account is reset if the forgot password.
                                //HttpContext.Current.Response.Redirect(AppConstants.ConstAppURL + "ResetPassword.aspx");
                                _Error = AppConstants.ConstAppURL + "ResetPassword.aspx#login";
                                #endregion
                            }
                            #endregion
                        }
                    }
                    else
                    {
                        #region  The Username or Password is bad!
                        _Error = "Username or Password is not valid!";
                        #endregion
                    }
                }
                else
                {
                    #region  The Username or Password is bad!
                    _Error = "Username or Password is not valid!";
                    #endregion
                }
            }
            else
            {
                #region  The Username or Password is bad!
                _Error = "Username or Password is not valid!";
                #endregion
            }

            return(_Error);
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTCSID = string.Empty;
                string strTCid  = string.Empty;
                try
                {
                    strTCSID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    if (GlobalMethods.ValueIsNull(strTCSID).Length > 0)
                    {
                        strTCSID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    }

                    #region Getting Class Details
                    clsLK_Inst_CourseSchedule objCS = new clsLK_Inst_CourseSchedule();
                    objCS = LK_Inst_CourseScheduleDAL.SelectLK_Inst_CourseScheduleById(Convert.ToInt32(strTCSID));
                    if (objCS != null)
                    {
                        clsUser objUser = new clsUser();
                        objUser = UserDAL.SelectUserById(objCS.AuthorisedUserId);
                        if (objUser != null)
                        {
                            lblCrouseName.Text = objUser.FName + " " + objUser.LName;
                        }
                    }
                    #endregion

                    #region Checking if this records is already saved.
                    List <clsCourse_Result> objCRsave = new List <clsCourse_Result>();
                    objCRsave = Course_ResultDAL.SelectDynamicCourse_Result("Inst_CourseSchId = " + strTCSID + "", "ClassResultId");
                    if (objCRsave != null)
                    {
                        if (objCRsave.Count > 0)
                        {
                            // this records already exsistes
                            btnAddTManual.Enabled  = false;
                            dropAttendence.Enabled = false;
                            dropPassFail.Enabled   = false;
                            dropScore.Enabled      = false;
                        }
                        else
                        {
                            btnAddTManual.Enabled  = true;
                            dropAttendence.Enabled = true;
                            dropPassFail.Enabled   = true;
                            dropScore.Enabled      = true;
                        }
                    }

                    #endregion

                    //strTCid = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(strTCid.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(9, "bar", "Inst_MgmtCourses.aspx?dash=active") + "</div>"));
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Beispiel #24
0
        protected void Populate_Instructors(object sender, EventArgs e)
        {
            string vTP = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();

            #region Getting All the locations from this Training Provider.
            //dropLocation
            List <dynamic> lstLocations;
            string         strSQLL = @"SELECT DISTINCT tbl_TP_Location.TP_Address_Line_1, tbl_TP_Location.TPLocationId
                               FROM            tbl_TrainingProvider INNER JOIN
                               tbl_TP_Location ON tbl_TrainingProvider.TPId = tbl_TP_Location.TPId
                              WHERE        (tbl_TP_Location.TPId = " + vTP + ")";
            var            objParL = new DynamicParameters();

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    lstLocations = db.Query <dynamic>(strSQLL, objParL, commandType: CommandType.Text).ToList();
                    if (lstLocations != null)
                    {
                        if (lstLocations.Count > 0)
                        {
                            for (int i = 0; i < lstLocations.Count; i++)
                            {
                                dropLocation.Items.Add(new ListItem(
                                                           String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstLocations[i].TP_Address_Line_1.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstLocations[i].TPLocationId.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            #endregion

            #region Getting TPId using the InstructorId
            List <dynamic> lstTPInst;
            string         strSQLTP = @"SELECT        tbl_LK_TP_Instructor.TP_InstructorsId, tbl_LK_TP_Instructor.IsActive, tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, tbl_Instructor.InstructorId
FROM            tbl_LK_TP_Instructor INNER JOIN
                         tbl_Instructor ON tbl_LK_TP_Instructor.InstructorId = tbl_Instructor.InstructorId
WHERE        (tbl_LK_TP_Instructor.TPId = @TPID) AND (tbl_LK_TP_Instructor.IsActive = 1)";
            var            objParTP = new DynamicParameters();
            objParTP.Add("@TPID", vTP, DbType.Int32);
            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    lstTPInst = db.Query <dynamic>(strSQLTP, objParTP, commandType: CommandType.Text).ToList();
                    if (lstTPInst != null)
                    {
                        if (lstTPInst.Count > 0)
                        {
                            dropInst.Items.Add(new ListItem(
                                                   String.Format("{0}", SQLHelper.TrimAndReplaceEOF("Select Instructor")), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt("0".ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                            for (int i = 0; i < lstTPInst.Count; i++)
                            {
                                dropInst.Items.Add(new ListItem(
                                                       String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstTPInst[i].Instructor_FName.ToString()) + " " + SQLHelper.TrimAndReplaceEOF(lstTPInst[i].Instructor_LName.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstTPInst[i].InstructorId.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            #endregion

            #region Getting all the Courses
            List <clsMDE_Courses> lstCats = new List <clsMDE_Courses>();
            lstCats = MDE_CoursesDAL.SelectDynamicMDE_Courses("IsActive = 1", "CourseId");
            if (lstCats != null)
            {
                if (lstCats.Count > 0)
                {
                    for (int i = 0; i < lstCats.Count; i++)
                    {
                        dropCourses.Items.Add(new ListItem(
                                                  String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCats[i].CourseDescription.ToString()) + " - " + SQLHelper.TrimAndReplaceEOF(lstCats[i].InstructionLanguage.ToString()) + " - " + SQLHelper.TrimAndReplaceEOF(lstCats[i].InitialOrRenewal.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstCats[i].CourseId.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                    }
                }
            }
            #endregion
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strInstructorId = string.Empty;
                phWriteComment.Visible = false;

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

                #region Category Dropdown
                List <clsCategory> lstCategory = new List <clsCategory>();
                lstCategory = CategoryDAL.SelectDynamicCategory("(ACRDCategory = 'Instructor Accreditations')", "ACRDCatID");
                if (lstCategory != null)
                {
                    if (lstCategory.Count > 0)
                    {
                        dropInstructCategory.Items.Add(new ListItem(
                                                           String.Format("{0}", SQLHelper.TrimAndReplaceEOF("Select a Category")), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt("0".ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                        for (int i = 0; i < lstCategory.Count; i++)
                        {
                            dropInstructCategory.Items.Add(new ListItem(
                                                               String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].ACRDCatID.ToString()))));
                            // String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(objcryptoJS.AES_encrypt(lstCategory[i].ACRDCatID.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString()))));
                        }
                    }
                }
                #endregion


                #region Getting all the Comments by Application Id.
                StringBuilder strMessenger = new StringBuilder("");
                List <clsInstructor_Comment> lstComments = new List <clsInstructor_Comment>();
                lstComments = Instructor_CommentDAL.SelectDynamicInstructor_Comment("InstructorId = " + strInstructorId + "", "InstructorCommentId");
                if (lstComments != null)
                {
                    if (lstComments.Count > 0)
                    {
                        for (int i = 0; i < lstComments.Count; i++)
                        {
                            strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString());
                        }
                    }
                }
                pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString()));
                #endregion

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _instructorRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strInstructorId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _instructorRepository.Get(int.Parse(strInstructorId));
                if (obj != null)
                {
                    lblContractorApp.Text = obj.Instructor_FName + " " + obj.Instructor_LName;
                    lblContactInfo.Text   = obj.TP_Contact_FName + " " + obj.TP_Contact_LName + " / " + obj.Instructor_Phone;

                    txtLName.Text                       = obj.Instructor_LName;
                    txtSuffix.Text                      = obj.Instructor_Suffix;
                    txtFName.Text                       = obj.Instructor_FName;
                    txtMName.Text                       = obj.Instructor_MName;
                    txtAddress_1.Text                   = obj.Instructor_Address_Line_1;
                    txtCity_1.Text                      = obj.Instructor_City;
                    txtState_1.Text                     = obj.Instructor_State;
                    txtZipCode_1.Text                   = obj.Instructor_ZipCode;
                    txtAddress_2.Text                   = obj.Instructor_Address_Line_2;
                    txtCity_2.Text                      = obj.Instructor_City_2;
                    txtState_2.Text                     = obj.Instructor_State_2;
                    txtZipcode_2.Text                   = obj.Instructor_ZipCode_2;
                    txtPhone.Text                       = obj.Instructor_Phone;
                    txtEmailAddress.Text                = obj.Instructor_Email;
                    txtDOB.Text                         = obj.Instructor_DOB.FromByteArray();
                    txtSSNO.Text                        = obj.Instructor_SSN.FromByteArray();
                    txtInstructTP.Text                  = obj.TP_Name;
                    txtInstructAcctNum.Text             = obj.TP_AcctNumber;
                    txtInstructContFN.Text              = obj.TP_Contact_FName;
                    txtInstructContLN.Text              = obj.TP_Contact_LName;
                    txtInstructContPhone.Text           = obj.TP_Telephone;
                    txtInstructContAddress.Text         = obj.TP_Address_Line_1;
                    txtInstructContCity.Text            = obj.TP_City;
                    txtInstructContState.Text           = obj.TP_State;
                    txtInstructContZipcode.Text         = obj.TP_ZipCode;
                    txtACCID.Text                       = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    txtNewInitTrainingCard.Text         = obj.NewInitialTCard;
                    txtNewInitStartDate.Text            = obj.NewIT_StartDates.HasValue ? obj.NewIT_StartDates.Value.ToShortDateString() : "";
                    txtNewInitEndDate.Text              = obj.NewIT_EndDates.HasValue ? obj.NewIT_EndDates.Value.ToShortDateString() : "";
                    txtRenewalTrainingCard.Text         = obj.RenewalTCard;
                    txtRenewalStartDate.Text            = obj.RenewalLT_StartDates.HasValue ? obj.RenewalLT_StartDates.Value.ToShortDateString() : "";
                    txtRenewalEndDate.Text              = obj.RenewalLT_EndDates.HasValue ? obj.RenewalLT_EndDates.Value.ToShortDateString() : "";
                    if (obj.NewInstructors_URL != null)
                    {
                        var url = obj.NewInstructors_URL.Split('\\')[1];
                        lkuploadNewInstructors.Text        = url;
                        lkuploadNewInstructors.NavigateUrl = obj.NewInstructors_URL;
                    }
                    txtNewRenewAcctNum.Text        = obj.NewRenewal_InspecTech_AcctNumber;
                    txtNewRenewAcctExpireDate.Text = obj.NewRenewal_InspecTech_AcctExpiration;
                    if (obj.NewInspectorTechnInstructors_URL != null)
                    {
                        var url = obj.NewInspectorTechnInstructors_URL.Split('\\')[1];
                        lkuploadNewInspectorTech.Text        = url;
                        lkuploadNewInspectorTech.NavigateUrl = obj.NewInspectorTechnInstructors_URL;
                    }
                    chkIAgree.Checked                  = obj.Agreed == 1;
                    lblSignedBy.Text                   = obj.Instructor_FName + " " + obj.Instructor_LName;
                    lblDateSigned.Text                 = Convert.ToDateTime(obj.CreatedDate).ToLongDateString();
                    dropIsRenewal.SelectedValue        = obj.IsRenewal.ToString();
                    dropInstructCategory.SelectedValue = obj.ACRDCatID.ToString();

                    #region Getting all the Case files.
                    StringBuilder strMessengerUpload = new StringBuilder("");

                    foreach (var each in obj.Files.OrderByDescending(x => x.Id))
                    {
                        strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString()));
                    #endregion
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    GlobalMethods.DisableControls(this.Page);
                    btnAddCourse.Visible = false;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    phWriteComment.Visible = true;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "MDE_InstructorApps.aspx?InstructApps=active") + "</div>"));
                }

                #region Making all the fields disabled.
                GlobalMethods.DisableControl_CheckBoxByID(chkIAgree);
                GlobalMethods.DisableControl_DropDownByID(dropInstructCategory);
                GlobalMethods.DisableControl_DropDownByID(dropIsRenewal);
                #endregion
            }
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strtcId = string.Empty;
                phWriteComment.Visible = false;

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

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _tcRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strtcId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _tcRepository.Get(int.Parse(strtcId));
                if (obj != null)
                {
                    //txtLName.Text = obj.InspectorLastName;
                    //txtSuffix.Text = obj.Suffix;
                    //txtFName.Text = obj.InspectorFirstName;
                    //txtMName.Text = obj.InspectorMiddleName;
                    //lblContractorApp.Text = obj.InspectorFirstName + " " + obj.InspectorLastName; ;

                    //txtAddress_1.Text = obj.InspectorContractor_Address_Line_1;
                    //txtCity_1.Text = obj.InspectorContractor_City;
                    //txtState_1.Text = obj.InspectorContractor_State;
                    //txtZipCode_1.Text = obj.InspectorContractor_ZipCode;
                    //txtAddress_2.Text = obj.InspectorContractor_Address_Line_2;
                    //txtCity_2.Text = obj.InspectorContractor_City_2;
                    //txtState_2.Text = obj.InspectorContractor_State_2;
                    //txtZipcode_2.Text = obj.InspectorContractor_ZipCode_2;
                    //txtPhone.Text = obj.InspectorPhone;
                    //txtEmailAddress.Text = obj.InspectorEmail;
                    //txtDOB.Text = obj.InspectorDOB.FromByteArray();
                    //txtSSNO.Text = obj.InspectorSSN.FromByteArray();
                    //txtACCID.Text = obj.AccreditationID;
                    //txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    //txtThirdPartyInspTechExamDate.Text = obj.ThirdPartyExamDate.HasValue ? obj.ThirdPartyExamDate.Value.ToShortDateString() : "";
                    //txtThirdPartyRiskAssExamDate.Text = obj.ThirdPartyExamDate.HasValue ? obj.ThirdPartyExamDate.Value.ToShortDateString() : "";
                    //txtMinEx_Start.Text = obj.OneYearMinExperience_Start.HasValue ? obj.OneYearMinExperience_Start.Value.ToShortDateString() : "";
                    //txtMinEx_End.Text = obj.OneYearMinExperience_End.HasValue ? obj.OneYearMinExperience_End.Value.ToShortDateString() : ""; ;
                    //txtInTechAccred.Text = obj.InspectorTechAccreditationId;
                    //chkWaiver.Checked = obj.Waiver == 1;
                    //txtTrainingCardNum.Text = obj.CourseTrainingCardNum;
                    //txtTrainCExpire.Text = obj.CourseExpirationDate;
                    //txtTrainingProviderName.Text = obj.CourseTPName;
                    //txtCourseName.Text = obj.CourseName;
                    //txtCourseStartDate.Text = obj.CourseStartDate.HasValue ? obj.CourseStartDate.Value.ToShortDateString() : "";
                    //txtCourseEndDate.Text = obj.CourseEndDate.HasValue ? obj.CourseEndDate.Value.ToShortDateString() : "";
                    //txtContractorName.Text = obj.InspectorContractorName;
                    //txtContractorAccdNum.Text = obj.InspectorContractorAcctNum;
                    //txtIC_Address_Line_1.Text = obj.InspectorContractor_Address_Line_1;
                    //txtIC_City.Text = obj.InspectorContractor_City;
                    //txtIC_State.Text = obj.InspectorContractor_State;
                    //txtIC_Zipcode.Text = obj.InspectorContractor_ZipCode;
                    //txtICContactFName.Text = obj.InspectorContactFirstName;
                    //txtICContactLName.Text = obj.InspectorContactLastName;
                    //lblContactInfo.Text = obj.InspectorContactFirstName + " " + obj.InspectorContactLastName + " / " + obj.InspectorPhone;
                    //lblDateSigned.Text = obj.CreatedDate.ToLongDateString();
                    //var url = obj.RiskAssessorExperi_URL.Split('\\');
                    //if (url[0].Length > 0)
                    //{
                    //    lkupload.Text = url[1];
                    //    lkupload.NavigateUrl = objcryptoJS.AES_encrypt(Path.GetFileNameWithoutExtension(url[1]), AppConstants.secretKey, AppConstants.initVec) + Path.GetExtension(obj.RiskAssessorExperi_URL);
                    //}
                    //chkIAgree.Checked = obj.Agreed == 1;
                    //dropIsRenewal.SelectedValue = obj.IsRenewal.HasValue ? obj.IsRenewal.Value.ToString() : "-1";

                    //if ((dropIsRenewal.SelectedValue == "0") || (dropIsRenewal.SelectedValue == "-1"))
                    //{
                    //    divIsRenewal.Visible = false;
                    //}

                    //dropCategory.SelectedValue = obj.ACRDCatID.ToString();
                    //if (obj.ACRDCatID == Category.VisualInspector)
                    //{
                    //    divCatInspection.Visible = true;
                    //}
                    //if (obj.ACRDCatID == Category.InspectorTechnician)
                    //{
                    //    divCatResidential.Visible = true;
                    //}
                    //if (obj.ACRDCatID == Category.RiskAccesor)
                    //{
                    //    divCatSteel.Visible = true;
                    //}
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-danger2 open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-warning open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }

                #region Disabling all controls.
                GlobalMethods.DisableControls(this.Page);
                #endregion
            }
        }
Beispiel #27
0
 public void ProcessRequest(HttpContext context)
 {
     if (!context.User.Identity.IsAuthenticated)
     {
         FormsAuthentication.RedirectToLoginPage();
         return;
     }
     if (context.Request.Url.AbsoluteUri.IndexOf(".pdf") > -1)
     {
         using (var stream = new MemoryStream())
         {
             var url      = objcryptoJS.AES_decrypt(context.Request.Url.AbsoluteUri.Split('/').Last().Replace(".pdf", ""), AppConstants.secretKey, AppConstants.initVec);
             var fileName = url;
             using (FileStream fs = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "uf", url + ".pdf"), FileMode.Create))
             {
                 stream.CopyTo(fs);
             }
             context.Response.BinaryWrite(stream.ToArray());
         }
     }
     else
     {
         var userId   = HttpContext.Current.Session["UserAuthId"];
         var template = objcryptoJS.AES_decrypt(context.Request.Url.AbsoluteUri.Split('/').Last().Replace(".cert", ""), AppConstants.secretKey, AppConstants.initVec);
         var content  = new StringBuilder(File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_data", template + ".htm")));
         if (template == "Acct_Certificate")
         {
             content.Replace("{{Name}}", ConvertTextToBase64Image("				Jack Vu", "Arial", 14, Color.White, Color.Black, 694, 70));
             content.Replace("{{CourseName}}", ConvertTextToBase64Image("		Inspection (IC)", "Arial", 14, Color.White, Color.Black, 598, 77));
             content.Replace("{{ExpDate}}", ConvertTextToBase64Image("12,12,2021", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{TP}}", ConvertTextToBase64Image("Zoom Training Center", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{CourseDate}}", ConvertTextToBase64Image("12,12,2020", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{CertId}}", ConvertTextToBase64Image(RandomNumber(5, 100).ToString(), "Arial", 18, Color.White, Color.Black, 152, 31));
         }
         else if (template == "TrainingCard")
         {
             content.Replace("{{Name}}", ConvertTextToBase64Image("Jack Vu", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{ClassCode}}", ConvertTextToBase64Image("Inspection (IC)", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{DOB}}", ConvertTextToBase64Image("12,12,1984", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{ProviderName}}", ConvertTextToBase64Image("Zoom Training Center", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{ExpDate}}", ConvertTextToBase64Image("12,12,2021", "Arial", 18, Color.White, Color.Black, 262, 32));
             content.Replace("{{Number}}", ConvertTextToBase64Image(RandomNumber(5, 100).ToString(), "Arial", 18, Color.White, Color.Black, 262, 32));
         }
         var fileName = Guid.NewGuid();
         context.Response.Headers.Add("Content-Type", "text/pdf");
         context.Response.Headers.Add("Content-Disposition", "attachment; filename=" + objcryptoJS.AES_encrypt(userId.ToString(), AppConstants.secretKey, AppConstants.initVec) + "_" + template + ".pdf");
         using (var stream = new MemoryStream())
         {
             new PdfConverter().Convert(stream, content.ToString());
             var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Attachments");
             var dir  = new DirectoryInfo(path);
             if (!dir.Exists)
             {
                 dir.Create();
             }
             using (FileStream fs = new FileStream(string.Format("{0}\\{1}.pdf", path, fileName), FileMode.Create))
             {
                 stream.CopyTo(fs);
             }
             context.Response.BinaryWrite(stream.ToArray());
             stream.Flush();
         }
     }
 }
Beispiel #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strCourseId = string.Empty;
                try
                {
                    strCourseId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                    if (GlobalMethods.ValueIsNull(strCourseId).Length > 0)
                    {
                        strCourseId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    }

                    #region Getting Course Information
                    clsCourseSchedule objCourse = new clsCourseSchedule();
                    objCourse = CourseScheduleDAL.SelectCourseScheduleById(Convert.ToInt32(strCourseId));
                    if (objCourse != null)
                    {
                        CourseTitle   = objCourse.ClassTitle;
                        CourseDesc    = objCourse.Notes;
                        AttendenceReq = objCourse.InstructionLanguage;
                    }
                    #endregion

                    #region Showing all the Courses added to the list.
                    List <dynamic> lstValues;
                    string         strSQL = @"SELECT DISTINCT 
                         tbl_CourseSchedule.InstructorId, tbl_CourseSchedule.TPLocationId, tbl_CourseSchedule.ClassTitle, tbl_CourseSchedule.StartDate, tbl_CourseSchedule.EndDate, tbl_CourseSchedule.InstructionLanguage, 
                         tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, tbl_TrainingProvider.TP_Name, tbl_CourseSchedule.TrainingCourseScheduleId
                         FROM            tbl_CourseSchedule INNER JOIN
                         tbl_TrainingProvider ON tbl_CourseSchedule.TPId = tbl_TrainingProvider.TPId INNER JOIN
                         tbl_Instructor ON tbl_CourseSchedule.InstructorId = tbl_Instructor.InstructorId INNER JOIN
                         tbl_TP_Location ON tbl_CourseSchedule.TPLocationId = tbl_TP_Location.TPLocationId
                         WHERE        (tbl_CourseSchedule.TrainingCourseScheduleId = @strCourseId)";
                    var            objPar = new DynamicParameters();
                    objPar.Add("@strCourseId", strCourseId, DbType.Int32);
                    try
                    {
                        using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                        {
                            lstValues = db.Query <dynamic>(strSQL, objPar, commandType: CommandType.Text).ToList();
                            if (lstValues != null)
                            {
                                if (lstValues.Count > 0)
                                {
                                    for (int i = 0; i < lstValues.Count; i++)
                                    {
                                        showTable(pnlVideos, GlobalMethods.ValueIsNull(lstValues[i].ClassTitle), GlobalMethods.ValueIsNull(lstValues[i].StartDate) + " - " + GlobalMethods.ValueIsNull(lstValues[i].EndDate), GlobalMethods.ValueIsNull(lstValues[i].InstructionLanguage), GlobalMethods.ValueIsNull(lstValues[i].TP_Name), "", GlobalMethods.ValueIsNull(lstValues[i].Instructor_FName) + " " + GlobalMethods.ValueIsNull(lstValues[i].Instructor_LName), Convert.ToInt32(GlobalMethods.ValueIsNull(lstValues[i].TrainingCourseScheduleId)));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.ErrorLogging(ex, false);
                        ErrorHandler.ReadError();
                    }
                    #endregion
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Beispiel #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTPID = string.Empty;
                string strTCid = 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();
                    }

                    #region Showing all the Courses added to the list.
                    List <dynamic> lstValues;
                    string         strSQL = @"SELECT        tbl_TrainingProvider.TPId, tbl_TrainingProvider.TP_Name, tbl_TrainingProvider.TP_Logo_URL, tbl_TrainingProvider.TP_WebSite, tbl_TrainingProvider.TP_Telephone, tbl_TrainingProvider.CreatedDate, 
                         tbl_TrainingProvider.CreatedBy, tbl_TrainingProvider.UpdatedDate, tbl_TrainingProvider.UpdatedBy, tbl_TrainingProvider.Notes, tbl_TrainingProvider.IsActive, tbl_Course_Result.AuthorisedUserId, 
                         tbl_LK_Inst_CourseSchedule.IsApproved, tbl_User.FName, tbl_User.LName, tbl_User.EmailId, tbl_LK_Inst_CourseSchedule.ApprovedOn, tbl_Instructor.Instructor_FName, tbl_Instructor.Instructor_LName, 
                         tbl_CourseSchedule.StartDate, tbl_CourseSchedule.EndDate, tbl_LK_Inst_CourseSchedule.Inst_CourseSchId
FROM            tbl_Course_Result INNER JOIN
                         tbl_TrainingProvider ON tbl_Course_Result.TPId = tbl_TrainingProvider.TPId INNER JOIN
                         tbl_LK_Inst_CourseSchedule ON tbl_Course_Result.AuthorisedUserId = tbl_LK_Inst_CourseSchedule.AuthorisedUserId INNER JOIN
                         tbl_User ON tbl_Course_Result.AuthorisedUserId = tbl_User.AuthorisedUserId INNER JOIN
                         tbl_TP_Location ON tbl_Course_Result.TPLocationId = tbl_TP_Location.TPLocationId INNER JOIN
                         tbl_Instructor ON tbl_Course_Result.InstructorId = tbl_Instructor.InstructorId INNER JOIN
                         tbl_CourseSchedule ON tbl_Course_Result.TrainingCourseScheduleId = tbl_CourseSchedule.TrainingCourseScheduleId
WHERE        (tbl_TrainingProvider.TPId = @TPID) AND (tbl_LK_Inst_CourseSchedule.IsApproved = 1)";
                    var            objPar = new DynamicParameters();
                    objPar.Add("@TPID", Convert.ToInt32(strTPID), DbType.Int32);
                    try
                    {
                        using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                        {
                            lstValues = db.Query <dynamic>(strSQL, objPar, commandType: CommandType.Text).ToList();
                            if (lstValues != null)
                            {
                                if (lstValues.Count > 0)
                                {
                                    for (int i = 0; i < lstValues.Count; i++)
                                    {
                                        showTable(pnlVideos, GlobalMethods.ValueIsNull(lstValues[i].FName), GlobalMethods.ValueIsNull(lstValues[i].LName), GlobalMethods.ValueIsNull(lstValues[i].EmailId), "", GlobalMethods.ValueIsNull(lstValues[i].Instructor_FName) + " " + GlobalMethods.ValueIsNull(lstValues[i].Instructor_LName), Convert.ToDateTime(GlobalMethods.ValueIsNull(lstValues[i].StartDate)).ToShortDateString() + "-" + Convert.ToDateTime(GlobalMethods.ValueIsNull(lstValues[i].EndDate)).ToShortDateString(), Convert.ToInt32(GlobalMethods.ValueIsNull(lstValues[i].IsApproved)), Convert.ToInt32(GlobalMethods.ValueIsNull(lstValues[i].Inst_CourseSchId)));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.ErrorLogging(ex, false);
                        ErrorHandler.ReadError();
                    }
                    #endregion
                    strTCid = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode("2".ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(9, "bar", "RoleDesc.aspx?Dash=active&cgi=" + strTCid + "") + "</div>"));
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strInspectorRiskAssId = string.Empty;
                phWriteComment.Visible = false;

                strInspectorRiskAssId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                if (GlobalMethods.ValueIsNull(strInspectorRiskAssId).Length > 0)
                {
                    strInspectorRiskAssId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                }
                #region Getting all the Comments by Application Id.
                StringBuilder strMessenger = new StringBuilder("");
                List <clsRiskAssessor_Comment> lstComments = new List <clsRiskAssessor_Comment>();
                lstComments = RiskAssessor_CommentDAL.SelectDynamicRiskAssessor_Comment("InspectorRiskAssId = " + strInspectorRiskAssId + "", "InspectorRiskAssId");
                if (lstComments != null)
                {
                    if (lstComments.Count > 0)
                    {
                        for (int i = 0; i < lstComments.Count; i++)
                        {
                            strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString());
                        }
                    }
                }
                pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString()));
                #endregion

                #region Checking if this is AssignedToMe Action
                bool IsAssignedToMe = false;

                var pendingApps = _riskAssessorRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strInspectorRiskAssId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _riskAssessorRepository.Get(int.Parse(strInspectorRiskAssId));
                if (obj != null)
                {
                    txtLName.Text         = obj.InspectorLastName;
                    txtSuffix.Text        = obj.Suffix;
                    txtFName.Text         = obj.InspectorFirstName;
                    txtMName.Text         = obj.InspectorMiddleName;
                    lblContractorApp.Text = obj.InspectorFirstName + " " + obj.InspectorLastName;
                    lblSignedBy.Text      = obj.InspectorFirstName + " " + obj.InspectorLastName;
                    txtAddress_1.Text     = obj.InspectorContractor_Address_Line_1;
                    txtCity_1.Text        = obj.InspectorContractor_City;
                    txtState_1.Text       = obj.InspectorContractor_State;
                    txtZipCode_1.Text     = obj.InspectorContractor_ZipCode;
                    txtAddress_2.Text     = obj.InspectorContractor_Address_Line_2;
                    txtCity_2.Text        = obj.InspectorContractor_City_2;
                    txtState_2.Text       = obj.InspectorContractor_State_2;
                    txtZipcode_2.Text     = obj.InspectorContractor_ZipCode_2;
                    txtPhone.Text         = obj.InspectorPhone;
                    txtEmailAddress.Text  = obj.InspectorEmail;
                    txtDOB.Text           = obj.InspectorDOB.FromByteArray();
                    txtSSNO.Text          = obj.InspectorSSN.FromByteArray();
                    txtACCID.Text         = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    txtThirdPartyInspTechExamDate.Text  = obj.ThirdPartyExamDate.HasValue ? obj.ThirdPartyExamDate.Value.ToShortDateString() : "";
                    txtThirdPartyRiskAssExamDate.Text   = obj.ThirdPartyExamDate.HasValue ? obj.ThirdPartyExamDate.Value.ToShortDateString() : "";
                    txtMinEx_Start.Text          = obj.OneYearMinExperience_Start.HasValue ? obj.OneYearMinExperience_Start.Value.ToShortDateString() : "";
                    txtMinEx_End.Text            = obj.OneYearMinExperience_End.HasValue ? obj.OneYearMinExperience_End.Value.ToShortDateString() : "";;
                    txtInTechAccred.Text         = obj.InspectorTechAccreditationId;
                    chkWaiver.Checked            = obj.Waiver == 1;
                    txtTrainingCardNum.Text      = obj.CourseTrainingCardNum;
                    txtTrainCExpire.Text         = obj.CourseExpirationDate;
                    txtTrainingProviderName.Text = obj.CourseTPName;
                    txtCourseName.Text           = obj.CourseName;
                    txtCourseStartDate.Text      = obj.CourseStartDate.HasValue ? obj.CourseStartDate.Value.ToShortDateString() : "";
                    txtCourseEndDate.Text        = obj.CourseEndDate.HasValue ? obj.CourseEndDate.Value.ToShortDateString() : "";
                    txtContractorName.Text       = obj.InspectorContractorName;
                    txtContractorAccdNum.Text    = obj.InspectorContractorAcctNum;
                    txtIC_Address_Line_1.Text    = obj.InspectorContractor_Address_Line_1;
                    txtIC_City.Text        = obj.InspectorContractor_City;
                    txtIC_State.Text       = obj.InspectorContractor_State;
                    txtIC_Zipcode.Text     = obj.InspectorContractor_ZipCode;
                    txtICContactFName.Text = obj.InspectorContactFirstName;
                    txtICContactLName.Text = obj.InspectorContactLastName;
                    lblContactInfo.Text    = obj.InspectorContactFirstName + " " + obj.InspectorContactLastName + " / " + obj.InspectorPhone;
                    lblDateSigned.Text     = obj.CreatedDate.ToLongDateString();
                    var url = obj.RiskAssessorExperi_URL.Split('\\');
                    if (url[0].Length > 0)
                    {
                        lkupload.Text        = "View Attachment";
                        lkupload.NavigateUrl = obj.RiskAssessorExperi_URL;
                    }
                    chkIAgree.Checked           = obj.Agreed == 1;
                    dropIsRenewal.SelectedValue = obj.IsRenewal.HasValue ? obj.IsRenewal.Value.ToString() : "-1";

                    if ((dropIsRenewal.SelectedValue == "0") || (dropIsRenewal.SelectedValue == "-1"))
                    {
                        divIsRenewal.Visible = false;
                    }

                    dropCategory.SelectedValue = obj.ACRDCatID.ToString();
                    if (obj.ACRDCatID == Category.VisualInspector)
                    {
                        divCatInspection.Visible = true;
                    }
                    if (obj.ACRDCatID == Category.InspectorTechnician)
                    {
                        divCatResidential.Visible = true;
                    }
                    if (obj.ACRDCatID == Category.RiskAccesor)
                    {
                        divCatSteel.Visible = true;
                    }
                    txtICContactPhone.Text = obj.InspectorContractor_Phone;

                    #region Getting all the Case files.
                    StringBuilder strMessengerUpload = new StringBuilder("");

                    foreach (var each in obj.Files.OrderByDescending(x => x.Id))
                    {
                        strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString()));
                    #endregion
                }

                string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                if (IsAssignedToMe)
                {
                    GlobalMethods.DisableControls(this.Page);
                    btnAddCourse.Visible = false;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }
                else
                {
                    phWriteComment.Visible = true;
                    pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>"));
                }

                #region Making all the fields disabled.
                GlobalMethods.DisableControl_CheckBoxByID(chkIAgree);
                GlobalMethods.DisableControl_DropDownByID(dropCategory);
                GlobalMethods.DisableControl_DropDownByID(dropIsRenewal);
                #endregion
            }
        }