public async void loadData() { MYschdeule2 = new ObservableCollection <EmployeeSchedule>(); List <EmployeeSchedule> filterdatatoshow = new List <EmployeeSchedule>(); try { BasicinformationDetails BID = new BasicinformationDetails(); Employee = EmployeeProfileHelper.EmployeeCurrentProfile; //await apiSevices.GetBasicinformation(Settings.AccessToken); var employeeSch = Employee.EmployeeScheduels; var allSpecificcDates = employeeSch.Where(y => y.DayOfWeek == -1).ToList(); tempschadual = new ObservableCollection <EmployeeSchedule>(allSpecificcDates.OrderByDescending(d => d.createdDate)); _Listtofilter = tempschadual; foreach (var item in _Listtofilter) { item.ToTimeDate = Convert.ToDateTime(item.To); item.FromTimeDate = Convert.ToDateTime(item.From); } MYschdeule2 = new ObservableCollection <EmployeeSchedule>(tempschadual.Where(x => x.SpecificDateyear == MonthlyControlHelper.CurrentYear && x.SpecificDatmonth == MonthlyControlHelper.GetCurrentMonthNumber().ToString()).ToList()); } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in Employeescheduleviewmodel.cs", ex); await logged.LoggAPI(); } }
public async void get() { try { BasicinformationDetails BID = new BasicinformationDetails(); Employee = EmployeeProfileHelper.EmployeeCurrentProfile; var employeeSch = Employee.EmployeeScheduels; var sch = employeeSch.FirstOrDefault(d => d.DayOfWeek == constants.currentDayOfWeek); if (sch != null) { Timefrom = DateTime.Parse(sch.From).TimeOfDay; Timeto = DateTime.Parse(sch.To).TimeOfDay; isAvailableFullDay = sch.isAvailableFullDay; TotalHours = sch.TotalHour; } scheduleListOFData.Clear(); foreach (var item in employeeSch) { scheduleListOFData.Add(item); } } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in employeescheduleviewmodel", ex); await logged.LoggAPI(); } }
public static async Task <EmployeeCurrentProfile> RefreshEmployeeCurrentProfile(bool refresh = false) { if (refresh) { BasicinformationDetails api = new BasicinformationDetails(); EmployeeCurrentProfile = await api.GetCurentUserBasicinformationDetailsAsync(URLConfig.CurrentEmployeeProfileAPI); } return(EmployeeCurrentProfile); }
public async void RefreshData() { BasicinformationDetails BID = new BasicinformationDetails(); Employee = await BID.GetCurentUserBasicinformationDetailsAsync(URLConfig.Currentuserapiurl); var employeeSch = Employee.EmployeeScheduels; var shc1 = employeeSch.Where(y => y.DayOfWeek == -1); ObservableCollection <EmployeeSchedule> castlist = new ObservableCollection <EmployeeSchedule>(shc1); MYschdeule2 = castlist; }
/* public Allspecialdays(INavigation nav) * { * this.Navigation = nav; * loadData(); * }*/ public async void loadData() { BasicinformationDetails BID = new BasicinformationDetails(); Employee = await BID.GetCurentUserBasicinformationDetailsAsync(URLConfig.Currentuserapiurl); var employeeSch = Employee.EmployeeScheduels; var shc1 = employeeSch.FirstOrDefault(y => y.DayOfWeek == -1); //uu.Clear(); //var z = employeeSch.Find(y => y.DayOfWeek == 0); var data = employeeSch.Where(y => y.DayOfWeek == -1); Device.BeginInvokeOnMainThread(() => { foreach (var item in employeeSch.Where(y => y.DayOfWeek == -1).ToList()) { //uu.Add(item); MYschdeule2.Add(item); } }); constants.datas = MYschdeule2; }