public virtual void EPTimeCard_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPTimeCard row = e.Row as EPTimeCard; if (row != null) { EPEmployee employee = Base.Employee.Current; if (employee != null) { TGEPEmployeeExtension employeeExt = PXCache <EPEmployee> .GetExtension <TGEPEmployeeExtension>(employee); preloadFromToggl.SetEnabled(!String.IsNullOrEmpty(employeeExt.UsrTGToken)); } } }
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); }