private async void btnFacilitySaveUpdate_Click(object sender, RoutedEventArgs e)
        {
            string strfacilityDetails   = isolatedLocalStorage.Read(IsolatedFiles.facilityDetails);
            var    deserializedFacility = JsonConvert.DeserializeObject <Facility>(strfacilityDetails);

            string strAuth          = isolatedLocalStorage.Read(IsolatedFiles.authFile);
            var    deserializedAuth = JsonConvert.DeserializeObject <Auth>(strAuth);

            var facility = new Facility();

            facility.street  = txtAddress.Text;
            facility.name    = txtName.Text;
            facility.poBox   = txtPoBox.Text;
            facility.state   = txtState.Text;
            facility.email   = txtEmail.Text;
            facility.city    = txtCity.Text;
            facility.contact = txtContact.Text;
            facility.country = txtCountry.Text;
            facility.logo    = facilityBase64Logo;
            //deserializedFacility
            string response = await httpClientServices.UpdateAsync(EndPoints.savefacilities, deserializedFacility.Id, facility, deserializedAuth.AccessToken);

            isolatedLocalStorage.Write(IsolatedFiles.facilityDetails, response);
            isolatedLocalStorage.Write(IsolatedFiles.isFacilityDetailsCompleted, "true");

            MessageBox.Show("Organisation Information updated successfully", "CardIn");
        }
Example #2
0
        private async void AuthUser()
        {
            btnLogin.IsEnabled   = false;
            pBarLogin.Visibility = Visibility.Visible;
            LoginAuthentication authObject = new LoginAuthentication();

            authObject.phone    = txtPhone.Text;
            authObject.password = pbxPassword.Password;
            authObject.strategy = "local";
            HttpClientServices httpClientServices = new HttpClientServices();

            try
            {
                string response = await httpClientServices.CreateAsync(EndPoints.authentication, authObject, "");

                var payload = JsonConvert.DeserializeObject <Auth>(response);
                if (response != "")
                {
                    string serializedAuth = JsonConvert.SerializeObject(payload);
                    IsolatedLocalStorage isolatedLocalStorage = new IsolatedLocalStorage();
                    isolatedLocalStorage.Write(IsolatedFiles.authFile, serializedAuth);
                    pBarLogin.Visibility = Visibility.Collapsed;
                    this.Hide();
                }
                else
                {
                    pBarLogin.Visibility = Visibility.Collapsed;
                    btnLogin.IsEnabled   = true;
                }
            }
            catch (Exception ex)
            {
                string t = ex.Message;
                pBarLogin.Visibility = Visibility.Collapsed;
                btnLogin.IsEnabled   = false;
            }
        }
Example #3
0
        private async void buttonNextButtonLabel_Click(object sender, RoutedEventArgs e)
        {
            switch (menuIndex)
            {
            case 1:
                btnNext.IsEnabled = false;
                App.globalValueIndicator.IIndicator = false;
                indicatorStep1.Visibility           = Visibility.Visible;
                gridregistrationMainLayout.Children.Clear();
                gridregistrationMainLayout.Children.Add(new UserControlRegistrationStep1());
                menuIndex = 2;
                break;

            case 2:
                btnNext.IsEnabled = false;
                App.globalValueIndicator.IIndicator = false;
                tbkWelcomeLabel.Visibility          = Visibility.Hidden;
                indicatorStep1.Visibility           = Visibility.Collapsed;
                indicatorStep2.Visibility           = Visibility.Visible;
                chkStep1.Visibility = Visibility.Visible;
                gridregistrationMainLayout.Children.Clear();
                gridregistrationMainLayout.Children.Add(new UserControlRegistrationStep2());
                menuIndex = 3;
                break;

            case 3:
                indicatorStep2.Visibility = Visibility.Collapsed;
                chkStep2.Visibility       = Visibility.Visible;
                indicatorStep3.Visibility = Visibility.Visible;
                gridregistrationMainLayout.Children.Clear();
                gridregistrationMainLayout.Children.Add(new UserControlRegistrationFinish());
                menuIndex = 4;
                tbkNextButtonLabel.Text = "Finish";
                break;

            case 4:
                indicatorStep3.Visibility     = Visibility.Collapsed;
                chkStep3.Visibility           = Visibility.Visible;
                btnNext.Visibility            = Visibility.Collapsed;
                tbkNextButtonLabel.Visibility = Visibility.Collapsed;
                gridregistrationMainLayout.Children.Clear();
                gridregistrationMainLayout.Children.Add(new UserControlSettingUpCardIn());
                HttpClientServices httpClientServices = new HttpClientServices();
                try
                {
                    string response = await httpClientServices.CreateAsync(EndPoints.registration, App.facilityRegistration, "");

                    var payload = JsonConvert.DeserializeObject <RegistrationItem>(response);
                    if (payload.Status == "success")
                    {
                        this.Hide();
                        string serializedFacility = JsonConvert.SerializeObject(payload.Data.Facility);
                        string serializedAuth     = JsonConvert.SerializeObject(payload.Data.Auth);
                        IsolatedLocalStorage isolatedLocalStorage = new IsolatedLocalStorage();
                        isolatedLocalStorage.Write(IsolatedFiles.facilityDetails, serializedFacility);
                        isolatedLocalStorage.Write(IsolatedFiles.isFacilityDetailsCompleted, "true");
                        isolatedLocalStorage.Write(IsolatedFiles.authFile, serializedAuth);
                        MasterLandingWindow mainWindow = new MasterLandingWindow();
                        mainWindow.Show();
                    }
                }
                catch (Exception ex) {
                    string t = ex.Message;
                }
                break;

            default:
                break;
            }
        }