Esempio n. 1
0
 private void LoadInfo(string userName)
 {
     this.UserName = userName;
     this.UserGuid = new Guid("AD6C7C77-71D0-4126-A12E-3CBA39E3FD51");
     BusinessRole role1 = new BusinessRole();
     this.Roles.Add(role1);
 }
Esempio n. 2
0
        public ActionResult Item(string keyGuid, BusinessRole entity, bool isOnlyPlaceHolder = true)
        {
            Guid targetGuid = Converter.TryToGuid(keyGuid);
            bool isSuccessful = false;
            string displayMessage = string.Empty;

            BusinessRole targetRole = null;
            if (targetGuid == Guid.Empty)
            {
                targetRole = new BusinessRole();
                targetRole.RoleGuid = GuidHelper.NewGuid();

                SetTargetEntityValue(entity, ref targetRole);

                CreateUserRoleStatuses status;
                BusinessRoleBLL.CreateRole(targetRole, out status);

                if (status == CreateUserRoleStatuses.Successful)
                {
                    isSuccessful = true;
                }
                else
                {
                    isSuccessful = false;
                }
            }
            else
            {
                targetRole = BusinessRoleBLL.Get(targetGuid);

                SetTargetEntityValue(entity, ref targetRole);

                isSuccessful = BusinessRoleBLL.UpdateRole(targetRole);
            }

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

            return Json(new LogicStatusInfo(isSuccessful, displayMessage));
        }
Esempio n. 3
0
 /// <summary>
 /// 通过一个实体给另外一个实体赋值
 /// </summary>
 /// <param name="originalEntity"></param>
 /// <param name="targetEntity"></param>
 private static void SetTargetEntityValue(BusinessRole originalEntity, ref BusinessRole targetEntity)
 {
     targetEntity.RoleDescrition = originalEntity.RoleDescrition;
     targetEntity.RoleName = originalEntity.RoleName;
     targetEntity.CanUsable = originalEntity.CanUsable;
 }