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 Boolean InsertUpdateLK_Inst_CourseSchedule(clsLK_Inst_CourseSchedule objLK_Inst_CourseSchedule) { bool isAdded = false; string SpName = "usp_InsertUpdateLK_Inst_CourseSchedule"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objLK_Inst_CourseSchedule, commandType: CommandType.StoredProcedure); } isAdded = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isAdded); }
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 + ""); }
public static clsLK_Inst_CourseSchedule SelectLK_Inst_CourseScheduleById(int?Inst_CourseSchId) { clsLK_Inst_CourseSchedule objLK_Inst_CourseSchedule = new clsLK_Inst_CourseSchedule(); bool isnull = true; string SpName = "usp_SelectLK_Inst_CourseSchedule"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(Inst_CourseSchId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@Inst_CourseSchId", Inst_CourseSchId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objLK_Inst_CourseSchedule = db.Query <clsLK_Inst_CourseSchedule>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objLK_Inst_CourseSchedule); } }
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(); } } }