public static Boolean UpdateContractor_Comment(clsContractor_Comment objContractor_Comment) { bool isUpdated = false; string SpName = "usp_UpdateContractor_Comment"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objContractor_Comment, commandType: CommandType.StoredProcedure); } isUpdated = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isUpdated); }
protected void CommentEnter(object sender, EventArgs e) { string strSPContractorID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strSPContractorID).Length > 0) { strSPContractorID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } else { ErrorHandler.ErrorPage(); } clsContractor_Comment objComm = new clsContractor_Comment(); objComm.SPContractorID = Convert.ToInt32(strSPContractorID); objComm.Comment = GlobalMethods.KillChars(txtComment.Text); objComm.CreatedDate = DateTime.Now; objComm.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objComm.IsActive = 1; if (!Contractor_CommentDAL.InsertContractor_Comment(objComm)) { } #region Getting all the Comments by Application Id. StringBuilder strMessenger = new StringBuilder(""); List <clsContractor_Comment> lstComments = new List <clsContractor_Comment>(); lstComments = Contractor_CommentDAL.SelectDynamicContractor_Comment("SPContractorID = " + strSPContractorID + "", "ContractorCommentId"); 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 clsContractor_Comment SelectContractor_CommentById(int?ContractorCommentId) { clsContractor_Comment objContractor_Comment = new clsContractor_Comment(); bool isnull = true; string SpName = "usp_SelectContractor_Comment"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(ContractorCommentId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@ContractorCommentId", ContractorCommentId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objContractor_Comment = db.Query <clsContractor_Comment>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objContractor_Comment); } }