コード例 #1
0
        public ServiceResponseData SaveUser()
        {
            BaseEmployee emp  = requestData.GetData <BaseEmployee>(0);
            BaseUser     user = requestData.GetData <BaseUser>(1);

            int[] currEmpDeptList    = requestData.GetData <int[]>(2);
            int   currDefaultEmpDept = requestData.GetData <int>(3);

            int[] currGroupUserList = requestData.GetData <int[]>(4);

            emp.BindDb(oleDb, _container, _cache, _pluginName);
            user.BindDb(oleDb, _container, _cache, _pluginName);

            if (emp.EmpId == 0)
            {
                if (NewObject <User>().GetUser(user.Code) != null)
                {
                    responseData.AddData(false);
                    return(responseData);
                }
            }

            emp.Pym      = SpellAndWbCode.GetSpellCode(emp.Name);
            emp.Wbm      = SpellAndWbCode.GetWBCode(emp.Name);
            emp.Brithday = DateTime.Now;
            emp.save();
            user.EmpId    = emp.EmpId;
            user.PassWord = ConvertExtend.ToPassWord("1");
            //user.IsAdmin = 0;
            user.save();

            NewObject <Employee>().SetHaveEmpDeptRole(emp.EmpId, currEmpDeptList);
            NewObject <Employee>().SetDefaultEmpDeptRole(emp.EmpId, currDefaultEmpDept);
            NewObject <User>().SetGroupUserRole(user.UserId, currGroupUserList);

            responseData.AddData(true);
            return(responseData);
        }
コード例 #2
0
        public string SaveUser()
        {
            BaseEmployee emp  = ToObject <BaseEmployee>(ToArray(ParamJsonData)[0]);
            BaseUser     user = ToObject <BaseUser>(ToArray(ParamJsonData)[1]);

            int[] currEmpDeptList    = ToObject <int[]>(ToArray(ParamJsonData)[2]);
            int   currDefaultEmpDept = Convert.ToInt32(ToArray(ParamJsonData)[3]);

            int[] currGroupUserList = ToObject <int[]>(ToArray(ParamJsonData)[4]);

            emp.BindDb(oleDb, _container, _cache, _pluginName);
            user.BindDb(oleDb, _container, _cache, _pluginName);

            if (emp.EmpId == 0)
            {
                if (NewObject <User>().GetUser(user.Code) != null)
                {
                    return(ToJson(false));
                }
            }

            emp.Pym      = SpellAndWbCode.GetSpellCode(emp.Name);
            emp.Wbm      = SpellAndWbCode.GetWBCode(emp.Name);
            emp.Brithday = DateTime.Now;
            emp.save();
            user.EmpId    = emp.EmpId;
            user.PassWord = ConvertExtend.ToPassWord("1");
            //user.IsAdmin = 0;
            user.save();

            NewObject <Employee>().SetHaveEmpDeptRole(emp.EmpId, currEmpDeptList);
            NewObject <Employee>().SetDefaultEmpDeptRole(emp.EmpId, currDefaultEmpDept);
            NewObject <User>().SetGroupUserRole(user.UserId, currGroupUserList);

            return(ToJson(true));
        }