コード例 #1
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();
            string   strTPID     = string.Empty;
            string   strInstID   = string.Empty;

            try
            {
                #region "variables"
                string vTrainingCourseId   = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropCourses.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vTPId               = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();;
                string vInstID             = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropInst.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();;;
                string vLocationId         = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropLocation.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();;;
                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 vLocation           = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropLocation.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vDesc               = objSecurity.KillChars(txtCDesc.Text.ToString());
                string vCost               = objSecurity.KillChars(txtCost.Text);
                #endregion

                #region Object for Training Provider.
                clsCourseSchedule objCourseS = new clsCourseSchedule();
                objCourseS.CourseId            = Convert.ToInt32(vTrainingCourseId);
                objCourseS.TPId                = Convert.ToInt32(vTPId);
                objCourseS.InstructorId        = Convert.ToInt32(vInstID);
                objCourseS.TPLocationId        = Convert.ToInt32(vLocationId);
                objCourseS.ClassTitle          = vCName;
                objCourseS.StartDate           = Convert.ToDateTime(vStartDate);
                objCourseS.EndDate             = Convert.ToDateTime(vEndDate);
                objCourseS.InstructionLanguage = vCLanguage;
                objCourseS.RegistrationLimit   = Convert.ToInt32(vRegistrationLimit);
                objCourseS.ExpectedEnrollment  = vExpectedEnrollment;
                objCourseS.CourseCancelled     = "";
                objCourseS.CancellationReason  = "";
                objCourseS.CourseCost          = vCost;
                objCourseS.CreateDate          = DateTime.Now;
                objCourseS.CreatedBy           = HttpContext.Current.Session["UserAuthId"].ToString();
                objCourseS.UpdatedDate         = Convert.ToDateTime("1/1/1900");
                objCourseS.UpdatedBy           = "";
                objCourseS.Notes               = vDesc;
                objCourseS.IsActive            = 1;
                if (!CourseScheduleDAL.InsertCourseSchedule(objCourseS))
                {
                }
                #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();
            }
        }
コード例 #2
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 + "");
        }
コード例 #3
0
        public static Boolean InsertUpdateCourseSchedule(clsCourseSchedule objCourseSchedule)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateCourseSchedule";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objCourseSchedule, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
コード例 #4
0
        public static clsCourseSchedule SelectCourseScheduleById(int?TrainingCourseScheduleId)
        {
            clsCourseSchedule objCourseSchedule = new clsCourseSchedule();
            bool   isnull = true;
            string SpName = "usp_SelectCourseSchedule";
            var    objPar = new DynamicParameters();

            if (String.IsNullOrEmpty(TrainingCourseScheduleId.ToString()))
            {
                throw new ArgumentException("Function parameters cannot be blank!");
            }
            else
            {
                try
                {
                    objPar.Add("@TrainingCourseScheduleId", TrainingCourseScheduleId, dbType: DbType.Int32);

                    using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                    {
                        objCourseSchedule = db.Query <clsCourseSchedule>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault();
                        isnull            = false;
                    }
                }
                catch (Exception ex)
                {
                    ErrorHandler.ErrorLogging(ex, false);
                    ErrorHandler.ReadError();
                }
            }

            if (isnull)
            {
                return(null);
            }
            else
            {
                return(objCourseSchedule);
            }
        }
コード例 #5
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
                    clsCourseSchedule objCS = new clsCourseSchedule();
                    objCS = CourseScheduleDAL.SelectCourseScheduleById(Convert.ToInt32(strTCSID));
                    if (objCS != null)
                    {
                        lblCrouseName.Text = objCS.ClassTitle;
                    }
                    #endregion

                    #region Showing all the Courses added to the list.
                    List <dynamic> lstValues;
                    string         strSQL = @"SELECT        tbl_LK_Inst_CourseSchedule.CreatedDate, tbl_User.FName, tbl_User.LName, tbl_User.EmailId, tbl_LK_Inst_CourseSchedule.IsApproved, tbl_LK_Inst_CourseSchedule.TrainingCourseScheduleId, 
                         tbl_LK_Inst_CourseSchedule.AuthorisedUserId, tbl_LK_Inst_CourseSchedule.Inst_CourseSchId, tbl_LK_Inst_CourseSchedule.TP_AuthorisedUserId, tbl_LK_Inst_CourseSchedule.InstructorId, tbl_Instructor.Instructor_FName, 
                         tbl_Instructor.Instructor_LName,  tbl_CourseSchedule.StartDate, tbl_CourseSchedule.EndDate,tbl_CourseSchedule.CourseId
FROM            tbl_LK_Inst_CourseSchedule INNER JOIN
                         tbl_User ON tbl_LK_Inst_CourseSchedule.AuthorisedUserId = tbl_User.AuthorisedUserId 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_TP_Location ON tbl_CourseSchedule.TPLocationId = tbl_TP_Location.TPLocationId
                                     WHERE        (tbl_LK_Inst_CourseSchedule.TrainingCourseScheduleId = @TCSId)";
                    var            objPar = new DynamicParameters();
                    objPar.Add("@TCSId", Convert.ToInt32(strTCSID), 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++)
                                    {
                                        if (i == 0)
                                        {
                                            strTCid = GlobalMethods.ValueIsNull(lstValues[i].TrainingCourseId);
                                        }
                                        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(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();
                }
            }
        }
コード例 #6
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();
                }
            }
        }
コード例 #7
0
        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;'>&nbsp;</div></div>"));
                        }
                    }

                    #endregion
                }
                catch (Exception)
                {
                    ErrorHandler.ErrorPage();
                }
            }
        }