Exemplo n.º 1
0
        private void RptBind(int _category_id, string _strWhere, string _orderby)
        {
            this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);

            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = _category_id.ToString();
            }
            this.txtKeywords.Text      = this.keywords;
            this.ddlLock.SelectedValue = this.islock;
            //图表或列表显示
            BLL.good_template bll = new BLL.good_template();
            switch (this.prolistview)
            {
            case "Txt":
                this.rptList2.Visible    = false;
                this.rptList1.DataSource = bll.GetList(_category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
                this.rptList1.DataBind();
                break;

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

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 2
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_list", Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.good_template bll     = new BLL.good_template();
            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("template_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&islock={3}",
                                                                   this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.islock), "Success");
        }
Exemplo n.º 3
0
        private void ShowInfo(int _id)
        {
            BLL.good_template   bll   = new BLL.good_template();
            Model.good_template model = bll.GetModel(_id);

            if (model.pics.Count > 0)
            {
                foreach (Model.good_template_pic list in model.pics)
                {
                    if (list.typeId == 1)
                    {
                        txtPicUrl1.Text = list.picUrl;
                    }
                    else if (list.typeId == 2)
                    {
                        txtPicUrl2.Text = list.picUrl;
                    }
                    else if (list.typeId == 3)
                    {
                        txtPicUrl3.Text = list.picUrl;
                    }
                    else if (list.typeId == 4)
                    {
                        txtPicUrl4.Text = list.picUrl;
                    }
                    else if (list.typeId == 5)
                    {
                        txtPicUrl5.Text = list.picUrl;
                    }
                    else if (list.typeId == 6)
                    {
                        txtPicUrl6.Text = list.picUrl;
                    }
                }
            }
            if (!string.IsNullOrEmpty(model.img_url))
            {
                txtImgUrl.Text = model.img_url;
            }
            ddlCategoryId.SelectedValue = model.categoryId.ToString();
            txtAddTime.Text             = model.addTime.ToString("yyyy-MM-dd HH:mm:ss");
            txtName.Text               = model.name;
            txtRemark.Text             = model.remark;
            txtSortId.Text             = model.sort_id.ToString();
            rblIsLock.SelectedValue    = model.isLock.ToString();
            rblIsDefault.SelectedValue = model.isDefault.ToString();
            rblIsAd.SelectedValue      = model.isAd.ToString();
            //是广告位就显示广告位信息
            if (model.isAd == 1)
            {
                this.txtSortAd.Text = model.sort_ad.ToString();
                if (!string.IsNullOrEmpty(model.img_url1))
                {
                    txtImgUrl1.Text = model.img_url1;
                }
            }
            txtGoodId.Text = model.goodId.ToString();
        }
Exemplo 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.good_template bll     = new BLL.good_template();
            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("template_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&islock={3}",
                                                                                                       this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.islock), "Success");
        }
Exemplo n.º 5
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_list", Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.good_template   bll   = new BLL.good_template();
            Model.good_template model = bll.GetModel(id);
            switch (e.CommandName)
            {
            case "lbtnIsAd":
                if (model.isAd == 1)
                {
                    bll.UpdateField(id, "isAd=0");
                }
                else
                {
                    bll.UpdateField(id, "isAd=1");
                }
                break;
            }
            this.RptBind(this.category_id, "id>0" + CombSqlTxt(this.keywords, this.islock), "sort_id asc,addTime desc,id desc");
        }
Exemplo n.º 6
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.name       = txtName.Text.Trim();
            model.img_url    = txtImgUrl.Text;
            model.categoryId = Vincent._DTcms.Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            //内容摘要提取内容前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.sort_id   = Vincent._DTcms.Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.isLock    = Vincent._DTcms.Utils.StrToInt(this.rblIsLock.SelectedValue, 1);
            model.isDefault = Vincent._DTcms.Utils.StrToInt(this.rblIsDefault.SelectedValue, 0);
            #region  一主题只能有一个默认模板
            if (model.isDefault == 1)
            {
                bll.UpdateField("isDefault=0", "categoryId=" + model.categoryId);
            }
            #endregion
            model.addTime = Vincent._DTcms.Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.isAd    = Vincent._DTcms.Utils.StrToInt(this.rblIsAd.SelectedValue, 0);
            if (model.isAd == 1)
            {
                model.sort_ad  = Vincent._DTcms.Utils.StrToInt(txtSortAd.Text.Trim(), 1);
                model.img_url1 = this.txtImgUrl1.Text;
            }
            else
            {
                model.sort_ad = 0;
            }
            model.goodId = Vincent._DTcms.Utils.StrToInt(txtGoodId.Text.Trim(), 0);

            #region 保存图片====================
            List <Model.good_template_pic> ls = new List <Model.good_template_pic>();

            int[] arry = { 0, 0, 0, 0, 0, 0 };
            foreach (Model.good_template_pic m in model.pics)
            {
                int i = 1;
                if ((i + 1) == m.typeId)
                {
                    arry[i] = m.typeId;
                }
                i++;
            }
            if (!string.IsNullOrEmpty(txtPicUrl1.Text))
            {
                if (arry[0] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[0].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 1
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 1
                    });
                }
            }

            if (!string.IsNullOrEmpty(txtPicUrl2.Text))
            {
                if (arry[1] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[1].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl2.Text, typeId = 2
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl2.Text, typeId = 2
                    });
                }
            }

            if (!string.IsNullOrEmpty(txtPicUrl3.Text))
            {
                if (arry[2] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[2].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl3.Text, typeId = 3
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl3.Text, typeId = 3
                    });
                }
            }

            if (!string.IsNullOrEmpty(txtPicUrl4.Text))
            {
                if (arry[3] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[3].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl4.Text, typeId = 4
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl4.Text, typeId = 4
                    });
                }
            }

            if (!string.IsNullOrEmpty(txtPicUrl5.Text))
            {
                if (arry[4] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[4].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl5.Text, typeId = 5
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl5.Text, typeId = 5
                    });
                }
            }

            if (!string.IsNullOrEmpty(txtPicUrl6.Text))
            {
                if (arry[5] > 0)
                {
                    ls.Add(new Model.good_template_pic {
                        id = ls[5].id, templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl6.Text, typeId = 6
                    });
                }
                else
                {
                    ls.Add(new Model.good_template_pic {
                        templateId = model.id, addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl6.Text, typeId = 6
                    });
                }
            }


            model.pics = ls;

            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.name); //记录日志
                result = true;
            }
            return(result);
        }
Exemplo n.º 7
0
        private bool DoAdd()
        {
            bool result = false;

            Model.good_template model = new Model.good_template();
            BLL.good_template   bll   = new BLL.good_template();

            model.categoryId = Vincent._DTcms.Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.name       = txtName.Text.Trim();
            model.img_url    = txtImgUrl.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.sort_id   = Vincent._DTcms.Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.isLock    = Vincent._DTcms.Utils.StrToInt(this.rblIsLock.SelectedValue, 1);
            model.isDefault = Vincent._DTcms.Utils.StrToInt(this.rblIsDefault.SelectedValue, 0);
            #region  一主题只能有一个默认模板
            if (model.isDefault == 1)
            {
                bll.UpdateField("isDefault=0", "categoryId=" + model.categoryId);
            }
            #endregion
            model.addTime = Vincent._DTcms.Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.isAd    = Vincent._DTcms.Utils.StrToInt(this.rblIsAd.SelectedValue, 0);
            if (model.isAd == 1)
            {
                model.sort_ad  = Vincent._DTcms.Utils.StrToInt(txtSortAd.Text.Trim(), 1);
                model.img_url1 = this.txtImgUrl1.Text;
            }
            else
            {
                model.sort_ad = 0;
            }
            model.goodId = Vincent._DTcms.Utils.StrToInt(txtGoodId.Text.Trim(), 0);

            #region 保存图片====================

            List <Model.good_template_pic> ls = new List <Model.good_template_pic>();
            if (!string.IsNullOrEmpty(txtPicUrl1.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 1
                });
            }
            else if (!string.IsNullOrEmpty(txtPicUrl2.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 2
                });
            }
            else if (!string.IsNullOrEmpty(txtPicUrl3.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 3
                });
            }
            else if (!string.IsNullOrEmpty(txtPicUrl4.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 4
                });
            }
            else if (!string.IsNullOrEmpty(txtPicUrl5.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 5
                });
            }
            else if (!string.IsNullOrEmpty(txtPicUrl6.Text))
            {
                ls.Add(new Model.good_template_pic {
                    addTime = DateTime.Now, isLock = 0, picUrl = this.txtPicUrl1.Text, typeId = 6
                });
            }

            model.pics = ls;

            #endregion

            if (bll.Add(model) > 0)
            {
                AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "频道内容:" + model.name); //记录日志
                result = true;
            }
            return(result);
        }