Ejemplo n.º 1
0
        private static async Task AddUserRoleHistory(UsersInRole current, UserRoleOperations op)
        {
            UsersRoleHistoryServiceProxy hrhsvc = new UsersRoleHistoryServiceProxy();
            UsersRoleHistorySet          urhs   = new UsersRoleHistorySet();
            UsersRoleHistory             urh    = new UsersRoleHistory();

            urh.UserID      = current.UserID;
            urh.RoleID      = current.RoleID;
            urh.SubPriority = current.SubPriority;
            urh.OperatorID  = current.AdminID;
            urh.ChangeDate  = DateTime.UtcNow;
            switch (op)
            {
            case UserRoleOperations.Added:
                urh.Operation = urhs.OperationValues[0];
                break;

            case UserRoleOperations.Modified:
                urh.Operation = urhs.OperationValues[1];
                break;

            case UserRoleOperations.Deleted:
                urh.Operation = urhs.OperationValues[2];
                break;
            }
            await hrhsvc.AddOrUpdateEntitiesAsync(Cntx, urhs, new UsersRoleHistory[] { urh });
        }
 private static async Task AddUserRoleHistory(UsersInRole current, UserRoleOperations op)
 {
     UsersRoleHistoryServiceProxy hrhsvc = new UsersRoleHistoryServiceProxy();
     UsersRoleHistorySet urhs = new UsersRoleHistorySet();
     UsersRoleHistory urh = new UsersRoleHistory();
     urh.UserID = current.UserID;
     urh.RoleID = current.RoleID;
     urh.SubPriority = current.SubPriority;
     urh.OperatorID = current.AdminID;
     urh.ChangeDate = DateTime.UtcNow;
     switch (op)
     {
         case UserRoleOperations.Added:
             urh.Operation = urhs.OperationValues[0];
             break;
         case UserRoleOperations.Modified:
             urh.Operation = urhs.OperationValues[1];
             break;
         case UserRoleOperations.Deleted:
             urh.Operation = urhs.OperationValues[2];
             break;
     }
     await hrhsvc.AddOrUpdateEntitiesAsync(Cntx, urhs, new UsersRoleHistory[] { urh });
 }