public ActionResult UserItem(string enterpriseKey, string itemKey, BusinessUser originalEntity)
        {
            bool         isSuccessful   = false;
            string       displayMessage = string.Empty;
            BusinessUser targetUser     = null;

            if (GuidHelper.IsInvalidOrEmpty(itemKey) == true)
            {
                targetUser = new BusinessUser();

                targetUser.EnterpriseKey = enterpriseKey;
                targetUser.UserType      = UserTypes.Broker;
                targetUser.Password      = SystemConst.InitialUserPassword;

                SetTargetUserEntityValue(originalEntity, ref targetUser);

                CreateUserRoleStatuses createStatus = CreateUserRoleStatuses.Successful;
                BusinessUserBLL.CreateUser(targetUser, out createStatus);
                if (createStatus == CreateUserRoleStatuses.Successful)
                {
                    isSuccessful = true;
                }
            }
            else
            {
                targetUser = BusinessUserBLL.Get(new Guid(itemKey));

                SetTargetUserEntityValue(originalEntity, ref targetUser);
                isSuccessful = BusinessUserBLL.UpdateUser(targetUser);
            }

            if (isSuccessful == true)
            {
                displayMessage = "数据保存成功";
            }
            else
            {
                displayMessage = "数据保存失败";
            }

            return(Json(new LogicStatusInfo(isSuccessful, displayMessage)));
        }
Exemplo n.º 2
0
        public new CreateUserRoleStatuses Create(EmployeeEntity model)
        {
            CreateUserRoleStatuses createStatus;

            BusinessUserBLL.CreateUser(model, out createStatus);
            if (createStatus == CreateUserRoleStatuses.Successful)
            {
                bool isSuccessful = base.Create(model);
                if (isSuccessful == true)
                {
                    return(CreateUserRoleStatuses.Successful);
                }
                else
                {
                    return(CreateUserRoleStatuses.FailureUnknowReason);
                }
            }
            else
            {
                return(createStatus);
            }
        }
Exemplo n.º 3
0
        public new CreateUserRoleStatuses Create(LaborEntity model)
        {
            CreateUserRoleStatuses createStatus;

            BusinessUserBLL.CreateUser(model, out createStatus);
            if (createStatus == CreateUserRoleStatuses.Successful)
            {
                bool isSuccessful = base.Create(model);
                OperateLogBLL.RecordOperateLog(string.Format("创建劳务人员信息{0}", isSuccessful == true ? "成功" : "失败"), "Labor", model.UserGuid.ToString(), model.UserNameDisplay, model, null);
                if (isSuccessful == true)
                {
                    return(CreateUserRoleStatuses.Successful);
                }
                else
                {
                    return(CreateUserRoleStatuses.FailureUnknowReason);
                }
            }
            else
            {
                return(createStatus);
            }
        }