public static Boolean InsertUpdateTrainingCourse_Comment(clsTrainingCourse_Comment objTrainingCourse_Comment) { bool isAdded = false; string SpName = "usp_InsertUpdateTrainingCourse_Comment"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objTrainingCourse_Comment, commandType: CommandType.StoredProcedure); } isAdded = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isAdded); }
protected void CommentEnter(object sender, EventArgs e) { string strTrainingCourseAppId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strTrainingCourseAppId).Length > 0) { strTrainingCourseAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } else { ErrorHandler.ErrorPage(); } clsTrainingCourse_Comment objComm = new clsTrainingCourse_Comment(); objComm.TrainingCourseAppId = Convert.ToInt32(strTrainingCourseAppId); objComm.Comment = GlobalMethods.KillChars(txtComment.Text); objComm.CreatedDate = DateTime.Now; objComm.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objComm.IsActive = 1; if (!TrainingCourse_CommentDAL.InsertTrainingCourse_Comment(objComm)) { } #region Getting all the Comments by Application Id. StringBuilder strMessenger = new StringBuilder(""); List <clsTrainingCourse_Comment> lstComments = new List <clsTrainingCourse_Comment>(); lstComments = TrainingCourse_CommentDAL.SelectDynamicTrainingCourse_Comment("TrainingCourseAppId = " + strTrainingCourseAppId + "", "TrainingCourseCommentId"); if (lstComments != null) { if (lstComments.Count > 0) { for (int i = 0; i < lstComments.Count; i++) { strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString()); } } } pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString())); #endregion }
public static clsTrainingCourse_Comment SelectTrainingCourse_CommentById(int?TrainingCourseCommentId) { clsTrainingCourse_Comment objTrainingCourse_Comment = new clsTrainingCourse_Comment(); bool isnull = true; string SpName = "usp_SelectTrainingCourse_Comment"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(TrainingCourseCommentId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@TrainingCourseCommentId", TrainingCourseCommentId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objTrainingCourse_Comment = db.Query <clsTrainingCourse_Comment>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objTrainingCourse_Comment); } }