コード例 #1
0
ファイル: article_list.aspx.cs プロジェクト: Hcq/Rain
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            this.ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString());
            int int32 = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            Rain.BLL.article   article = new Rain.BLL.article();
            Rain.Model.article model   = article.GetModel(int32);
            switch (e.CommandName)
            {
            case "lbtnIsMsg":
                if (model.is_msg == 1)
                {
                    article.UpdateField(int32, "is_msg=0");
                    break;
                }
                article.UpdateField(int32, "is_msg=1");
                break;

            case "lbtnIsTop":
                if (model.is_top == 1)
                {
                    article.UpdateField(int32, "is_top=0");
                    break;
                }
                article.UpdateField(int32, "is_top=1");
                break;

            case "lbtnIsRed":
                if (model.is_red == 1)
                {
                    article.UpdateField(int32, "is_red=0");
                    break;
                }
                article.UpdateField(int32, "is_red=1");
                break;

            case "lbtnIsHot":
                if (model.is_hot == 1)
                {
                    article.UpdateField(int32, "is_hot=0");
                    break;
                }
                article.UpdateField(int32, "is_hot=1");
                break;

            case "lbtnIsSlide":
                if (model.is_slide == 1)
                {
                    article.UpdateField(int32, "is_slide=0");
                    break;
                }
                article.UpdateField(int32, "is_slide=1");
                break;
            }
            this.RptBind(this.channel_id, this.category_id, "id>0" + this.CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc");
        }
コード例 #2
0
ファイル: BaseMasterPage.cs プロジェクト: Hcq/Rain
 protected string get_article_content(string call_index)
 {
     if (string.IsNullOrEmpty(call_index))
     {
         return(string.Empty);
     }
     Rain.BLL.article article = new Rain.BLL.article();
     if (article.Exists(call_index))
     {
         return(article.GetModel(call_index).content);
     }
     return(string.Empty);
 }
コード例 #3
0
ファイル: article_show.cs プロジェクト: Hcq/Rain
 protected override void ShowPage()
 {
     this.id   = DTRequest.GetQueryInt("id");
     this.page = DTRequest.GetQueryString("page");
     Rain.BLL.article article = new Rain.BLL.article();
     if (this.id > 0)
     {
         if (!article.Exists(this.id))
         {
             HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除!"))));
             return;
         }
         this.model = article.GetModel(this.id);
     }
     else
     {
         if (string.IsNullOrEmpty(this.page))
         {
             return;
         }
         if (!article.Exists(this.page))
         {
             HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除!"))));
             return;
         }
         this.model = article.GetModel(this.page);
     }
     if (this.model.link_url != null)
     {
         this.model.link_url = this.model.link_url.Trim();
     }
     if (string.IsNullOrEmpty(this.model.link_url))
     {
         return;
     }
     HttpContext.Current.Response.Redirect(this.model.link_url);
 }
コード例 #4
0
ファイル: BaseMasterPage.cs プロジェクト: Hcq/Rain
 protected string get_article_field(string call_index, string field_name)
 {
     if (string.IsNullOrEmpty(call_index))
     {
         return(string.Empty);
     }
     Rain.BLL.article article = new Rain.BLL.article();
     if (!article.Exists(call_index))
     {
         return(string.Empty);
     }
     Rain.Model.article model = article.GetModel(call_index);
     if (model != null && model.fields.ContainsKey(field_name))
     {
         return(model.fields[field_name]);
     }
     return(string.Empty);
 }
コード例 #5
0
ファイル: article_edit.aspx.cs プロジェクト: Hcq/Rain
        private bool DoEdit(int _id)
        {
            bool flag = false;

            Rain.BLL.article   article = new Rain.BLL.article();
            Rain.Model.article model   = article.GetModel(_id);
            model.channel_id      = this.channel_id;
            model.category_id     = Utils.StrToInt(this.ddlCategoryId.SelectedValue, 0);
            model.call_index      = this.txtCallIndex.Text.Trim();
            model.title           = this.txtTitle.Text.Trim();
            model.link_url        = this.txtLinkUrl.Text.Trim();
            model.img_url         = this.txtImgUrl.Text;
            model.seo_title       = this.txtSeoTitle.Text.Trim();
            model.seo_keywords    = this.txtSeoKeywords.Text.Trim();
            model.seo_description = this.txtSeoDescription.Text.Trim();
            model.zhaiyao         = !string.IsNullOrEmpty(this.txtZhaiyao.Text.Trim()) ? Utils.DropHTML(this.txtZhaiyao.Text, (int)byte.MaxValue) : Utils.DropHTML(this.txtContent.Value, (int)byte.MaxValue);
            model.content         = this.txtContent.Value;
            model.sort_id         = Utils.StrToInt(this.txtSortId.Text.Trim(), 99);
            model.click           = int.Parse(this.txtClick.Text.Trim());
            model.status          = Utils.StrToInt(this.rblStatus.SelectedValue, 0);
            model.is_msg          = 0;
            model.is_top          = 0;
            model.is_red          = 0;
            model.is_hot          = 0;
            model.is_slide        = 0;
            if (this.cblItem.Items[0].Selected)
            {
                model.is_msg = 1;
            }
            if (this.cblItem.Items[1].Selected)
            {
                model.is_top = 1;
            }
            if (this.cblItem.Items[2].Selected)
            {
                model.is_red = 1;
            }
            if (this.cblItem.Items[3].Selected)
            {
                model.is_hot = 1;
            }
            if (this.cblItem.Items[4].Selected)
            {
                model.is_slide = 1;
            }
            model.add_time    = Utils.StrToDateTime(this.txtAddTime.Text.Trim());
            model.update_time = new DateTime?(DateTime.Now);
            model.fields      = this.SetFieldValues(this.channel_id);
            if (this.txtImgUrl.Text.Trim() == "")
            {
                model.img_url = this.hidFocusPhoto.Value;
            }
            if (model.albums != null)
            {
                model.albums.Clear();
            }
            string[] values1 = this.Request.Form.GetValues("hid_photo_name");
            string[] values2 = this.Request.Form.GetValues("hid_photo_remark");
            if (values1 != null)
            {
                List <article_albums> articleAlbumsList = new List <article_albums>();
                for (int index = 0; index < values1.Length; ++index)
                {
                    string[] strArray = values1[index].Split('|');
                    int      num      = Utils.StrToInt(strArray[0], 0);
                    if (strArray.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(values2[index]))
                        {
                            articleAlbumsList.Add(new article_albums()
                            {
                                id            = num,
                                article_id    = _id,
                                original_path = strArray[1],
                                thumb_path    = strArray[2],
                                remark        = values2[index]
                            });
                        }
                        else
                        {
                            articleAlbumsList.Add(new article_albums()
                            {
                                id            = num,
                                article_id    = _id,
                                original_path = strArray[1],
                                thumb_path    = strArray[2]
                            });
                        }
                    }
                }
                model.albums = articleAlbumsList;
            }
            if (model.attach != null)
            {
                model.attach.Clear();
            }
            string[] values3 = this.Request.Form.GetValues("hid_attach_id");
            string[] values4 = this.Request.Form.GetValues("hid_attach_filename");
            string[] values5 = this.Request.Form.GetValues("hid_attach_filepath");
            string[] values6 = this.Request.Form.GetValues("hid_attach_filesize");
            string[] values7 = this.Request.Form.GetValues("txt_attach_point");
            if (values3 != null && values4 != null && (values5 != null && values6 != null) && (values7 != null && values3.Length > 0 && (values4.Length > 0 && values5.Length > 0)) && values6.Length > 0 && values7.Length > 0)
            {
                List <Rain.Model.article_attach> articleAttachList = new List <Rain.Model.article_attach>();
                for (int index = 0; index < values4.Length; ++index)
                {
                    int    num1    = Utils.StrToInt(values3[index], 0);
                    int    num2    = Utils.StrToInt(values6[index], 0);
                    string fileExt = Utils.GetFileExt(values5[index]);
                    int    num3    = Utils.StrToInt(values7[index], 0);
                    articleAttachList.Add(new Rain.Model.article_attach()
                    {
                        id         = num1,
                        article_id = _id,
                        file_name  = values4[index],
                        file_path  = values5[index],
                        file_size  = num2,
                        file_ext   = fileExt,
                        point      = num3
                    });
                }
                model.attach = articleAttachList;
            }
            List <user_group_price> userGroupPriceList = new List <user_group_price>();

            for (int index = 0; index < this.rptPrice.Items.Count; ++index)
            {
                int num1 = 0;
                if (!string.IsNullOrEmpty(((HiddenField)this.rptPrice.Items[index].FindControl("hidePriceId")).Value))
                {
                    num1 = Convert.ToInt32(((HiddenField)this.rptPrice.Items[index].FindControl("hidePriceId")).Value);
                }
                int     int32 = Convert.ToInt32(((HiddenField)this.rptPrice.Items[index].FindControl("hideGroupId")).Value);
                Decimal num2  = Convert.ToDecimal(((TextBox)this.rptPrice.Items[index].FindControl("txtGroupPrice")).Text.Trim());
                userGroupPriceList.Add(new user_group_price()
                {
                    id         = num1,
                    article_id = _id,
                    group_id   = int32,
                    price      = num2
                });
            }
            model.group_price = userGroupPriceList;
            if (article.Update(model))
            {
                this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title);
                flag = true;
            }
            return(flag);
        }