示例#1
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");
        }
示例#2
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 + "");
        }
示例#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");
        }
示例#4
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 + "");
        }
示例#5
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);
    }
示例#6
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 + "");
        }
示例#7
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 + "");
        }
示例#8
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 + "");
        }
示例#9
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);
        }
示例#10
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 + "");
        }
示例#11
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);
        }
示例#12
0
 internal string calculateHash()
 {
     return(CryptoJS.SHA256($"{index}{previousHash}{timestamp}{data}"));
 }