protected override async void OnResume() { base.OnResume(); _selectedBeanDiaChi = new BeanDiaChi(); _currentship = -1; if (Activity_Bill_Confirm_Address._DiaChiSelected != null && !String.IsNullOrEmpty(Activity_Bill_Confirm_Address._DiaChiSelected.SoNha)) { _selectedBeanDiaChi = Activity_Bill_Confirm_Address._DiaChiSelected; await Utilities_API.API_GetShipFee(generateDistrict(_selectedBeanDiaChi.QuanHuyen)); _currentship = Utilities_API.RESULT_API_COUNTSHIP; if (_tvAddress != null) { _tvAddress.Text = _selectedBeanDiaChi.SoNha + " " + _selectedBeanDiaChi.PhuongXa + " " + _selectedBeanDiaChi.QuanHuyen + " " + _selectedBeanDiaChi.TinhThanh; } if (_tvShip != null) { if (_currentship == -1) { _tvShip.Text = "Không giao hàng"; _tvShip.SetTextColor(Color.Red); } else { _tvShip.Text = String.Format("{0:#,0}", _currentship) + " VNĐ"; _tvShip.SetTextColor(Color.Black); } } } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); list = SQLiteDataHandler.BeanSession_LoadList(); _lstCart = SQLiteDataHandler.BeanShoppingCart_LoadList(); if (_btnClose == null) { if (list != null && list.Count > 0) // Co session { _MaNguoiDung = list[0].MaNguoiDung; if (!String.IsNullOrEmpty(_MaNguoiDung)) // keo API dia chi { await Utilities_API.API_GetListDiaChiByMaNguoiDung(_MaNguoiDung); _lstDiaChi = Utilities_API.RESULT_APIGET_LISTDIACHI_BYMANGUOIDUNG; if (_lstDiaChi != null && _lstDiaChi.Count > 0) { List <BeanDiaChi> temp = _lstDiaChi.Where(x => x.MacDinh == true).ToList(); await Utilities_API.API_GetShipFee(generateDistrict(temp[0].QuanHuyen)); _selectedBeanDiaChi = temp[0]; _currentship = Utilities_API.RESULT_API_COUNTSHIP; } } } else // chua co session { } } getLayout(); SetData(); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _DiaChiSelected = new BeanDiaChi(); if (Intent != null) { MaNguoiDung = Intent.GetStringExtra("MaNguoiDung"); if (!String.IsNullOrEmpty(MaNguoiDung)) { await Utilities_API.API_GetListDiaChiByMaNguoiDung(MaNguoiDung); _lstDiaChi = Utilities_API.RESULT_APIGET_LISTDIACHI_BYMANGUOIDUNG; } } getLayout(); SetData(); }
private void SetData() { if (!String.IsNullOrEmpty(_selectedBeanDiaChi.QuanHuyen)) { _tvAddress.Text = _selectedBeanDiaChi.SoNha + " " + _selectedBeanDiaChi.PhuongXa + " " + _selectedBeanDiaChi.QuanHuyen + " " + _selectedBeanDiaChi.TinhThanh; } if (_lstCart != null && _lstCart.Count > 0) { ShoppingCartRecyclerViewAdapter adapter = new ShoppingCartRecyclerViewAdapter(this, _lstCart); adapter.ClickDecrease += Click_ItemDecrease; adapter.ClickIncrease += Click_ItemIncrease; adapter.ItemClick += Click_DeleteItem; _recyclerData.SetAdapter(adapter); _recyclerData.SetLayoutManager(new LinearLayoutManager(this)); } if (_lstDiaChi != null && _lstDiaChi.Count > 0) { List <BeanDiaChi> temp = _lstDiaChi.Where(x => x.MacDinh == true).ToList(); _currentBeanDiaChi = temp[0]; _tvAddress.Text = ""; if (!String.IsNullOrEmpty(_currentBeanDiaChi.PhuongXa) && !String.IsNullOrEmpty(_currentBeanDiaChi.SoNha) && !String.IsNullOrEmpty(_currentBeanDiaChi.QuanHuyen) && !String.IsNullOrEmpty(_currentBeanDiaChi.TinhThanh)) { _tvAddress.Text = _currentBeanDiaChi.SoNha + " " + _currentBeanDiaChi.PhuongXa + " " + _currentBeanDiaChi.QuanHuyen + " " + _currentBeanDiaChi.TinhThanh; } } _currentmoney = CountTotalMoney(_lstCart); _tvPrice.Text = String.Format("{0:#,0}", _currentmoney) + " VNĐ"; if (_currentship == -1) { _tvShip.Text = "Không giao hàng"; _tvShip.SetTextColor(Color.Red); } else { _tvShip.Text = String.Format("{0:#,0}", _currentship) + " VNĐ"; _tvShip.SetTextColor(Color.Black); } }
private void Click_Recy_Choose(object sender, int e) { _DiaChiSelected = _lstDiaChi[e]; Finish(); }