Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op         = RequestData.Get <string>("op");
            id         = RequestData.Get <string>("id");
            type       = RequestData.Get <string>("type");
            JsonString = RequestData.Get <string>("JsonString");
            if (!string.IsNullOrEmpty(id))
            {
                ent = EmpInsurance.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                if (!string.IsNullOrEmpty(JsonString))
                {
                    ent = JsonHelper.GetObject <EmpInsurance>(JsonString);
                }
                if (string.IsNullOrEmpty(ent.Id))
                {
                    ent.CreateId   = UserInfo.UserID;
                    ent.CreateName = UserInfo.Name;
                    ent.CreateTime = DateTime.Now;
                    ent.DoCreate();
                }
                else
                {
                    ent.DoUpdate();
                }
                ent.State = "待提交";
                PageState.Add("Id", ent.Id);
                break;

            case "submit":
                if (!string.IsNullOrEmpty(JsonString))
                {
                    ent = JsonHelper.GetObject <EmpInsurance>(JsonString);
                }
                ent.ApplyTime = DateTime.Now;    //申请时间在提交审批的时候赋值
                if (string.IsNullOrEmpty(ent.Id))
                {
                    ent.CreateId   = UserInfo.UserID;
                    ent.CreateName = UserInfo.Name;
                    ent.CreateTime = DateTime.Now;
                    ent.DoCreate();
                }
                IList <SysApproveConfig> sacEnts = SysApproveConfig.FindAll();
                if (sacEnts.Count > 0)
                {
                    ent.ApproveUserId = sacEnts[0].ChildWelfareId;
                    ent.ApproveName   = sacEnts[0].ChildWelfareName;
                }
                ent.State = "已提交";
                ent.DoUpdate();
                PageState.Add("Id", ent.Id);
                break;

            case "GetWorkNo":
                string     UserID = RequestData.Get("UserID") + "";
                ComUtility Ut     = new ComUtility();
                PageState.Add("WorkNo", Ut.GetWorkNo(UserID));
                break;

            default:
                DoSelect();
                break;
            }
        }