protected void Save()
 {
     ShowShop.Model.Accessories.Top_Searches  tsmodel= new ShowShop.Model.Accessories.Top_Searches();
     ShowShop.BLL.Accessories.Top_Searches  tsbll= new ShowShop.BLL.Accessories.Top_Searches();
     tsmodel.Name = this.txtName.Text;
     tsmodel.Sort =int.Parse(this.txtSort.Text);
     tsmodel.IsShow =int.Parse(this.rdolstIsShow.SelectedValue);
     if (ViewState["id"] == null)
     {
         if (tsbll.Add(tsmodel) > 0)
         {
             this.txtName.Text = string.Empty;
             this.ltlMsg.Text = "操作成功,已保存该信息";
             this.pnlMsg.Visible = true;
             this.pnlMsg.CssClass = "actionOk";
         }
     }
     else
     {
         tsmodel.ID = Convert.ToInt32(ViewState["id"].ToString());
         if (tsbll.Update(tsmodel) > 0)
         {
             this.ltlMsg.Text = "操作成功,已修改该信息";
             this.pnlMsg.Visible = true;
             this.pnlMsg.CssClass = "actionOk";
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 返回数据
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 public ShowShop.Model.Accessories.Top_Searches GetModel(System.Data.DataRow row)
 {
     ShowShop.Model.Accessories.Top_Searches model = new ShowShop.Model.Accessories.Top_Searches();
     if (row != null)
     {
         model.ID = int.Parse(row["id"].ToString());
         model.Name = row["name"].ToString();
         model.Sort = int.Parse(row["sort"].ToString());
         model.IsShow = int.Parse(row["isshow"].ToString());
         return model;
     }
     else
     {
         return null;
     }
 }