Ejemplo n.º 1
0
        private async void sendUserName_Click(object sender, RoutedEventArgs e)
        {
            log.Username = usernameBox.Text;

            try
            {
                ringOring.IsActive      = true;
                ringOring.Visibility    = Visibility.Visible;
                sendUserName.Visibility = Visibility.Collapsed;

                var res = await LoginVerifyCall.LoginVerifyAsync(log, null);

                if (res.response.Equals("Success"))
                {
                    ToastyToast.ShowToastNotification("Success", "Yay!!!");
                    usernameBox.Visibility = Visibility.Collapsed;

                    ringOring.Visibility = Visibility.Collapsed;
                    ringOring.IsActive   = false;

                    otpBox.Visibility  = Visibility.Visible;
                    sendOtp.Visibility = Visibility.Visible;
                }
                else
                {
                    ToastyToast.ShowToastNotification("No", "noooooooooo!!!");
                    ringOring.Visibility    = Visibility.Collapsed;
                    ringOring.IsActive      = false;
                    sendUserName.Visibility = Visibility.Visible;
                }
            }

            catch (Exception) { }
        }
Ejemplo n.º 2
0
        private async void sendDatatoDB_Click(object sender, RoutedEventArgs e)
        {
            diseaseData.DUID     = DataSecurity.EncryptThisData(don.DUID, Constants.PRIVPASS);
            diseaseData.DName    = DataSecurity.EncryptThisData(don.DName, Constants.PRIVPASS);
            diseaseData.PUID     = don.PUID;
            diseaseData.Disease  = DataSecurity.EncryptThisData(disName.Text, Constants.PRIVPASS);
            diseaseData.Medicine = DataSecurity.EncryptThisData(medicBox.Text, Constants.PRIVPASS);
            diseaseData.Date     = DataSecurity.EncryptThisData(dateOdater.Date.ToString(), Constants.PRIVPASS);
            string duration = dateFromPicker.Date.ToString() + " - " + dateToPicker.Date.ToString();

            diseaseData.Duration = DataSecurity.EncryptThisData(duration, Constants.PRIVPASS);

            var res = await UpdateHistoryCall.UpdatPatientHistoryAsync(diseaseData);

            log.TypeLogin = don.TypeLogin;
            log.Username  = don.DUID;
            if (res.response.Equals("Success"))
            {
                Frame.Navigate(typeof(UserProfile), log);
            }
            else
            {
                ToastyToast.ShowToastNotification("Trouble :/", "Something went wrong :/");
                disName.Text = ""; medicBox.Text = "";
            }
        }
Ejemplo n.º 3
0
        private async void listHam_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (bloodListItem.IsSelected)
            {
                Frame.Navigate(typeof(Blood), log);
            }
            else if (SponsorsListItem.IsSelected)
            {
                Frame.Navigate(typeof(Sponsors), log);
            }
            else if (feedListItem.IsSelected)
            {
                Frame.Navigate(typeof(Feedback), log);
            }
            else if (logoutListItem.IsSelected)
            {
                var title   = "Pending changes";
                var content = "Are you sure that you wish to logout?";

                var yesCommand = new UICommand("Yes", null);
                var noCommand  = new UICommand("No", null);

                var dialog = new MessageDialog(content, title);
                dialog.Options = MessageDialogOptions.None;
                dialog.Commands.Add(yesCommand);

                dialog.DefaultCommandIndex = 0;
                dialog.CancelCommandIndex  = 0;

                if (noCommand != null)
                {
                    dialog.Commands.Add(noCommand);
                    dialog.CancelCommandIndex = (uint)dialog.Commands.Count - 1;
                }

                var command = await dialog.ShowAsync();

                if (command == yesCommand)
                {
                    var keepTemp = Windows.Storage.ApplicationData.Current.LocalSettings;
                    keepTemp.Values["user"] = null;
                    keepTemp.Values["type"] = null;

                    Frame.Navigate(typeof(MainPage));
                }
                else
                {
                    ToastyToast.ShowToastNotification("Cancelled", "User cancelled logout");
                }
            }
        }
Ejemplo n.º 4
0
        private async void sendOtp_Click(object sender, RoutedEventArgs e)
        {
            string otp = otpBox.Text;

            ringOring.IsActive   = true;
            ringOring.Visibility = Visibility.Visible;
            sendOtp.Visibility   = Visibility.Collapsed;
            try
            {
                var res = await LoginVerifyCall.LoginVerifyAsync(null, otp);

                if (res.response.Equals("Success"))
                {
                    var keepTemp = ApplicationData.Current.LocalSettings;
                    keepTemp.Values["user"] = log.Username;
                    keepTemp.Values["type"] = log.TypeLogin;

                    if (log.TypeLogin.Equals("Doctor"))
                    {
                        Frame.Navigate(typeof(DocProfile), log);
                    }
                    else
                    {
                        Frame.Navigate(typeof(UserProfile), log);
                    }
                }
                else
                {
                    ToastyToast.ShowToastNotification("No", "Wrong OTP :(");
                    ringOring.Visibility = Visibility.Collapsed;
                    ringOring.IsActive   = false;
                    sendOtp.Visibility   = Visibility.Visible;
                }
            }
            catch (Exception) { }
        }