Example #1
0
 public virtual void PreloadFromToggl()
 {
     if (TGTasks.AskExt() == WebDialogResult.OK)
     {
         foreach (TGTimecardTask task in TGTasks.Cache.Cached)
         {
             if (task.Selected ?? false)
             {
                 Base.Activities.Insert(TogglMapper.MapToTimecard(task));
             }
         }
     }
 }
Example #2
0
        public virtual IEnumerable tGTasks()
        {
            List <TGTimecardTask> tasks = new List <TGTimecardTask>();

            EPEmployee employee = Base.Employee.Current;

            if (employee != null)
            {
                DateTime startDate = PXWeekSelector2Attribute.GetWeekStartDate(Base.Document.Current.WeekID.Value);
                DateTime endDate   = PXWeekSelector2Attribute.GetWeekEndDate(this.Base, Base.Document.Current.WeekID.Value);

                TGEPEmployeeExtension employeeExt = PXCache <EPEmployee> .GetExtension <TGEPEmployeeExtension>(employee);

                using (TogglClient client = new TogglClient(employeeExt.UsrTGToken))
                {
                    foreach (TogglMap result in client.TGTimecardTaskList(startDate, endDate))
                    {
                        tasks.Add(TogglMapper.MapFromToggl(this.Base, result));
                    }
                }
            }

            return(tasks);
        }