public LoginPageViewModel() { if (Device.RuntimePlatform == Device.Android) { myAPI = RestService.For <IMyAPI>("http://10.0.2.2:5000"); } else if ((Device.RuntimePlatform == Device.UWP)) { myAPI = RestService.For <IMyAPI>("http://localhost:5000"); } else if ((Device.RuntimePlatform == Device.iOS)) { myAPI = RestService.For <IMyAPI>("http://127.0.0.1:5000"); } else { MessagingCenter.Send <LoginPageViewModel, string>(this, "Login", "Unsupported Device"); } user = new TblUser(); LoginCommand = new Command(async() => { try { var result = await myAPI.LoginUser(user); MessagingCenter.Send <LoginPageViewModel, string>(this, "Login", "Login Success"); } catch (Exception ex) { MessagingCenter.Send <LoginPageViewModel, string>(this, "Login", ex.Message); } }); }
/// <summary> /// Changes image of the specified category. /// </summary> /// In Postman, select 'form-data' payload, then select 'file' type, and the /// file chooser will appear. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// id of the category /// </param> /// <param name='file'> /// image file /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> UpdateCategoryImageAsync(this IMyAPI operations, int id, string file = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateCategoryImageWithHttpMessagesAsync(id, file, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public async void DoAll() { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); var result = await myAPI.GetComment(Intent.GetStringExtra("ServiceId")); for (int i = 0; i < result.Count; i++) { star[(result[i].SoSao ?? default(int)) - 1]++; } Drawchart(); double avg; if (((star[0] + star[1] + star[2] + star[3] + star[4])) != 0) { avg = ((star[0] * 1 + star[1] * 2 + star[2] * 3 + star[3] * 4 + star[4] * 5) / (star[0] + star[1] + star[2] + star[3] + star[4])); } else { avg = 0; } avg = Math.Round(avg, 1); rateStar.Text = (avg.ToString() + "/5").ToString(); Array.Clear(star, 0, star.Length); }
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(); }
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(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <string> > ApiValuesGetAsync(this IMyAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiValuesGetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Lists all categories (image bytes not included). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <CategoryDto> > GetAllCategoriesAsync(this IMyAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAllCategoriesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public AppointmentPage() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjIyOTkzQDMxMzcyZTM0MmUzMEFiRHhQTms2NTJySzBzZ1dhM2xhTml0RVJxTVBwZ0QrWHVMVjBZblNSMUk9"); InitializeComponent(); var currentContext = Android.App.Application.Context; this.context = currentContext; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); //ImageTabFrom.Tapped += ImageTabFrom_Tapped; ImageTabTo.Tapped += ImageTabTo_Tapped; SaveAppointment.Clicked += SaveAppointment_Clicked; var getDate = Application.Current.Properties["APP_DATE"] as string; var getTime = Application.Current.Properties["APP_TIME"] as string; var getSubject = Application.Current.Properties["APP_SUB"] as string; DateTime date = DateTime.ParseExact(getDate, "dd/MM/yyyy", null); TimeSpan time = TimeSpan.ParseExact(getTime, "hh\\:mm", null); AppointmentDateFrom.IsEnabled = false; AppointmentTimeFrom.IsEnabled = false; AppointmentDateFrom.Date = date; AppointmentTimeFrom.Time = time; lblSubject.Text = "เลื่อนนัด: " + getSubject; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Destination> ApiDestinationsByIdGetAsync(this IMyAPI operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiDestinationsByIdGetWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <WeatherForecast> > GetWeatherForecastAsync(this IMyAPI operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWeatherForecastWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); //Create API myAPI = RestService.For <IMyAPI>("http://10.0.2.2:3000"); apiRequestHelper = new APIRequestHelper(this, myAPI); edt_email = FindViewById <EditText>(Resource.Id.edt_email); edt_password = FindViewById <EditText>(Resource.Id.edt_password); btn_login = FindViewById <Button>(Resource.Id.btn_login); btn_login.Click += async delegate { await apiRequestHelper.RequestLoginUserAsync(edt_email.Text.ToString(), edt_password.Text.ToString()); }; txt_create_account = FindViewById <TextView>(Resource.Id.txt_create_account); txt_create_account.Click += delegate { RegisterDialog dialog = new RegisterDialog(this, apiRequestHelper); dialog.Show(); }; }
public async override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { Customer_ShoppingCardShoppingCart_Service_ViewModel_ViewHolder vh = holder as Customer_ShoppingCardShoppingCart_Service_ViewModel_ViewHolder; myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); var result = await myAPI.GetOutletFromService(cart_list[position].MaDv); holder. //a.GetOutletToSpinner(vh.Outlet, result); if (cart_list[position].Anhdv == "") { Picasso.Get().Load(cart_list[position].Anhcb).Into(vh.ServiceImg); } else { Picasso.Get().Load(cart_list[position].Anhdv).Into(vh.ServiceImg); } //vh.OutletName.Text = cart_list[position].ten; //vh.Time.Text = cart_list[position].NgayHen.ToString(); getListOutlet(cart_list[position].MaDv, cart_list[position].MaCombo, vh.Outlet, ); }
public async void getListOutlet(string serviceId, string comboId, Spinner spn, ViewGroup parent) { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); List <AddressOfService> result; if (serviceId == null) { result = await myAPI.GetOutletFromCombo(comboId); } else { result = await myAPI.GetOutletFromService(serviceId); } //xử lí sự kiện chọn item //listOutlet.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(listOutlet_ItemSelected); List <KeyValuePair <string, string> > outlets_pair = new List <KeyValuePair <string, string> >(result.Count); var outlets = new List <string>(result.Count); for (int i = 0; i < result.Count; i++) { var item = new KeyValuePair <string, string>(result[i].MaChiNhanh, result[i].DiaChi); outlets_pair.Add(item); } foreach (var item in outlets_pair) { outlets.Add(item.Value); } var adapter = new ArrayAdapter <string>(parent.Context, Android.Resource.Layout.SimpleSpinnerItem, outlets); spn.Adapter = adapter; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='mediaElementId'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <MediaElement> GetMediaElementAsync(this IMyAPI operations, int mediaElementId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMediaElementWithHttpMessagesAsync(mediaElementId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public APITestPage() { InitializeComponent(); btnLogin.Clicked += BtnLogin_Clicked; var currentContext = Android.App.Application.Context; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); }
public async void GetAdvertisement() { // lay du lieu tu db myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); var result = await myAPI.GetListAdvertisement(); mAdapterAdvertisement = new Home_Advertisement_Customer_Adapter(result); mRecyclerViewAdvertisement.SetAdapter(mAdapterAdvertisement); }
public HistoryPage() { InitializeComponent(); var currentContext = Android.App.Application.Context; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); this.SelectedTabColor = Color.FromHex("#FFFFFF"); this.UnselectedTabColor = Color.FromHex("#4C4C4C"); }
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); }
public RegisterPage() { NavigationPage.SetHasNavigationBar(this, true); InitializeComponent(); var currentContext = Android.App.Application.Context; this.context = currentContext; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); }
//public DateTime(int year, int day, int month); private async void getTherapist() { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); //DateTime date1 = new DateTime(2020, 4, 6); //var result = await myAPI.GetListDoctor("CN1", date1, "1"); //int i = 0; var result = await myAPI.GetCart("KH1"); int i = 1; }
public MainPageDetail() { InitializeComponent(); var currentContext = Android.App.Application.Context; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); popupLoadingView.IsVisible = true; activityIndicator.IsRunning = true; GetHistoryData(); }
private void SendConfirm_Click(object sender, EventArgs e) { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); Finish(); SetContentView(Resource.Layout.Account_Customer); var navBottom = FindViewById <Android.Support.Design.Widget.BottomNavigationView>(Resource.Id.bottom_navigation); navBottom.NavigationItemSelected += (s, b) => { var trans = SupportFragmentManager.BeginTransaction(); trans.Replace(Resource.Id.frame_container, new Fragment.Account()).Commit(); }; }
public MainPageMaster() { InitializeComponent(); //Initial database API var currentContext = Android.App.Application.Context; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); //End of initial databaseAPI BindingContext = new MainPageMasterViewModel(); ListView = MenuItemsListView; LoadProfile(); }
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; }
public async void getDescribe() { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); DetailService result; if (Intent.GetStringExtra("ServiceId") == null) { result = await myAPI.GetCombo(Intent.GetStringExtra("ComboId")); } else { result = await myAPI.GetService(Intent.GetStringExtra("ServiceId")); } describe.Text = result.MoTa; }
public async void GetOutlet() { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); var result = await myAPI.GetListChiNhanh(); mAdapterOutlet = new Home_Outlet_Customer_Adapter(result); mRecyclerViewOutlet.SetAdapter(mAdapterOutlet); mAdapterOutlet.ItemClick += (s, e) => { var intent = new Intent(Activity, typeof(Customer.activity_Outlet_Customer)); intent.PutExtra("OutletId", result[e].MaCN); intent.PutExtra("OutletName", result[e].name); StartActivity(intent); }; }
public ProfilePage() { InitializeComponent(); //Initial API var currentContext = Android.App.Application.Context; this.context = currentContext; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); //End of initial SetEditMode(false); popupLoadingView.IsVisible = true; activityIndicator.IsRunning = true; LoadProfile(); }
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); }
private async void getAppointmentDetail() { myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); string id = Intent.GetStringExtra("AppointmentId"); var result = await myAPI.GetAppointmentDetail(id); maLH = result[0].MaLichHen; Picasso.Get().Load(result[0].AnhChiNhanh).Into(image); outletName.Text = result[0].TenChiNhanh; address.Text = result[0].DiaChi; customerName.Text = result[0].TenKH; phone.Text = result[0].sdt; time.Text = result[0].GioHen.ToString(); date.Text = result[0].NgayHen.ToString(); totalPrice.Text = result[0].Gia.ToString(); totalService.Text = result[0].TongDv.ToString(); }
public SchedulePage() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjIyOTkzQDMxMzcyZTM0MmUzMEFiRHhQTms2NTJySzBzZ1dhM2xhTml0RVJxTVBwZ0QrWHVMVjBZblNSMUk9"); InitializeComponent(); popupLoadingView.IsVisible = true; activityIndicator.IsRunning = true; var currentContext = Android.App.Application.Context; this.context = currentContext; myAPI = RestService.For <IMyAPI>(App._apiURL.ToString()); apiRequestHelper = new APIRequestHelper(currentContext, myAPI); AddAppointment.Clicked += AddAppointment_Clicked; CancelAppointment.Clicked += CancelAppointment_Clicked; schedule.CellTapped += Schedule_CellTapped; LoadAppointment(); }