public void AddCommentReport(CommentsReport coRe)
 {
     try
     {
         this.conn.Open();
         string cmdString = "INSERT INTO CommentsReport(CoReUsID, ReID, CoReTitle, CoReContent, CoReCreateDate)";
         // Columns Value
         cmdString += " VALUES(@CoReUsIDN, @ReIDN, @CoReTitleN,@CoReContentN, @CoReCreateDateN)";
         this.command = new SqlCommand(cmdString, conn);
         // Add Values
         this.command.Parameters.AddWithValue("@CoReUsIDN", coRe.coReUsID);
         this.command.Parameters.AddWithValue("@ReIDN", coRe.reID);
         this.command.Parameters.AddWithValue("@CoReTitleN", coRe.coReTitle);
         this.command.Parameters.AddWithValue("@CoReContentN", coRe.coReContent);
         this.command.Parameters.AddWithValue("@CoReCreateDateN", coRe.coReCreateTime);
         this.command.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         this.conn.Close();
     }
 }
 protected void commentReport_Click(object sender, EventArgs e)
 {
     string currentUserID = HttpContext.Current.Session["UsID"].ToString();
     CommentsReport coRe = new CommentsReport(Int32.Parse(currentUserID), Int32.Parse(currentReportID),
         titleComment.Value, contentComment.Value, DateTime.Now);
     this.dbm.AddCommentReport(coRe);
     Response.Redirect("DLT-CommentsReport.aspx");
 }
        public List<CommentsReport> ListCommentDetailsForPVC(string pvcID)
        {
            DataTable dt;
            List<CommentsReport> coReList = new List<CommentsReport>();
            try
            {
                dt = new DataTable();
                this.conn.Open();
                string cmdString = "SELECT coRe.*, re.UsCreateID, c.CoCM";
                cmdString += " FROM CommentsReport coRe";
                cmdString += " LEFT JOIN Reports re ON coRe.ReID = re.ReID";
                cmdString += " LEFT JOIN Courses c ON re.CoID = c.CoID";
                cmdString += " LEFT JOIN Faculties f ON f.FaID = c.FaID";
                cmdString += " WHERE f.FaPVC ='" + pvcID + "' ";
                this.command = new SqlCommand(cmdString, conn);
                dt.Load(this.command.ExecuteReader());
                if (dt.Rows.Count > 0)
                {

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int coReID = Convert.ToInt32(dt.Rows[i]["CoReID"]);
                        int coReUsID = Convert.ToInt32(dt.Rows[i]["CoReUsID"]);
                        int reID = Convert.ToInt32(dt.Rows[i]["ReID"]);
                        string coReTitle = dt.Rows[i]["CoReTitle"].ToString();
                        string coReContent = dt.Rows[i]["CoReContent"].ToString();

                        DateTime coReCreateDate;
                        DateTime.TryParse(dt.Rows[i]["CoReCreateDate"].ToString(), out coReCreateDate);
                        CommentsReport coRe = new CommentsReport(coReID, coReUsID, reID, coReTitle, coReContent, coReCreateDate);
                        coReList.Add(coRe);
                    }

                }
                return coReList;
            }
            catch (Exception)
            {
                return null;
                throw;
            }
            finally
            {
                this.conn.Close();
            }
        }
        public List<CommentsReport> ListCommentDetailsForDLT(string dltID)
        {
            DataTable dt;
            List<CommentsReport> coReList = new List<CommentsReport>();
            try
            {
                dt = new DataTable();
                this.conn.Open();
                string cmdString = "SELECT *";
                cmdString += " FROM CommentsReport";
                cmdString += " WHERE CoReUsID ='" + dltID + "' ";
                this.command = new SqlCommand(cmdString, conn);
                dt.Load(this.command.ExecuteReader());
                if (dt.Rows.Count > 0)
                {

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int coReID = Convert.ToInt32(dt.Rows[i]["CoReID"]);
                        int coReUsID = Convert.ToInt32(dt.Rows[i]["CoReUsID"]);
                        int reID = Convert.ToInt32(dt.Rows[i]["ReID"]);
                        string coReTitle = dt.Rows[i]["CoReTitle"].ToString();
                        string coReContent = dt.Rows[i]["CoReContent"].ToString();

                        DateTime coReCreateDate;
                        DateTime.TryParse(dt.Rows[i]["CoReCreateDate"].ToString(), out coReCreateDate);
                        CommentsReport coRe = new CommentsReport(coReID, coReUsID, reID, coReTitle, coReContent, coReCreateDate);
                        coReList.Add(coRe);
                    }

                }
                return coReList;
            }
            catch (Exception)
            {
                return null;
                throw;
            }
            finally
            {
                this.conn.Close();
            }
        }