Example #1
0
        public static bool Insert(int UserID, int CommentTypeID, COM.Enum.CommentTypeCode CommentTypeCode, string CommentDetailOriginal, string CommentByName, string CommentByMail, bool IsNotifyMe)
        {
            SqlConnection conn = DBHelper.getConnection();

            try
            {
                SqlParameter[] pParms = new SqlParameter[7];
                if (UserID == 0)
                {
                    pParms[0] = new SqlParameter("@UserID", DBNull.Value);
                }
                else
                {
                    pParms[0] = new SqlParameter("@UserID", UserID);
                }
                pParms[1] = new SqlParameter("@CommentTypeID", CommentTypeID);
                pParms[2] = new SqlParameter("@CommentTypeCode", (int)CommentTypeCode);
                pParms[3] = new SqlParameter("@CommentDetailOriginal", Util.r(CommentDetailOriginal));
                pParms[4] = new SqlParameter("@CommentByName", Util.r(CommentByName));
                pParms[5] = new SqlParameter("@CommentByMail", Util.r(CommentByMail));
                pParms[6] = new SqlParameter("@IsNotifyMe", IsNotifyMe);

                SqlHelper.ExecuteNonQuery(conn, "CommentsIn", pParms);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #2
0
        public static DataTable GetComments(int CommentTypeID, COM.Enum.CommentTypeCode CommentTypeCode)
        {
            SqlConnection conn = DBHelper.getConnection();

            try
            {
                return(SqlHelper.ExecuteDataset(conn, "GetComments",
                                                new SqlParameter("@CommentTypeID", CommentTypeID),
                                                new SqlParameter("@CommentTypeCode", (int)CommentTypeCode)
                                                ).Tables[0]);
            }
            catch (Exception)
            {
                return(null);
            }
        }