Exemplo n.º 1
0
 public static IProject Get(Guid project_id)
 {
     using (Context ctx = new Context(""))
     {
         return ProjectUtility.Get(ctx, project_id);
     }
 }
Exemplo n.º 2
0
 public static List<IProject> GetAll()
 {
     using (Context ctx = new Context(""))
     {
         return ProjectUtility.GetAll(ctx);
     }
 }
Exemplo n.º 3
0
 public static void Update(IProject project)
 {
     if (project == null)
         return;
     using (Context ctx = new Context(""))
     {
         ProjectUtility.Update(ctx, project);
     }
 }
Exemplo n.º 4
0
 public static void Delete(Guid project_id)
 {
     if(project_id == null)
         return;
     using (Context ctx = new Context(""))
     {
         ProjectUtility.Delete(ctx, project_id);
     }
 }
Exemplo n.º 5
0
 public static ITask Get(Guid task_id)
 {
     if(task_id == null)
         return null;
     using (Context ctx = new Context(""))
     {
         return TaskUtility.Get(ctx, task_id);
     }
 }
Exemplo n.º 6
0
 public static List<ITask> GetAllProjectTask(Guid project_id)
 {
     List<ITask> projectTasks = null;
     if (project_id == null)
         return projectTasks;
     using (Context ctx = new Context(""))
     {
         projectTasks = TaskUtility.GetAllProjectTasks(ctx, project_id);
     }
     return projectTasks;
 }
Exemplo n.º 7
0
 public static IUser Get(Guid user_id)
 {
     IUser user = null;
     using (Context context = new Context(""))
     {
         if (user_id != null)
         {
             user = UserUtility.Get(context, user_id);
         }
     }
     return user;
 }
Exemplo n.º 8
0
        public static bool AuthorizedByRole(Guid userId, Guid resourceId)
        {
            bool result = false;
            using(Context ctx = new Context(""))
            {
                SqlCommand command = new SqlCommand("isAuthorizedByRole", ctx.Connection);
                command.Parameters.Add(new SqlParameter("UserID", userId));
                command.Parameters.Add(new SqlParameter("ResourceID", resourceId));
                command.Parameters.Add(new SqlParameter("Result", SqlDbType.Bit, 32, ParameterDirection.Output,
                    false, 0, 0, "", DataRowVersion.Default, result));
                command.CommandType = CommandType.StoredProcedure;

                command.ExecuteNonQuery();
                return (bool)command.Parameters["Result"].Value;
            }
        }
Exemplo n.º 9
0
        public static string Login(string login, string password)
        {
            var token = (from u in _loggedInUsersByGuid where u.Value.Name.Equals(login) select u.Key).FirstOrDefault();
            if (token != null)
                return token.ToString();

            IUser user = null;
            using (Context context = new Context(""))
            {
                user = UserUtility.GetByLogin(context, login);
            }

            token = Guid.NewGuid();

            _loggedInUsersByGuid.Add(token, user);

            return token.ToString();
        }
Exemplo n.º 10
0
 public static IUser GetByLogin(Context context, string login)
 {
     throw new NotImplementedException();
 }