Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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();
        }