using System;
using System.Web;
namespace FineUIPro.Web.HSSE.Check
{
    public partial class ContactListView : PageBase
    {
        #region 定义项
        /// 
        /// 主键
        /// 
        public string ContactListId
        {
            get
            {
                return (string)ViewState["ContactListId"];
            }
            set
            {
                ViewState["ContactListId"] = value;
            }
        }
        #endregion
        #region 加载
        /// 
        /// 加载页面
        /// 
        /// 
        /// 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.ContactListId = Request.Params["ContactListId"];
                if (!string.IsNullOrEmpty(this.ContactListId))
                {
                    Model.Check_ContactList ContactList = BLL.ContactListService.GetContactListById(this.ContactListId);
                    if (ContactList != null)
                    {
                        this.txtCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.ContactListId);
                        this.drpSponsorUnit.Text = BLL.UnitService.GetUnitNameByUnitId(ContactList.SponsorUnitId);
                        this.drpReceivingUnits.Text = ContactList.ReceivingUnitNames;
                        this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", ContactList.CompileDate);
                        this.txtRemark.Text = ContactList.Remark;
                        this.txtSeeFile.Text = HttpUtility.HtmlDecode(ContactList.SeeFile);
                        this.txtCompileMan.Text = BLL.UserService.GetUserNameByUserId(ContactList.CompileMan);
                    }
                }
            }
        }
        #endregion
        #region 附件上传
        /// 
        /// 上传附件
        /// 
        /// 
        /// 
        protected void btnAttachUrl_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.ContactListId))
            {
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ContactListAttachUrl&menuId={1}&type=-1", ContactListId, BLL.Const.ProjectContactListMenuId)));
            }
        }
        #endregion
    }
}