private async void DeleteCustomer(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa customer này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { if (await customer_repo.Remove((int)obj)) { ListCustomer.Remove(ListCustomer.SingleOrDefault(t => t.CusID == (int)obj)); dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async void ShowInfoCus(int?obj) { if (obj != null) { var index = (int)obj; var cus = ListCustomer.SingleOrDefault(t => t.CusID == index); if (cus != null) { Name = cus.Name; CusID = cus.CusID.ToString(); ImgCus = cus.Avatar.LoadImage(); Phone = cus.Phone; if (cus.Sex == true) { IsB = true; } if (cus.Sex == false) { IsG = true; } Address = cus.Address; Email = cus.Email; if (cus.Kind != null) { int indexcus = (int)cus.Kind; Kind = ListKinds.ElementAt(indexcus); } else { Kind = null; } } await DialogHost.Show(new CustomerProfile(), DialogHostId); } }