예제 #1
0
        public object Post(FB_Time request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Models.Instance_Config(hdUser);
            bool            isProjectLog   = false;
            string          notes          = "";
            int             staffID        = 0;
            DateTime        date           = DateTime.MinValue;

            if (request.is_project_log.HasValue)
            {
                isProjectLog = request.is_project_log.Value;
            }
            if (request.notes != null)
            {
                notes = request.notes;
            }
            if (request.fb_staff_id.HasValue)
            {
                staffID = request.fb_staff_id.Value;
            }
            if (request.date.HasValue)
            {
                date = request.date.Value;
            }
            try
            {
                string result = FBTimeEntries.CreateTimeEntry(hdUser, instanceConfig, staffID, request.fb_project_id, request.fb_task_type_id,
                                                              request.hours, notes, date, request.time_id, isProjectLog);
                if (result == "ok")
                {
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                else
                {
                    throw new HttpError(result.Replace("\n", " ").Replace("\r", " "));
                }
            }
            catch (Exception ex)
            {
                throw new HttpError(ex.Message.Replace("\n", " ").Replace("\r", " "));
            }
        }
예제 #2
0
 public object Post(FB_Time request)
 {
     ApiUser hdUser = request.ApiUser;
     Instance_Config instanceConfig = new Models.Instance_Config(hdUser);
     bool isProjectLog = false;
     string notes = "";
     int staffID = 0;
     DateTime date = DateTime.MinValue;
     if (request.is_project_log.HasValue)
     {
         isProjectLog = request.is_project_log.Value;
     }
     if (request.notes != null)
     {
         notes = request.notes;
     }
     if (request.fb_staff_id.HasValue)
     {
         staffID = request.fb_staff_id.Value;
     }
     if (request.date.HasValue)
     {
         date = request.date.Value;
     }
     try
     {
         string result = FBTimeEntries.CreateTimeEntry(hdUser, instanceConfig, staffID, request.fb_project_id, request.fb_task_type_id,
             request.hours, notes, date, request.time_id, isProjectLog);
         if (result == "ok")
         {
             return new HttpResult("", HttpStatusCode.OK);
         }
         else
         {
             throw new HttpError(result.Replace("\n", " ").Replace("\r", " "));
         }
     }
     catch (Exception ex)
     {
         throw new HttpError(ex.Message.Replace("\n", " ").Replace("\r", " "));
     }
 }