Exemplo n.º 1
0
        protected void Save()
        {
            YXShop.Model.Accessories.Top_Searches tsmodel = new YXShop.Model.Accessories.Top_Searches();
            YXShop.BLL.Accessories.Top_Searches   tsbll   = new YXShop.BLL.Accessories.Top_Searches();
            tsmodel.Name   = this.txtName.Text;
            tsmodel.Sort   = int.Parse(this.txtSort.Text);
            tsmodel.IsShow = int.Parse(this.rdolstIsShow.SelectedValue);
            tsmodel.LinkAd = this.txtLinkAd.Text;

            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";
                }
            }
        }
 private void sort(int id, int Sort)
 {
     YXShop.BLL.Accessories.Top_Searches bll = new YXShop.BLL.Accessories.Top_Searches();
     if (bll.Amend(id, "sort", Sort) > 0)
     {
         Response.Write("ok");
     }
 }
Exemplo n.º 3
0
 protected void BindInfo(int id)
 {
     YXShop.BLL.Accessories.Top_Searches   tsbll   = new YXShop.BLL.Accessories.Top_Searches();
     YXShop.Model.Accessories.Top_Searches tsmodel = tsbll.GetModelID(id);
     if (tsmodel != null)
     {
         this.txtName.Text = tsmodel.Name;
         this.txtSort.Text = tsmodel.Sort.ToString();
         this.rdolstIsShow.SelectedValue = tsmodel.IsShow.ToString();
         this.txtLinkAd.Text             = tsmodel.LinkAd;
     }
 }
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        protected string GetList()
        {
            SOSOshop.BLL.SysParameter           sp       = new SOSOshop.BLL.SysParameter();
            ChangeHope.WebPage.Table            table    = new ChangeHope.WebPage.Table();
            YXShop.BLL.Accessories.Top_Searches data     = new YXShop.BLL.Accessories.Top_Searches();
            ChangeHope.DataBase.DataByPage      dataPage = data.GetList();
            //第一步先添加表头
            table.AddHeadCol("10%", "序号");
            table.AddHeadCol("40%", "关键词");
            table.AddHeadCol("15%", "排序");
            table.AddHeadCol("20%", "状态");
            table.AddHeadCol("25%", "操作");
            table.AddRow();
            //添加表的内容
            if (dataPage.DataReader != null)
            {
                int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex");
                if (curpage < 0)
                {
                    curpage = 1;
                }
                int count = 0;
                while (dataPage.DataReader.Read())
                {
                    count++;
                    string No = (15 * (curpage - 1) + count).ToString();
                    table.AddCol("No." + No);
                    table.AddCol("<a href=\"" + dataPage.DataReader["linkad"].ToString() + "\">" + dataPage.DataReader["name"].ToString() + "</a>");
                    table.AddCol(string.Format("<input id='sort{0}' value='{1}' size='5' onblur='Sort({0},{1})'/>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["sort"].ToString()));
                    table.AddCol(string.Format("<img src='../images/{0}.gif'/>", dataPage.DataReader["isshow"].ToString()));
                    table.AddCol(string.Format("<a href=topsearchesseting_edit.aspx?id={0}>编辑</a> <a href='#' onclick='Del({0})'>删除</a>", dataPage.DataReader["id"].ToString()));

                    table.AddRow();
                }
            }
            string view = table.GetTable() + dataPage.PageToolBar;

            dataPage.Dispose();
            dataPage = null;
            return(view);
        }
 private void del(int id)
 {
     YXShop.BLL.Accessories.Top_Searches bll = new YXShop.BLL.Accessories.Top_Searches();
     bll.Delete(id);
     Response.Write("ok");
 }