using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web.UI.WebControls;
using BLL;
using Model;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.CQMS.Performance
{
    public partial class PerformanceSubmit : PageBase
    {
        /// 
        /// 主键
        /// 
        public string PerformanceGid
        {
            get
            {
                return (string)ViewState["PerformanceGid"];
            }
            set
            {
                ViewState["PerformanceGid"] = value;
            }
        }
        /// 
        /// 日期
        /// 
        public string CreateDateMonth
        {
            get
            {
                return (string)ViewState["CreateDateMonth"];
            }
            set
            {
                ViewState["CreateDateMonth"] = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //主键
                PerformanceGid = Request.Params["PerformanceGid"];
                CreateDateMonth = Request.Params["CreateDateMonth"];
                //加载当前项目下的审核人
                //UserService.InitUserDropDownList(drpUser, CurrUser.LoginProjectId, true);
                //施工经理
                UserService.InitUserProjectIdRoleIdDropDownList(drpUser, CurrUser.LoginProjectId, Const.ConstructionManager, false);
            }
        }
        protected void btnEdit_Click(object sender, EventArgs e) {
            if (drpUser.SelectedValue == Const._Null)
            {
                ShowNotify("请选择审核人。", MessageBoxIcon.Warning);
            }
            else {
                var model = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid);
                model.States = "1";
                model.ScorMan = drpUser.SelectedValue;
                Funs.DB.SubmitChanges();
                ShowNotify("提交成功,请等待领导打分。", MessageBoxIcon.Success);
                ViewState["CompileDateMonth"] = CreateDateMonth;
                PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
            }
        }
    }
}