using System;

namespace FineUIPro.Web.PublicInfo.FileControl
{
    public partial class DomesticLawsRegulationsView : PageBase
    {
        #region 定义变量
        /// <summary>
        /// 主键
        /// </summary>
        private string DomesticLawsRegulationsId
        {
            get
            {
                return (string)ViewState["DomesticLawsRegulationsId"];
            }
            set
            {
                ViewState["DomesticLawsRegulationsId"] = 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.DomesticLawsRegulationsId = Request.Params["DomesticLawsRegulationsId"];
                if (!string.IsNullOrEmpty(this.DomesticLawsRegulationsId))
                {
                    Model.FileControl_DomesticLawsRegulations domesticLawsRegulations = BLL.FileControl_DomesticLawsRegulationsService.GetDomesticLawsRegulationsById(this.DomesticLawsRegulationsId);
                    if (domesticLawsRegulations != null)
                    {
                        this.txtDomesticLawsRegulationsCode.Text = domesticLawsRegulations.DomesticLawsRegulationsCode;
                        this.txtDomesticLawsRegulationsName.Text = domesticLawsRegulations.DomesticLawsRegulationsName;
                        this.txtAbstract.Text = domesticLawsRegulations.Abstract;
                        if (!string.IsNullOrEmpty(domesticLawsRegulations.CompileMan))
                        {
                            this.txtCompileManName.Text = BLL.Sys_UserService.GetUserNameByUserId(domesticLawsRegulations.CompileMan);
                        }
                        if (domesticLawsRegulations.CompileDate.HasValue)
                        {
                            this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", domesticLawsRegulations.CompileDate);
                        }
                        this.txtRemark.Text = domesticLawsRegulations.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.DomesticLawsRegulationsId))
            {
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/DomesticLawsRegulations&menuId={1}&edit=0", this.DomesticLawsRegulationsId, BLL.Const.DomesticLawsRegulationsMenuId)));
            }
        }
        #endregion
    }
}