예제 #1
0
파일: FootJs1.cs 프로젝트: llenroc/kangaroo
        protected void Page_Load(object sender, System.EventArgs e)
        {
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                base.Response.Write(";");
            }
            else
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                int         userId      = currentMember.UserId;
                NoticeQuery noticeQuery = new NoticeQuery();
                noticeQuery.SendType = 0;
                noticeQuery.UserId   = new int?(userId);
                bool value = DistributorsBrower.GetDistributorInfo(userId) != null;
                noticeQuery.IsDistributor = new bool?(value);
                noticeQuery.IsDel         = new int?(0);
                System.Data.DataTable noticeNotReadDt = NoticeBrowser.GetNoticeNotReadDt(noticeQuery);
                if (noticeNotReadDt != null && noticeNotReadDt.Rows.Count > 0)
                {
                    System.Data.DataRow[] array = noticeNotReadDt.Select("SendType='0'");
                    if (array != null)
                    {
                        stringBuilder.Append("$('.my-message').html('<i></i>');");
                    }
                    else
                    {
                        stringBuilder.Append("$('.my-message').html('<i></i>').attr('href','notice.aspx?type=1');");
                    }
                    for (int i = 0; i < noticeNotReadDt.Rows.Count; i++)
                    {
                        if (System.Convert.ToInt32(noticeNotReadDt.Rows[i]["SendType"]) == 0)
                        {
                            stringBuilder.Append(string.Concat(new object[]
                            {
                                "$('.new_message ul').append('<li><a href=\"NoticeDetail.aspx?Id=",
                                noticeNotReadDt.Rows[i]["Id"],
                                "\">",
                                noticeNotReadDt.Rows[i]["Title"],
                                "</a></li>');"
                            }));
                        }
                        else
                        {
                            stringBuilder.Append(string.Concat(new object[]
                            {
                                "$('.new_message ul').append('<li><a  href=\"NoticeDetail.aspx?Id=",
                                noticeNotReadDt.Rows[i]["Id"],
                                "\">",
                                noticeNotReadDt.Rows[i]["Title"],
                                "</a></li>');"
                            }));
                        }
                    }
                }
                base.Response.Write(stringBuilder.ToString());
            }
            base.Response.End();
        }
예제 #2
0
        protected override void AttachChildControls()
        {
            string a   = Globals.RequestQueryStr("type");
            int    num = Globals.RequestQueryNum("id");

            this.litTitle   = (System.Web.UI.WebControls.Literal) this.FindControl("litTitle");
            this.litPubTime = (System.Web.UI.WebControls.Literal) this.FindControl("litPubTime");
            this.litMemo    = (System.Web.UI.WebControls.Literal) this.FindControl("litMemo");
            NoticeInfo noticeInfo = NoticeBrowser.GetNoticeInfo(num);

            if (noticeInfo != null)
            {
                int    sendType = noticeInfo.SendType;
                string text     = "公告";
                if (sendType == 1)
                {
                    text = "消息";
                }
                this.litTitle.Text = noticeInfo.Title;
                System.DateTime dateTime = noticeInfo.PubTime.HasValue ? noticeInfo.PubTime.Value : noticeInfo.AddTime;
                this.litPubTime.Text = string.Concat(new string[]
                {
                    "<span>",
                    dateTime.ToString("yyyy-MM-dd"),
                    "</span><span><i class='glyphicon glyphicon-time'></i>",
                    dateTime.ToString("HH:mm"),
                    "</span>"
                });
                this.litMemo.Text = string.Concat(new object[]
                {
                    noticeInfo.Memo,
                    "<p class=\"lookall\"><a href=\"notice.aspx?type=",
                    sendType,
                    "\">更多",
                    text,
                    "&gt;&gt;</a></p>"
                });
                PageTitle.AddSiteNameTitle(noticeInfo.Title);
                if (!(a == "view"))
                {
                    if (noticeInfo.IsPub == 1)
                    {
                        MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                        NoticeBrowser.ViewNotice(currentMember.UserId, num);
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Response.Write("文章未发布!");
                        System.Web.HttpContext.Current.Response.End();
                    }
                }
            }
            else
            {
                System.Web.HttpContext.Current.Response.Redirect("/default.aspx");
                System.Web.HttpContext.Current.Response.End();
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                base.Response.Write(";");
            }
            else
            {
                StringBuilder builder = new StringBuilder();
                int           userId  = currentMember.UserId;
                NoticeQuery   query   = new NoticeQuery
                {
                    SendType = 0,
                    UserId   = new int?(userId)
                };
                bool flag = DistributorsBrower.GetDistributorInfo(userId) != null;
                query.IsDistributor = new bool?(flag);
                query.IsDel         = 0;
                DataTable noticeNotReadDt = NoticeBrowser.GetNoticeNotReadDt(query);
                if ((noticeNotReadDt != null) && (noticeNotReadDt.Rows.Count > 0))
                {
                    if (noticeNotReadDt.Select("SendType='0'") != null)
                    {
                        builder.Append("$('.my-message').html('<i></i>');");
                    }
                    else
                    {
                        builder.Append("$('.my-message').html('<i></i>').attr('href','notice.aspx?type=1');");
                    }
                    for (int i = 0; i < noticeNotReadDt.Rows.Count; i++)
                    {
                        if (Convert.ToInt32(noticeNotReadDt.Rows[i]["SendType"]) == 0)
                        {
                            builder.Append(string.Concat(new object[] { "$('.new_message ul').append('<li><a href=\"NoticeDetail.aspx?Id=", noticeNotReadDt.Rows[i]["Id"], "\">", noticeNotReadDt.Rows[i]["Title"], "</a></li>');" }));
                        }
                        else
                        {
                            builder.Append(string.Concat(new object[] { "$('.new_message ul').append('<li><a  href=\"NoticeDetail.aspx?Id=", noticeNotReadDt.Rows[i]["Id"], "\">", noticeNotReadDt.Rows[i]["Title"], "</a></li>');" }));
                        }
                    }
                }
                base.Response.Write(builder.ToString());
            }
            base.Response.End();
        }