private bool DoEdit(int id)
        {
            bool result = true;

            int    BrandsID   = id;
            string BrandsName = this.txtBrandsName.Text;
            int    SortIndex  = int.Parse(this.txtSortIndex.Text);
            string Remark     = this.txtRemark.Value;


            WebSiteModel.Brands model = new WebSiteModel.Brands();

            model.BrandsID   = BrandsID;
            model.BrandsName = BrandsName;
            model.SortIndex  = SortIndex;
            model.Remark     = Remark;

            WebSiteData.Brands bll = new WebSiteData.Brands();

            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }
        protected void btnMutil_Click(object sender, EventArgs e)
        {
            string[]           arr = this.txtBrandsName.Text.Split('|');
            WebSiteData.Brands dal = new WebSiteData.Brands();

            int n = 0;

            for (int i = 0; i < arr.Length; i++)
            {
                string BrandsName = arr[i];
                int    SortIndex  = int.Parse(this.txtSortIndex.Text);
                string Remark     = this.txtRemark.Value;

                WebSiteModel.Brands model = new WebSiteModel.Brands();

                model.BrandsName = BrandsName;
                model.SortIndex  = SortIndex;
                model.Remark     = Remark;


                n = dal.Add(model);

                if (n < 1)
                {
                    Response.Write("<span>添加失败了!</span>");
                    continue;
                }
                else
                {
                    Response.Write("<span>添加成功了!</span>");
                }
            }
        }
        private void ShowInfo(int BrandsID)
        {
            WebSiteData.Brands  bll   = new WebSiteData.Brands();
            WebSiteModel.Brands model = bll.GetModel(BrandsID);

            this.lblBrandsID.Text   = model.BrandsID.ToString();
            this.txtBrandsName.Text = model.BrandsName;
            this.txtSortIndex.Text  = model.SortIndex.ToString();
            this.txtRemark.Value    = model.Remark;
        }
Exemple #4
0
        /// <summary>
        /// 绑定品牌信息
        /// </summary>
        private void BrandsBind()
        {
            WebSiteData.Brands brands = new WebSiteData.Brands();

            //获得某一个站点所有的数据分类
            DataTable dt = brands.GetList("").Tables[0];

            this.ddBrands.Items.Clear();
            this.ddBrands.Items.Add(new ListItem("品牌信息", ""));//默认值是0

            foreach (DataRow dr in dt.Rows)
            {
                string Id    = dr["BrandsID"].ToString();
                string Title = dr["BrandsName"].ToString().Trim();
                this.ddBrands.Items.Add(new ListItem(Title, Id));
            }
        }
Exemple #5
0
        //保存排序
        protected void btnSaveSort_Click(object sender, EventArgs e)
        {
            WebSiteData.Brands bll = new WebSiteData.Brands();
            //在图文展示的情况下 rptList.Items.Count 数量为0 所以 不成功

            for (int i = 0; i < this.rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;

                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "SortIndex=" + sortId.ToString());
            }

            JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("BrandsList.aspx", urlParams, txtKeywords.Text), "Success");
        }
Exemple #6
0
        /// <summary>
        /// 组合查询的条件
        /// </summary>
        /// <param name="_strWhere">组合条件</param>
        /// <param name="_orderby"></param>
        private void RptBind(string _strWhere, string _orderby)
        {
            //得到第几页数据
            this.page = DTRequest.GetQueryInt("page", 1);

            //绑定关键字
            this.txtKeywords.Text = this.keywords;

            WebSiteData.Brands mdata = new WebSiteData.Brands();

            //参数分别是:每页条数  第几页  查询条件 排序条件 数据总数
            this.rptList.DataSource = mdata.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("BrandsList.aspx", urlParamsPage, this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
            litCount.Text         = this.totalCount.ToString();
        }
        private bool DoAdd()
        {
            bool result = true;

            string BrandsName = this.txtBrandsName.Text;
            int    SortIndex  = int.Parse(this.txtSortIndex.Text);
            string Remark     = this.txtRemark.Value;

            WebSiteModel.Brands model = new WebSiteModel.Brands();

            model.BrandsName = BrandsName;
            model.SortIndex  = SortIndex;
            model.Remark     = Remark;

            WebSiteData.Brands bll = new WebSiteData.Brands();

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
Exemple #8
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            bool bl = true;//标记变量

            WebSiteData.Brands bll = new WebSiteData.Brands();

            //遍历提交过来的对象集合
            for (int i = 0; i < this.rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");

                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        //将捕获代码的程序 放置在最底层
                        bl = true;
                    }
                    else
                    {
                        //表示其中有一个选项没有删除成功
                        bl = false;
                        Response.Write("出错的ID为" + id.ToString());
                        break;
                    }
                }
            }

            if (bl)
            {
                JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("BrandsList.aspx", urlParams, this.keywords), "Success");
            }
            else
            {
                JscriptMsg("批量删除操作中...有一个没有删除成功!", "back", "Error");
            }
        }