Exemple #1
0
        public void SaveAsync()
        {
            string emailpattern = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
            Regex  emailRegx    = new Regex(emailpattern);

            if (IsCheck1 == true)
            {
                HostelGender = "Male";
            }
            else
            {
                HostelGender = "Female";
            }
            //  Hostel.hostelName = HostelName;
            if (AreaId == null)
            {
                App.Current.MainPage.DisplayAlert("", "Please Select Area", "OK");
            }
            else if (HostelName == null || HostelName.Length == 0)
            {
                App.Current.MainPage.DisplayAlert("", "Please Enter Hostel Name", "OK");
            }
            else if (emailRegx.IsMatch(Email) == false)
            {
                App.Current.MainPage.DisplayAlert("HMS", "Enter Valid Email Address", "OK");
                return;
            }

            else
            {
                HostelModel Hostels = new HostelModel();
                Hostels.hostelName      = HostelName;
                Hostels.areaId          = AreaId;
                Hostels.hostelForGender = HostelGender;
                Hostels.addressLine1    = Address;
                Hostels.zipCode         = Zipcode;
                Hostels.phone           = Phone;
                Hostels.email           = Email;
                web.SaveHostelEntry(Hostels);
                // new CountryReportService((AreaEntryI)this).SaveAreaEntry(Area);
            }
        }