Example #1
0
        public void Delete(int id)
        {
            News_ArticleInfo news_ArticleInfo = new News_ArticleInfo();

            news_ArticleInfo.id = id;
            this.control.DeleteEntity(news_ArticleInfo);
        }
Example #2
0
    protected void Del_Btn(object obj, EventArgs e)
    {
        LinkButton        linkButton        = obj as LinkButton;
        RepeaterItem      repeaterItem      = linkButton.Parent as RepeaterItem;
        HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
        int num = Convert.ToInt32(htmlInputCheckBox.Value);

        try
        {
            IList all = News_Article.Init().GetAll("typeid=" + num, null);
            if (all != null && all.Count > 0)
            {
                foreach (object current in all)
                {
                    News_ArticleInfo news_ArticleInfo = current as News_ArticleInfo;
                    Help.DeleteFiles(news_ArticleInfo.FilePath);
                }
            }
        }
        catch
        {
        }
        string cmdText = "delete from News_Article where typeid=" + num;

        MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText, new SqlParameter[0]);
        News_Type.Init().Delete(num);
        this.Show();
    }
Example #3
0
    protected void Del_Btn(object obj, EventArgs e)
    {
        LinkButton        linkButton        = obj as LinkButton;
        RepeaterItem      repeaterItem      = linkButton.Parent as RepeaterItem;
        HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
        int id = Convert.ToInt32(htmlInputCheckBox.Value);
        News_ArticleInfo byId = News_Article.Init().GetById(id);

        Help.DeleteFiles(byId.FilePath);
        News_Article.Init().Delete(id);
        this.Show();
    }
Example #4
0
    private void Show()
    {
        if (!string.IsNullOrEmpty(base.Request.QueryString["nid"]))
        {
            News_ArticleInfo byId = News_Article.Init().GetById(Convert.ToInt32(base.Request.QueryString["nid"]));
            this.NewsTitle.Value     = byId.NewsTitle;
            this.Bodys.Value         = byId.Notes;
            this.ComID.SelectedValue = string.Concat(byId.ComID);
            if (byId.ShareDeps != "")
            {
                this.sel.SelectedIndex      = 1;
                this.tr.Attributes["style"] = "";
                this.userlist_dep.Value     = byId.ShareDeps;
                this.namelist_dep.Value     = byId.namelist;
            }
            this.TypeID.SelectedValue = string.Concat(byId.TypeID);
            if (!string.IsNullOrEmpty(byId.FilePath) && byId.FilePath.Contains("|"))
            {
                this.Attachword.Visible = true;
                List <TmpInfo> list  = new List <TmpInfo>();
                string[]       array = byId.FilePath.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Trim() != "")
                    {
                        TmpInfo tmpInfo = new TmpInfo();
                        int     num     = array[i].LastIndexOf('/') + 1;
                        string  tmp     = array[i].Substring(num, array[i].Length - num);
                        string  tmp2    = array[i].Replace("~", "");
                        tmpInfo.Tmp1 = array[i];
                        tmpInfo.Tmp2 = tmp;
                        tmpInfo.Tmp3 = tmp2;
                        list.Add(tmpInfo);
                    }
                }
                this.rpt.DataSource = list;
                this.rpt.DataBind();
            }
        }
        IList all = News_Type.Init().GetAll(null, null);

        this.TypeID.DataTextField  = "TypeName";
        this.TypeID.DataValueField = "id";
        this.TypeID.DataSource     = all;
        this.TypeID.DataBind();
    }
Example #5
0
 protected void Del_All(object sender, EventArgs e)
 {
     foreach (RepeaterItem repeaterItem in this.rpt.Items)
     {
         HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
         if (htmlInputCheckBox.Checked)
         {
             int id = Convert.ToInt32(htmlInputCheckBox.Value);
             News_ArticleInfo byId = News_Article.Init().GetById(id);
             Help.DeleteFiles(byId.FilePath);
             News_Article.Init().Delete(id);
         }
     }
     this.Show();
 }
Example #6
0
 public void Update(News_ArticleInfo News_Article_)
 {
     this.control.UpdateEntity(News_Article_, News_Article_.id);
 }
Example #7
0
 public void Add(News_ArticleInfo News_Article_)
 {
     this.control.AddEntity(News_Article_);
 }
Example #8
0
 public void Update(News_ArticleInfo com)
 {
     News_Article.dal.Update(com);
 }
Example #9
0
 public void Add(News_ArticleInfo com)
 {
     News_Article.dal.Add(com);
 }
Example #10
0
    protected void Save_Btn(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(base.Request.QueryString["nid"]))
        {
            News_ArticleInfo news_ArticleInfo = News_Article.Init().GetById(Convert.ToInt32(base.Request.QueryString["nid"]));
            news_ArticleInfo.FilePath  = this.UpdateFiles();
            news_ArticleInfo.NewsTitle = this.NewsTitle.Value;
            news_ArticleInfo.Notes     = this.Bodys.Value;
            news_ArticleInfo.ShareDeps = this.userlist_dep.Value.Trim();
            news_ArticleInfo.namelist  = this.namelist_dep.Value;
            news_ArticleInfo.TypeID    = Convert.ToInt32(base.Request.Form["TypeID"]);
            news_ArticleInfo.AddTime   = DateTime.Now;
            news_ArticleInfo.ComID     = Convert.ToInt32(this.ComID.SelectedValue);
            News_Article.Init().Update(news_ArticleInfo);
        }
        else
        {
            News_ArticleInfo news_ArticleInfo = new News_ArticleInfo();
            news_ArticleInfo.AddTime         = DateTime.Now;
            news_ArticleInfo.CreatorDepName  = this.DepName;
            news_ArticleInfo.CreatorID       = Convert.ToInt32(this.Uid);
            news_ArticleInfo.CreatorRealName = this.RealName;
            news_ArticleInfo.FilePath        = this.UpdateFiles();
            news_ArticleInfo.NewsTitle       = this.NewsTitle.Value;
            news_ArticleInfo.Notes           = this.Bodys.Value;
            news_ArticleInfo.ShareDeps       = this.userlist_dep.Value.Trim();
            news_ArticleInfo.namelist        = this.namelist_dep.Value;
            news_ArticleInfo.TypeID          = Convert.ToInt32(base.Request.Form["TypeID"]);
            news_ArticleInfo.ComID           = Convert.ToInt32(this.ComID.SelectedValue);
            News_Article.Init().Add(news_ArticleInfo);
            if (this.IsSms.Checked)
            {
                if (news_ArticleInfo.ShareDeps.Contains("#") && news_ArticleInfo.ShareDeps.Contains(","))
                {
                    string[] array = news_ArticleInfo.ShareDeps.Split(new char[]
                    {
                        ','
                    });
                    List <string> list = new List <string>();
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i].Contains("#"))
                        {
                            string str = array[i].Split(new char[]
                            {
                                '#'
                            })[1];
                            IList all = Sys_User.Init().GetAll("depid=" + str, "id desc");
                            foreach (object current in all)
                            {
                                Sys_UserInfo sys_UserInfo = current as Sys_UserInfo;
                                if (Help.ValidateMobile(sys_UserInfo.Phone))
                                {
                                    list.Add(sys_UserInfo.Phone);
                                }
                            }
                        }
                    }
                    if (list.Count > 0)
                    {
                        Help.NewsMobleSend(list, news_ArticleInfo.NewsTitle);
                    }
                }
                if (news_ArticleInfo.ShareDeps.Trim() == "")
                {
                    IList         all  = Sys_User.Init().GetAll(null, "id desc");
                    List <string> list = new List <string>();
                    foreach (object current in all)
                    {
                        Sys_UserInfo sys_UserInfo = current as Sys_UserInfo;
                        if (Help.ValidateMobile(sys_UserInfo.Phone))
                        {
                            list.Add(sys_UserInfo.Phone);
                        }
                    }
                    if (list.Count > 0)
                    {
                        Help.NewsMobleSend(list, news_ArticleInfo.NewsTitle);
                    }
                }
            }
        }
        string str2 = HttpContext.Current.Server.HtmlEncode("您好!资讯已保存成功!");
        string ssss = "~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str2;

        base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str2);
    }
Example #11
0
    private void Show(string nid)
    {
        News_ArticleInfo byId = News_Article.Init().GetById(Convert.ToInt32(nid));

        if (this.Modules.Contains("29") || byId.ShareDeps.Trim() == "" || byId.ShareDeps.Contains("#" + this.DepID + "#"))
        {
            this.NewsTitle.InnerText = byId.NewsTitle;
            this.Creator.InnerText   = byId.CreatorRealName;
            this.addtime.InnerText   = Utils.ConvertDate5(byId.AddTime);
            byId.Notes = (byId.Notes ?? "");
            if (byId.Notes.ToLower().Contains("script"))
            {
                this.Notes.InnerHtml = byId.Notes.ToLower().Replace("script", "scrript");
            }
            else
            {
                this.Notes.InnerHtml = byId.Notes;
            }
            this.Page.Title = "标题:" + byId.NewsTitle;
            this.AddReadRecord(nid);
            if (byId.ShareDeps.Contains(","))
            {
                string   text  = "";
                string[] array = byId.ShareDeps.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Contains("#"))
                    {
                        text = text + array[i].Split(new char[]
                        {
                            '#'
                        })[0] + " ";
                    }
                }
                this.Deps.InnerText = text;
            }
            else
            {
                this.Deps.InnerText = "全体人员";
            }
            if (!string.IsNullOrEmpty(byId.FilePath))
            {
                this.fjs = "";
                string[] array = byId.FilePath.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Trim() != "")
                    {
                        int    num = array[i].LastIndexOf('/') + 1;
                        string arg = array[i].Substring(num, array[i].Length - num);
                        string s   = array[i].Replace("~", "");
                        this.fjs += string.Format(this.fj, base.Server.UrlEncode(s), arg);
                    }
                }
            }
        }
        else
        {
            base.Response.Write("<script>alert('您没有查看权限');window.location='NewsList.aspx';</script>");
        }
    }
Example #12
0
    private void Show(string nid)
    {
        IList            all  = News_Type.Init().GetAll(null, " order by orders asc");
        News_ArticleInfo byId = News_Article.Init().GetById(Convert.ToInt32(nid));

        if (this.Modules.Contains("29") || byId.ShareDeps.Trim() == "" || byId.ShareDeps.Contains("#" + this.DepID + "#"))
        {
            this.NewsTitle.InnerText = byId.NewsTitle;
            this.Creator.InnerText   = byId.CreatorRealName + " (" + byId.CreatorDepName + ")";
            this.addtime.InnerText   = Utils.ConvertDate2(byId.AddTime);
            byId.Notes = (byId.Notes ?? "");
            if (byId.Notes.ToLower().Contains("script"))
            {
                this.Notes.InnerHtml = byId.Notes.ToLower().Replace("script", "scrript");
            }
            else
            {
                this.Notes.InnerHtml = byId.Notes;
            }
            this.Page.Title = "标题:" + byId.NewsTitle;
            this.AddReadRecord(nid);
            if (byId.ShareDeps.Contains(","))
            {
                string   text  = "";
                string[] array = byId.ShareDeps.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Contains("#"))
                    {
                        text = text + array[i].Split(new char[]
                        {
                            '#'
                        })[0] + " ";
                    }
                }
                this.Deps.InnerText = text;
            }
            else
            {
                this.Deps.InnerText = "全体人员";
            }
            if (!string.IsNullOrEmpty(byId.FilePath))
            {
                this.fjs = "<span style='font-weight:bold; color:Black;'>相关文件</span>:<br>";
                string[] array = byId.FilePath.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Trim() != "")
                    {
                        int    num = array[i].LastIndexOf('/') + 1;
                        string arg = array[i].Substring(num, array[i].Length - num);
                        string s   = array[i].Replace("~", "");
                        this.fjs += string.Format(this.fj, base.Server.UrlEncode(s), arg);
                    }
                }
            }
        }
        else
        {
            base.Response.Write("<script>alert('您没有查看权限');window.location='../News/News_List.aspx';</script>");
        }
        string text2 = "我的资讯:";

        for (int i = 0; i < all.Count; i++)
        {
            News_TypeInfo news_TypeInfo = all[i] as News_TypeInfo;
            this.news_menu += string.Format(this.news_tmp, news_TypeInfo.id, news_TypeInfo.TypeName);
            string text3 = "&nbsp;|&nbsp;";
            if (i == all.Count - 1)
            {
                text3 = "";
            }
            if (news_TypeInfo.id == byId.TypeID)
            {
                string text4 = text2;
                text2 = string.Concat(new string[]
                {
                    text4,
                    "<span style='color:#ff0000;'>",
                    news_TypeInfo.TypeName,
                    "</span>",
                    text3
                });
            }
            else
            {
                text2 = text2 + news_TypeInfo.TypeName + text3;
            }
        }
        this.top.InnerHtml = text2;
    }