Beispiel #1
0
        private void LstSearch_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                var user = (CsvUsersDetails)e.ClickedItem;

                int selectedIndex = 0;
                foreach (var item in UserDetail)
                {
                    if (user.Fullname == item.Fullname)
                    {
                        LstPopulate.SelectedIndex = selectedIndex;
                        LstPopulate.ScrollIntoView(LstPopulate.SelectedItem);
                        hideGridSearchPoulated();
                        LstPopulate_ItemClick(sender, e);
                        return;
                    }
                    selectedIndex += 1;
                }
            }
            catch (Exception ex)
            {
                //Do not. The only possible error is when Item is "NO RESULT FOUND".
            }
        }
Beispiel #2
0
        private void LstSearch_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                var Guest = (DisplayDetails)e.ClickedItem;

                int selectedIndex = 0;
                foreach (var item in DisplayGuestList)
                {
                    if (Guest.GuestFullName == item.GuestFullName)
                    {
                        LstPopulate.SelectedIndex = selectedIndex;
                        LstPopulate.ScrollIntoView(LstPopulate.SelectedItem);
                        hideGridSearchPopulated();
                        LstPopulate_ItemClick(sender, e);
                        return;
                    }
                    selectedIndex += 1;
                }
            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.Message + " Void - LstSearch_ItemClick");
                //msg.ShowAsync();
            }
        }
Beispiel #3
0
        private async void checkSyntax()
        {
            try
            {
                string fullName = FullName;
                string email    = Email;
                string company  = Company;

                string txtPhoneNuber = PhoneNumber;

                bool stringFullname    = false;
                bool stringEmail       = false;
                bool stringCompany     = false;
                bool stringPhoneNumber = false;


                #region Validate PhoneNumber
                if (PhoneNumber != null)
                {
                    for (int i = 0; i < PhoneNumber.Length; i++)
                    {
                        if (!char.IsNumber(txtPhoneNuber[i]))
                        {
                            continueValidation = false;
                            MessageDialog msg = new MessageDialog("The Phone Number contains non-numeric character; " + txtPhoneNuber[i]);
                            await msg.ShowAsync();

                            LstPopulate.SelectedIndex = 0;
                            LstPopulate.ScrollIntoView(LstPopulate.SelectedItem);
                            txtClickedItemPhoneNumber.Background = new SolidColorBrush(Colors.Red);
                            selectedItem();
                            return;
                        }
                    }
                }
                #endregion

                #region Validate Email
                if (string.IsNullOrWhiteSpace(email) || !Regex.IsMatch(email, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"))
                {
                    continueValidation = false;
                    MessageDialog msg = new MessageDialog("The email is invalid at Serial Number " + sn.ToString());
                    await msg.ShowAsync();

                    LstPopulate.SelectedIndex      = 0;
                    txtClickedItemEmail.Background = new SolidColorBrush(Colors.Red);
                    selectedItem();
                    return;
                }
                #endregion

                #region Validate Full Name
                if (fullName != null)
                {
                    for (int i = 0; i < FullName.Length; i++)
                    {
                        if (!char.IsLetter(fullName[i]) && fullName[i].ToString() != "-" && fullName[i].ToString() != " ")
                        {
                            continueValidation = false;
                            MessageDialog msg = new MessageDialog("The Full Name contains an invalid character; " + fullName[i] + "\n" + "Please remove to proceed at Serial Number " + sn.ToString());
                            await msg.ShowAsync();

                            LstPopulate.SelectedIndex         = 0;
                            txtClickedItemFullname.Background = new SolidColorBrush(Colors.Red);
                            selectedItem();
                            return;
                        }
                    }
                }
                #endregion
                //else
                //{
                long phoneNumber = Convert.ToInt64(PhoneNumber);

                MessageDialog msgbox = new MessageDialog(
                    "Full Name: " + FullName + "\n" +
                    "Company: " + Company + "\n" +
                    "email: " + Email + "\n" +
                    "Phone Number: " + PhoneNumber
                    );
                //msgbox.ShowAsync();

                var ser = sn - 1;
                //}
            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.Message + " Void - checkSyntax");
                //msg.ShowAsync();
            }
        }
Beispiel #4
0
        private async void fileCsvToDb()
        {
            try
            {
                var ity = LstPopulate.Items.Count();
                continueValidation = true;

                for (int i = 0; i < ity; i++)
                {
                    if (continueValidation == true)
                    {
                        var user = UserDetail[0];

                        FullName    = user.Fullname;
                        Company     = user.Company;
                        Email       = user.Email;
                        PhoneNumber = user.PhoneNumber;

                        sn = i + 1;

                        checkSyntax();

                        RemoteService      service = new RemoteService();
                        VisitorDataPayLoad payload = new VisitorDataPayLoad
                        {
                            PhoneNumber = Convert.ToInt64(PhoneNumber)
                        };

                        var response = await service.CheckIfVisitorExistService(payload);


                        if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found)
                        {
                            MessageDialog checkInMsg = new MessageDialog("User already exist");
                            LstPopulate.SelectedIndex = 0;
                            LstPopulate.ScrollIntoView(LstPopulate.SelectedItem);
                            await checkInMsg.ShowAsync();

                            return;
                        }
                        else if (response.ResponseStatusCode == System.Net.HttpStatusCode.NotFound)
                        {
                            //Send to Registration DB
                            newVisitor();
                        }
                        else if (response.ResponseStatusCode == System.Net.HttpStatusCode.InternalServerError)
                        {
                            continueValidation = false;
                            MessageDialog md = new MessageDialog("Could not complete registration: " + "Err: ");
                            await md.ShowAsync();

                            return;
                        }
                        else
                        {
                            MessageDialog checkInMsg = new MessageDialog("Server error");
                            await checkInMsg.ShowAsync();

                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                MessageDialog msg = new MessageDialog("Uploaded Successfully");
                await msg.ShowAsync();
            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.Message + " fileCsvToDb");
                //msg.ShowAsync();
            }
        }