private async void LoadMenuFromApi() { overlay.IsVisible = true; UserDetais objUserDetais = await App.TodoManager.UserDetais(App.id); List <UserMenu> lstUserDetais = new List <UserMenu>(); var menu = new UserMenu(); List <Service> services = objUserDetais.data.branch.corporate.services.OrderBy(o => o.sequence).ToList(); if (objUserDetais.data != null) { foreach (Service s in services) { menu.id = s.id; menu.name = s.name; menu = new UserMenu(); lstUserDetais.Add(menu); } App.UserMenu = lstUserDetais; App.Database.SaveUserMenu(lstUserDetais); LoadMenuFromLocalDB(); overlay.IsVisible = false; } }
async void GetKoins() { try { UserDetais objUserDetais = await App.TodoManager.UserDetais(App.id); if (objUserDetais.data != null) { lblTotalKoins.Text = objUserDetais.data.points.ToString() + " KOINS"; } } catch (Exception ex) { DependencyService.Get <IMessage>().LongAlert(); } finally { } }
async void BindUserDetails() { try { overlay.IsVisible = true; UserDetais objUserDetais = await App.TodoManager.UserDetais(App.id); if (objUserDetais.data != null) { lblName.Text = objUserDetais.data.name; userprofile.Source = objUserDetais.data.photo_url; lblCoins.Text = objUserDetais.data.points.ToString() + " KOINS"; } } catch (Exception ex) { DependencyService.Get <IMessage>().LongAlert(); } finally { overlay.IsVisible = false; } }
private async void pkrRelation_SelectedIndexChanged(object sender, EventArgs e) { try { var pkr = (Picker)sender; if (LastIndex != pkr.SelectedIndex) { int id = objCommonDropDowns.GetRalations().Find(x => x.Name == pkr.SelectedItem.ToString()).ID; enmRelations Relation = (enmRelations)id; int index = lstHealthCheckupInitial.IndexOf((HealthCheckUpDeafult)pkr.BindingContext); HealthCheckUpDeafult objHealthCheckUpDeafult = new Models.HealthCheckUpDeafult(); objHealthCheckUpDeafult = ((HealthCheckUpDeafult)pkr.BindingContext) as HealthCheckUpDeafult; if (Relation == enmRelations.Self) { UserDetais objUserDetais = await App.TodoManager.UserDetais(App.id); objHealthCheckUpDeafult.SeniorityLevelEnablity = false; objHealthCheckUpDeafult.EmployeeCodeEnablity = false; objHealthCheckUpDeafult.GenderEnablity = false; objHealthCheckUpDeafult.DobEnablity = false; objHealthCheckUpDeafult.NameEnablity = false; objHealthCheckUpDeafult.PhoneEnablity = false; objHealthCheckUpDeafult.ID = objUserDetais.data.id; objHealthCheckUpDeafult.Name = objUserDetais.data.name; objHealthCheckUpDeafult.RelationID = "1"; objHealthCheckUpDeafult.Relation = "Self"; // objHealthCheckUpDeafult.MaritalStatusID = objUserDetais.data.status; //objHealthCheckUpDeafult.MaritalStatus = objCommonDropDowns.MaritalStatus()[Convert.ToInt32(SavedPatientResponse.data[0].marital_status) - 1].Name; objHealthCheckUpDeafult.GenderID = objUserDetais.data.gender.ToLower() == "male" ? 0 : 1; int Gender = objUserDetais.data.gender.ToLower() == "male" ? 0 : 1; objHealthCheckUpDeafult.Gender = objCommonDropDowns.Gender()[Gender].Name; objHealthCheckUpDeafult.EmployeeCode = objUserDetais.data.employee_code; objHealthCheckUpDeafult.ExistingPatientVisiblity = false; if (objUserDetais.data.seniority_level != 0) { objHealthCheckUpDeafult.SeniorityLevelID = objUserDetais.data.seniority_level.ToString(); objHealthCheckUpDeafult.SeniorityLevel = objCommonDropDowns.GetSenorityLevels()[(int)objUserDetais.data.seniority_level - 1].Name; } else { objHealthCheckUpDeafult.SeniorityLevelEnablity = false; } objHealthCheckUpDeafult.Phone = objUserDetais.data.phone; objHealthCheckUpDeafult.DateOfBirth = Convert.ToDateTime(objUserDetais.data.date_of_birth).ToString("dd/MMM/yyyy"); LastIndex = pkr.SelectedIndex; lstHealthCheckupInitial[index] = objHealthCheckUpDeafult; } else { //lvHealthCheckups.ItemsSource = null; objHealthCheckUpDeafult.SeniorityLevelEnablity = false; objHealthCheckUpDeafult.EmployeeCodeEnablity = Relation == enmRelations.CoWorker; objHealthCheckUpDeafult.GenderEnablity = true; objHealthCheckUpDeafult.DobEnablity = true; objHealthCheckUpDeafult.NameEnablity = true; objHealthCheckUpDeafult.PhoneEnablity = true; objHealthCheckUpDeafult.EmployeeCode = ""; objHealthCheckUpDeafult.SeniorityLevel = null; LastIndex = pkr.SelectedIndex; lstHealthCheckupInitial[index] = objHealthCheckUpDeafult; lvHealthCheckups.ItemsSource = lstHealthCheckupInitial; } } } catch (Exception ex) { overlay.IsVisible = false; DependencyService.Get <IMessage>().LongAlert(); } }