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 + ""); }
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 + ""); }
protected void AddTManual_Click(object sender, EventArgs e) { Security objSecurity = new Security(); #region "variables" string vPassFail = dropPassFail.SelectedItem.Value; string vtxtAttendence = dropAttendence.SelectedItem.Value; string vScore = dropScore.SelectedItem.Value; string vAuthorisedUserId = string.Empty; string vTrainingCourseScheduleId = string.Empty; string vInstructorId = string.Empty; string vTPLocationId = string.Empty; string vTPId = string.Empty; string vSPContractorID = string.Empty; #endregion string 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 rest of the values. List <dynamic> lstCourses; string strSQLC = @"SELECT tbl_LK_Inst_CourseSchedule.Inst_CourseSchId, tbl_LK_Inst_CourseSchedule.AuthorisedUserId, tbl_LK_Inst_CourseSchedule.TrainingCourseScheduleId, tbl_LK_Inst_CourseSchedule.InstructorId, tbl_LK_Inst_CourseSchedule.TP_AuthorisedUserId, tbl_CourseSchedule.CourseId, tbl_LK_Inst_CourseSchedule.IsApproved, tbl_CourseSchedule.TPLocationId, tbl_CourseSchedule.TPId FROM tbl_LK_Inst_CourseSchedule INNER JOIN tbl_CourseSchedule ON tbl_LK_Inst_CourseSchedule.TrainingCourseScheduleId = tbl_CourseSchedule.TrainingCourseScheduleId INNER JOIN tbl_TrainingProvider ON tbl_CourseSchedule.TPId = tbl_TrainingProvider.TPId WHERE (tbl_LK_Inst_CourseSchedule.Inst_CourseSchId = @CourseSchId)"; var objParC = new DynamicParameters(); objParC.Add("@CourseSchId", strTCSID, 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) { vAuthorisedUserId = GlobalMethods.ValueIsNull(lstCourses[0].AuthorisedUserId); vTrainingCourseScheduleId = GlobalMethods.ValueIsNull(lstCourses[0].TrainingCourseScheduleId); vInstructorId = GlobalMethods.ValueIsNull(lstCourses[0].InstructorId); vTPLocationId = GlobalMethods.ValueIsNull(lstCourses[0].TPLocationId); vTPId = GlobalMethods.ValueIsNull(lstCourses[0].TPId); vSPContractorID = GlobalMethods.ValueIsNull(lstCourses[0].SPContractorID); } } } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } #endregion #region Checking if this is IsApproved ... if not Updating the value with TPID to LK_Inst_CourseSchedule List <clsLK_Inst_CourseSchedule> lstICS = new List <clsLK_Inst_CourseSchedule>(); lstICS = LK_Inst_CourseScheduleDAL.SelectDynamicLK_Inst_CourseSchedule("Inst_CourseSchId = " + strTCSID + " and AuthorisedUserId = " + vAuthorisedUserId + " and IsApproved = 1", "Inst_CourseSchId"); if (lstICS != null) { if (lstICS.Count > 0) { } else { clsLK_Inst_CourseSchedule objICS = new clsLK_Inst_CourseSchedule(); objICS = LK_Inst_CourseScheduleDAL.SelectLK_Inst_CourseScheduleById(Convert.ToInt32(strTCSID)); if (objICS != null) { objICS.IsApproved = 1; objICS.TP_AuthorisedUserId = Convert.ToInt32(vTPId); if (!LK_Inst_CourseScheduleDAL.UpdateLK_Inst_CourseSchedule(objICS)) { } } } } #endregion clsCourse_Result objCR = new clsCourse_Result(); objCR.Inst_CourseSchId = Convert.ToInt32(strTCSID); objCR.AuthorisedUserId = Convert.ToInt32(vAuthorisedUserId); objCR.TrainingCourseScheduleId = Convert.ToInt32(vTrainingCourseScheduleId); objCR.InstructorId = Convert.ToInt32(vInstructorId); objCR.MDE_AuthorisedUserId = 0; objCR.TPLocationId = Convert.ToInt32(vTPLocationId); objCR.TPId = Convert.ToInt32(vTPId); objCR.SPContractorID = 0; objCR.Inst_PASSFAIL = Convert.ToInt32(vPassFail); objCR.Inst_Attendence = Convert.ToInt32(vtxtAttendence); objCR.Inst_ScorePercent = vScore; objCR.Inst_TrainingCard = ""; objCR.MDE_EmployerVeri = 0; objCR.MDE_BackGround = 0; objCR.MDE_PaymentVeri = 0; objCR.PaymentAmount = ""; objCR.Acct_Term = 0; objCR.MDE_F_Decision = 0; objCR.MDE_F_Notes = ""; objCR.MDE_Acct_Certificate = ""; objCR.CreatedDate = DateTime.Now; objCR.Notes = ""; objCR.IsActive = -1; if (Course_ResultDAL.InsertCourse_Result(objCR)) { strTCSID = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(strTCSID.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Saved successfully!', '', 'success', 'Inst_SaveScores.aspx?dash=active&cgi=" + strTCSID + "');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Error: Cannot Save Records!', '', 'danger', '#');", true); } }
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(); } } }
protected void showTable(Panel pnlName, string ClassTitle, string StartDateEndDate, string InstructionLanguage, string TP_Name, string Loc_Ti, string InstName, int CourseId) { string strSPContractorID = objcryptoJS.AES_encrypt(CourseId.ToString(), AppConstants.secretKey, AppConstants.initVec).ToString(); bool IsEnrolled = false; StringBuilder strContent = new StringBuilder("<tr>"); strContent.Append("<td width='15%' nowrap><a href='ClassDetails.aspx?dash=active&cgi=" + System.Web.HttpUtility.UrlEncode(strSPContractorID) + "' >"); strContent.Append(ClassTitle); strContent.Append("</a></td>"); strContent.Append("<td width='10%'nowrap>"); strContent.Append(StartDateEndDate); strContent.Append("</td>"); strContent.Append("<td width='10%'nowrap>"); strContent.Append(InstructionLanguage); strContent.Append("</td>"); //strContent.Append("<td width='10%'nowrap>"); //strContent.Append(TP_Name); //strContent.Append("</td>"); strContent.Append("<td width='10%'nowrap>"); strContent.Append(""); strContent.Append("</td>"); //strContent.Append("<td width='10%'nowrap>"); //strContent.Append(InstName); //strContent.Append("</td>"); //*************************************** strContent.Append("<td width='5%' nowrap>"); #region Checking if this course is already registered. List <clsLK_Inst_CourseSchedule> objInstCS = new List <clsLK_Inst_CourseSchedule>(); objInstCS = LK_Inst_CourseScheduleDAL.SelectDynamicLK_Inst_CourseSchedule("TrainingCourseScheduleId = " + CourseId + " and AuthorisedUserId = " + HttpContext.Current.Session["UserAuthId"].ToString() + "", "Inst_CourseSchId"); if (objInstCS != null) { if (objInstCS.Count > 0) { if (objInstCS[0].IsApproved == 0) { // Applied but not approved strContent.Append("<a class='btn btn-xs btn-primary' href='ClassDetails.aspx?dash=active&cgi=" + System.Web.HttpUtility.UrlEncode(strSPContractorID) + "'>View Details</a> <a href='#' class='btn btn-xs btn-warning2' >Applied but Pending Approval</a>"); } else if (objInstCS[0].IsApproved == 1) { // This has been enrolled. strContent.Append("<a class='btn btn-xs btn-primary' href='ClassDetails.aspx?dash=active&cgi=" + System.Web.HttpUtility.UrlEncode(strSPContractorID) + "'>View Details</a> <a href='#' class='btn btn-xs btn-default' >Enrolled</a>"); } } else { // User should apply for the class. strContent.Append("<a class='btn btn-xs btn-primary' href='ClassDetails.aspx?dash=active&cgi=" + System.Web.HttpUtility.UrlEncode(strSPContractorID) + "'>View Details</a> <a href='#' class='btn btn-xs btn-success open-Enroll' data-id='" + System.Web.HttpUtility.UrlEncode(strSPContractorID) + "' data-toggle='modal'>Apply for Enrollment</a>"); } } #endregion //if (IsEnrolled) //{ // //} //else //{ // //} strContent.Append("</td>"); pnlName.Controls.Add(new LiteralControl(strContent.ToString())); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strCourseScheduleId = string.Empty; try { strCourseScheduleId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strCourseScheduleId).Length > 0) { strCourseScheduleId = 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(strCourseScheduleId)); if (objCourse != null) { CourseTitle = objCourse.ClassTitle; CourseDesc = objCourse.Notes; AttendenceReq = objCourse.RegistrationLimit.ToString(); language = objCourse.InstructionLanguage; strStartDate = Convert.ToDateTime(objCourse.StartDate).ToShortDateString(); strEndDate = Convert.ToDateTime(objCourse.EndDate).ToShortDateString(); strDuration = "5 hours";// objCourse.InstructionLanguage; strInstructor = "-"; strLocation = "-"; strCost = "75.00"; strPhone = "Instructor Phone"; } #endregion #region Checking if this course is already registered. List <clsLK_Inst_CourseSchedule> objInstCS = new List <clsLK_Inst_CourseSchedule>(); objInstCS = LK_Inst_CourseScheduleDAL.SelectDynamicLK_Inst_CourseSchedule("TrainingCourseScheduleId = " + strCourseScheduleId + " and AuthorisedUserId = " + HttpContext.Current.Session["UserAuthId"].ToString() + "", "Inst_CourseSchId"); if (objInstCS != null) { if (objInstCS.Count > 0) { if (objInstCS[0].IsApproved == 0) { // Applied but not approved pnlAddButton.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-warning' style='padding:8px !important;'><b>Applied but Pending Approval</b></div></div>")); } else if (objInstCS[0].IsApproved == 1) { // This has been enrolled. pnlAddButton.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;'><b>Enrolled</b></div></div>")); } } else { // User should apply for the class. pnlAddButton.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='#' class='btn btn-success open-Enroll' data-id='" + Request["cgi"].ToString() + "' data-toggle='modal'>Apply for Enrollment</a></div><div class='alert alert-success' style='padding:8px !important;'> </div></div>")); } } #endregion } catch (Exception) { ErrorHandler.ErrorPage(); } } }