Exemple #1
0
        static Dictionary <string, string> listOfCountries()
        {
            //Add values and keys to dictionary
            var nameToCountry = CountryDictionary.listOfCountries();

            return(nameToCountry);
        }
        //Guest Language picker
        void guestLanguageDetailsPicker(string language)
        {
            Language.Items.Clear();
            var nameToLanguage = CountryDictionary.listOfLanguage();

            foreach (string LanguageName in nameToLanguage.Keys)
            {
                Language.Items.Add(LanguageName);
            }
            if (language != "" || language != "")
            {
                string name  = nameToLanguage.FirstOrDefault(x => x.Value == language).Value;
                int    index = nameToLanguage.Values.ToList().IndexOf(name);
                Language.SelectedIndex = index;
                guestLanguage          = language;
            }
            Language.SelectedIndexChanged += (sender, args) =>
            {
                if (Language.SelectedIndex == -1)
                {
                    guestLanguage = language;
                }
                else
                {
                    string languageName = Language.Items[Language.SelectedIndex];
                    guestLanguage = nameToLanguage[languageName];
                }
            };
        }
        //Guest Gender pickers
        void guestGenderDetailsPicker(string gender)
        {
            Gender.Items.Clear();
            var nameToGender = CountryDictionary.listOfGender();

            foreach (string genderItems in nameToGender.Keys)
            {
                Gender.Items.Add(genderItems);
            }
            if (gender != "" || gender != "")
            {
                string name  = nameToGender.FirstOrDefault(x => x.Value == gender).Value;
                int    index = nameToGender.Values.ToList().IndexOf(name);
                Gender.SelectedIndex = index;
                guestGender          = gender;
            }
            Gender.SelectedIndexChanged += (sender, args) =>
            {
                if (Gender.SelectedIndex == -1)
                {
                    guestGender = gender;
                }
                else
                {
                    string genderItems = Gender.Items[Gender.SelectedIndex];
                    guestGender = nameToGender[genderItems];
                }
            };
        }
        public static string titleName(string val)
        {
            string name             = "";
            var    nameToSalutation = CountryDictionary.listofSalutation();

            if (val != "" || val != "")
            {
                //Item Value in dictionar
                name = nameToSalutation.FirstOrDefault(x => x.Value == val).Key;
            }
            return(name);
        }
        public static string titleNationality(string val)
        {
            string name = "";
            var    nameToNationality = CountryDictionary.listOfNationalitie();

            if (val != "" || val != "")
            {
                //Item Value in dictiona
                name = nameToNationality.FirstOrDefault(x => x.Value == val).Key;
            }
            return(name);
        }
        //Guest Country pickers
        void guestContryDetailsPicker(string country)
        {
            GuestCountry.Items.Clear();
            //List of Countries from dictionary
            var nameToCountry = CountryDictionary.listOfCountrie();

            //Adding all countries into picker
            foreach (string countryName in nameToCountry.Keys)
            {
                GuestCountry.Items.Add(countryName);
            }

            //if values are not available on load
            if (country != "" || country != "")
            {
                //Item Value in dictionary
                string name = nameToCountry.FirstOrDefault(x => x.Value == country).Value;

                //Index of item in dictionary
                int index = nameToCountry.Values.ToList().IndexOf(name);

                //Set picker selected item index
                GuestCountry.SelectedIndex = index;

                //Set country to update guest
                guestCountry = country;
            }

            //Index of picker changed
            GuestCountry.SelectedIndexChanged += (sender, args) =>
            {
                if (GuestCountry.SelectedIndex == -1)
                {
                    guestCountry = country;
                }
                else
                {
                    //Get key value of selected item
                    string countryName = GuestCountry.Items[GuestCountry.SelectedIndex];

                    //Set picker value
                    guestCountry = nameToCountry[countryName];
                }
            };
        }
        //Guest Nationality/Passport pickers
        void guestIdentificationDetailsPicker(string identificationMethod)
        {
            IdentificationMethod.Items.Clear();
            //List of identification methods from dictionary
            var nameToIdentification = CountryDictionary.listofIdentificationMethod();

            //Adding all identiication methods into picker
            foreach (string identificationName in nameToIdentification.Keys)
            {
                IdentificationMethod.Items.Add(identificationName);
            }

            //if values are not available on load
            if (identificationMethod != "" || identificationMethod != "")
            {
                //Item value in dictionary
                string name = nameToIdentification.FirstOrDefault(x => x.Value == identificationMethod).Value;

                //Index of item value in dictionary
                int index = nameToIdentification.Values.ToList().IndexOf(name);

                //Set picker selecteditem index
                IdentificationMethod.SelectedIndex = index;

                //Set Identification Method to Update guest
                guestIdentification = identificationMethod;
            }

            //Index of picker changed
            IdentificationMethod.SelectedIndexChanged += (sender, args) =>
            {
                if (IdentificationMethod.SelectedIndex == -1)
                {
                    guestIdentification = identificationMethod;
                }
                else
                {
                    //Get key value of selected item
                    string identificationName = IdentificationMethod.Items[IdentificationMethod.SelectedIndex];

                    //Set picker value
                    guestIdentification = nameToIdentification[identificationName];
                }
            };
        }
        void guestSalutationPicker(string salutation)
        {
            Salutation.Items.Clear();
            var nameToSalutationList = CountryDictionary.listofSalutation();

            foreach (string SalutationName in nameToSalutationList.Keys)
            {
                Salutation.Items.Add(SalutationName);
            }

            if (salutation != "" || salutation != "")
            {
                //Item value in dictionary
                string name = nameToSalutationList.FirstOrDefault(x => x.Value == salutation).Value;

                //Index of item value in dictionary
                int index = nameToSalutationList.Values.ToList().IndexOf(name);

                //Set picker selecteditem index
                Salutation.SelectedIndex = index;

                //Set Identification Method to Update guest
                guestSalutation = salutation;
            }


            Salutation.SelectedIndexChanged += (sender, args) =>
            {
                if (Salutation.SelectedIndex == -1)
                {
                    guestSalutation = salutation;
                }
                else
                {
                    string nationalityName = Salutation.Items[Salutation.SelectedIndex];
                    guestSalutation = nameToSalutationList[nationalityName];
                }
            };
        }
        void guestNationalityDetailsPicker(string nationlity)
        {
            Nationality.Items.Clear();
            var nameToNationalityList = CountryDictionary.listOfNationalitie();

            foreach (string NationalityName in nameToNationalityList.Keys)
            {
                Nationality.Items.Add(NationalityName);
            }

            if (nationlity != "" || nationlity != "")
            {
                //Item value in dictionary
                string name = nameToNationalityList.FirstOrDefault(x => x.Value == nationlity).Value;

                //Index of item value in dictionary
                int index = nameToNationalityList.Values.ToList().IndexOf(name);

                //Set picker selecteditem index
                Nationality.SelectedIndex = index;

                //Set Identification Method to Update guest
                guestNationality = nationlity;
            }


            Nationality.SelectedIndexChanged += (sender, args) =>
            {
                if (Nationality.SelectedIndex == -1)
                {
                    guestNationality = nationlity;
                }
                else
                {
                    string nationalityName = Nationality.Items[Nationality.SelectedIndex];
                    guestNationality = nameToNationalityList[nationalityName];
                }
            };
        }
        public GuestEdit(List <guestDetails> guestDetailsList, guestDetails Object)
        {
            //Passing values value on page load to fields and pickers
            InitializeComponent();

            //Setting limits for datetime.
            DateTime date = new DateTime(1900, 1, 1);

            DateOfBirth.MaximumDate = DateTime.Today;
            DateOfBirth.MinimumDate = date;

            //setting guest details retrieved from guestifo page
            guestdetails        = guestDetailsList;
            guestCodeFromSearch = Object.guestCode;
            Visitperhotel       = Object.noOfVisitsHotel;
            Totalvisit          = Object.noOfVisits;
            RevenueTotal        = Object.revenueTotal;
            RevenueRoom         = Object.revenueRoom;
            RevenueFnb          = Object.reveneuFB;
            RevenueOther        = Object.revenueOther;

            //countryFromSearch = Object.country;
            if (Object.passportIdNumber == "")
            {
                hideUntilSearched.IsVisible = false;
                viewUntilSearched.IsVisible = true;
            }
            else
            {
                hideUntilSearched.IsVisible = true;
                viewUntilSearched.IsVisible = false;
            }

            pageLoading();

            guestDetailsAvailableOnLoad((Object.guestNumber).ToString(), Object.identificationMethod, Object.passportIdNumber, Object.salutation, Object.guestFirstName, Object.guestLastName, Object.gender, Object.email, Object.contactNumber, Object.houseNumber, Object.street, Object.city, Object.country, Object.nationality, Object.language, Object.guestCode, Object.dateOfBirth, Object.dateOfExpiry);

            //Getting results after passport successfully scanned
            MessagingCenter.Subscribe <Messages.BlinkIDResults>(this, Messages.BlinkIDResultsMessage, async(sender) =>
            {
                pageLoading();
                try
                {
                    //Values from passport
                    foreach (var result in sender.Results)
                    {
                        //Seperating values from array
                        result.TryGetValue("SecondaryId", out fname);
                        result.TryGetValue("PrimaryId", out lname);
                        result.TryGetValue("Nationality", out nationality);
                        result.TryGetValue("Sex", out gender);
                        result.TryGetValue("DocumentNumber", out PassportNumber);
                        result.TryGetValue("DateOfExpiry", out dateOfExpiry);
                        result.TryGetValue("DateOfBirth", out dateOfBirthPass);

                        PassportNumber = Regex.Replace(PassportNumber, "[^A-Za-z0-9 _]", "");
                        //List of identification methods from dictionary
                        var nameToAlpha2FromAlpha3 = CountryDictionary.listAlpha3To();
                        //Getting Key Value from Dictoinary by passing the THREE Letter code
                        nationality = nameToAlpha2FromAlpha3.FirstOrDefault(x => x.Key == nationality).Value;
                        //string guestNumberPassport = guestNumber.Text;
                    }

                    new APILogger().Logger($"PP Scan Result : FName {fname},LName {lname},Nationality {nationality},Sex {gender},DocumentNumber {PassportNumber},DateOfExpiry {dateOfExpiry},DateOfBirth {dateOfBirthPass}");

                    await existingGuestDetailsFromDatabses(2, PassportNumber);
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        GuestFisrtName.Text = fname;
                        GuestLastName.Text  = lname;
                        guestIdentificationDetailsPicker("2");
                        guestNationalityDetailsPicker(nationality);
                        guestContryDetailsPicker(nationality);
                        guestLanguageDetailsPicker("E");
                        PassportExpiry.Date = FormatChanges.PassScanDateFormat(dateOfExpiry);
                        guestGenderDetailsPicker(serviceDataValidation.guestEditGenderValidation(gender));
                        DateOfBirth.Date = FormatChanges.PassScanDateFormat(dateOfBirthPass);
                        stopPageLoading();
                    });
                }
                catch (Exception)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        stopPageLoading();
                        guestEntryDetails(guestNumber.Text, PassportNumber, fname, lname, "", "", "", "", "");
                        guestIdentificationDetailsPicker("2");
                        guestNationalityDetailsPicker(nationality);
                        guestContryDetailsPicker(nationality);
                        guestLanguageDetailsPicker("E");
                        guestSalutationPicker("");
                        guestGenderDetailsPicker(serviceDataValidation.guestEditGenderValidation(gender));
                        PassportExpiry.Date = FormatChanges.PassScanDateFormat(dateOfExpiry);
                        DateOfBirth.Date    = FormatChanges.PassScanDateFormat(dateOfBirthPass);
                        Visitperhotel       = "00";
                        Totalvisit          = "00";
                        RevenueTotal        = "0.00";
                        RevenueRoom         = "0.00";
                        RevenueFnb          = "0.00";
                        RevenueOther        = "0.00";
                        stopPageLoading();
                        DisplayAlert(Constants._headerMessage, Constants._noDetails, Constants._buttonOkay);
                    });
                }
                //MessagingCenter.Unsubscribe<Messages.BlinkIDResults>(this, Messages.BlinkIDResultsMessage);
            });
        }
Exemple #11
0
        //Guest Details
        public async void DisplayGuestDetails()
        {
            pageLoading();
            layoutHeightGuestDetails     = 0;
            layoutHeightSignatures       = 0;
            lasyoutHeighSignatureInitial = 1;
            guestNumber      = 1;
            guestNumberCount = 1;
            try
            {
                GuestNameList.ItemsSource = null;
                string result = await checkInManager.GetRemarksDetails(Constants._reservation_id);

                guestdetails = new List <guestDetails>();
                if (Constants._notAvailableSignatureAdded == false)
                {
                    guestsignature = new List <guestSignature>();
                }

                GuestSignatureList.ItemsSource = null;

                if (result != null)
                {
                    string guestNameAvailabiliyty = "";
                    string tem_resultMain         = result; //

                    //Removing ticks issue in date
                    result = result.Replace("Date(-", "Date(");
                    var output = JObject.Parse(result);

                    if (Enumerable.Count(output["d"]["results"][0]["ReservationNaviGuest"]["results"]) > 0)
                    {
                        savedSignatureCount = 0;
                        for (int i = 0; i < Enumerable.Count(output["d"]["results"][0]["ReservationNaviGuest"]["results"]); i++)
                        {
                            string guestCountryKeyValue    = string.Empty;
                            string guestSalutationKeyValue = string.Empty;
                            //Setting values to global variables
                            guestNameAvailabiliyty   = serviceDataValidation.validation(Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Xnombre"]));
                            layoutHeightGuestDetails = layoutHeightGuestDetails + 40;
                            if (guestNameAvailabiliyty != Constants._notAvailable)
                            {
                                if (lasyoutHeighSignatureInitial == 1)
                                {
                                    layoutHeightSignatures = 187;
                                }
                                else
                                {
                                    layoutHeightSignatures = layoutHeightSignatures + 157;
                                }
                            }
                            //Signaure Manually Not added
                            if (Constants._notAvailableSignatureAdded == false)
                            {
                                if (guestNameAvailabiliyty != Constants._notAvailable)
                                {
                                    try
                                    {
                                        string result1 = await checkInManager.GetGuestSignature(guestNumberCount.ToString());

                                        if (result1 != null)
                                        {
                                            var output1 = JObject.Parse(result1);

                                            //Removing ticks error
                                            result1 = result1.Replace("Date(-", "Date(");

                                            //Converting base64 string to byte array
                                            byte[] data = Convert.FromBase64String(Convert.ToString(output1["d"]["XIMAGE"]));

                                            guestsignature.Add(new guestSignature(ImageSource.FromStream(() => new MemoryStream(data)), guestNameAvailabiliyty, "White", guestNumber, Constants._available, "Purple", ""));
                                            savedSignatureCount++;
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        //Guest Signature Not Available
                                        string addSignatureImage = "SignatureImage.jpg";
                                        if (guestNameAvailabiliyty != Constants._notAvailable)
                                        {
                                            guestsignature.Add(new guestSignature(addSignatureImage,
                                                                                  guestNameAvailabiliyty, "Purple",
                                                                                  guestNumber,
                                                                                  Constants._notAvailable, "White", ""));
                                        }
                                    }
                                }
                            }
                            String dateString       = "";
                            string expiryDateString = "";

                            DateTime date = DateTime.Now;
                            try
                            {
                                string dateOfBirth = Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Gbdat"]);

                                if (dateOfBirth != "")
                                {
                                    DateTime dt             = DateTime.Now;
                                    int      index          = i + 1;
                                    string   temp_substring = tem_resultMain.Substring(0, tem_resultMain.IndexOf("Xorden\":\"" + "0" + index + "\""));
                                    //temp_substring = temp_substring.Substring(0, temp_substring.IndexOf("Gbdat") + 20);
                                    //temp_substring = temp_substring.Substring(temp_substring.IndexOf("Gbdat"));
                                    temp_substring = temp_substring.Substring(temp_substring.LastIndexOf("Gbdat"));
                                    temp_substring = temp_substring.Substring(0, 20);
                                    //Begin of + Vinoch 15122061
                                    if (temp_substring.Contains("-"))
                                    {
                                        DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                        long     ms    = (long)(DateTime.Parse(dateOfBirth) - epoch).TotalMilliseconds;
                                        dateOfBirth = ms.ToString();

                                        dateOfBirth = "-" + dateOfBirth;

                                        long     milliSec  = (long)(Convert.ToDouble(dateOfBirth));
                                        DateTime startTime = new DateTime(1970, 1, 1);

                                        TimeSpan time = TimeSpan.FromMilliseconds(milliSec);
                                        dt = startTime.Add(time);
                                    }
                                    else
                                    {
                                        if (dateOfBirth != "")                //- Vinoch 1512201
                                        {
                                            dt = DateTime.Parse(dateOfBirth); // Vinoch 1512201
                                        }
                                    }

                                    //DateTime date = serviceDataValidation.dateOfBirthValidation(dateOfBirth);
                                    date       = dt;
                                    dateString = date.ToString();
                                }
                                else
                                {
                                    dateString       = "";
                                    expiryDateString = "";
                                }
                            }
                            catch (Exception)
                            {
                                dateString       = "";
                                expiryDateString = "";
                            }

                            string country = Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Country"]);

                            var nameToCountry = CountryDictionary.listOfCountrie();
                            if (country != "" || country != "")
                            {
                                string name = nameToCountry.FirstOrDefault(x => x.Value == country).Key;
                                guestCountryKeyValue = country;
                            }
                            guestdetails.Add(new guestDetails(guestNumberCount,
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["XtipoDocId"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["XnumeroDoc"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Title"]),
                                                              guestNameAvailabiliyty,
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Name1"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Name2"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Parge"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["SmtpAddr"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["MobileNo"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["HouseNum1"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Street"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["City1"]),
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Country"]),
                                                              guestCountryKeyValue,
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Xnacionalidad"]),
                                                              dateString,
                                                              expiryDateString,
                                                              Convert.ToString(output["d"]["results"][0]["ReservationNaviGuest"]["results"][i]["Langu"]),
                                                              "",
                                                              "",
                                                              "",
                                                              "",
                                                              "",
                                                              "",
                                                              ""));

                            //Increment guestnumber and guest number count by 1
                            guestNumber                  = guestNumber + 1;
                            guestNumberCount             = guestNumberCount + 1;
                            lasyoutHeighSignatureInitial = 0;
                        }

                        //Setting stack Layput heights according to the number of records
                        GuestDetails.HeightRequest       = layoutHeightGuestDetails;
                        GuestSignatureView.HeightRequest = layoutHeightSignatures;
                    }
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        //Setting guest number in label
                        GuestNumber.Text = (guestNumberCount - 1).ToString();

                        //Adding list to observable Collection
                        items = new ItemList(guestdetails);
                        GuestNameList.ItemsSource = items.Items;

                        //Set Guest Signatures. Signatures loaded from service
                        if (Constants._notAvailableSignatureAdded == false)
                        {
                            GuestSignatureList.ItemsSource = guestsignature;
                        }
                        else
                        {
                            if (Constants._reservationStatus == Constants._reservationStatusCheckedIn)
                            {
                                //checkinAndSaveButton.IsVisible = true;
                                saveSignatureButton.IsVisible = true;            //true
                                checkinButton.IsVisible       = false;
                            }
                            else if (Constants._reservationStatus == Constants._reservationStatusPending)
                            {
                                //checkinAndSaveButton.IsVisible = true;
                                saveSignatureButton.IsVisible = true;            //false
                                checkinButton.IsVisible       = true;
                            }
                        }

                        if (Constants._reservationStatus != Constants._reservationStatusCheckedIn && savedSignatureCount > 0)
                        {
                            checkinAndSaveButton.IsVisible = true;
                        }
                        else
                        {
                            checkinAndSaveButton.IsVisible = false;
                        }

                        if (savedSignatureCount == guestsignature.Count)
                        {
                            saveSignatureButton.IsVisible = false;
                        }
                    });
                }
            }
            catch (Exception e)
            {
                this.DisplayGuestDetails();
            }
            stopPageLoading();
        }
Exemple #12
0
        public RegistrationCard()
        {
            initialPageLoading();

            //Privacy statement

            //Signature Added
            MessagingCenter.Subscribe <Signature, List <guestSignature> >(this, Constants._signatureAddedMessage, (sender, arg) =>
            {
                checkinAndSaveButton.IsVisible = true;
                if (Constants._reservationStatus == Constants._reservationStatusCheckedIn)
                {
                    //saveSignatureButton.IsVisible = true;//false
                    checkinButton.IsVisible  = false;
                    PerformaButton.IsVisible = true;
                }
                else
                {
                    //saveSignatureButton.IsVisible = false;//false
                    checkinButton.IsVisible  = true;
                    PerformaButton.IsVisible = false;
                }

                GuestSignatureList.ItemsSource = null;
                guestsignature = arg;
                GuestSignatureList.ItemsSource = guestsignature;
                //MessagingCenter.Unsubscribe<Signature, List<guestSignature>>(this, Constants._signatureAddedMessage);
            });

            //Guest Edited
            MessagingCenter.Subscribe <GuestEdit, List <guestDetails> >(this, Constants._guestEdited, (sender, arg) =>
            {
                GuestNameList.ItemsSource = null;
                guestdetails = arg;
                GuestNameList.ItemsSource = guestdetails;

                var obj = guestdetails.FirstOrDefault(x => x.guestNumber == Int32.Parse(Constants._guestNumber));
                if (obj != null)
                {
                    var obj1 = guestsignature.FirstOrDefault(x => x.guestNumber == Int32.Parse(Constants._guestNumber));
                    if (obj1 == null)
                    {
                        guestSignature newGuestSignature = new guestSignature("SignatureImage.jpg", obj.guestName, "Purple", obj.guestNumber, Constants._notAvailable, "White", "");
                        GuestSignatureList.ItemsSource   = null;
                        guestsignature.Add(newGuestSignature);
                        GuestSignatureList.ItemsSource   = guestsignature;
                        GuestSignatureView.HeightRequest = 40 + (157 * guestsignature.Count);
                    }
                    else
                    {
                        obj1.guestName   = obj.guestName;
                        obj1.guestNumber = obj.guestNumber;
                        GuestSignatureList.ItemsSource = null;
                        GuestSignatureList.ItemsSource = guestsignature;
                    }
                    if (obj.guestNumber == 1)
                    {
                        string title = obj.salutation;
                        //List of salutations from dictiona
                        var nameToSalutation = CountryDictionary.listofSalutation();

                        if (title != "" || title != "")
                        {
                            //Item Value in dictionar
                            string name         = nameToSalutation.FirstOrDefault(x => x.Value == title).Key;
                            titleName.Text      = name;
                            titleName.TextColor = serviceDataValidation.validationColor(name);
                        }

                        fname.Text              = serviceDataValidation.validation(obj.guestFirstName);
                        fname.TextColor         = serviceDataValidation.validationColor(obj.guestFirstName);
                        lname.Text              = serviceDataValidation.validation(obj.guestLastName);
                        lname.TextColor         = serviceDataValidation.validationColor(obj.guestLastName);
                        emailaddress.Text       = serviceDataValidation.validation(obj.email);
                        emailaddress.TextColor  = serviceDataValidation.validationColor(obj.email);
                        ContactNumber.Text      = serviceDataValidation.validation(obj.contactNumber);
                        ContactNumber.TextColor = serviceDataValidation.validationColor(obj.contactNumber);
                        dob.Text          = serviceDataValidation.validation(obj.dateOfBirth);
                        dob.TextColor     = serviceDataValidation.validationColor(obj.dateOfBirth);
                        NICPASS.Text      = serviceDataValidation.validation(obj.passportIdNumber);
                        NICPASS.TextColor = serviceDataValidation.validationColor(obj.passportIdNumber);
                        houseno.Text      = serviceDataValidation.validation(obj.houseNumber);
                        houseno.TextColor = serviceDataValidation.validationColor(obj.houseNumber);
                        street.Text       = serviceDataValidation.validation(obj.street);
                        street.TextColor  = serviceDataValidation.validationColor(obj.street);
                        city.Text         = serviceDataValidation.validation(obj.city);
                        city.TextColor    = serviceDataValidation.validationColor(obj.city);



                        country.Text          = serviceDataValidation.validation(serviceDataValidation.titleCountry(obj.country));
                        country.TextColor     = serviceDataValidation.validationColor(obj.country);
                        nationality.Text      = serviceDataValidation.validation(serviceDataValidation.titleNationality(obj.nationality));
                        nationality.TextColor = serviceDataValidation.validationColor(obj.nationality);
                    }
                }
                //MessagingCenter.Unsubscribe<GuestEdit, List<guestDetails>>(this, Constants._guestEdited);
            });

            //Signature Saved
            MessagingCenter.Subscribe <RegistrationCard, string>(this, Constants._signatureSuccessfullySaved, (sender, arg) =>
            {
                //checkinAndSaveButton.IsVisible = false;//false
                stopPageLoading();
                MessagingCenter.Unsubscribe <RegistrationCard, string>(this, Constants._signatureSuccessfullySaved);
            });
            //Checked-In
            MessagingCenter.Subscribe <RegistrationCard, string>(this, Constants._reservationStatusCheckedIn, (sender, arg) =>
            {
                //checkinAndSaveButton.IsVisible = false;//false

                Device.BeginInvokeOnMainThread(() =>
                {
                    checkinButton.IsVisible = false;
                });

                checkinButton.IsVisible = false;
                stopPageLoading();
                MessagingCenter.Unsubscribe <RegistrationCard, string>(this, Constants._reservationStatusCheckedIn);
            });
        }
        //Dictionary for list of genders
        public static Dictionary <string, string> listOfGender()
        {
            var nameToGender = CountryDictionary.listOfGenders();

            return(nameToGender);
        }
        public static Dictionary <string, string> listofSalutation()
        {
            var nameToIdentification = CountryDictionary.listOfSalutations();

            return(nameToIdentification);
        }
        //Dictionary to Convert ISO Alpha 3 to Alpha 2 country code
        public static Dictionary <string, string> listAlpha3To()
        {
            var alphaTo32 = CountryDictionary.listAlpha3To2();

            return(alphaTo32);
        }
        //Disctionaty List Of Nationalities
        public static Dictionary <string, string> listofIdentificationMethod()
        {
            var nameToIdentification = CountryDictionary.listofIdentificationMethods();

            return(nameToIdentification);
        }
        //Dictionary for URLs
        public static Dictionary <string, string> listOfURL()
        {
            var nameToURL = CountryDictionary.listOfURLS();

            return(nameToURL);
        }
        //Dictionary fo list of languages
        public static Dictionary <string, string> listOfLanguage()
        {
            var nameToLanguage = CountryDictionary.listOfLanguages();

            return(nameToLanguage);
        }
        public static Dictionary <string, string> listOfNationalitie()
        {
            var nameToNationalityList = CountryDictionary.listOfNationalities();

            return(nameToNationalityList);
        }
        //Update Guest Details
        async void saveButton(object sender, EventArgs e)
        {
            string validation = FieldValidation.guestSaveDetailsValidation(IdentificationMethod, IdentificationMethodNumber.Text, GuestFisrtName.Text, GuestLastName.Text, DateOfBirth, GuestContact.Text, GuestEmail.Text, City.Text, Street.Text);

            if (validation != "")
            {
                await DisplayAlert("Warning!", validation, "Ok");
            }
            else
            {
                DateTime date = DateOfBirth.Date;

                DateTime dateOfEx = PassportExpiry.Date;

                //Page loading indicator
                pageLoading();

                //Pass values to payload
                StatusChange statusChange = new StatusChange(Constants._hotel_code, Constants._reservation_id, guestIdentification, IdentificationMethodNumber.Text, guestNumber.Text, guestSalutation, GuestFisrtName.Text, GuestLastName.Text, guestGender, GuestEmail.Text, GuestContact.Text, HouseNumber.Text, Street.Text, City.Text, guestCountry, guestNationality, guestLanguage, date.ToString("s"), dateOfEx.ToString("s"));
                //PPExpiryDate expiryDateChange = new PPExpiryDate(Constants._hotel_code, Constants._reservation_id, guestNumber.Text, guestSalutation, GuestFisrtName.Text, GuestLastName.Text, IdentificationMethodNumber.Text ,dateOfEx.ToString("s"),guestIdentification,guestCountry,guestLanguage);

                //Data Posting source
                //PostServiceManager postServiceManager = new PostServiceManager();
                GuestPostManager guestPostManager = new GuestPostManager();

                string result = await guestPostManager.CreateUpdateGuest(statusChange);

                //String result = await postServiceManager.StatusChangeAsync(statusChange);
                //String result2 = await postServiceManager.SavePPExpiryAsync(expiryDateChange);

                if (result != "Reservation is locked" || result.Contains("Updated Successfully"))
                {
                    //Updateing guest details object
                    var obj = guestdetails.FirstOrDefault(x => x.guestNumber == Int32.Parse(guestNumber.Text));
                    obj.guestNumber          = Int32.Parse(guestNumber.Text);
                    obj.identificationMethod = guestIdentification;
                    obj.passportIdNumber     = IdentificationMethodNumber.Text;
                    obj.salutation           = guestSalutation;
                    obj.guestName            = GuestFisrtName.Text + " " + GuestLastName.Text;
                    obj.guestFirstName       = GuestFisrtName.Text;
                    obj.guestLastName        = GuestLastName.Text;
                    obj.gender          = guestGender;
                    obj.email           = GuestEmail.Text;
                    obj.contactNumber   = GuestContact.Text;
                    obj.houseNumber     = HouseNumber.Text;
                    obj.street          = Street.Text;
                    obj.city            = City.Text;
                    obj.nationality     = guestNationality;
                    obj.country         = guestCountry;
                    obj.language        = guestLanguage;
                    obj.guestCode       = guestCodeFromSearch;
                    obj.dateOfBirth     = date.ToString("s");
                    obj.dateOfExpiry    = dateOfEx.ToString("s");
                    obj.noOfVisitsHotel = Visitperhotel;
                    obj.noOfVisits      = Totalvisit;
                    obj.revenueTotal    = RevenueTotal;
                    obj.revenueRoom     = RevenueRoom;
                    obj.reveneuFB       = RevenueFnb;
                    obj.revenueOther    = RevenueOther;

                    var nameToCountry = CountryDictionary.listOfCountrie();
                    if (guestCountry != "" || guestCountry != "")
                    {
                        //Item Value in dictionary
                        string name = nameToCountry.FirstOrDefault(x => x.Value == guestCountry).Key;
                        obj.countryKeyValue = name;
                    }

                    Constants._guestNumber = "";
                    Constants._guestNumber = guestNumber.Text;
                    stopPageLoading();

                    //Guest details updateindicator, Reload content page
                    MessagingCenter.Send <GuestEdit, List <guestDetails> >(this, Constants._guestEdited, guestdetails);
                    await DisplayAlert("Message", result, "OK");

                    //Logger
                    new APILogger().Logger("Guest Payload :" + JsonConvert.SerializeObject(statusChange));
                    new APILogger().Logger("Guest Save Status :" + result);

                    //Close this content page
                    this.Navigation.RemovePage(this);
                }
                else
                {
                    stopPageLoading();
                    await DisplayAlert("Message", result, "OK");
                }
            }
        }
Exemple #21
0
        private void InitBlinkID()
        {
            // before obtaining any of the recognizer's implementations from DependencyService, it is required
            // to obtain instance of IMicroblinkScanner and set the license key.
            // Failure to do so will crash your app.
            var microblinkFactory = DependencyService.Get <IMicroblinkScannerFactory>();

            // license keys are different for iOS and Android and depend on iOS bundleID/Android application ID
            // in your app, you may obtain the correct license key for your platform via DependencyService from
            // your Droid/iOS projects
            string licenseKey;

            // both these license keys are demo license keys for bundleID/applicationID com.microblink.xamarin.blinkid
            if (Device.RuntimePlatform == Device.iOS)
            {
                //licenseKey = @"sRwAAAEQY29tLmNobWwuaXQuY2Nmc0iUtoUk/ef1YJ5jX+o5uIzyxuRON+o5AprGt1y0HRXyOS3r7Xn/J8u2qeYccWpDTk0d8mdaDPrcaJjP7EUTBVG7BwPOlZfYAd4bPftj+19de9RS9WPc8U+nSNUgG39oaeL7cG4/J8B6V13gvRYYCDRAQh8EUDUy7R77C7WcuFQ4UMs2c7MkJxwFuxtX0k2W5TvMANrFRd31HhWVGYl8v1QsBgD2qxPBDq1QIXNdmmfHd0PCavSzTUVXE0tuTGjm7ZiY";
                licenseKey = @"sRwAAAETY29tLmNobWwuaXQuY2hlY2tpbgGm5r7k3Ek2zECA87ExzLf1KJZaW29XBS/9dg+G7MK6iq76H9mvl6iZWyFCQIZkJDJtfeI4Ojyvaa33CV/GUaGfjAeT/gbPdEECFLJdiJzYEAFGXlwFYpkfb4wDuHefL7y+R4dJFOdoCKFTG78XSRWoeIMReXDXzayIXHmSn09Fw9fzpkcM3eDNmtxnza4a6M07yoU=";
            }
            else
            {
                //licenseKey = "sRwAAAEQY29tLmNobWwuaXQuY2Nmc0iUtoUk/ef1YJ5jX+o5uIzyxuRON+o5AprGt1y0HRXyOS3r7Xn/J8u2qeYccWpDTk0d8mdaDPrcaJjP7EUTBVG7BwPOlZfYAd4bPftj+19de9RS9WPc8U+nSNUgG39oaeL7cG4/J8B6V13gvRYYCDRAQh8EUDUy7R77C7WcuFQ4UMs2c7MkJxwFuxtX0k2W5TvMANrFRd31HhWVGYl8v1QsBgD2qxPBDq1QIXNdmmfHd0PCavSzTUVXE0tuTGjm7ZiY";
                licenseKey = "sRwAAAATY29tLmNobWwuaXQuY2hlY2tpbtRm4Sqvhw507E+XVCNTtcxAXSpC2KKosWxzcIjD++kxxsJIOUU4a8rhxtQ3g30tGeoYbJOCycdV/DSfLEmiz1E2g4PgA53THm1J2IyLsczXEmhqqAAEO3wmKSIwi2jgO8MHZvu35bDgH9/EV34AuKVxE97kdVh4LIIxmbaOcJFMzH9syNrE8Qfano3mAP8O4zxg0/c=";
            }

            // since DependencyService requires implementations to have default constructor, a factory is needed
            // to construct implementation of IMicroblinkScanner with given license key
            blinkID = microblinkFactory.CreateMicroblinkScanner(licenseKey);

            // subscribe to scanning done message
            MessagingCenter.Subscribe <ScanningDoneMessage>(this, ScanningDoneMessageId, async(sender) => {
                pageLoading();

                try
                {
                    ImageSource fullDocumentImageSource = null;
                    ImageSource successFrameImageSource = null;

                    string stringResult = "No valid results.";

                    // if user cancelled scanning, sender.ScanningCancelled will be true
                    if (sender.ScanningCancelled)
                    {
                        stringResult = "Scanning cancelled";
                    }
                    else
                    {
                        // otherwise, one or more recognizers used in RecognizerCollection (see StartScan method below)
                        // will contain result

                        // if specific recognizer's result's state is Valid, then it contains data recognized from image
                        if (mrtdRecognizer.Result.ResultState == RecognizerResultState.Valid)
                        {
                            var result = mrtdRecognizer.Result;


                            lname           = result.MrzResult.PrimaryId;
                            fname           = result.MrzResult.SecondaryId;
                            nationality     = result.MrzResult.Nationality;
                            gender          = result.MrzResult.Gender;
                            PassportNumber  = Regex.Replace(result.MrzResult.DocumentNumber, "[^A-Za-z0-9 _]", "");
                            dateOfExpiry    = $"{result.MrzResult.DateOfExpiry.Day}-{result.MrzResult.DateOfExpiry.Month}-{result.MrzResult.DateOfExpiry.Year}";
                            dateOfBirthPass = $"{result.MrzResult.DateOfBirth.Day}-{result.MrzResult.DateOfBirth.Month}-{result.MrzResult.DateOfBirth.Year}";


                            //List of identification methods from dictionary
                            var nameToAlpha2FromAlpha3 = CountryDictionary.listAlpha3To();
                            //Getting Key Value from Dictoinary by passing the THREE Letter code
                            nationality = nameToAlpha2FromAlpha3.FirstOrDefault(x => x.Key == nationality).Value;

                            //Extracting document Images
                            fullDocumentImageSource = result.FullDocumentImage;
                            successFrameImageSource = mrtdSuccessFrameGrabberRecognizer.Result.SuccessFrame;
                            //Set Image to Globals
                            Constants.PassportCopy = fullDocumentImageSource;


                            await existingGuestDetailsFromDatabses(2, PassportNumber);

                            Device.BeginInvokeOnMainThread(() =>
                            {
                                GuestFisrtName.Text = fname;
                                GuestLastName.Text  = lname;
                                guestIdentificationDetailsPicker("2");
                                guestNationalityDetailsPicker(nationality);
                                guestContryDetailsPicker(nationality);
                                guestLanguageDetailsPicker("E");
                                PassportExpiry.Date = DateTime.ParseExact(dateOfExpiry, "d-M-yyyy", CultureInfo.CurrentCulture);
                                guestGenderDetailsPicker(serviceDataValidation.guestEditGenderValidation(gender));
                                DateOfBirth.Date = DateTime.ParseExact(dateOfBirthPass, "d-M-yyyy", CultureInfo.CurrentCulture);
                                stopPageLoading();
                            });
                        }
                    }
                }
                catch (Exception)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        stopPageLoading();
                        guestEntryDetails(guestNumber.Text, PassportNumber, fname, lname, "", "", "", "", "");
                        guestIdentificationDetailsPicker("2");
                        guestNationalityDetailsPicker(nationality);
                        guestContryDetailsPicker(nationality);
                        guestLanguageDetailsPicker("E");
                        guestSalutationPicker("");
                        guestGenderDetailsPicker(serviceDataValidation.guestEditGenderValidation(gender));
                        PassportExpiry.Date = DateTime.ParseExact(dateOfExpiry, "d-M-yyyy", CultureInfo.CurrentCulture);
                        DateOfBirth.Date    = DateTime.ParseExact(dateOfBirthPass, "d-M-yyyy", CultureInfo.CurrentCulture);
                        Visitperhotel       = "00";
                        Totalvisit          = "00";
                        RevenueTotal        = "0.00";
                        RevenueRoom         = "0.00";
                        RevenueFnb          = "0.00";
                        RevenueOther        = "0.00";
                        stopPageLoading();


                        DisplayAlert(Constants._headerMessage, Constants._noDetails, Constants._buttonOkay);
                    });
                }
            });
        }