Esempio n. 1
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page                  = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text      = this.keywords;
            this.ddlLock.SelectedValue = this.islock;
            //图表或列表显示
            BLL.brand bll = new BLL.brand();
            switch (this.prolistview)
            {
            case "Txt":
                this.rptList2.Visible    = false;
                this.rptList1.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
                this.rptList1.DataBind();
                break;

            default:
                this.rptList1.Visible    = false;
                this.rptList2.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
                this.rptList2.DataBind();
                break;
            }
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Vincent._DTcms.Utils.CombUrlTxt("brand_list.aspx", "channel_id={0}&keywords={1}&islock={2}&page={3}",
                                                             this.channel_id.ToString(), this.keywords, this.islock, "__id__");

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Esempio n. 2
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_list", Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.brand bll     = new BLL.brand();
            Repeater  rptList = new Repeater();

            switch (this.prolistview)
            {
            case "Txt":
                rptList = this.rptList1;
                break;

            default:
                rptList = this.rptList2;
                break;
            }
            for (int i = 0; i < 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, "sort_id=" + sortId.ToString());
            }
            AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "商品品牌排序"); //记录日志
            JscriptMsg("保存排序成功啦!", Vincent._DTcms.Utils.CombUrlTxt("brand_list.aspx", "channel_id={0}&keywords={1}&islock={2}",
                                                                   this.channel_id.ToString(), this.keywords, this.islock), "Success");
        }
Esempio n. 3
0
        private void ShowInfo(int _id)
        {
            BLL.brand   bll   = new BLL.brand();
            Model.brand model = bll.GetModel(_id);

            txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss");
            if (!string.IsNullOrEmpty(model.brandImgUrl))
            {
                txtBrandImgUrl.Text = model.brandImgUrl;
            }
            txtBrandName.Text       = model.brandName;
            txtRemark.Text          = model.remark;
            txtSortId.Text          = model.sort_id.ToString();
            rblIsLock.SelectedValue = model.isLock.ToString();
            //图片列表
            rptAlbumList.DataSource = model.brand_attach;
            rptAlbumList.DataBind();
        }
Esempio n. 4
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_list", Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                                                                           //成功数量
            int errorCount = 0;                                                                                           //失败数量

            BLL.brand bll     = new BLL.brand();
            Repeater  rptList = new Repeater();

            switch (this.prolistview)
            {
            case "Txt":
                rptList = this.rptList1;
                break;

            default:
                rptList = this.rptList2;
                break;
            }
            for (int i = 0; i < 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))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "品牌成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Vincent._DTcms.Utils.CombUrlTxt("brand_list.aspx", "channel_id={0}&keywords={1}&islock={2}",
                                                                                                       this.channel_id.ToString(), this.keywords, this.islock), "Success");
        }
Esempio n. 5
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.brand   bll   = new BLL.brand();
            Model.brand model = bll.GetModel(_id);

            model.brandName   = txtBrandName.Text.Trim();
            model.brandImgUrl = txtBrandImgUrl.Text;
            //内容摘要提取内容前500个字符
            if (!string.IsNullOrEmpty(txtRemark.Text.Trim()) && txtRemark.Text.Trim().Length > 500)
            {
                model.remark = Vincent._DTcms.Utils.DropHTML(txtRemark.Text, 500);
            }
            else
            {
                model.remark = txtRemark.Text;
            }
            model.isLock  = Vincent._DTcms.Utils.StrToInt(this.rblIsLock.SelectedValue, 1);
            model.sort_id = Vincent._DTcms.Utils.StrToInt(txtSortId.Text.Trim(), 99);
            int managerId = 0;

            if (IsAdminLogin())
            {
                managerId = GetAdminInfo().id;
            }
            model.managerId   = managerId;
            model.add_time    = Vincent._DTcms.Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.update_time = DateTime.Now;


            #region 保存相册====================
            //检查是否有自定义图片
            if (txtBrandImgUrl.Text.Trim() == "")
            {
                model.brandImgUrl = hidFocusPhoto.Value;
            }
            if (model.brand_attach != null)
            {
                model.brand_attach.Clear();
            }
            string[] albumArr    = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr   = Request.Form.GetValues("hid_photo_remark");
            string[] categoryArr = Request.Form.GetValues("hid_photo_category");
            string[] sizeArr     = Request.Form.GetValues("hid_photo_size");
            if (albumArr != null)
            {
                List <Model.brand_attach> ls = new List <Model.brand_attach>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = Vincent._DTcms.Utils.StrToInt(imgArr[0], 0);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.brand_attach {
                                brand_id     = _id,
                                theme_id     = Vincent._DTcms.Utils.StrToInt(categoryArr[i], 0),
                                img_url      = imgArr[1].Trim(),
                                small_imgurl = imgArr[2].Trim(),
                                remark       = remarkArr[i],
                                size         = sizeArr[i].Trim()
                            });
                        }
                        else
                        {
                            ls.Add(new Model.brand_attach {
                                brand_id     = _id,
                                theme_id     = Vincent._DTcms.Utils.StrToInt(categoryArr[i], 0),
                                img_url      = imgArr[1].Trim(),
                                small_imgurl = imgArr[2].Trim(),
                                size         = sizeArr[i].Trim()
                            });
                        }
                    }
                }
                model.brand_attach = ls;
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.brandName); //记录日志
                result = true;
            }

            return(result);
        }