コード例 #1
0
ファイル: channel.cs プロジェクト: yi724926089/MyWx
 /// <summary>
 /// 返回频道列表
 /// </summary>
 /// <param name="category_id">频道类别ID</param>
 /// <returns>DataTable</returns>
 protected DataTable get_channel_list(int categoryid)
 {
     DataTable dt = new DataTable();
     BLL.channel bll = new BLL.channel();
     dt = bll.GetList(0, "category_id=" + categoryid, "sort_id asc,id desc").Tables[0];
     return dt;
 }
コード例 #2
0
        private void TreeBind()
        {
            BLL.channel bll = new BLL.channel();
            DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            this.ddlChannel.Items.Clear();
            this.ddlChannel.Items.Add(new ListItem("不属于频道", ""));
            foreach (DataRow dr in dt.Rows)
            {
                this.ddlChannel.Items.Add(new ListItem(dr["title"].ToString(), dr["name"].ToString()));
            }
        }
コード例 #3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = MXRequest.GetQueryInt("page", 1);
            ddlCategoryId.SelectedValue = this.category_id.ToString();
            txtKeywords.Text = this.keywords;
            BLL.channel bll = new BLL.channel();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("channel_list.aspx", "category_id={0}&keywords={1}&page={2}", this.category_id.ToString(), this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #4
0
ファイル: builder_html.aspx.cs プロジェクト: yi724926089/MyWx
 //嵌套绑定
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     BLL.channel bll = new BLL.channel();
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Repeater rptChannel = (Repeater)e.Item.FindControl("rptChannel");
         //找到分类Repeater关联的数据项
         DataRowView drv = (DataRowView)e.Item.DataItem;
         //提取分类ID
         int categoryId = Convert.ToInt32(drv["id"]);
         //根据分类ID查询并绑定所属频道
         rptChannel.DataSource = bll.GetList(0, "category_id=" + categoryId, "sort_id asc,id desc");
         rptChannel.DataBind();
     }
 }
コード例 #5
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("site_channel_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.channel bll = new BLL.channel();
     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.UpdateSort(id, sortId);
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存频道排序"); //记录日志
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("channel_list.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success", "parent.loadMenuTree");
 }
コード例 #6
0
ファイル: category_list.aspx.cs プロジェクト: LutherW/MTMS
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("site_channel_category", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.channel_category bll = new BLL.channel_category();
     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)
         {
             //检查该分类下是否还有频道
             int channelCount = new BLL.channel().GetCount("category_id=" + id);
             if (channelCount > 0)
             {
                 errorCount += 1;
                 continue;
             }
             Model.channel_category model = bll.GetModel(id);
             //删除成功后对应的目录及文件
             if (bll.Delete(id))
             {
                 sucCount += 1;
                 Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + model.build_path);
                 Utils.DeleteDirectory(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + model.build_path);
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除频道分类成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("category_list.aspx", "keywords={0}", this.keywords), "Success", "parent.loadMenuTree");
 }
コード例 #7
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("site_channel_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.channel bll = new BLL.channel();
     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)
         {
             //检查该频道下是否还有文章
             int articleCount = new BLL.article().GetCount("channel_id=" + id);
             if (articleCount > 0)
             {
                 errorCount += 1;
                 continue;
             }
             Model.channel model = bll.GetModel(id);
             if (bll.Delete(id))
             {
                 sucCount += 1;
                 //删除URL配置
                 new BLL.url_rewrite().Remove("channel", model.name);
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除频道成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("channel_list.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success", "parent.loadMenuTree");
 }
コード例 #8
0
ファイル: search.cs プロジェクト: LutherW/MTMS
 //查找匹配的URL
 private string get_url_rewrite(int channel_id, string call_index, int id)
 {
     if (channel_id == 0)
     {
         return string.Empty;
     }
     string querystring = id.ToString();
     string channel_name = new BLL.channel().GetChannelName(channel_id);
     if (string.IsNullOrEmpty(channel_name))
     {
         return string.Empty;
     }
     if (!string.IsNullOrEmpty(call_index))
     {
         querystring = call_index;
     }
     BLL.url_rewrite bll = new BLL.url_rewrite();
     Model.url_rewrite model = bll.GetInfo(channel_name, "detail");
     if (model != null)
     {
         return linkurl(model.name, querystring);
     }
     return string.Empty;
 }
コード例 #9
0
        private void ShowSysField(int _channel_id)
        {
            //查找该频道所选的默认字段
            List<Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=1");
            foreach (Model.article_attribute_field modelt in ls)
            {
                //查找相应的控件,如找到则显示
                HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl;
                if (htmlDiv != null)
                {
                    htmlDiv.Visible = true;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text = modelt.title;
                    ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text = modelt.valid_tip_msg;
                }
            }
            //查找该频道所开启的功能
            Model.channel channelModel = new BLL.channel().GetModel(_channel_id);
            if (channelModel.is_albums == 1)
            {
                div_albums_container.Visible = true;
            }
            if (channelModel.is_attach == 1)
            {
                div_attach_container.Visible = true;
            }
            if (channelModel.is_group_price == 1)
            {

            }
        }
コード例 #10
0
        private void ShowInfo(int _id)
        {
            BLL.channel bll = new BLL.channel();
            Model.channel model = bll.GetModel(_id);

            txtTitle.Text = model.title;
            txtName.Text = model.name;
            txtName.Focus(); //设置焦点,防止JS无法提交
            txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_name_validate&old_channel_name=" + Utils.UrlEncode(model.name));
            ddlSiteId.SelectedValue = model.site_id.ToString();
            if (model.is_albums == 1)
            {
                cbIsAlbums.Checked = true;
            }
            if (model.is_attach == 1)
            {
                cbIsAttach.Checked = true;
            }
            if (model.is_spec == 1)
            {
                cbIsSpec.Checked = true;
            }
            txtSortId.Text = model.sort_id.ToString();

            //赋值扩展字段
            if (model.channel_fields != null)
            {
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值
                    Model.channel_field modelt = model.channel_fields.Find(p => p.field_id == int.Parse(fieldIdArr[1])); //查找对应的字段ID
                    if (modelt != null)
                    {
                        cblAttributeField.Items[i].Selected = true;
                    }
                }
            }

            //绑定URL配置列表
            rptList.DataSource = new BLL.url_rewrite().GetList(model.name);
            rptList.DataBind();
        }
コード例 #11
0
        private bool DoEdit(int _id)
        {
            BLL.channel bll = new BLL.channel();
            Model.channel model = bll.GetModel(_id);

            string old_name = model.name;
            model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0);
            model.name = txtName.Text.Trim();
            model.title = txtTitle.Text.Trim();
            model.is_albums = 0;
            model.is_attach = 0;
            model.is_spec = 0;
            if (cbIsAlbums.Checked == true)
            {
                model.is_albums = 1;
            }
            if (cbIsAttach.Checked == true)
            {
                model.is_attach = 1;
            }
            if (cbIsSpec.Checked == true)
            {
                model.is_spec = 1;
            }
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            //添加频道扩展字段
            List<Model.channel_field> ls = new List<Model.channel_field>();
            for (int i = 0; i < cblAttributeField.Items.Count; i++)
            {
                if (cblAttributeField.Items[i].Selected)
                {
                    string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值
                    ls.Add(new Model.channel_field { channel_id = model.id, field_id = Utils.StrToInt(fieldIdArr[1], 0) });
                }
            }
            model.channel_fields = ls;

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

            #region 保存URL配置
            BLL.url_rewrite urlBll = new BLL.url_rewrite();
            urlBll.Remove("channel", old_name); //先删除旧的
            string[] itemTypeArr = Request.Form.GetValues("item_type");
            string[] itemNameArr = Request.Form.GetValues("item_name");
            string[] itemPageArr = Request.Form.GetValues("item_page");
            string[] itemTempletArr = Request.Form.GetValues("item_templet");
            string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize");
            string[] itemRewriteArr = Request.Form.GetValues("item_rewrite");

            if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length)
                    && (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        Model.url_rewrite urlModel = new Model.url_rewrite();
                        urlModel.name = itemNameArr[i].Trim();
                        urlModel.type = itemTypeArr[i].Trim();
                        urlModel.page = itemPageArr[i].Trim();
                        urlModel.inherit = GetInherit(urlModel.type);
                        urlModel.templet = itemTempletArr[i].Trim();
                        if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0)
                        {
                            urlModel.pagesize = itemPageSizeArr[i].Trim();
                        }
                        urlModel.channel = model.name;

                        List<Model.url_rewrite_item> itemLs = new List<Model.url_rewrite_item>();
                        string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串
                        for (int j = 0; j < urlRewriteArr.Length; j++)
                        {
                            string[] urlItemArr = urlRewriteArr[j].Split(',');
                            if (urlItemArr.Length == 3)
                            {
                                itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] });
                            }
                        }
                        urlModel.url_rewrite_items = itemLs;
                        urlBll.Add(urlModel);
                    }
                }
            }
            #endregion

            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改频道" + model.title); //记录日志
            return true;
        }
コード例 #12
0
ファイル: article_category.cs プロジェクト: rockhe168/CMS
 /// <summary>
 /// 取得该频道下所有类别列表
 /// </summary>
 /// <param name="parent_id">父ID</param>
 /// <param name="channel_name">频道名称</param>
 /// <returns>DataTable</returns>
 public DataTable GetList(int parent_id, string channel_name)
 {
     int channel_id = new BLL.channel().GetChannelId(channel_name);
     return dal.GetList(parent_id, channel_id);
 }
コード例 #13
0
 private void channel_validate(HttpContext context)
 {
     string channel_name = MXRequest.GetString("param");
     string old_channel_name = MXRequest.GetString("old_channel_name");
     if (string.IsNullOrEmpty(channel_name))
     {
         context.Response.Write("{ \"info\":\"频道名称不可为空!\", \"status\":\"n\" }");
         return;
     }
     if (channel_name.ToLower() == old_channel_name.ToLower())
     {
         context.Response.Write("{ \"info\":\"该名称可使用\", \"status\":\"y\" }");
         return;
     }
     BLL.channel bll = new BLL.channel();
     if (bll.Exists(channel_name))
     {
         context.Response.Write("{ \"info\":\"该名称已被占用,请更换!\", \"status\":\"n\" }");
         return;
     }
     context.Response.Write("{ \"info\":\"该名称可使用\", \"status\":\"y\" }");
     return;
 }
コード例 #14
0
ファイル: channel.cs プロジェクト: mychun/youcheng
        /// <summary>
        /// 文章列表
        /// </summary>
        /// <param name="channel_name">频道名称</param>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        protected DataTable get_channel_list(int top, string strwhere)
        {
            DataTable dt = new BLL.channel().GetList(top, strwhere, "sort_id asc").Tables[0];

            return(dt);
        }
コード例 #15
0
        private bool DoEdit(int _id)
        {
            BLL.channel   bll   = new BLL.channel();
            Model.channel model = bll.GetModel(_id);

            string old_name = model.name;

            model.category_id    = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.name           = txtName.Text.Trim();
            model.title          = txtTitle.Text.Trim();
            model.is_albums      = 0;
            model.is_attach      = 0;
            model.is_group_price = 0;
            if (cbIsAlbums.Checked == true)
            {
                model.is_albums = 1;
            }
            if (cbIsAttach.Checked == true)
            {
                model.is_attach = 1;
            }
            if (cbIsGroupPrice.Checked == true)
            {
                model.is_group_price = 1;
            }
            model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10);
            model.sort_id   = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            //添加频道扩展字段
            List <Model.channel_field> ls = new List <Model.channel_field>();

            for (int i = 0; i < cblAttributeField.Items.Count; i++)
            {
                if (cblAttributeField.Items[i].Selected)
                {
                    ls.Add(new Model.channel_field {
                        channel_id = model.id, field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0)
                    });
                }
            }
            model.channel_fields = ls;

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

            #region 保存URL配置
            BLL.url_rewrite urlBll = new BLL.url_rewrite();
            urlBll.Remove("channel", old_name); //先删除旧的
            string[] itemTypeArr    = Request.Form.GetValues("item_type");
            string[] itemNameArr    = Request.Form.GetValues("item_name");
            string[] itemPageArr    = Request.Form.GetValues("item_page");
            string[] itemTempletArr = Request.Form.GetValues("item_templet");
            string[] itemRewriteArr = Request.Form.GetValues("item_rewrite");

            if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemRewriteArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) &&
                    (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemRewriteArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        Model.url_rewrite urlModel = new Model.url_rewrite();
                        urlModel.name    = itemNameArr[i].Trim();
                        urlModel.type    = itemTypeArr[i].Trim();
                        urlModel.page    = itemPageArr[i].Trim();
                        urlModel.inherit = GetInherit(urlModel.type);
                        urlModel.templet = itemTempletArr[i].Trim();
                        urlModel.channel = model.name;

                        List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>();
                        string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串
                        for (int j = 0; j < urlRewriteArr.Length; j++)
                        {
                            string[] urlItemArr = urlRewriteArr[j].Split(',');
                            if (urlItemArr.Length == 3)
                            {
                                itemLs.Add(new Model.url_rewrite_item {
                                    path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2]
                                });
                            }
                        }
                        urlModel.url_rewrite_items = itemLs;
                        urlBll.Add(urlModel);
                    }
                }
            }
            #endregion

            AddAdminLog(AXEnums.ActionEnum.Edit.ToString(), "修改频道" + model.title); //记录日志
            return(true);
        }
コード例 #16
0
        /// <summary>
        /// 索引数据
        /// </summary>
        private void CreateSearchIndex(HttpContext context)
        {
            //检查权限
            if (!new BLL.manager_role().Exists(adminInfo.role_id, "lucene_index", DTEnums.ActionEnum.Build.ToString()))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认订单的权限!\"}");
                return;
            }
            bool   hasnew    = false;
            int    is_create = DTRequest.GetQueryInt("create");
            int    is_lock   = is_create;
            string strWhere  = "status=0";

            BLL.article               bll  = new BLL.article();
            BLL.channel               chl  = new BLL.channel();
            BLL.luceneconfig          xml  = new BLL.luceneconfig();
            List <Model.luceneconfig> list = xml.Load();

            foreach (Model.luceneconfig model in list)
            {
                if (!chl.Exists(model.name))
                {
                    continue;
                }
                if (is_create == 0)
                {
                    strWhere += " and id >" + model.id.ToString();
                }
                if (model.status == 1)
                {
                    DataTable dt     = bll.GetList(model.name, 1000, strWhere, "id asc").Tables[0];
                    int       _count = dt.Rows.Count;
                    if (_count > 0)
                    {
                        int count = 0;
                        hasnew = true;
                        LuceneHelper.CreateIndex(LuceneHelper.INDEX_DIR, is_lock);
                        LuceneHelper.MaxMergeFactor = 301;
                        LuceneHelper.MinMergeDocs   = 301;
                        string     _maxid = dt.Rows[_count - 1]["ID"].ToString();
                        SearchItem item   = null;
                        if (is_lock > 0)
                        {
                            is_lock = 0;
                        }
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            item             = new SearchItem();
                            item.id          = Utils.StrToInt(dt.Rows[j]["id"].ToString(), 0);
                            item.site_id     = Utils.StrToInt(dt.Rows[j]["site_id"].ToString(), 0);
                            item.channel_id  = Utils.StrToInt(dt.Rows[j]["channel_id"].ToString(), 0);
                            item.category_id = Utils.StrToInt(dt.Rows[j]["category_id"].ToString(), 0);
                            item.title       = dt.Rows[j]["title"].ToString();
                            //if (dt.Columns.Contains("sub_title"))
                            //{
                            //    item.sub_title = dt.Rows[j]["sub_title"].ToString();
                            //}
                            //else
                            //{
                            //    item.sub_title = "";
                            //}
                            item.call_index = dt.Rows[j]["call_index"].ToString();
                            item.tags       = dt.Rows[j]["tags"].ToString();
                            item.img_url    = dt.Rows[j]["img_url"].ToString();
                            //item.zhaiyao = dt.Rows[j]["zhaiyao"].ToString();
                            item.zhaiyao = Utils.DropHTML(dt.Rows[j]["content"].ToString());
                            //if (dt.Columns.Contains("market_price"))
                            //{
                            //    item.market_price = Utils.StrToDecimal(dt.Rows[j]["market_price"].ToString(), 0);
                            //}
                            //else
                            //{
                            //    item.market_price = 0;
                            //}
                            //if (dt.Columns.Contains("sell_price"))
                            //{
                            //    item.sell_price = Utils.StrToInt(dt.Rows[j]["sell_price"].ToString(), 0);
                            //}
                            //else
                            //{
                            //    item.sell_price = 0;
                            //}
                            //item.is_top = Utils.StrToInt(dt.Rows[j]["is_top"].ToString(), 0);
                            //item.is_red = Utils.StrToInt(dt.Rows[j]["is_red"].ToString(), 0);
                            //item.is_hot = Utils.StrToInt(dt.Rows[j]["is_hot"].ToString(), 0);
                            item.add_time    = DateTime.Parse(dt.Rows[j]["add_time"].ToString());
                            item.update_time = Utils.StrToDateTime(dt.Rows[j]["update_time"].ToString(), item.add_time);
                            LuceneHelper.IndexString(LuceneHelper.INDEX_DIR, item).ToString();
                            count++;
                            if (count % 300 == 0)
                            {
                                LuceneHelper.CloseWithoutOptimize();
                                LuceneHelper.CreateIndex(LuceneHelper.INDEX_DIR, 0);
                                LuceneHelper.MaxMergeFactor = 301;
                                LuceneHelper.MinMergeDocs   = 301;
                            }
                        }
                        xml.Update("Lucene/" + model.name + "/lastid", _maxid);
                        xml.Update("Lucene/" + model.name + "/lasttime", System.DateTime.Now.ToString());
                        xml.Save();
                        LuceneHelper.Close();
                    }
                }
            }
            if (hasnew)
            {
                JsonHelper.WriteJson(context, new
                {
                    status = 2,
                    msg    = "再去追加一次吧"
                });
            }
            else
            {
                JsonHelper.WriteJson(context, new
                {
                    status = 1,
                    msg    = "索引更新完成"
                });
            }
        }
コード例 #17
0
ファイル: reset.aspx.cs プロジェクト: sfwjiao/MyTestProject
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["debug"] == "1qaz@WSX")
                {

                    BLL.article articleBll = new BLL.article();
                    lblLogs.Text += articleBll.RestoreDefault() ? "article_albums表已重置。<br />article表已重置。" : "article_albums表重置失败!<br />article表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attach attachBll = new BLL.article_attach();
                    lblLogs.Text += attachBll.RestoreDefault() ? "article_attach表已重置。" : "article_attach表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attribute_field aafiledBll = new BLL.article_attribute_field();
                    lblLogs.Text += aafiledBll.RestoreDefault() ? "article_attribute_field表已重置。<br />article_attribute_value表已重置。" : "article_attribute_field表重置失败!<br />article_attribute_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_category categoryBll = new BLL.article_category();
                    lblLogs.Text += categoryBll.RestoreDefault() ? "article_category表已重置。" : "article_category表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_comment commentBll = new BLL.article_comment();
                    lblLogs.Text += commentBll.RestoreDefault() ? "article_comment表已重置。" : "article_comment表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel channelBll = new BLL.channel();
                    lblLogs.Text += channelBll.RestoreDefault() ? "channel表已重置。<br />channel_field表已重置。" : "channel表重置失败!<br />channel_field表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel_site siteBll = new BLL.channel_site();
                    lblLogs.Text += siteBll.RestoreDefault() ? "channel_site表已重置。" : "channel_site表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.express expressBll = new BLL.express();
                    lblLogs.Text += expressBll.RestoreDefault() ? "express表已重置。<br />feedback表已重置。<br />link表已重置。" : "express表重置失败!feedback表重置失败!<br />link表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager managerBll = new BLL.manager();
                    lblLogs.Text += managerBll.RestoreDefault() ? "manager表已重置。" : "manager表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_log logBll = new BLL.manager_log();
                    lblLogs.Text += logBll.RestoreDefault() ? "manager_log表已重置。" : "manager_log表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_role roleBll = new BLL.manager_role();
                    lblLogs.Text += roleBll.RestoreDefault() ? "manager_role表已重置。<br />manager_role_value表已重置。" : "manager_role表重置失败!<br />manager_role_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.orders ordersBll = new BLL.orders();
                    lblLogs.Text += ordersBll.RestoreDefault() ? "order_goods表已重置。<br />orders表已重置。" : "order_goods表重置失败!<br />orders表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.navigation navigationBll = new BLL.navigation();
                    lblLogs.Text += navigationBll.RestoreDefault() ? "navigation表已重置。" : "navigation表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.users usersBll = new BLL.users();
                    lblLogs.Text += usersBll.RestoreDefault() ? "users表已重置。" : "users表重置失败!";
                    lblLogs.Text += "<br />";
                }
                else
                {
                    lblLogs.Text = "没有权限!";
                }
            }
        }
コード例 #18
0
ファイル: article.cs プロジェクト: xuxiaolei/DTCMS
        /// <summary>
        /// 根据视图获得查询分页数据
        /// </summary>
        public DataSet GetSearch(int channel_id, int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            string channel_name = new BLL.channel().GetName(channel_id);

            return(dal.GetSearch(channel_name, pageSize, pageIndex, strWhere, filedOrder, out recordCount));
        }
コード例 #19
0
        private bool DoAdd()
        {
            Model.channel model = new Model.channel();
            BLL.channel   bll   = new BLL.channel();

            model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0);
            model.name    = txtName.Text.Trim();
            model.title   = txtTitle.Text.Trim();
            if (cbIsAlbums.Checked == true)
            {
                model.is_albums = 1;
            }
            if (cbIsAttach.Checked == true)
            {
                model.is_attach = 1;
            }
            if (cbIsSpec.Checked == true)
            {
                model.is_spec = 1;
            }
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            //添加频道扩展字段
            List <Model.channel_field> ls = new List <Model.channel_field>();

            for (int i = 0; i < cblAttributeField.Items.Count; i++)
            {
                if (cblAttributeField.Items[i].Selected)
                {
                    string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值
                    ls.Add(new Model.channel_field {
                        field_id = Utils.StrToInt(fieldIdArr[1], 0)
                    });
                }
            }
            model.channel_fields = ls;

            if (bll.Add(model) < 1)
            {
                return(false);
            }

            #region 保存URL配置
            BLL.url_rewrite urlBll = new BLL.url_rewrite();
            urlBll.Remove("channel", model.name); //先删除
            string[] itemTypeArr     = Request.Form.GetValues("item_type");
            string[] itemNameArr     = Request.Form.GetValues("item_name");
            string[] itemPageArr     = Request.Form.GetValues("item_page");
            string[] itemTempletArr  = Request.Form.GetValues("item_templet");
            string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize");
            string[] itemRewriteArr  = Request.Form.GetValues("item_rewrite");

            if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) &&
                    (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        Model.url_rewrite urlModel = new Model.url_rewrite();
                        urlModel.name    = itemNameArr[i].Trim();
                        urlModel.type    = itemTypeArr[i].Trim();
                        urlModel.page    = itemPageArr[i].Trim();
                        urlModel.inherit = GetInherit(urlModel.type);
                        urlModel.templet = itemTempletArr[i].Trim();
                        if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0)
                        {
                            urlModel.pagesize = itemPageSizeArr[i].Trim();
                        }
                        urlModel.channel = model.name;

                        List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>();
                        string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串
                        for (int j = 0; j < urlRewriteArr.Length; j++)
                        {
                            string[] urlItemArr = urlRewriteArr[j].Split(',');
                            if (urlItemArr.Length == 3)
                            {
                                itemLs.Add(new Model.url_rewrite_item {
                                    path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2]
                                });
                            }
                        }
                        urlModel.url_rewrite_items = itemLs;
                        urlBll.Add(urlModel);
                    }
                }
            }
            #endregion

            AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志
            return(true);
        }
コード例 #20
0
        /// <summary>
        /// 取得该频道指定类别下的列表
        /// </summary>
        /// <param name="parent_id"></param>
        /// <param name="channel_name"></param>
        /// <returns></returns>
        public DataTable GetChildList(int parent_id, string channel_name)
        {
            int channel_id = new BLL.channel().GetChannelId(channel_name);

            return(dal.GetChildList(parent_id, channel_id));
        }
コード例 #21
0
 private void GroupBind(string strWhere)
 {
     //检查网站是否开启会员功能
     if (siteConfig.memberstatus == 0)
     {
         return;
     }
     //检查该频道是否开启会员组价格
     Model.channel model = new BLL.channel().GetModel(this.channel_id);
     if (model == null || model.is_group_price == 0)
     {
         return;
     }
     BLL.user_groups bll = new BLL.user_groups();
     DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc");
     if (ds.Tables[0].Rows.Count > 0)
     {
         this.rptPrice.DataSource = ds;
         this.rptPrice.DataBind();
     }
 }
コード例 #22
0
ファイル: channel_edit.aspx.cs プロジェクト: yi724926089/MyWx
        private bool DoAdd()
        {
            Model.channel model = new Model.channel();
            BLL.channel bll = new BLL.channel();

            model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.name = txtName.Text.Trim();
            model.title = txtTitle.Text.Trim();
            if (cbIsAlbums.Checked == true)
            {
                model.is_albums = 1;
            }
            if (cbIsAttach.Checked == true)
            {
                model.is_attach = 1;
            }
            if (cbIsGroupPrice.Checked == true)
            {
                model.is_group_price = 1;
            }
            model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10);
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            //添加频道扩展字段
            List<Model.channel_field> ls = new List<Model.channel_field>();
            for (int i = 0; i < cblAttributeField.Items.Count; i++)
            {
                if (cblAttributeField.Items[i].Selected)
                {
                    ls.Add(new Model.channel_field { field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0) });
                }
            }
            model.channel_fields = ls;

            if (bll.Add(model) < 1)
            {
                return false;
            }

            #region 保存URL配置
            BLL.url_rewrite urlBll = new BLL.url_rewrite();
            urlBll.Remove("channel", model.name); //先删除
            string[] itemTypeArr = Request.Form.GetValues("item_type");
            string[] itemNameArr = Request.Form.GetValues("item_name");
            string[] itemPageArr = Request.Form.GetValues("item_page");
            string[] itemTempletArr = Request.Form.GetValues("item_templet");
            string[] itemRewriteArr = Request.Form.GetValues("item_rewrite");

            if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemRewriteArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length)
                    && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemRewriteArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        Model.url_rewrite urlModel = new Model.url_rewrite();
                        urlModel.name = itemNameArr[i].Trim();
                        urlModel.type = itemTypeArr[i].Trim();
                        urlModel.page = itemPageArr[i].Trim();
                        urlModel.inherit = GetInherit(urlModel.type);
                        urlModel.templet = itemTempletArr[i].Trim();
                        urlModel.channel = model.name;

                        List<Model.url_rewrite_item> itemLs = new List<Model.url_rewrite_item>();
                        string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串
                        for (int j = 0; j < urlRewriteArr.Length; j++)
                        {
                            string[] urlItemArr = urlRewriteArr[j].Split(',');
                            if (urlItemArr.Length == 3)
                            {
                                itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] });
                            }
                        }
                        urlModel.url_rewrite_items = itemLs;
                        urlBll.Add(urlModel);
                    }
                }
            }
            #endregion

            AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志
            return true;
        }
コード例 #23
0
        private void ShowInfo(int _id)
        {
            BLL.channel   bll   = new BLL.channel();
            Model.channel model = bll.GetModel(_id);

            txtTitle.Text = model.title;
            txtName.Text  = model.name;
            txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_name_validate&old_channel_name=" + Utils.UrlEncode(model.name));
            txtName.Focus(); //设置焦点,防止JS无法提交

            ddlSiteId.SelectedValue = model.site_id.ToString();
            if (model.is_albums == 1)
            {
                cbIsAlbums.Checked = true;
            }
            if (model.is_attach == 1)
            {
                cbIsAttach.Checked = true;
            }
            if (model.is_spec == 1)
            {
                cbIsSpec.Checked = true;
            }
            txtSortId.Text = model.sort_id.ToString();

            //扩展
            if (model.is_comment == 1)
            {
                cbIsComment.Checked = true;
            }
            if (model.is_attribute == 1)
            {
                cbIsAttr.Checked = true;
            }
            if (model.is_recycle == 1)
            {
                cbIsRecycle.Checked = true;
            }
            rblIsType.SelectedValue = model.is_type.ToString();
            txtHeight.Text          = model.height.ToString();
            txtWidth.Text           = model.width.ToString();

            //SEO优化
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;

            //赋值扩展字段
            if (model.channel_fields != null)
            {
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    string[]            fieldIdArr = cblAttributeField.Items[i].Value.Split(',');                            //分解出ID值
                    Model.channel_field modelt     = model.channel_fields.Find(p => p.field_id == int.Parse(fieldIdArr[1])); //查找对应的字段ID
                    if (modelt != null)
                    {
                        cblAttributeField.Items[i].Selected = true;
                    }
                }
            }

            //绑定URL配置列表
            rptList.DataSource = new BLL.url_rewrite().GetList(model.name);
            rptList.DataBind();
        }
コード例 #24
0
ファイル: channel_edit.aspx.cs プロジェクト: xuxiaolei/DTCMS
        private bool DoEdit(int _id)
        {
            BLL.channel   bll   = new BLL.channel();
            Model.channel model = bll.GetModel(_id);

            string old_name = model.name;

            model.site_id      = Utils.StrToInt(ddlSiteId.SelectedValue, 0);
            model.name         = txtName.Text.Trim();
            model.title        = txtTitle.Text.Trim();
            model.is_albums    = 0;
            model.is_attach    = 0;
            model.is_spec      = 0;
            model.is_comment   = 0;
            model.is_attribute = 0;
            if (cbIsAlbums.Checked == true)
            {
                model.is_albums = 1;
            }
            if (cbIsAttach.Checked == true)
            {
                model.is_attach = 1;
            }
            if (cbIsSpec.Checked == true)
            {
                model.is_spec = 1;
            }
            if (cbIsComment.Checked == true)
            {
                model.is_comment = 1;
            }
            if (cbIsAttr.Checked == true)
            {
                model.is_attribute = 1;
            }
            model.is_type = Utils.StrToInt(rblIsType.SelectedValue, 0);
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            //SEO优化
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim().Replace(",", ",");
            model.seo_description = txtSeoDescription.Text.Trim();

            //添加频道扩展字段
            List <Model.channel_field> ls = new List <Model.channel_field>();

            for (int i = 0; i < cblAttributeField.Items.Count; i++)
            {
                if (cblAttributeField.Items[i].Selected)
                {
                    string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值
                    ls.Add(new Model.channel_field {
                        channel_id = model.id, field_id = Utils.StrToInt(fieldIdArr[1], 0)
                    });
                }
            }
            model.channel_fields = ls;

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

            #region 保存URL配置
            BLL.url_rewrite urlBll = new BLL.url_rewrite();
            urlBll.Remove("channel", old_name); //先删除旧的
            string[] itemTypeArr      = Request.Form.GetValues("item_type");
            string[] itemNameArr      = Request.Form.GetValues("item_name");
            string[] itemPageArr      = Request.Form.GetValues("item_page");
            string[] itemTempletArr   = Request.Form.GetValues("item_templet");
            string[] itemIsCacheArr   = Request.Form.GetValues("item_cache");
            string[] itemCachePathArr = Request.Form.GetValues("item_path");
            string[] itemPageSizeArr  = Request.Form.GetValues("item_pagesize");
            string[] itemRewriteArr   = Request.Form.GetValues("item_rewrite");

            if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) &&
                    (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        Model.url_rewrite urlModel = new Model.url_rewrite();
                        urlModel.name      = itemNameArr[i].Trim();
                        urlModel.type      = itemTypeArr[i].Trim();
                        urlModel.page      = itemPageArr[i].Trim();
                        urlModel.inherit   = GetInherit(urlModel.type);
                        urlModel.templet   = itemTempletArr[i].Trim();
                        urlModel.cache     = itemIsCacheArr[i].Trim();
                        urlModel.cachepath = itemCachePathArr[i].Trim();

                        if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0)
                        {
                            urlModel.pagesize = itemPageSizeArr[i].Trim();
                        }
                        urlModel.channel = model.name;

                        List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>();
                        string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串
                        for (int j = 0; j < urlRewriteArr.Length; j++)
                        {
                            string[] urlItemArr = urlRewriteArr[j].Split(',');
                            if (urlItemArr.Length == 3)
                            {
                                itemLs.Add(new Model.url_rewrite_item {
                                    path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2]
                                });
                            }
                        }
                        urlModel.url_rewrite_items = itemLs;
                        urlBll.Add(urlModel);
                    }
                }
            }
            #endregion

            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改频道" + model.title); //记录日志
            return(true);
        }