Пример #1
0
        /// <summary>
        /// 返回当前频道模型
        /// </summary>
        /// <param name="channel_id">频道id</param>
        /// <returns>频道模型</returns>
        protected Model.sys_channel get_channel_by_channelid(int channel_id)
        {
            BLL.sys_channel bll=new BLL.sys_channel();
            if (bll.Exists(channel_id))
	        {
		        return bll.GetModel(channel_id);
	        }
            return null;
        }
Пример #2
0
        private bool DoAdd()
        {
            Model.sys_channel model = new Model.sys_channel();
            BLL.sys_channel   bll   = new BLL.sys_channel();
            model.name     = txtName.Text.Trim();
            model.title    = txtTitle.Text.Trim();
            model.model_id = int.Parse(ddlModelId.SelectedValue);
            model.sort_id  = int.Parse(txtSortId.Text.Trim());
            int new_id = bll.Add(model); //儲存

            if (new_id < 1)
            {
                return(false);
            }
            #region 儲存URL配置.開始===================================
            BLL.url_rewrite bll2 = new BLL.url_rewrite();
            bll2.Remove("channel", new_id.ToString()); //先刪除
            string[] itemTypeArr        = Request.Form.GetValues("item_type");
            string[] itemNameArr        = Request.Form.GetValues("item_name");
            string[] itemPathArr        = Request.Form.GetValues("item_path");
            string[] itemPatternArr     = Request.Form.GetValues("item_pattern");
            string[] itemQuerystringArr = Request.Form.GetValues("item_querystring");
            string[] itemTempletArr     = Request.Form.GetValues("item_templet");
            string[] itemPageArr        = Request.Form.GetValues("item_page");
            if (itemTypeArr != null && itemNameArr != null && itemPathArr != null &&
                itemPatternArr != null && itemQuerystringArr != null && itemTempletArr != null && itemPageArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPathArr.Length) && (itemPathArr.Length == itemPatternArr.Length) &&
                    (itemPatternArr.Length == itemQuerystringArr.Length) && (itemQuerystringArr.Length == itemTempletArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        bll2.Add(new Model.url_rewrite
                        {
                            name    = itemNameArr[i].Trim(),
                            path    = itemPathArr[i].Trim(),
                            pattern = itemPatternArr[i].Trim(),
                            //page = GetPageName(model.name, itemTypeArr[i].Trim()), //源頁面地址
                            page        = itemPageArr[i].Trim(),
                            querystring = itemQuerystringArr[i].Trim(),
                            templet     = itemTempletArr[i].Trim(),
                            channel     = new_id.ToString(),
                            type        = itemTypeArr[i].Trim(),
                            inherit     = GetInherit(model.model_id, itemTypeArr[i].Trim()) //繼承的類名
                        });
                    }
                }
            }
            #endregion 儲存URL配置.結束

            return(true);
        }
Пример #3
0
 private void ShowInfo(int _id)
 {
     BLL.sys_channel   bll   = new BLL.sys_channel();
     Model.sys_channel model = bll.GetModel(_id);
     txtName.Text             = model.name;
     hidName.Value            = model.name;
     txtTitle.Text            = model.title;
     ddlModelId.SelectedValue = model.model_id.ToString();
     txtSortId.Text           = model.sort_id.ToString();
     //綁定URL配置清單
     //rptList.DataSource = new BLL.url_rewrite().GetList(model.id.ToString());
     //rptList.DataBind();
 }
Пример #4
0
 private void ShowInfo(int _id)
 {
     BLL.sys_channel bll = new BLL.sys_channel();
     Model.sys_channel model = bll.GetModel(_id);
     txtName.Text = model.name;
     hidName.Value = model.name;
     txtTitle.Text = model.title;
     ddlModelId.SelectedValue = model.model_id.ToString();
     txtSortId.Text = model.sort_id.ToString();
     //绑定URL配置列表
     rptList.DataSource = new BLL.url_rewrite().GetList(model.id.ToString());
     rptList.DataBind();
 }
Пример #5
0
        private void sys_channel_load(HttpContext context)
        {
            StringBuilder strTxt = new StringBuilder();

            BLL.sys_channel bll = new BLL.sys_channel();
            DataTable       dt  = bll.GetList("").Tables[0];

            strTxt.Append("[");
            int i = 1;

            foreach (DataRow dr in dt.Rows)
            {
                Model.manager admin_info = new ManagePage().GetAdminInfo();
                if (!new BLL.manager_role().Exists(admin_info.role_id, Convert.ToInt32(dr["id"]), ManagePage.ActionEnum.View.ToString()))
                {
                    continue;
                }
                BLL.sys_model   bll2   = new BLL.sys_model();
                Model.sys_model model2 = bll2.GetModel(Convert.ToInt32(dr["model_id"]));
                strTxt.Append("{");
                strTxt.Append("\"text\":\"" + dr["title"] + "\",");
                strTxt.Append("\"isexpand\":\"false\",");
                strTxt.Append("\"children\":[");
                if (model2.sys_model_navs != null)
                {
                    int j = 1;
                    foreach (Model.sys_model_nav nav in model2.sys_model_navs)
                    {
                        strTxt.Append("{");
                        strTxt.Append("\"text\":\"" + nav.title + "\",");
                        strTxt.Append("\"url\":\"" + nav.nav_url + "?channel_id=" + dr["id"] + "\""); //此处要优化,加上nav.nav_url网站目录标签替换
                        strTxt.Append("}");
                        if (j < model2.sys_model_navs.Count)
                        {
                            strTxt.Append(",");
                        }
                        j++;
                    }
                }
                strTxt.Append("]");
                strTxt.Append("}");
                strTxt.Append(",");
                i++;
            }
            string newTxt = Utils.DelLastChar(strTxt.ToString(), ",") + "]";

            context.Response.Write(newTxt);
            return;
        }
        private bool DoAdd()
        {
            Model.sys_channel model = new Model.sys_channel();
            BLL.sys_channel bll = new BLL.sys_channel();
            model.name = txtName.Text.Trim();
            model.title = txtTitle.Text.Trim();
            model.model_id = int.Parse(ddlModelId.SelectedValue);
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            int new_id = bll.Add(model); //保存
            if (new_id < 1)
            {
                return false;
            }
            #region 保存URL配置.开始===================================
            BLL.url_rewrite bll2 = new BLL.url_rewrite();
            bll2.Remove("channel", new_id.ToString()); //先删除
            string[] itemTypeArr = Request.Form.GetValues("item_type");
            string[] itemNameArr = Request.Form.GetValues("item_name");
            string[] itemPathArr = Request.Form.GetValues("item_path");
            string[] itemPatternArr = Request.Form.GetValues("item_pattern");
            string[] itemQuerystringArr = Request.Form.GetValues("item_querystring");
            string[] itemTempletArr = Request.Form.GetValues("item_templet");
            if (itemTypeArr != null && itemNameArr != null && itemPathArr != null
                && itemPatternArr != null && itemQuerystringArr != null && itemTempletArr != null)
            {
                if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPathArr.Length) && (itemPathArr.Length == itemPatternArr.Length)
                    && (itemPatternArr.Length == itemQuerystringArr.Length) && (itemQuerystringArr.Length == itemTempletArr.Length))
                {
                    for (int i = 0; i < itemTypeArr.Length; i++)
                    {
                        bll2.Add(new Model.url_rewrite
                        {
                            name = itemNameArr[i].Trim(),
                            path = itemPathArr[i].Trim(),
                            pattern = itemPatternArr[i].Trim(),
                            page = GetPageName(model.name, itemTypeArr[i].Trim()), //源页面地址
                            querystring = itemQuerystringArr[i].Trim(),
                            templet = itemTempletArr[i].Trim(),
                            channel = new_id.ToString(),
                            type = itemTypeArr[i].Trim(),
                            inherit = GetInherit(model.model_id, itemTypeArr[i].Trim()) //继承的类名
                        });
                    }
                }
            }
            #endregion 保存URL配置.结束

            return true;
        }
Пример #7
0
 private void sys_channel_load(HttpContext context)
 {
     StringBuilder strTxt = new StringBuilder();
     BLL.sys_channel bll = new BLL.sys_channel();
     DataTable dt = bll.GetList("").Tables[0];
     strTxt.Append("[");
     int i = 1;
     foreach (DataRow dr in dt.Rows)
     {
         Model.manager admin_info = new ManagePage().GetAdminInfo();
         if (!new BLL.manager_role().Exists(admin_info.role_id, Convert.ToInt32(dr["id"]), DTEnums.ActionEnum.View.ToString()))
         {
             continue;
         }
         BLL.sys_model bll2 = new BLL.sys_model();
         Model.sys_model model2 = bll2.GetModel(Convert.ToInt32(dr["model_id"]));
         strTxt.Append("{");
         strTxt.Append("\"text\":\"" + dr["title"] + "\",");
         strTxt.Append("\"isexpand\":\"false\",");
         strTxt.Append("\"children\":[");
         if (model2.sys_model_navs != null)
         {
             int j = 1;
             foreach (Model.sys_model_nav nav in model2.sys_model_navs)
             {
                 strTxt.Append("{");
                 strTxt.Append("\"text\":\"" + nav.title + "\",");
                 strTxt.Append("\"url\":\"" + nav.nav_url + "?channel_id=" + dr["id"] + "\""); //此处要优化,加上nav.nav_url网站目录标签替换
                 strTxt.Append("}");
                 if (j < model2.sys_model_navs.Count)
                 {
                     strTxt.Append(",");
                 }
                 j++;
             }
         }
         strTxt.Append("]");
         strTxt.Append("}");
         strTxt.Append(",");
         i++;
     }
     string newTxt = Utils.DelLastChar(strTxt.ToString(), ",") + "]";
     context.Response.Write(newTxt);
     return;
 }
Пример #8
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     page = DTRequest.GetQueryString("page");
     BLL.article bll = new BLL.article();
     BLL.sys_channel bll_channel = new BLL.sys_channel();
     if (id > 0)
     {
         if (!bll.Exists(id))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetContentModel(id);
     }
     else if (!string.IsNullOrEmpty(page))
     {
         if (!bll.ContentExists(page))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetContentModel(page);
     }
     else
     {
         Server.Transfer("error.aspx");
         return;
     }
     //浏览数+1
     bll.UpdateField(model.id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
         model.link_url = model.link_url.Trim();
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
     channel = bll_channel.GetModel(model.channel_id);
 }
Пример #9
0
        private void sys_channel_validate(HttpContext context)
        {
            string channelname = DTRequest.GetFormString("channelname");
            string oldname     = DTRequest.GetFormString("oldname");

            if (string.IsNullOrEmpty(channelname))
            {
                context.Response.Write("false");
                return;
            }
            //检查是否与站点根目录下的目录同名
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
            DirectoryInfo    dirInfo    = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath));

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                if (channelname.ToLower() == dir.Name)
                {
                    context.Response.Write("false");
                    return;
                }
            }
            //检查是否修改操作
            if (channelname == oldname)
            {
                context.Response.Write("true");
                return;
            }
            //检查Key是否与已存在
            BLL.sys_channel bll = new BLL.sys_channel();
            if (bll.Exists(channelname))
            {
                context.Response.Write("false");
                return;
            }
            context.Response.Write("true");
            return;
        }
Пример #10
0
 private void sys_channel_validate(HttpContext context)
 {
     string channelname = DTRequest.GetFormString("channelname");
     string oldname = DTRequest.GetFormString("oldname");
     if (string.IsNullOrEmpty(channelname))
     {
         context.Response.Write("false");
         return;
     }
     //检查是否与站点根目录下的目录同名
     Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
     DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath));
     foreach (DirectoryInfo dir in dirInfo.GetDirectories())
     {
         if (channelname.ToLower() == dir.Name)
         {
             context.Response.Write("false");
             return;
         }
     }
     //检查是否修改操作
     if (channelname == oldname)
     {
         context.Response.Write("true");
         return;
     }
     //检查Key是否与已存在
     BLL.sys_channel bll = new BLL.sys_channel();
     if (bll.Exists(channelname))
     {
         context.Response.Write("false");
         return;
     }
     context.Response.Write("true");
     return;
 }
Пример #11
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     BLL.sys_channel bll = new BLL.sys_channel();
     channel = bll.GetModel(1);
 }
Пример #12
0
        private void sys_channel_load(HttpContext context)
        {
            StringBuilder strTxt = new StringBuilder();

            BLL.sys_channel bll = new BLL.sys_channel();
            DataTable       dt  = bll.GetList("").Tables[0];

            strTxt.Append("[");
            int i  = 1;
            int jj = 0;

            foreach (DataRow dr in dt.Rows)
            {
                jj++;
                Model.manager admin_info = new ManagePage().GetAdminInfo();
                if (!new BLL.manager_role().Exists(admin_info.role_id, Convert.ToInt32(dr["id"]), DTEnums.ActionEnum.View.ToString()))
                {
                    continue;
                }
                BLL.sys_model   bll2   = new BLL.sys_model();
                Model.sys_model model2 = bll2.GetModel(Convert.ToInt32(dr["model_id"]));
                if (jj == 1)
                {
                    strTxt.Append("{");
                    strTxt.Append("\"text\":\"基礎設置\",");
                    strTxt.Append("\"isexpand\":\"false\",");
                    strTxt.Append("\"children\":[");

                    strTxt.Append("{");
                    strTxt.Append("\"text\":\"房屋類型\",");
                    strTxt.Append("\"url\":\"settings/sys_model_list.aspx\""); //此處要優化,加上nav.nav_url網站目錄標籤替換
                    strTxt.Append("}");
                    strTxt.Append(",");

                    strTxt.Append("{");
                    strTxt.Append("\"text\":\"縣市鄉鎮\",");
                    strTxt.Append("\"url\":\"Area_list.aspx\""); //此處要優化,加上nav.nav_url網站目錄標籤替換
                    strTxt.Append("}");
                    strTxt.Append(",");

                    strTxt.Append("]");
                    strTxt.Append("}");
                    strTxt.Append(",");
                }
                strTxt.Append("{");
                strTxt.Append("\"text\":\"" + dr["title"] + "\",");
                strTxt.Append("\"isexpand\":\"false\",");
                strTxt.Append("\"children\":[");
                if (model2.sys_model_navs != null)
                {
                    int j = 1;
                    foreach (Model.sys_model_nav nav in model2.sys_model_navs)
                    {
                        strTxt.Append("{");
                        strTxt.Append("\"text\":\"" + nav.title + "\",");
                        switch (dr["name"].ToString())
                        {
                        case "kongjian":     //空間規劃
                            if (!nav.title.Contains("類別"))
                            {
                                nav.nav_url = "goods/list_kj.aspx";
                            }
                            break;

                        case "diguangjingpin":     //帝光精品
                            if (!nav.title.Contains("類別"))
                            {
                                nav.nav_url = "goods/list_dg.aspx";
                            }
                            break;

                        case "banjia":     //搬家幫手
                            if (!nav.title.Contains("類別"))
                            {
                                nav.nav_url = "goods/list_bj.aspx";
                            }
                            break;

                        case "VIP":     //搬家幫手
                            if (!nav.title.Contains("類別"))
                            {
                                nav.nav_url = "download/list.aspx";
                            }
                            break;

                        case "土地":     //土地
                            if (!nav.title.Contains("類別"))
                            {
                                nav.nav_url = "goods/list_td.aspx";
                            }
                            break;

                        default:
                            break;
                        }
                        strTxt.Append("\"url\":\"" + nav.nav_url + "?channel_id=" + dr["id"] + "\""); //此處要優化,加上nav.nav_url網站目錄標籤替換
                        strTxt.Append("}");
                        if (j < model2.sys_model_navs.Count)
                        {
                            strTxt.Append(",");
                        }
                        j++;
                    }
                }
                strTxt.Append("]");
                strTxt.Append("}");
                strTxt.Append(",");
                i++;
            }
            string newTxt = Utils.DelLastChar(strTxt.ToString(), ",") + "]";

            context.Response.Write(newTxt);
            return;
        }