Esempio n. 1
0
    private void BindInfoData()
    {
        this._infoID = Convert.ToInt64(ViewState["InfoID"]);
        Tz888.BLL.Info.MainInfoBLL bll = new Tz888.BLL.Info.MainInfoBLL();
        long intCurrentPage            = 1;
        long intCurrentPageSize        = 1;
        long intTotalCount             = 1;

        this.RfInfo.DataSource = bll.GetMainInfoViewList("*", "InfoID = " + this._infoID.ToString(), "", ref intCurrentPage, intCurrentPageSize, ref intTotalCount);
        this.RfInfo.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Page.User.Identity.Name))
        {
            Response.Redirect("/login.aspx?url=" + Page.Request.Url.ToString());
        }

        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            bool isValid = false;
            long id      = 0;
            try
            {
                id = Convert.ToInt64(Request.QueryString["id"].Trim());
            }
            catch
            {
                id = 0;
            }
            if (id != 0)
            {
                ViewState["InfoID"] = id;
                Tz888.BLL.Info.MainInfoBLL bll = new Tz888.BLL.Info.MainInfoBLL();
                DataTable dt = bll.GetMainInfoViewList("*", "InfoID = " + id.ToString(), "", ref intCurrentPage, intCurrentPageSize, ref intTotalCount);

                if (dt != null)
                {
                    try
                    {
                        if (dt.Rows[0]["LoginName"].ToString().Trim() == Page.User.Identity.Name.Trim())//获取成功
                        {
                            //if (Convert.ToDateTime(dt.Rows[0]["InfoOverdueTime"]) < DateTime.Now)
                            //{
                            isValid        = true;
                            ltTitle.Text   = dt.Rows[0]["Title"].ToString();
                            ltPubDate.Text = Convert.ToDateTime(dt.Rows[0]["PublishT"]).ToString("yyyy-MM-dd");
                            if (dt.Rows[0]["InfoOverdueTime"].ToString().Trim() != "")
                            {
                                ltStartDate.Text = Convert.ToDateTime(dt.Rows[0]["InfoOverdueTime"]).ToString("yyyy-MM-dd");
                            }
                            //}
                        }
                    }
                    catch { }
                }
            }
            if (!isValid)
            {
                Response.Redirect("./ResourceManage_Pass.aspx");
            }
        }
    }