public static Boolean InsertUpdateTP_Comment(clsTP_Comment objTP_Comment) { bool isAdded = false; string SpName = "usp_InsertUpdateTP_Comment"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objTP_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 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(); } else { ErrorHandler.ErrorPage(); } clsTP_Comment objComm = new clsTP_Comment(); objComm.TPId = Convert.ToInt32(strtpId); objComm.Comment = GlobalMethods.KillChars(txtComment.Text); objComm.CreatedDate = DateTime.Now; objComm.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objComm.IsActive = 1; if (!TP_CommentDAL.InsertTP_Comment(objComm)) { } #region Getting all the Comments by Application Id. StringBuilder strMessenger = new StringBuilder(""); List <clsTP_Comment> lstComments = new List <clsTP_Comment>(); lstComments = TP_CommentDAL.SelectDynamicTP_Comment("TPId = " + strtpId + "", "TPCommentId"); 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 clsTP_Comment SelectTP_CommentById(int?TPCommentId) { clsTP_Comment objTP_Comment = new clsTP_Comment(); bool isnull = true; string SpName = "usp_SelectTP_Comment"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(TPCommentId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@TPCommentId", TPCommentId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objTP_Comment = db.Query <clsTP_Comment>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objTP_Comment); } }