using System;

namespace FineUIPro.Web.PublicInfo.FileControl
{
    public partial class ForeignStandardsView : PageBase
    {
        #region 定义变量
        /// <summary>
        /// 主键
        /// </summary>
        private string ForeignStandardsId
        {
            get
            {
                return (string)ViewState["ForeignStandardsId"];
            }
            set
            {
                ViewState["ForeignStandardsId"] = value;
            }
        }
        #endregion

        #region 加载
        /// <summary>
        ///加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.ForeignStandardsId = Request.Params["ForeignStandardsId"];
                if (!string.IsNullOrEmpty(this.ForeignStandardsId))
                {
                    Model.FileControl_ForeignStandards foreignStandards = BLL.FileControl_ForeignStandardsService.GetForeignStandardsById(this.ForeignStandardsId);
                    if (foreignStandards != null)
                    {
                        this.txtForeignStandardsCode.Text = foreignStandards.ForeignStandardsCode;
                        this.txtForeignStandardsName.Text = foreignStandards.ForeignStandardsName;
                        this.txtAbstract.Text = foreignStandards.Abstract;
                        if (!string.IsNullOrEmpty(foreignStandards.CompileMan))
                        {
                            this.txtCompileManName.Text = BLL.Sys_UserService.GetUserNameByUserId(foreignStandards.CompileMan);
                        }
                        if (foreignStandards.CompileDate.HasValue)
                        {
                            this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", foreignStandards.CompileDate);
                        }
                        this.txtRemark.Text = foreignStandards.Remarks;
                    }
                }
            }
        }
        #endregion

        #region 附件上传
        /// <summary>
        /// 上传附件资源
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAttachUrl_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.ForeignStandardsId))
            {
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/ForeignStandards&menuId={1}&edit=0", this.ForeignStandardsId, BLL.Const.ForeignStandardsMenuId)));
            }
        }
        #endregion
    }
}