using System;

namespace FineUIPro.Web.PublicInfo.FileControl
{
    public partial class DomesticStandardsView : PageBase
    {
        #region 定义变量
        /// <summary>
        /// 主键
        /// </summary>
        private string DomesticStandardsId
        {
            get
            {
                return (string)ViewState["DomesticStandardsId"];
            }
            set
            {
                ViewState["DomesticStandardsId"] = 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.DomesticStandardsId = Request.Params["DomesticStandardsId"];
                if (!string.IsNullOrEmpty(this.DomesticStandardsId))
                {
                    Model.FileControl_DomesticStandards domesticStandards = BLL.FileControl_DomesticStandardsService.GetDomesticStandardsById(this.DomesticStandardsId);
                    if (domesticStandards != null)
                    {
                        this.txtDomesticStandardsCode.Text = domesticStandards.DomesticStandardsCode;
                        this.txtDomesticStandardsName.Text = domesticStandards.DomesticStandardsName;
                        this.txtAbstract.Text = domesticStandards.Abstract;
                        if (!string.IsNullOrEmpty(domesticStandards.CompileMan))
                        {
                            this.txtCompileManName.Text = BLL.Sys_UserService.GetUserNameByUserId(domesticStandards.CompileMan);
                        }
                        if (domesticStandards.CompileDate.HasValue)
                        {
                            this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", domesticStandards.CompileDate);
                        }
                        this.txtRemark.Text = domesticStandards.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.DomesticStandardsId))
            {
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/DomesticStandards&menuId={1}&edit=0", this.DomesticStandardsId, BLL.Const.DomesticStandardsMenuId)));
            }
        }
        #endregion
    }
}