Beispiel #1
0
 public M_AdCategory GetModel(int AdCategoryId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@AdCategoryId", SqlDbType.Int, 4), new SqlParameter("@PageSize", SqlDbType.Int, 4), new SqlParameter("@PageIndex", SqlDbType.Int, 4), new SqlParameter("@WhereString", SqlDbType.NVarChar, 0x7d0) };
     commandParameters[0].Value = 1;
     commandParameters[1].Value = AdCategoryId;
     commandParameters[4].Value = "";
     M_AdCategory category = new M_AdCategory();
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_AdCategory_Get", commandParameters);
     category.AdCategoryId = AdCategoryId;
     if (table.Rows.Count > 0)
     {
         category.CategoryName = table.Rows[0]["CategoryName"].ToString();
         if (table.Rows[0]["IsDisabled"].ToString() != "")
         {
             category.IsDisabled = int.Parse(table.Rows[0]["IsDisabled"].ToString());
         }
         category.WidthHeigth = table.Rows[0]["WidthHeigth"].ToString();
         if (table.Rows[0]["DisplayType"].ToString() != "")
         {
             category.DisplayType = int.Parse(table.Rows[0]["DisplayType"].ToString());
         }
         category.Description = table.Rows[0]["Description"].ToString();
         return category;
     }
     return null;
 }
Beispiel #2
0
 private void ExcuteSet(int type, M_AdCategory model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@AdCategoryId", SqlDbType.Int, 4), new SqlParameter("@CategoryName", SqlDbType.NVarChar, 50), new SqlParameter("@IsDisabled", SqlDbType.Int, 4), new SqlParameter("@WidthHeigth", SqlDbType.VarChar, 12), new SqlParameter("@DisplayType", SqlDbType.Int, 4), new SqlParameter("@Description", SqlDbType.NVarChar, 50) };
     commandParameters[0].Value = type;
     commandParameters[1].Value = model.AdCategoryId;
     commandParameters[2].Value = (model.CategoryName == null) ? "" : model.CategoryName;
     commandParameters[3].Value = model.IsDisabled;
     commandParameters[4].Value = (model.WidthHeigth == null) ? "||" : model.WidthHeigth;
     commandParameters[5].Value = model.DisplayType;
     commandParameters[6].Value = (model.Description == null) ? "" : model.Description;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_AdCategory_Set", commandParameters);
 }
 /// <summary>
 /// 在修改时绑定数据
 /// </summary>
 void BindOnUpdate()
 {
     Model = Bll.GetModel(CategoryId);
     if (Model != null)
     {
         txtCategoryName.Text = Model.CategoryName;
         txtDescription.Text = Model.Description;
         string[] param = Model.WidthHeigth.Split('|');
         if (param.Length == 3)
         {
             txtHeigth.Text = param[1];
             txtWidth.Text = param[0];
             txtPer.Text = param[2];
         }
         rblDisplayType.SelectedIndex = Model.DisplayType - 1;
         rblIsDisable.SelectedIndex = Model.IsDisabled - 1;
         if (Model.DisplayType == 5)
         { TrMatrix.Attributes.Add("style","display:''"); }
     }
     else
     {
         Function.ShowSysMsg(0, "<li>没有获取到数据</li><li><a href='other/PushCategoryList.aspx'>返回广告位列表</a></li>");
     }
 }
Beispiel #4
0
 public void Update(M_AdCategory model)
 {
     this.dal.Update(model);
 }
Beispiel #5
0
 public void Add(M_AdCategory model)
 {
     this.dal.Add(model);
 }
Beispiel #6
0
 public void Update(M_AdCategory model)
 {
     this.ExcuteSet(2, model);
 }
Beispiel #7
0
 public void Delete(int AdCategoryId)
 {
     M_AdCategory model = new M_AdCategory();
     model.AdCategoryId = AdCategoryId;
     this.ExcuteSet(3, model);
 }
Beispiel #8
0
 public void Add(M_AdCategory model)
 {
     this.ExcuteSet(1, model);
 }