Пример #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            this.ChkAdminLevel("sys_channel_manage", DTEnums.ActionEnum.Delete.ToString());
            int num1 = 0;
            int num2 = 0;

            Rain.BLL.channel channel = new Rain.BLL.channel();
            for (int index = 0; index < this.rptList.Items.Count; ++index)
            {
                int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value);
                if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked)
                {
                    if (new Rain.BLL.article().GetCount("channel_id=" + (object)int32) > 0)
                    {
                        ++num2;
                    }
                    else
                    {
                        Rain.Model.channel model = channel.GetModel(int32);
                        if (channel.Delete(int32))
                        {
                            ++num1;
                            new Rain.BLL.url_rewrite().Remove("channel", model.name);
                        }
                        else
                        {
                            ++num2;
                        }
                    }
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除频道成功" + (object)num1 + "条,失败" + (object)num2 + "条");
            this.JscriptMsg("删除成功" + (object)num1 + "条,失败" + (object)num2 + "条!", Utils.CombUrlTxt("channel_list.aspx", "site_id={0}&keywords={1}", this.site_id.ToString(), this.keywords), "parent.loadMenuTree");
        }
Пример #2
0
 private void ShowInfo(int _id)
 {
     Rain.Model.channel model = new Rain.BLL.channel().GetModel(_id);
     this.txtTitle.Text = model.title;
     this.txtName.Text  = model.name;
     this.txtName.Focus();
     this.txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_name_validate&old_channel_name=" + Utils.UrlEncode(model.name));
     this.ddlSiteId.SelectedValue = model.site_id.ToString();
     if (model.is_albums == 1)
     {
         this.cbIsAlbums.Checked = true;
     }
     if (model.is_attach == 1)
     {
         this.cbIsAttach.Checked = true;
     }
     if (model.is_spec == 1)
     {
         this.cbIsSpec.Checked = true;
     }
     this.txtSortId.Text = model.sort_id.ToString();
     if (model.channel_fields != null)
     {
         for (int index = 0; index < this.cblAttributeField.Items.Count; ++index)
         {
             string[] fieldIdArr = this.cblAttributeField.Items[index].Value.Split(',');
             if (model.channel_fields.Find((Predicate <channel_field>)(p => p.field_id == int.Parse(fieldIdArr[1]))) != null)
             {
                 this.cblAttributeField.Items[index].Selected = true;
             }
         }
     }
     this.rptList.DataSource = (object)new Rain.BLL.url_rewrite().GetList(model.name);
     this.rptList.DataBind();
 }
Пример #3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.ChkAdminLevel("sys_channel_manage", DTEnums.ActionEnum.Edit.ToString());
     Rain.BLL.channel channel = new Rain.BLL.channel();
     for (int index = 0; index < this.rptList.Items.Count; ++index)
     {
         int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value);
         int result;
         if (!int.TryParse(((TextBox)this.rptList.Items[index].FindControl("txtSortId")).Text.Trim(), out result))
         {
             result = 99;
         }
         channel.UpdateSort(int32, result);
     }
     this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存频道排序");
     this.JscriptMsg("保存排序成功!", Utils.CombUrlTxt("channel_list.aspx", "site_id={0}&keywords={1}", this.site_id.ToString(), this.keywords), "parent.loadMenuTree");
 }
Пример #4
0
Файл: search.cs Проект: Hcq/Rain
        private string get_url_rewrite(int channel_id, string call_index, int id)
        {
            if (channel_id == 0)
            {
                return(string.Empty);
            }
            string str         = id.ToString();
            string channelName = new Rain.BLL.channel().GetChannelName(channel_id);

            if (string.IsNullOrEmpty(channelName))
            {
                return(string.Empty);
            }
            if (!string.IsNullOrEmpty(call_index))
            {
                str = call_index;
            }
            Rain.Model.url_rewrite info = new Rain.BLL.url_rewrite().GetInfo(channelName, "detail");
            if (info == null)
            {
                return(string.Empty);
            }
            return(this.linkurl(info.name, (object)str));
        }
Пример #5
0
        private bool DoEdit(int _id)
        {
            Rain.BLL.channel   channel = new Rain.BLL.channel();
            Rain.Model.channel model1  = channel.GetModel(_id);
            string             name    = model1.name;

            model1.site_id   = Utils.StrToInt(this.ddlSiteId.SelectedValue, 0);
            model1.name      = this.txtName.Text.Trim();
            model1.title     = this.txtTitle.Text.Trim();
            model1.is_albums = 0;
            model1.is_attach = 0;
            model1.is_spec   = 0;
            if (this.cbIsAlbums.Checked)
            {
                model1.is_albums = 1;
            }
            if (this.cbIsAttach.Checked)
            {
                model1.is_attach = 1;
            }
            if (this.cbIsSpec.Checked)
            {
                model1.is_spec = 1;
            }
            model1.sort_id = Utils.StrToInt(this.txtSortId.Text.Trim(), 99);
            List <channel_field> channelFieldList = new List <channel_field>();

            for (int index = 0; index < this.cblAttributeField.Items.Count; ++index)
            {
                if (this.cblAttributeField.Items[index].Selected)
                {
                    string[] strArray = this.cblAttributeField.Items[index].Value.Split(',');
                    channelFieldList.Add(new channel_field()
                    {
                        channel_id = model1.id,
                        field_id   = Utils.StrToInt(strArray[1], 0)
                    });
                }
            }
            model1.channel_fields = channelFieldList;
            if (!channel.Update(model1))
            {
                return(false);
            }
            Rain.BLL.url_rewrite urlRewrite = new Rain.BLL.url_rewrite();
            urlRewrite.Remove("channel", name);
            string[] values1 = this.Request.Form.GetValues("item_type");
            string[] values2 = this.Request.Form.GetValues("item_name");
            string[] values3 = this.Request.Form.GetValues("item_page");
            string[] values4 = this.Request.Form.GetValues("item_templet");
            string[] values5 = this.Request.Form.GetValues("item_pagesize");
            string[] values6 = this.Request.Form.GetValues("item_rewrite");
            if (values1 != null && values2 != null && (values3 != null && values4 != null) && values5 != null && values6 != null && (values1.Length == values2.Length && values2.Length == values3.Length && (values3.Length == values4.Length && values4.Length == values5.Length) && values5.Length == values6.Length))
            {
                for (int index = 0; index < values1.Length; ++index)
                {
                    Rain.Model.url_rewrite model2 = new Rain.Model.url_rewrite()
                    {
                        name = values2[index].Trim(),
                        type = values1[index].Trim(),
                        page = values3[index].Trim()
                    };
                    model2.inherit = this.GetInherit(model2.type);
                    model2.templet = values4[index].Trim();
                    if (Utils.StrToInt(values5[index].Trim(), 0) > 0)
                    {
                        model2.pagesize = values5[index].Trim();
                    }
                    model2.channel = model1.name;
                    List <url_rewrite_item> urlRewriteItemList = new List <url_rewrite_item>();
                    string str1     = values6[index];
                    char[] chArray1 = new char[1] {
                        '&'
                    };
                    foreach (string str2 in str1.Split(chArray1))
                    {
                        char[] chArray2 = new char[1] {
                            ','
                        };
                        string[] strArray = str2.Split(chArray2);
                        if (strArray.Length == 3)
                        {
                            urlRewriteItemList.Add(new url_rewrite_item()
                            {
                                path        = strArray[0],
                                pattern     = strArray[1],
                                querystring = strArray[2]
                            });
                        }
                    }
                    model2.url_rewrite_items = urlRewriteItemList;
                    urlRewrite.Add(model2);
                }
            }
            this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改频道" + model1.title);
            return(true);
        }