public static Boolean InsertUpdateSupervisor_Comment(clsSupervisor_Comment objSupervisor_Comment) { bool isAdded = false; string SpName = "usp_InsertUpdateSupervisor_Comment"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objSupervisor_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 strSupervisorId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strSupervisorId).Length > 0) { strSupervisorId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } else { ErrorHandler.ErrorPage(); } clsSupervisor_Comment objComm = new clsSupervisor_Comment(); objComm.SupervisorId = Convert.ToInt32(strSupervisorId); objComm.Comment = GlobalMethods.KillChars(txtComment.Text); objComm.CreatedDate = DateTime.Now; objComm.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objComm.IsActive = 1; if (!Supervisor_CommentDAL.InsertSupervisor_Comment(objComm)) { } #region Getting all the Comments by Application Id. StringBuilder strMessenger = new StringBuilder(""); List <clsSupervisor_Comment> lstComments = new List <clsSupervisor_Comment>(); lstComments = Supervisor_CommentDAL.SelectDynamicSupervisor_Comment("SupervisorId = " + strSupervisorId + "", "SupervisorCommentId"); 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 clsSupervisor_Comment SelectSupervisor_CommentById(int?SupervisorCommentId) { clsSupervisor_Comment objSupervisor_Comment = new clsSupervisor_Comment(); bool isnull = true; string SpName = "usp_SelectSupervisor_Comment"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(SupervisorCommentId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@SupervisorCommentId", SupervisorCommentId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objSupervisor_Comment = db.Query <clsSupervisor_Comment>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objSupervisor_Comment); } }