using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.TestRun.Feeding
{
    public partial class SubInspectTermEdit : PageBase
    {
        /// 
        /// 主键
        /// 
        public string TermItemId
        {
            get { return (string)ViewState["TermItemId"]; }
            set { ViewState["TermItemId"] = value; }
        }
        /// 
        /// 分组主键
        /// 
        public string GroupName
        {
            get { return (string)ViewState["GroupName"]; }
            set { ViewState["GroupName"] = value; }
        }
        /// 
        /// 检查项名称
        /// 
        public string WorkInspectName
        {
            get { return (string)ViewState["WorkInspectName"]; }
            set { ViewState["WorkInspectName"] = value; }
        }
        /// 
        /// 装置主键
        /// 
        public string InstallationId
        {
            get { return (string)ViewState["InstallationId"]; }
            set { ViewState["InstallationId"] = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.TermItemId = Request.Params["TermItemId"];
                this.GroupName = Request.Params["GroupName"];
                this.WorkInspectName = Request.Params["WorkInspectName"];
                this.InstallationId = Request.Params["InstallationId"];
                PageInit();
            }
        }
        /// 
        /// 默认绑定
        /// 
        public void PageInit()
        {
            if (!string.IsNullOrWhiteSpace(this.TermItemId))
            {
                txtWorkInspectName.Text = this.WorkInspectName;
                ddlGroup.SelectedValue = this.GroupName;
            }
        }
        /// 
        /// 保存
        /// 
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string groupName = this.ddlGroup.SelectedValue;
                var requestStr = this.TermItemId + "|" + this.txtWorkInspectName.Text + "|" + groupName + "|" + this.InstallationId;
                PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(requestStr) + ActiveWindow.GetHidePostBackReference());
            }
            catch (Exception ex)
            {
                ShowNotify(ex.Message, MessageBoxIcon.Error);
            }
        }
    }
}