Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Authentication.HasResource(User.Identity.Name, "bbs_contentList"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }
            if (!IsPostBack)
            {
                _bbsRepo  = RepositoryFactory.CreateBbsRepo();
                _rootRepo = RepositoryFactory.CreateRootRepo();
                //從QueryString取得 公佈欄代碼
                string bbsID = String.IsNullOrEmpty(Request["BbsID"]) ? String.Empty : Request["BbsID"].ToString();

                PageTitle.Value = "公佈欄 > 新增";

                if (!String.IsNullOrWhiteSpace(bbsID))
                {
                    model           = _bbsRepo.GetBbs(bbsID);
                    PageTitle.Value = "公佈欄 > 編輯";

                    if (model.PhotoName != "")
                    {
                        HyperLink_FILENAME1.Visible     = true;
                        HyperLink_FILENAME1.NavigateUrl = @"..\..\Upload\" + model.PhotoName;
                        Button_DelFILE1.Visible         = true;
                        File_Photo.Visible = false;
                    }
                    else
                    {
                        HyperLink_FILENAME1.Visible = false;
                        Button_DelFILE1.Visible     = false;
                        File_Photo.Visible          = true;
                    }

                    if (model.UpName != "")
                    {
                        HyperLink_FILENAME2.Visible     = true;
                        HyperLink_FILENAME2.NavigateUrl = @"..\..\Upload\" + model.UpName;
                        Button_DelFILE2.Visible         = true;
                        File_Up1.Visible = false;
                    }
                    else
                    {
                        HyperLink_FILENAME2.Visible = false;
                        Button_DelFILE2.Visible     = false;
                        File_Up1.Visible            = true;
                    }

                    WebUtils.PageDataBind(_bbsRepo.GetBbsData(bbsID), this.Page);
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PageTitle.Value = "公佈欄資料 > 公佈的內容";
                _bbsRepo        = RepositoryFactory.CreateBbsRepo();
                //從QueryString取得 簽核代碼
                string bbsID = String.IsNullOrEmpty(Request["bbs_id"]) ? String.Empty : Request["bbs_id"].ToString();
                //根據查詢的SN 搜尋公告
                model = _bbsRepo.GetBbs(bbsID);
                if (model.PhotoName.ToString() != "")
                {
                    img_Photo.Visible  = true;
                    img_Photo.ImageUrl = @"..\..\Upload\" + model.PhotoName;
                }
                else
                {
                    img_Photo.Visible = false;
                }
                if (model.txt_Http.ToString() != "http://" && model.txt_Http.ToString() != "")
                {
                    hyl_Http.Visible     = true;
                    hyl_Http.Text        = model.txt_Http;
                    hyl_Http.NavigateUrl = model.txt_Http;
                }
                else
                {
                    hyl_Http.Visible = false;
                }

                if (model.UpName.ToString() != "")
                {
                    hyl_Url.Visible     = true;
                    hyl_Url.Text        = model.UpName;
                    hyl_Url.NavigateUrl = @"..\..\Upload\" + model.UpName;
                }
                else
                {
                    hyl_Url.Visible = false;
                }

                lbl_Creator.Text = model.Creator;
                WebUtils.PageDataBind(model, this.Page);
            }
        }