Exemplo n.º 1
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     try
     {
         int       result    = 0;
         clsCourse objcourse = new clsCourse();
         if (Request.QueryString["id"] != null)
         {
             courseid     = Convert.ToInt32(Request.QueryString["id"].ToString());
             objcourse.Id = courseid;
         }
         objcourse.CourseName = txtCourseName.Text;
         objcourse.Fee        = Convert.ToDecimal(txtCourserFee.Text);
         objcourse.Duration   = Convert.ToInt32(txtCourseDuaration.Text);
         objcourse.Active     = ChkActive.Checked;
         bal.courseopration course = new bal.courseopration();
         result = course.CourseInsertUpdate(objcourse);
         if (result > 0)
         {
             Response.Redirect("CourseList.aspx");
         }
         else
         {
             DivError.Visible = true;
             lblErrorMsg.Text = "Please Try after some Time.";
         }
     }
     catch (Exception ex)
     {
         DivError.Visible = true;
         lblErrorMsg.Text = "Please Try after some Time.";
         com.Loginsert(HttpContext.Current.Request.Url.AbsolutePath, "btnsave_Click", ex.StackTrace, ex.Message);
     }
 }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
 public int CourseInsertUpdate(clsCourse objcourse)
 {
     try
     {
         using (aspccEntities db = new aspccEntities())
         {
             var result = db.CourseInsertUpdate(objcourse.Id, objcourse.CourseName, objcourse.Fee, objcourse.Duration, objcourse.Active, 1, 1);
             //return Convert.ToInt32(result.FirstOrDefault());
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Exemplo n.º 4
0
        public static Boolean InsertUpdateCourse(clsCourse objCourse)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateCourse";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objCourse, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Exemplo n.º 5
0
        public static clsCourse SelectCourseById(int?TrainingCourseId)
        {
            clsCourse objCourse = new clsCourse();
            bool      isnull    = true;
            string    SpName    = "usp_SelectCourse";
            var       objPar    = new DynamicParameters();

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

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

            if (isnull)
            {
                return(null);
            }
            else
            {
                return(objCourse);
            }
        }