コード例 #1
0
        private void Save()
        {
            try
            {
                if (Check())
                {
                    RefreshUI(RefreshedTypes.ShowProgressBar);//点击保存后显示进度条

                    if (actions == FormTypes.New)
                    {
                        agentSetInfo.AGENTDATESETID = System.Guid.NewGuid().ToString();
                        if (!string.IsNullOrEmpty(dEFFECTDATE.Text))//生效日期
                        {
                            agentSetInfo.EFFECTIVEDATE = Convert.ToDateTime(dEFFECTDATE.Text);
                        }
                        if (!string.IsNullOrEmpty(dEFFECTDATE.Text))
                        {
                            agentSetInfo.PLANEXPIRATIONDATE = Convert.ToDateTime(dPLANEXPIRATIONDATE.Text);//计划失效日期
                        }
                        agentSetInfo.USERID             = Common.CurrentLoginUserInfo.EmployeeID;
                        agentSetInfo.MODELCODE          = (cbModelCode.SelectedItem as FLOW_MODELDEFINE_T).MODELCODE; //代理模块
                        agentSetInfo.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;         //创建公司ID
                        agentSetInfo.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;      //创建部门ID
                        agentSetInfo.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;            //创建岗位ID
                        agentSetInfo.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;                     //创建人ID
                        agentSetInfo.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;                   //创建人姓名
                        agentSetInfo.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;         //所属公司ID
                        agentSetInfo.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;      //所属部门ID
                        agentSetInfo.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;            //所属岗位ID
                        agentSetInfo.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;                     //所属人ID
                        agentSetInfo.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;                   //报销人ID(出差人)
                        agentSetInfo.CREATEDATE         = DateTime.Now;                                               //创建时间

                        SoaChannel.AgentDataSetAddAsync(agentSetInfo);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(dINVALIDDATE.Text))
                        {
                            agentSetInfo.EXPIRATIONDATE = Convert.ToDateTime(dINVALIDDATE.Text);//失效时间
                        }
                        agentSetInfo.UPDATEUSERID   = Common.CurrentLoginUserInfo.EmployeeID;
                        agentSetInfo.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                        SoaChannel.UpdateAgentDataSetAsync(agentSetInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.ToString()));
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
        }