예제 #1
0
        public ModelResponse Approve(UserInfo user, long reqKey, long jobId, bool approved, string reason, Dictionary <string, object> newValues)
        {
            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (!DalFactory.Singleton.DataService.IsAdmin(user.UserId))
                {
                    return(new ModelResponse(101));
                }
                if (!DalFactory.Singleton.DataService.IsSuperAdmin(user.UserId))
                {
                    if (DalFactory.Singleton.RequestLog.AssignedTo(reqKey) != user.UserId)
                    {
                        return(new ModelResponse(101));
                    }
                }

                Repo.Approve(user.UserId, reqKey, jobId, approved, reason, newValues);
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0));
        }