private void LoadData()
 {
     FeedBack feedBack = new FeedBack();
     feedBack = FeedBackBLL.GetFeedBackByID(Request.QueryString["FeedBackID"].ToString())[0];
     lblFullName.Text = feedBack.FullName;
     lblEmail.Text = feedBack.Email;
     ltrContent.Text = feedBack.Content;
 }
Beispiel #2
0
 public FeedBack FeedBackIDatareader(IDataReader dr)
 {
     FeedBack obj = new FeedBack();
     obj.ID = (dr["ID"] is DBNull) ? string.Empty : dr["ID"].ToString();
     obj.FullName = (dr["FullName"] is DBNull) ? string.Empty : dr["FullName"].ToString();
     obj.Email = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString();
     obj.Content = (dr["Content"] is DBNull) ? string.Empty : dr["Content"].ToString();
     obj.CreateDate = (dr["CreateDate"] is DBNull) ? string.Empty : dr["CreateDate"].ToString();
     return obj;
 }
        public bool InsertFeedBack(FeedBack feedBack)
        {
            using (SqlCommand cmd = GetCommand("insertFeedBack", CommandType.StoredProcedure))
            {
                AddParameter(cmd, "@FullName", feedBack.FullName);
                AddParameter(cmd, "@Email", feedBack.Email);
                AddParameter(cmd, "@Content", feedBack.Content);

                int result = ExeNonQuery(cmd);
                return result > 0;
            }
        }
 public List<FeedBack> GetAllFeedBack()
 {
     List<FeedBack> list = new List<FeedBack>();
     using (SqlCommand cmd = GetCommand("getAllFeedBack", CommandType.StoredProcedure))
     {
         FeedBack feedBack = new FeedBack();
         using (SqlDataReader dr = ExeDataReader(cmd))
         {
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     list.Add(feedBack.FeedBackIDatareader(dr));
                 }
             }
         }
         feedBack = null;
     }
     return list;
 }
 public List<FeedBack> GetFeedBackByID(string id)
 {
     List<FeedBack> list = new List<FeedBack>();
     using (SqlCommand cmd = GetCommand("getFeedBackByID", CommandType.StoredProcedure))
     {
         AddParameter(cmd, "@ID", Convert.ToInt32(id));
         FeedBack feedBack = new FeedBack();
         using (SqlDataReader dr = ExeDataReader(cmd))
         {
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     list.Add(feedBack.FeedBackIDatareader(dr));
                 }
             }
         }
         feedBack = null;
     }
     return list;
 }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                FeedBack feedBack = new FeedBack();
                feedBack.FullName = txtFullName.Text;
                feedBack.Email = txtEmail.Text;
                feedBack.Content = txtContent.Text;

                bool result = FeedBackBLL.InsertFeedBack(feedBack);
                if (result)
                {
                    lblReport.Text = "Send feedback Successful!";
                    Response.AddHeader("REFRESH", "2;URL=Support.aspx");
                }
                else
                {
                    lblReport.Text = "Can't send feed back";
                }
            }
        }
 public static bool UpdateFeedBack(FeedBack feedBack)
 {
     return db.UpdateFeedBack(feedBack);
 }
 public static bool InsertFeedBack(FeedBack feedBack)
 {
     return db.InsertFeedBack(feedBack);
 }
 public List<FeedBack> SearchFeedBackByName(string name)
 {
     List<FeedBack> list = new List<FeedBack>();
     using (SqlCommand cmd = GetCommand("SearchFeedBackByName", CommandType.StoredProcedure))
     {
         AddParameter(cmd, "@FullName", name);
         FeedBack feedBack = new FeedBack();
         using (SqlDataReader dr = ExeDataReader(cmd))
         {
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     list.Add(feedBack.FeedBackIDatareader(dr));
                 }
             }
         }
         feedBack = null;
     }
     return list;
 }