예제 #1
0
 public IEnumerable <HolidayInfo> GetHoliday(string name, int year)
 {
     try
     {
         var resp = TasksService.GetHolidayForUser(new GetHolidayForUserRequest {
             User = name, Year = year
         });
         return(resp.Holidays);
     }
     catch (Exception ex)
     {
         var result = Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
         throw new HttpResponseException(result);
     }
 }
예제 #2
0
        public ActionResult Index(string toid)
        {
            if (!string.IsNullOrWhiteSpace(toid))
            {
                var task = TasksService.GetTask(new GetTaskRequest {
                    TaskOid = Guid.Parse(toid)
                });
                var docs       = GetAttachedDocuments(task.Task.TaskOid);
                var comments   = GetCommentsForTask(task.Task.WorkflowOid.ToString());
                var parameters = GetTaskParameters(task.Task.TaskOid);

                var model = CreateTask(task.Task, docs, comments, parameters);
                var idStr = model.GetPropertyValueFromName("HolidayId");
                var name  = model.GetPropertyValueFromName("UserName");
                int id;
                int.TryParse(idStr, out id);

                if (id > 0)
                {
                    var res = TasksService.GetHolidayForUser(new GetHolidayForUserRequest {
                        HolidayId = id, User = name
                    });
                    var holiday = res.Holidays.First();
                    if (holiday != null)
                    {
                        var dates         = holiday.Holiday.Select(DateTime.Parse).OrderBy(d => d).ToList();
                        var datesToString = dates.Select(d => d.ToString("ddd d MMM"));
                        ViewBag.Dates = datesToString.ToArray();
                    }
                }


                return(CreateViewFromTaskOid(model));
            }

            return(View());
        }