예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.nCurPage  = int.Parse(IMBC.FW.Util.WebUtil.GetRequestQueryString("curPage", "1"));
        this.nCurPage2 = int.Parse(IMBC.FW.Util.WebUtil.GetRequestQueryString("curPage2", "1"));

        this.search      = IMBC.FW.Util.WebUtil.EncodeHTML(WebUtil.replaceSQLInjections(IMBC.FW.Util.WebUtil.GetRequestQueryString("search", "")));
        this.search2     = IMBC.FW.Util.WebUtil.EncodeHTML(WebUtil.replaceSQLInjections(IMBC.FW.Util.WebUtil.GetRequestQueryString("search2", "")));
        this.searchWord  = IMBC.FW.Util.WebUtil.RemoveHTMLTag(WebUtil.replaceSQLInjections(IMBC.FW.Util.WebUtil.GetRequestQueryString("searchWord", ""))).Replace("+", "").Replace("%", "").Replace("'", "");
        this.searchWord2 = IMBC.FW.Util.WebUtil.RemoveHTMLTag(WebUtil.replaceSQLInjections(IMBC.FW.Util.WebUtil.GetRequestQueryString("searchWord2", ""))).Replace("+", "").Replace("%", "").Replace("'", "");

        this.uInfo = new UserInfo();
        this.data  = new NoteData();


        if (this.uInfo.IsLogin == false)
        {
            imgSave.Src = "http://img.imbc.com/mini/UserNote/images/mini_memo_login.jpg";
            img1.Src    = "http://img.imbc.com/mini/UserNote/images/mini_memo_login.jpg";

            System.Web.HttpContext httpContext = System.Web.HttpContext.Current;

            httpContext.Response.Cookies["IMBCURL"].Value  = httpContext.Server.UrlEncode("http://" + httpContext.Request.ServerVariables["SERVER_NAME"] + httpContext.Request.RawUrl);
            httpContext.Response.Cookies["IMBCURL"].Domain = "imbc.com";
            httpContext.Response.Cookies["IMBCURL"].Path   = "/";
            httpContext.Response.Cookies["IMBCURL"].Secure = false;

            imgSave.Attributes.Add("onclick", "location.href='http://member.imbc.com/Login/Login.aspx?TemplateId=Popup'; return false;");
            txtComment.Enabled = false;

            img1.Attributes.Add("onclick", "location.href='http://member.imbc.com/Login/Login.aspx?TemplateId=Popup'; return false;");
            txtComment1.Enabled = false;
        }
        else
        {
            this.IsAdmin = data.IsAdminUserDB(this.progCode_STFM, uInfo.UserID);
            imgSave.Attributes.Add("onclick", "doSave();");
            img1.Attributes.Add("onclick", "doSave();");
        }

        if (!IsPostBack)
        {
            // 현재 시간의 편성 정보 가져오기
            ScheduleMBCList    STFM    = new NoteData().RetrieveScheduleListForMBC("STFM");
            List <ScheduleMBC> newSTFM = new List <ScheduleMBC>();

            newSTFM = STFM.FindAll(
                delegate(ScheduleMBC sc)
            {
                return(DateTime.Parse(sc.EndTime) > DateTime.Parse(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()) && sc.Day == GetDayOfWeek(DateTime.Now));
            }
                );
            newSTFM = newSTFM.GetRange(0, 1);

            foreach (ScheduleMBC sc in newSTFM)
            {
                progCode_STFM  = new NoteData().GetProgCode(sc.BroadCastID, sc.GroupID).Trim();
                progTitle.Text = sc.ProgramTitle + progCode_STFM;
//                Response.Write(sc.ProgramTitle + " : " + sc.BroadCastID + " :" + sc.GroupID);
            }

            try
            {
                this.mstInfo          = data.RetrieveMemoMstInfo(this.progCode_STFM);
                this.progTitle.Text   = mstInfo.progTitle;
                this.tblColor.BgColor = mstInfo.tblColor;
                this.nPageRow         = mstInfo.pageRow;

                if (this.mstInfo.memoType == "2")
                {
                    imgSave.Visible    = false;
                    txtComment.Text    = "mini 에서만 작성하실 수 있습니다.";
                    txtComment.Enabled = false;
                }
            }
            catch { }


            try
            {
                ListDataView ldv = data.RetrieveMemoList(this.progCode_STFM, this.nCurPage, this.nPageRow, this.search, this.searchWord);
                if (ldv != null)
                {
                    this.nTotalRecord            = ldv.TotalCount;
                    this.listRepeater.DataSource = ldv.DV;
                    this.listRepeater.DataBind();

                    string pagingURL = "MiniMsgMor.aspx?curPage={0}&progCode=" + this.progCode_STFM + "&search=" + this.search + "&searchWord=" + this.searchWord;

                    this.pageNavigator.Text = NoteUtil.SetNavigator(this.nCurPage, this.nTotalRecord, this.nPageRow, pagingURL);
                }
            }
            catch { }



            ScheduleMBCList    FM4U    = new NoteData().RetrieveScheduleListForMBC("FM4U");
            List <ScheduleMBC> newFM4U = new List <ScheduleMBC>();

            newFM4U = FM4U.FindAll(
                delegate(ScheduleMBC sc)
            {
                return(DateTime.Parse(sc.EndTime) > DateTime.Parse(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()) && sc.Day == GetDayOfWeek(DateTime.Now));
            }
                );
            newFM4U = newFM4U.GetRange(0, 1);
            foreach (ScheduleMBC sc in newFM4U)
            {
                progCode_FM4U = new NoteData().GetProgCode(sc.BroadCastID, sc.GroupID).Trim();
                Label1.Text   = sc.ProgramTitle;
                //Response.Write(sc.ProgramTitle + ":" + sc.BroadCastID + " :" + sc.GroupID);
            }

            try
            {
                this.mstInfo2          = data.RetrieveMemoMstInfo(this.progCode_FM4U);
                this.tblColor.BgColor  = mstInfo2.tblColor;
                this.tblColor2.BgColor = mstInfo2.tblColor;
                this.nPageRow2         = mstInfo2.pageRow;

                if (this.mstInfo2.memoType == "2")
                {
                    img1.Visible        = false;
                    txtComment1.Text    = "mini 에서만 작성하실 수 있습니다.";
                    txtComment1.Enabled = false;
                }
            }
            catch { }

            try
            {
                ListDataView ldv2 = data.RetrieveMemoList(this.progCode_FM4U, this.nCurPage2, this.nPageRow2, this.search2, this.searchWord2);

                this.nTotalRecord2            = ldv2.TotalCount;
                this.listRepeater2.DataSource = ldv2.DV;
                this.listRepeater2.DataBind();

                string pagingURL2 = "MiniMsgMor.aspx?curPage2={0}&progCode=" + this.progCode_FM4U + "&search2=" + this.search + "&searchWord2=" + this.searchWord;

                this.Label2.Text = NoteUtil.SetNavigator(this.nCurPage2, this.nTotalRecord2, this.nPageRow2, pagingURL2);
            }
            catch { }
        }
    }