Пример #1
0
 protected void Save()
 {
     ShowShop.BLL.Accessories.Leaveword bll = new ShowShop.BLL.Accessories.Leaveword();
     ShowShop.Model.Accessories.Leaveword model = new ShowShop.Model.Accessories.Leaveword();
     model.ID = Convert.ToInt32(ViewState["id"].ToString());
     model.Type = Convert.ToInt32(ViewState["type"].ToString());
     model.UserName = ViewState["username"].ToString();
     model.Telephone = ViewState["tel"].ToString();
     model.QQ = ViewState["qq"].ToString();
     model.MSN = ViewState["msn"].ToString();
     model.Email = ViewState["email"].ToString();
     model.IP = ViewState["ip"].ToString();
     model.IsRegUser = Convert.ToInt32(ViewState["isreg"].ToString());
     model.AddDate = Convert.ToDateTime(ViewState["adddate"].ToString());
     model.IsRead = Convert.ToInt32(ViewState["isread"].ToString());
     model.IsAuditing = Convert.ToInt32(ViewState["isauditing"].ToString());
     model.StoreId = Convert.ToInt32(ViewState["storeid"].ToString());
     //需要更新的信息
     model.Title = this.txtTitle.Text;
     model.IsReply = Convert.ToInt32(this.rabIsReply.SelectedValue);
     model.Content = this.txtContent.Text;
     model.ReplyContent = this.txtReplyContent.Text;
     model.ReplyDate = DateTime.Now;
     model.Address = ViewState["address"].ToString();
     bll.Amend(model);
     this.ltlMsg.Text = "操作成功,已回复该信息!";
     this.pnlMsg.Visible = true;
     this.pnlMsg.CssClass = "actionOk";
 }
Пример #2
0
 /// <summary>
 /// 得到一个实体
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ShowShop.Model.Accessories.Leaveword GetModelByID(int id)
 {
     ShowShop.Model.Accessories.Leaveword model = new ShowShop.Model.Accessories.Leaveword();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1 [id],[type],[username],[telephone],[qq],[msn],[email],[title],[ip],[isreguser],[content],[adddate],[isread],[replycontent],[isreply],[replydate],[isauditing],[storeid],[address] from yxs_leaveword ");
     strSql.Append(" where [id]=@id ");
     SqlParameter[] parameters = (SqlParameter[])this.ValueIDPara(id);
     using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString(), parameters))
     {
         if (reader.Read())
         {
             model.ID = reader.GetInt32(0);
             model.Type = reader.GetInt32(1);
             model.UserName = reader.GetString(2)==""?" ":reader.GetString(2);
             model.Telephone = reader.GetString(3)==""?" ":reader.GetString(3);
             model.QQ = reader.GetString(4) == "" ? " " : reader.GetString(4);
             model.MSN = reader.GetString(5) == "" ? " " : reader.GetString(5);
             model.Email = reader.GetString(6) == "" ? " " : reader.GetString(6);
             model.Title = reader.GetString(7)== ""?" ":reader.GetString(7);
             model.IP = reader.GetString(8) == ""? " " : reader.GetString(8);
             model.IsRegUser = reader.GetInt32(9);
             model.Content = reader.GetString(10) == ""? " " : reader.GetString(10);
             model.AddDate = reader.GetDateTime(11);
             model.IsRead = reader.GetInt32(12);
             model.ReplyContent = reader["replycontent"] == DBNull.Value ? " " : reader["replycontent"].ToString();
             model.IsReply = reader.GetInt32(14);
             model.ReplyDate = reader["replydate"] == DBNull.Value ? DateTime.Parse("0001-01-01") : Convert.ToDateTime(reader["replydate"]);
             model.IsAuditing = reader.GetInt32(16);
             model.StoreId = reader.GetInt32(17);
             model.Address = reader["address"] == DBNull.Value ? " " : reader["address"].ToString();
         }
     }
     return model;
 }
Пример #3
0
 /// <summary>
 /// 所有数据集合
 /// </summary>
 /// <returns></returns>
 public List<ShowShop.Model.Accessories.Leaveword> GetAll()
 {
     List<ShowShop.Model.Accessories.Leaveword> list = new List<ShowShop.Model.Accessories.Leaveword>();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select [id],[type],[username],[telephone],[qq],[msn],[email],[title],[ip],[isreguser],[content],[adddate],[isread],[replycontent],[isreply],[replydate],[isauditing],[storeid],[address] from yxs_leaveword ");
     strSql.Append(" where 1=1");
     using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString()))
     {
         while (reader.Read())
         {
             ShowShop.Model.Accessories.Leaveword model = new ShowShop.Model.Accessories.Leaveword();
             model.ID = reader.GetInt32(0);
             model.Type = reader.GetInt32(1);
             model.UserName = reader.GetString(2);
             model.Telephone = reader.GetString(3);
             model.QQ = reader.GetString(4);
             model.MSN = reader.GetString(5);
             model.Email = reader.GetString(6);
             model.Title = reader.GetString(7);
             model.IP = reader.GetString(8);
             model.IsRegUser = reader.GetInt32(9);
             model.Content = reader.GetString(10);
             model.AddDate = reader.GetDateTime(11);
             model.IsRead = reader.GetInt32(12);
             model.ReplyContent = reader.GetString(13);
             model.IsReply = reader.GetInt32(14);
             model.ReplyDate = reader.GetDateTime(15);
             model.IsAuditing = reader.GetInt32(16);
             model.StoreId = reader.GetInt32(17);
             model.Address = reader.GetString(18);
             list.Add(model);
         }
     }
     return list;
 }