Beispiel #1
0
 public RoleCommand GetRoleCommand()
 {
     if (roleCommand == null)
     {
         roleCommand = new RoleCommand
         {
             Id               = Id,
             Command_Id       = Command_Id,
             IsBuiltIn        = IsBuiltIn,
             IsManagerCommand = IsManagerCommand,
             SourceRole_Id    = SourceRole_Id,
             TargetRole_Id    = TargetRole_Id
         };
     }
     return(roleCommand);
 }
Beispiel #2
0
 private void CheckRoleCommand(int appid, int userId, RoleCommand rc)
 {
     var cmd = new Command { Id = rc.Command_Id };
     int cmdIdToCheck = -1;
     modelAccesser.Get<Command>(cmd);
     switch (cmd.CommandType)
     {
         case BuiltIns.BackendCommandType:
             cmdIdToCheck = BuiltIns.DefineBackendCommandCommand.Id;
             break;
         case BuiltIns.FrontendCommandType:
             cmdIdToCheck = BuiltIns.DefineFrontendCommandCommand.Id;
             break;
         case BuiltIns.UserCommandType:
             cmdIdToCheck = BuiltIns.DefineUserCommandCommand.Id;
             break;
     }
     CheckCommand(appid, rc.Application_Id, userId, cmdIdToCheck, BuiltIns.AllRole.Id);
 }
Beispiel #3
0
 public RoleCommandView(RoleCommand rc, Command cmd)
 {
     roleCommand = rc;
     if (roleCommand != null)
     {
         Id               = roleCommand.Id;
         Command_Id       = roleCommand.Command_Id;
         IsBuiltIn        = roleCommand.IsBuiltIn;
         IsManagerCommand = roleCommand.IsManagerCommand;
         SourceRole_Id    = roleCommand.SourceRole_Id;
         TargetRole_Id    = roleCommand.TargetRole_Id;
     }
     if (cmd != null && Command_Id == cmd.Id)
     {
         Command_Name   = cmd.Name;
         Application_Id = cmd.Application_Id;
         CommandType    = cmd.CommandType;
         Money          = cmd.Money;
     }
 }
Beispiel #4
0
 public RoleCommand GetRoleCommand(int appid, int userId, string token, int id)
 {
     try
     {
         CheckToken(appid, userId, token);
         RoleCommand rc = new RoleCommand { Id = id };
         modelAccesser.Get<RoleCommand>(rc);
         return rc.Loaded ? rc : null;
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Beispiel #5
0
 public RoleCommand AddRoleCommand(int appid, int userId, string token, RoleCommand roleCommand)
 {
     try
     {
         CheckToken(appid, userId, token);
         CheckRoleCommand(appid, userId, roleCommand);
         modelAccesser.Add(roleCommand);
         return roleCommand;
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Beispiel #6
0
 public void UpdateRoleCommand(int appid, int userId, string token, RoleCommand roleCommand)
 {
     try
     {
         CheckToken(appid, userId, token);
         CheckRoleCommand(appid, userId, roleCommand);
         modelAccesser.Update(roleCommand);
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Beispiel #7
0
 public void DeleteRoleCommand(int appid, int userId, string token, int id)
 {
     try
     {
         CheckToken(appid, userId, token);
         RoleCommand rc = new RoleCommand { Id = id };
         modelAccesser.Get<RoleCommand>(rc);
         if (rc.Loaded)
         {
             CheckRoleCommand(appid, userId, rc);
             modelAccesser.Delete(new RoleCommand { Id = id });
         }
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
 public YoYoStudio.Model.Core.RoleCommand AddRoleCommand(int userId, string token, YoYoStudio.Model.Core.RoleCommand roleCommand)
 {
     return(client.AddRoleCommand(application_Id, userId, token, roleCommand));
 }
 public void UpdateRoleCommand(int userId, string token, YoYoStudio.Model.Core.RoleCommand roleCommand)
 {
     client.UpdateRoleCommand(application_Id, userId, token, roleCommand);
 }
Beispiel #10
0
 public RoleCommandView(RoleCommand rc, Command cmd)
 {
     roleCommand = rc;
     if (roleCommand != null)
     {
         Id = roleCommand.Id;
         Command_Id = roleCommand.Command_Id;
         IsBuiltIn = roleCommand.IsBuiltIn;
         IsManagerCommand = roleCommand.IsManagerCommand;
         SourceRole_Id = roleCommand.SourceRole_Id;
         TargetRole_Id = roleCommand.TargetRole_Id;
     }
     if (cmd != null && Command_Id == cmd.Id)
     {
         Command_Name = cmd.Name;
         Application_Id = cmd.Application_Id;
         CommandType = cmd.CommandType;
         Money = cmd.Money;
     }
 }
Beispiel #11
0
        public RoleCommand GetRoleCommand()
        {
            if (roleCommand == null)
            {
                roleCommand = new RoleCommand
                {
                    Id = Id,
                    Command_Id = Command_Id,
                    IsBuiltIn = IsBuiltIn,
                    IsManagerCommand = IsManagerCommand,
                    SourceRole_Id = SourceRole_Id,
                    TargetRole_Id = TargetRole_Id

                };
            }
            return roleCommand;
        }