private async void Cart_Click1(object sender, EventArgs e)
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus = idCustomer.Substring(4, idCustomer.Length - 6);

            var List_Cart = await myAPI.GetCarts();

            int max = int.Parse(List_Cart[0].MaGioHang);

            for (int i = 1; i < List_Cart.Count; i++)
            {
                if (max < int.Parse(List_Cart[i].MaGioHang))
                {
                    max = int.Parse(List_Cart[i].MaGioHang);
                }
            }
            max++;
            Cart cartt = new Cart();

            cartt.MaGioHang = max.ToString();
            cartt.MaKh      = idCustomer.Substring(2, idCustomer.Length - 4);
            if (Intent.GetStringExtra("ServiceName") == null)
            {
                cartt.MaCombo = Intent.GetStringExtra("ServiceId");
            }
            else
            {
                cartt.MaDv = Intent.GetStringExtra("ServiceId");
            }
            var results = await myAPI.PostGioHang(cartt);

            Toast.MakeText(this, results, ToastLength.Short).Show();
        }
        private async void GetInfo()
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var customerId = await myAPI.GetIdCustomer("0123456789");

            customerId = customerId.Substring(2, customerId.Length - 4);
            var result = await myAPI.GetCustomerInfo(customerId);

            name.Text  = result.tenKh;
            email.Text = result.email;
            if (Intent.GetStringExtra("tt") == "1")
            {
                address.Text = Intent.GetStringExtra("addrData");
            }
            else
            {
                address.Text = result.diaChi;
            }
            phone.Text = result.sdt;
            if (result.gioitinh == true)
            {
                male.Checked = true;
            }
            else
            {
                female.Checked = true;
            }
            birthday.Text = (result.ngaySinh ?? default(DateTime)).ToString("dd-MM-yyyy");
            cday          = Int32.Parse(((result.ngaySinh ?? default(DateTime)).ToString("dd-MM-yyyy")).Substring(0, 2));
            cmonth        = Int32.Parse(((result.ngaySinh ?? default(DateTime)).ToString("dd-MM-yyyy")).Substring(3, 2));
            cyear         = Int32.Parse(((result.ngaySinh ?? default(DateTime)).ToString("dd-MM-yyyy")).Substring(6, 4));
            //Toast.MakeText(this, result.NgaySinh.ToString(), ToastLength.Short).Show();
            heigh.Text  = result.chieuCao.ToString();
            weight.Text = result.canNang.ToString();
        }
Пример #3
0
        private async void getHistoryAppointment()
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus    = idCustomer.Substring(2, idCustomer.Length - 4);
            var    result = await myAPI.GetHistoryAppointment(cus);

            mAdapterAppointment = new ShoppingCardHistoryAppointment_Appointment_Customer_Adapter(result);
            mRecyclerViewAppointment.SetAdapter(mAdapterAppointment);
        }
Пример #4
0
        private async void getInfoCustomer()
        {
            myAPI      = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus          = idCustomer.Substring(2, idCustomer.Length - 4);
            var    customerInfo = await myAPI.GetCustomerInfo(cus);

            idCustomer = cus;

            imageCustomer = customerInfo.anhKh;

            Picasso.Get().Load(customerInfo.anhKh).Into(avar);
            customerName.Text = customerInfo.tenKh;
        }
Пример #5
0
        private async void GetListService()
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus    = idCustomer.Substring(2, idCustomer.Length - 4);
            var    result = await myAPI.GetCart(cus);



            //for (int i = 0; i < result.Count; i++)
            //{

            //}
            mAdapterService = new ShoppingCardShoppingCart_Service_Customer_Adapter(result);
            mRecyclerViewService.SetAdapter(mAdapterService);
        }
Пример #6
0
        public async void getAppointmentList()
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus    = idCustomer.Substring(2, idCustomer.Length - 4);
            var    result = await myAPI.GetAppointment(cus);

            mAdapterRecentAppointment = new Appointment_RecentAppointment_Customer_Adapter(result);
            mRecyclerViewRecentAppointment.SetAdapter(mAdapterRecentAppointment);

            //mAdapterRecentAppointment.NotifyItemRemoved

            mAdapterRecentAppointment.ItemClick += (s, e) =>
            {
                var intent = new Intent(Activity, typeof(Customer.activity_DetailAppointmentCustomer));
                intent.PutExtra("AppointmentId", result[e].MaLichHen);
                StartActivity(intent);
            };
        }
Пример #7
0
        public async void GetUsedService()
        {
            // lay du lieu tu db
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var idCustomer = await myAPI.GetIdCustomer("0123456789");

            string cus           = idCustomer.Substring(2, idCustomer.Length - 4);
            var    resultService = await myAPI.GetListServiceUsed(cus);

            var resultCombo = await myAPI.GetListComboUsed(cus);

            var max = resultService.Count() + resultCombo.Count();

            mUsedService = new List <ListPromotion>(max);



            for (int i = 0; i < resultService.Count; i++)
            {
                var DataSample_Services_Outlet_ViewModel = new ListPromotion();
                DataSample_Services_Outlet_ViewModel.MaDV         = resultService[i].MaDV;
                DataSample_Services_Outlet_ViewModel.Image        = resultService[i].Image;
                DataSample_Services_Outlet_ViewModel.NameService  = resultService[i].NameService;
                DataSample_Services_Outlet_ViewModel.price        = resultService[i].price;
                DataSample_Services_Outlet_ViewModel.TotalOutlets = resultService[i].TotalOutlets;
                mUsedService.Add(DataSample_Services_Outlet_ViewModel);
            }

            for (int i = resultService.Count; i < max; i++)
            {
                var DataSample_Services_Outlet_ViewModel = new ListPromotion();
                DataSample_Services_Outlet_ViewModel.MaDV         = resultCombo[i - resultService.Count].MaDV;
                DataSample_Services_Outlet_ViewModel.Image        = resultCombo[i - resultService.Count].Image;
                DataSample_Services_Outlet_ViewModel.NameService  = resultCombo[i - resultService.Count].NameService;
                DataSample_Services_Outlet_ViewModel.price        = resultCombo[i - resultService.Count].price;
                DataSample_Services_Outlet_ViewModel.TotalOutlets = resultCombo[i - resultService.Count].TotalOutlets;
                mUsedService.Add(DataSample_Services_Outlet_ViewModel);
            }


            mAdapterUsedService = new Home_UsedService_Customer_Adapter(mUsedService);
            mRecyclerViewUsedService.SetAdapter(mAdapterUsedService);

            mAdapterUsedService.ItemClick += (s, e) =>
            {
                var intent = new Intent(Activity, typeof(Customer.activity_Service_Customer));
                if (e >= 0 && e < resultService.Count)
                {
                    intent.PutExtra("ServiceId", mUsedService[e].MaDV);
                }
                else
                {
                    intent.PutExtra("ComboId", mUsedService[e].MaDV);
                }
                intent.PutExtra("ServiceName", mUsedService[e].NameService);
                if (mUsedService[e].NamePromotion == null)
                {
                    intent.PutExtra("PromotionName", mUsedService[e].price.ToString());
                }
                else
                {
                    intent.PutExtra("PromotionName", mUsedService[e].NamePromotion.ToString());
                }
                intent.PutExtra("Index", e.ToString());
                StartActivity(intent);
            };
        }