示例#1
0
 /// <summary>
 /// Adds the adress to a restaurant
 /// </summary>
 /// <param name="restaurant"></param>
 /// <param name="adress"></param>
 public void AddAdress(Restaurant restaurant, Adress adress)
 {
     using var dbContext = new RestaurantContext();
     dbContext.Restaurants.Find(restaurant.ID).Adress = adress;
     dbContext.SaveChanges();
 }
示例#2
0
        static void Main(string[] args)
        {
            #region OTHER
            WorkDay work   = new WorkDay();
            WorkDay offDay = new WorkDay();
            offDay.ChangeDayToBusy();
            workDays.Add(work);
            workDays.Add(offDay);
            workDays.Add(work);
            workDays.Add(work);
            workDays.Add(work);
            #endregion

            #region DOCTORS
            Doctor d1 = new Doctor("Kuba", "Rzucidło", RandomPESEL(), SpecjalizationEnum.Cardiologist);
            Doctor d2 = new Doctor("Kasia", "Tobuk", RandomPESEL(), SpecjalizationEnum.Laryngologist);
            Doctor d3 = new Doctor("Retek", "Rydzyk", RandomPESEL(), SpecjalizationEnum.Family);

            d2.SetDoctorAvailibity(workDays);

            doctors.Add(d1);
            doctors.Add(d2);
            doctors.Add(d3);
            #endregion

            #region PATIENTS
            Adress a1 = new Adress("Kwiatowa", "Raciąż", CountryCode.PL, "09-140");

            Patient p1 = new Patient("Maciej", "Hawrzyniak", RandomPESEL(), a1);
            Patient p2 = new Patient("Marta", "Kkrawa", RandomPESEL(), a1);
            Patient p3 = new Patient("John", "Akoczny", RandomPESEL(), a1);

            patients.Add(p1);
            patients.Add(p2);
            patients.Add(p3);
            #endregion



            ClinicService clinicService = new ClinicService(patients, doctors);

            while (WorkStatus)
            {
                clinicService = RefreshClinicService();


                ShowClinicMenu();
                menuAnswer = Console.ReadLine();
                switch (menuAnswer)
                {
                case "1":
                    Console.Clear();
                    Patient patient = AddPatient();
                    patients.Add(patient);
                    break;

                case "2":
                    Console.Clear();
                    if (patients.Count > 0)
                    {
                        Console.WriteLine("Podaj PESEL pacjenta: ");
                        clinicService.RemovePatient(GetPeselFromUser());
                        patients = clinicService.GetPatients();
                    }
                    else
                    {
                        Console.WriteLine("LISTA PACJENTOW JEST PUSTA!!");
                    }

                    break;

                case "3":
                    Console.Clear();
                    Doctor doctor = AddDoctor();
                    doctors.Add(doctor);
                    break;

                case "4":
                    Console.Clear();
                    if (doctors.Count > 0)
                    {
                        Console.WriteLine("Podaj PESEL doktora: ");
                        clinicService.RemoveDoctor(GetPeselFromUser());
                        doctors = clinicService.GetDoctors();
                    }
                    else
                    {
                        Console.WriteLine("LISTA DOKTOROW JEST PUSTA!!");
                    }

                    break;

                case "5":
                    Console.Clear();
                    if (patients.Count > 0)
                    {
                        clinicService.SortPatients();
                        patients = clinicService.GetPatients();
                        Console.WriteLine("----------------");
                        Console.WriteLine("PACJENCI ZOSTALI POSORTOWANI!!!");
                        Console.WriteLine("----------------");
                    }
                    else
                    {
                        Console.WriteLine("LISTA PACJENTOW JEST PUSTA!!");
                    }
                    break;

                case "6":
                    Console.Clear();
                    clinicService.ShowPatient();
                    break;

                case "7":
                    Console.Clear();
                    Console.WriteLine("Podaj nazwisko pacjenta: ");
                    string surname = Console.ReadLine();
                    clinicService.SearchBySurname(surname);
                    break;

                case "8":
                    Console.Clear();
                    int day  = clinicService.CheackDay();
                    int hour = clinicService.CheackHour();
                    clinicService.ShowInfoAboutDoctors(day, hour);
                    break;

                case "9":
                    Console.Clear();
                    clinicService.ArrangeThePactient();
                    patients = clinicService.GetPatients();
                    doctors  = clinicService.GetDoctors();

                    break;

                case "10":
                    Console.Clear();
                    clinicService.ShowDoctors();
                    break;

                case "11":
                    Console.Clear();
                    clinicService.ShowPatientVisits();
                    break;

                case "12":

                    break;

                case "13":
                    Console.Clear();
                    WorkStatus = false;
                    break;

                default:

                    break;
                }
            }
            EndProgramInfo();
        }
示例#3
0
 public override bool Equals(Object obj)
 {
     if (obj is Problem ob)
     {
         return(Id.Equals(ob.Id) && CategoryId.Equals(ob.CategoryId) && ThemeId.Equals(ob.ThemeId) && Adress.Equals(ob.Adress) &&
                SourceId.Equals(ob.SourceId) && CreateDate.Equals(ob.CreateDate) && AnswerDate.Equals(ob.AnswerDate) &&
                ProblemText.Equals(ob.ProblemText) && ProblemPhotos.Equals(ob.ProblemPhotos) && AnswerText.Equals(ob.AnswerText) &&
                AnswerPhotos.Equals(ob.AnswerPhotos) && StatusId.Equals(ob.StatusId) && DistrictId.Equals(ob.DistrictId) && ChildID.Equals(ob.ChildID) &&
                ParentID.Equals(ob.ParentID) && IspolnitelName.Equals(ob.IspolnitelName) && IspolnitelId.Equals(ob.IspolnitelId));
     }
     return(false);
 }
 public async Task <Adress> UpdateClaimAdress(Claim claim, Adress adress)
 {
     if (claim == null)
     {
         return(default);
示例#5
0
 public override string ToString()
 {
     return(base.ToString() + " " + Type + " number of rooms: " + NbrOfRooms + " " + Adress.ToString());
 }
 public async Task <long> Save(Adress adress)
 {
     return(await claimAdressRepository.Save(adress));
 }
示例#7
0
 public Client()
 {
     NomComplet = new FullName();
     Address    = new Adress();
 }
 //[ApiAuthorizeAttribute(Roles = "A")]
 public EntityHttpResponse Update([FromBody] Adress value)
 {
     return(ControlBeforeAddorUpdate(value, ModelState, Request, _Adressmanager, false));
 }
示例#9
0
        public ClientesAdd(Tables.Client client = null)
        {
            InitializeComponent();

            sqlClient = new Sql.Client();

            if (client != null)
            {
                idClient        = client.Id;
                clientName.Text = client.Name;
                Adress.Text     = client.Street;
                District.Text   = client.District;
                Number.Text     = client.Number.ToString();
                Complement.Text = client.Complement;
                Telephone.Text  = client.Telephone;
                Reference.Text  = client.Reference;
            }

            Loaded += ClientesAdd_Loaded;

            Number.PreviewTextInput += (sender, e) => e.Handled = new Regex("[^0-9]").IsMatch(e.Text);

            clientName.GotFocus += delegate { clientName.SelectAll(); };
            Adress.GotFocus     += delegate { Adress.SelectAll(); };
            District.GotFocus   += delegate { District.SelectAll(); };
            Number.GotFocus     += delegate { Number.SelectAll(); };
            Complement.GotFocus += delegate { Complement.SelectAll(); };
            Telephone.GotFocus  += delegate { Complement.SelectAll(); };
            Reference.GotFocus  += delegate { Reference.SelectAll(); };

            clientName.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                          {
                                                              Adress.Focus();
                                                          }
            };
            Adress.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                      {
                                                          Number.Focus();
                                                      }
            };
            Number.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                      {
                                                          District.Focus();
                                                      }
            };
            District.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                        {
                                                            Complement.Focus();
                                                        }
            };
            Complement.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                          {
                                                              Telephone.Focus();
                                                          }
            };
            Telephone.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                         {
                                                             Reference.Focus();
                                                         }
            };
            Reference.PreviewKeyDown += (sender, e) => { if (e.Key == Key.Enter)
                                                         {
                                                             SaveBtn_Click(null, null);
                                                         }
            };

            SaveBtn.Click  += SaveBtn_Click;
            ClearBtn.Click += ClearBtn_Click;
        }
示例#10
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            string cat     = CategoryCB.Text;
            string type    = TypeCB.Text;
            string country = CountryCB.Text;
            string city    = CityTB.Text;
            string street  = StreetTB.Text;
            string zip     = ZipTB.Text;
            string spec    = SpecTB.Text;

            Adress Aobj = new Adress(city, street, zip, country);

            try
            {
                if (!string.IsNullOrEmpty(cat) && !string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(country) && !string.IsNullOrEmpty(city) && !string.IsNullOrEmpty(street) && !string.IsNullOrEmpty(zip))
                {
                    if (type == "Appartment")
                    {
                        Appartment Bobj = new Appartment(cat, Aobj, spec, type);
                        Em.Add(Bobj);
                        MessageBox.Show("Added");
                        Update();
                    }
                    if (type == "House")
                    {
                        House Bobj = new House(cat, Aobj, spec, type);
                        Em.Add(Bobj);

                        MessageBox.Show("Added");

                        Update();
                    }
                    if (type == "Villa")
                    {
                        Villa Bobj = new Villa(cat, Aobj, spec, type);
                        Em.Add(Bobj);

                        MessageBox.Show("Added");

                        Update();
                    }
                    if (type == "Townhouse")
                    {
                        Townhouse Bobj = new Townhouse(cat, Aobj, spec, type);
                        Em.Add(Bobj);

                        MessageBox.Show("Added");

                        Update();
                    }
                    if (type == "Shop")
                    {
                        Shop Bobj = new Shop(cat, Aobj, spec, type);
                        Em.Add(Bobj);

                        MessageBox.Show("Added");

                        Update();
                    }
                    if (type == "Warehouse")
                    {
                        Warehouse Bobj = new Warehouse(cat, Aobj, spec, type);
                        Em.Add(Bobj);

                        MessageBox.Show("Added");

                        Update();
                    }
                }
                else
                {
                    MessageBox.Show("Please fill all the forms!!");
                }
            }

            catch (Exception exc)
            {
                throw exc;
            }
        }
示例#11
0
 public BoletoPayment(string barCode, string boletoNumber, DateTime paidDate, DateTime expireDate, decimal total, decimal totalPaid, string payer, Document document, Email email, Adress adress)
     : base(paidDate, expireDate, total, totalPaid, payer, document, email, adress)
 {
     BarCode      = barCode;
     BoletoNumber = boletoNumber;
 }
示例#12
0
 public void UpdateAdress(Client client, Adress newAdress)
 {
     client.SetAdress(newAdress);
 }
示例#13
0
 public override string ToString() => Name + " " + Adress.ToString();
示例#14
0
 public override int GetHashCode()
 {
     return(Name.GetHashCode() + Adress.GetHashCode() + Semester.GetHashCode() + GenderType.GetHashCode());
 }
示例#15
0
 protected Payment(DateTime paidDate, DateTime expireDate, decimal total, decimal totalPaid, string payer, Document document, Email email, Adress adress)
 {
     Number     = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10).ToUpper();
     PaidDate   = paidDate;
     ExpireDate = expireDate;
     Total      = total;
     TotalPaid  = totalPaid;
     Payer      = payer;
     Document   = document;
     Email      = email;
     Adress     = adress;
     AddNotifications(new Contract()
                      .Requires()
                      .IsLowerThan(0, Total, "Payment.Total", "O total não pode ser zero")
                      .IsGreaterOrEqualsThan(Total, TotalPaid, "Payment.TotalPaid", "o valor pago é menor que o total")
                      );
 }
示例#16
0
        public override bool Equals(object obj)
        {
            Department department = obj as Department;

            return(Name == department.Name && Adress.Equals(department.Adress));
        }
        protected override void Seed(AirBnb_Web1.DataAccessLayer.AirBnbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.



            Adress adress1 = new Adress();

            adress1.ID           = 1;
            adress1.Streat       = "Bulevar Oslobodjenja";
            adress1.StreatNumber = 30;
            adress1.ZipCode      = 21000;
            adress1.Settlement   = "Novi Sad";
            context.Adresss.Add(adress1);
            context.SaveChanges();

            Amenitie amenitie1 = new Amenitie();

            amenitie1.Name = "Klima";
            context.Amenities.Add(amenitie1);
            context.SaveChanges();

            Location location1 = new Location();

            location1.ID        = 1;
            location1.Latitude  = 45.23;
            location1.Longitude = 25.23;
            location1.AdressID  = adress1.ID;
            context.Locations.Add(location1);
            context.SaveChanges();

            User user1 = new User {
                ID = 1, Name = "Sasa", Surname = "Dragomirovic", Gender = Helper.Enums.Genders.Male, Password = "******", Role = Helper.Enums.Roles.Admin, UserName = "******", Blocked = false
            };
            User user2 = new User {
                ID = 2, Name = "Biba", Surname = "Bibic", Gender = Helper.Enums.Genders.Male, Password = "******", Role = Helper.Enums.Roles.Guest, UserName = "******", Blocked = false
            };
            User user3 = new User {
                ID = 3, Name = "Gruja", Surname = "Grujic", Gender = Helper.Enums.Genders.Male, Password = "******", Role = Helper.Enums.Roles.Host, UserName = "******", Blocked = false
            };

            context.Users.Add(user1);
            context.Users.Add(user2);
            context.Users.Add(user3);
            context.SaveChanges();

            Apartman apartman1 = new Apartman {
                ID = 1, SingUpTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0), SingOutTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0), Status = Helper.Enums.ApartmanStatus.Active, GuestNumber = 3, HostID = user3.ID, LocationID = location1.ID, PricePerNight = 20, RoomNumber = 2
            };

            context.Apartmans.Add(apartman1);
            context.SaveChanges();

            Comment comment1 = new Comment {
                ID = 1, ApartmanID = apartman1.ID, GuestID = user2.ID, Rate = 9.5, Text = "Nice one"
            };

            context.Comments.Add(comment1);
            context.SaveChanges();

            DatesModel rentDate1 = new DatesModel {
                ID = 1, ApartmanID = apartman1.ID, Available = true, RentDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0)
            };

            context.DatesModels.Add(rentDate1);
            context.SaveChanges();

            DatesModel rentDate2 = new DatesModel {
                ID = 1, ApartmanID = apartman1.ID, Available = true, RentDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0)
            };

            context.DatesModels.Add(rentDate2);
            context.SaveChanges();

            DatesModel rentDate3 = new DatesModel {
                ID = 1, ApartmanID = apartman1.ID, Available = true, RentDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0)
            };

            context.DatesModels.Add(rentDate3);
            context.SaveChanges();

            Reservation reservation1 = new Reservation {
                ID = 1, ApartmanID = apartman1.ID, GuestID = user2.ID, NumberOfNights = 10, SingUpDate = rentDate1.RentDate, Stauts = Helper.Enums.ReservationStatus.Accepted, TotalPrice = 100
            };

            context.Reservations.Add(reservation1);
            context.SaveChanges();

            Reservation reservation2 = new Reservation {
                ID = 2, ApartmanID = apartman1.ID, GuestID = user2.ID, NumberOfNights = 10, SingUpDate = rentDate2.RentDate, Stauts = Helper.Enums.ReservationStatus.Created, TotalPrice = 200
            };

            context.Reservations.Add(reservation2);
            context.SaveChanges();

            Reservation reservation3 = new Reservation {
                ID = 3, ApartmanID = apartman1.ID, GuestID = user2.ID, NumberOfNights = 10, SingUpDate = rentDate3.RentDate, Stauts = Helper.Enums.ReservationStatus.Done, TotalPrice = 200
            };

            context.Reservations.Add(reservation3);
            context.SaveChanges();

            HolidayDays h1 = new HolidayDays {
                Deleted = false, Holiday = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0)
            };

            context.Holidays.Add(h1);
            context.SaveChanges();
        }
示例#18
0
 public Villa(string Cat, Adress Adress, string NbrOfRooms, string Type) :
     base(Cat, Adress)
 {
     this.NbrOfRooms = NbrOfRooms;
     this.Type       = Type;
 }
示例#19
0
 public void AddToAdresses(Adress adress)
 {
     base.AddObject("Adresses", adress);
 }
示例#20
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            // Sql injection validation on text strings. just matching to keywords in sql to block unwanted injections.

            if (Country.Contains("Delete") || Country.Contains("Alter") || Name.Contains("Delete") || Name.Contains("Alter") || Adress.Contains("Delete") || Adress.Contains("Alter"))
            {
                yield return(new ValidationResult(
                                 $"Any sql keywords are banned.",
                                 new[] { nameof(Country) }));
            }
        }
示例#21
0
 public static Adress CreateAdress(int ID, global::System.Guid guid, string createdBy, global::System.DateTime createdAt, bool isDefault, global::System.DateTime validFrom, byte[] timestamp, int mdaCountryID, int personID)
 {
     Adress adress = new Adress();
     adress.ID = ID;
     adress.Guid = guid;
     adress.CreatedBy = createdBy;
     adress.CreatedAt = createdAt;
     adress.IsDefault = isDefault;
     adress.ValidFrom = validFrom;
     adress.Timestamp = timestamp;
     adress.MdaCountryID = mdaCountryID;
     adress.PersonID = personID;
     return adress;
 }
示例#22
0
        //-----------------------------------------------------------------------------------------------------
        public Adress Select(Adress a)
        {
            NpgsqlConnection con = DB.DBConnector.GetConnection();



            NpgsqlCommand cmd = new NpgsqlCommand(null, con);

            cmd.CommandText = "SELECT * FROM Adresse where adressId=@id";

            NpgsqlParameter id = new NpgsqlParameter("@id", NpgsqlTypes.NpgsqlDbType.Numeric);

            id.Value = a.AdressId;
            cmd.Parameters.Add(id);

            NpgsqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            Adress ad = new Adress();

            if (reader.HasRows)
            {
                if (!(reader.IsDBNull(0)))
                {
                    ad.AdressId = long.Parse(reader[0].ToString());
                }
                if (!(reader.IsDBNull(1)))
                {
                    ad.Street = reader[1].ToString();
                }
                if (!(reader.IsDBNull(2)))
                {
                    ad.City = reader.GetString(2);
                }
                if (!(reader.IsDBNull(3)))
                {
                    ad.Country = reader.GetString(3);
                }
                if (!(reader.IsDBNull(4)))
                {
                    ad.HouseNumber = reader.GetInt32(4);
                }
                if (!(reader.IsDBNull(5)))
                {
                    ad.StairNumber = reader.GetInt32(5);
                }
                if (!(reader.IsDBNull(6)))
                {
                    // stock fehlt  ad. = reader[6].ToString();
                }
                if (!(reader.IsDBNull(7)))
                {
                    ad.ZipCode = reader.GetInt32(7);
                }
                if (!(reader.IsDBNull(8)))
                {
                    ad.DoorNumber = reader.GetInt32(8);
                }
            }
            reader.Close();
            con.Close();

            return(ad);
        }
        public ActionResult EditDate([Bind(Include = "Id,FirstName,LastName,Phone,Email,Password,Role_Id,Adress_Id,BankAccount_Id")] User user, [Bind(Include = "City,Street,ZipCode")] Adress adress,
                                     [Bind(Include = "Name,AccountNumber")] BankAccount bankAccount)
        {
            if (!ModelState.IsValid)
            {
                return(View(user));
            }

            if (!ChangeValues(user, adress, bankAccount))
            {
                return(View(user));
            }

            var isEmailChanged = HttpContext.User.Identity.Name != user.Email;

            if (!isEmailChanged)
            {
                return(RedirectToAction("Index"));
            }

            FormsAuthentication.SignOut();
            SignInUser(user.Email);
            return(RedirectToAction("Index"));
        }
示例#24
0
        private void DeleteInstanceRowTableAdress(int indexCurrentRow)
        {
            Adress thisDeleteAdress = _crudStudent.GetAdress(indexCurrentRow);

            _crudStudent.DeleteCurrentAdress(thisDeleteAdress);
        }
示例#25
0
 /// <summary>
 ///     Converts an instance of Adress into a Json-Object
 /// </summary>
 /// <param name="adress">An Instance of adress</param>
 /// <returns>An adress converted into a Json-string</returns>
 private string SerializeAdress(Adress adress)
 {
     return(JsonConvert.SerializeObject(adress));
 }
示例#26
0
        public static int SaveAdress(Adress p_Adress)
        {
            SQLiteConnection con           = Connection.GetConnection();
            SQLiteCommand    command       = new SQLiteCommand(con);
            bool             alreadyExists = false;

            command.CommandText = string.Format(
                "SELECT {0} FROM {1} " +
                "WHERE {0} = @0",
                ToolConstants.DB_ADRESS_ID,
                ToolConstants.DB_ADRESS_TABLE);
            command.Parameters.Add("@0", System.Data.DbType.Int32).Value = p_Adress.Id;

            SQLiteDataReader reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                alreadyExists = true;
            }
            reader.Close();

            if (alreadyExists)
            {
                command.CommandText = string.Format(
                    "UPDATE {0} SET " +
                    "{1} = @1, " +
                    "{2} = @2, " +
                    "{3} = @3 " +
                    "WHERE {4} = @4",
                    ToolConstants.DB_ADRESS_TABLE,
                    ToolConstants.DB_ADRESS_STREET,
                    ToolConstants.DB_ADRESS_POSTCODE,
                    ToolConstants.DB_ADRESS_PLACE,
                    ToolConstants.DB_ADRESS_ID
                    );
                command.Parameters.Add("@1", System.Data.DbType.String).Value = p_Adress.Street;
                command.Parameters.Add("@2", System.Data.DbType.String).Value = p_Adress.PostCode;
                command.Parameters.Add("@3", System.Data.DbType.String).Value = p_Adress.Place;
                command.Parameters.Add("@4", System.Data.DbType.Int32).Value  = p_Adress.Id;

                command.ExecuteNonQuery();

                return(p_Adress.Id);
            }
            else
            {
                command.CommandText = string.Format(
                    "INSERT INTO {0} ({1}, {2}, {3}) " +
                    "VALUES (@1, @2, @3)",
                    ToolConstants.DB_ADRESS_TABLE,
                    ToolConstants.DB_ADRESS_STREET,
                    ToolConstants.DB_ADRESS_POSTCODE,
                    ToolConstants.DB_ADRESS_PLACE);
                command.Parameters.Add("@1", System.Data.DbType.String).Value = p_Adress.Street;
                command.Parameters.Add("@2", System.Data.DbType.String).Value = p_Adress.PostCode;
                command.Parameters.Add("@3", System.Data.DbType.String).Value = p_Adress.Place;

                command.ExecuteNonQuery();

                command.CommandText = "SELECT last_insert_rowid()";
                reader = command.ExecuteReader();
                reader.Read();
                int adressID = reader.GetInt32(0);
                reader.Close();
                return(adressID);
            }
        }
        // GET: Admin/Adress
        public ActionResult AddAdress()
        {
            Adress ad = new Adress();

            return(View(ad));
        }
示例#28
0
        private async Task ExecuteFillByINN()
        {
            var query = new DataQuery
            {
                Query = INN,
                KPP   = KPP
            };

            Organisation organisation = await daDataService.GetOrganisationAsync(query);

            var suggestions = organisation.Suggestions.FirstOrDefault();

            if (suggestions == null)
            {
                return;
            }

            Name     = suggestions.Value;
            FullName = suggestions.UnrestrictedValue;

            var data = suggestions.Data;

            if (string.IsNullOrWhiteSpace(KPP))
            {
                KPP = data.KPP;
            }

            var adresses = await daDataService.GetAddressAsync(data.Address.UnrestrictedValue);

            var adress = adresses.FirstOrDefault();

            if (adress == null)
            {
                return;
            }

            LegalAdress = new Adress
            {
                ZIPCode = adress.PostalCode,
                City    = adress.City,
                Street  = adress.Street,
                Hause   = adress.House,
                Office  = adress.Flat
            };

            ActualAdress = new Adress
            {
                ZIPCode = adress.PostalCode,
                City    = adress.City,
                Street  = adress.Street,
                Hause   = adress.House,
                Office  = adress.Flat
            };

            PostalAdress = new Adress
            {
                ZIPCode = adress.PostalCode,
                City    = adress.City,
                Street  = adress.Street,
                Hause   = adress.House,
                Office  = adress.Flat
            };
        }
        public ActionResult AddAdress(Adress model)
        {
            result.resultint = ar.Insert(model);

            return(RedirectToAction("List"));
        }
        private bool GetApartmentFromBM(ApartmentBM apartmentBM) //add apartment
        {
            Apartman apartman = new Apartman();

            apartman.Type   = (apartmentBM.Type == ApartmanType.FullApartman.ToString()) ? ApartmanType.FullApartman : ApartmanType.Room;
            apartman.Status = ApartmanStatus.NotActive;
            apartman.HostID = apartmentBM.HostID;

            //promeni ovaj datetype :
            apartman.SingUpTime  = apartmentBM.SingUpTime;
            apartman.SingOutTime = apartmentBM.SingOutTime;
            apartman.RoomNumber  = apartmentBM.RoomNumber;

            apartman.PricePerNight = apartmentBM.PricePerNight;
            //pics
            apartman.Pictures = "";
            if (apartmentBM.Pictures != null)
            {
                foreach (string pic in apartmentBM.Pictures)
                {
                    apartman.Pictures = pic + ';';
                }
            }



            apartman.GuestNumber = apartmentBM.GuestNumber;

            Adress adress1 = new Adress();

            adress1.Streat       = apartmentBM.Streat;
            adress1.StreatNumber = apartmentBM.StreatNumber;
            adress1.ZipCode      = apartmentBM.ZipCode;
            adress1.Settlement   = apartmentBM.Settlement;
            context.Adresss.Add(adress1);
            context.SaveChanges();

            //location info:
            Location locationInfo = new Location();

            locationInfo.Latitude  = apartmentBM.Latitude;
            locationInfo.Longitude = apartmentBM.Longitude;
            locationInfo.AdressID  = adress1.ID;
            context.Locations.Add(locationInfo);
            context.SaveChanges();

            apartman.LocationID = locationInfo.ID;

            //Amenities:
            apartman.Amenities = new List <Amenitie>();
            foreach (string amm in apartmentBM.Amenities)
            {
                Amenitie amenitie = context.Amenities.Where(x => x.Name == amm).FirstOrDefault();

                apartman.Amenities.Add(amenitie);
            }
            context.SaveChanges();

            apartman.Deleted = false;
            context.Apartmans.Add(apartman);
            context.SaveChanges();
            //zbog slike mi treba ID:
            apartmentBM.ID = apartman.ID;


            return(true);
        }
 public ActionResult Edit(Adress model)
 {
     result.resultint = ar.Update(model);
     ViewBag.Mesaj    = result.resultint.UserMessage;
     return(RedirectToAction("List"));
 }
        void GetPropertyDetails()
        {
            try
            {
                Property1.MLSDataWebServiceSoapClient mlsClient = new Property1.MLSDataWebServiceSoapClient();

                DataTable dt = new DataTable();
                if (Session["PropertySearchType"].ToString().Contains("Residential"))
                {
                    dt = mlsClient.GetResidentialProperties(Convert.ToString(Request.QueryString["MLSID"]), "0", "0", "0", "0", "0", "0");
                }
                else if (Session["PropertySearchType"].ToString().Contains("Commercial"))
                {
                    dt = mlsClient.GetAllCommercialProperties(Request.QueryString["MLSID"].ToString(), "0", "0", "0", "0", "0");
                }
                else if (Session["PropertySearchType"].ToString().Contains("Condo"))
                {
                    dt = mlsClient.GetProperties_Condo(Convert.ToString(Request.QueryString["MLSID"]), "0", "0", "0", "0", "0", "0");
                }

                lblListBrokerage.Text = "Listing Contracted with: " + Convert.ToString(dt.Rows[0]["ListBrokerage"]);
                if ((Convert.ToString(dt.Rows[0]["PImage"])) == "images/no-image.gif")
                {
                    imgge.Visible = false;
                    img.Visible   = true;
                }
                imgge.ImageUrl = Convert.ToString(dt.Rows[0]["PImage"]);

                lblPrice.Text     = "$" + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["ListPrice"]));
                lblListPrice.Text = "$" + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["ListPrice"]));
                try
                {
                    lblStyle.Text = Convert.ToString(dt.Rows[0]["TypeOwn1Out"]) + " " + Convert.ToString(dt.Rows[0]["Style"]);
                }
                catch
                {
                    lblStyle.Text = Convert.ToString(dt.Rows[0]["TypeOwn1Out"]) + " " + Convert.ToString(dt.Rows[0]["Category"]);
                }
                string PostalCode = Convert.ToString(dt.Rows[0]["PostalCode"]);
                PostalCode                  = PostalCode.Insert(3, " ");
                lblMLS.Text                 = Convert.ToString(dt.Rows[0]["MLS"]);
                Session["Address"]          = (CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["address"])) + ", " + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Municipality"])) + ", " + CheckNullOrEmptyvalue(PostalCode));
                lblAddressBar1.Text         = (CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["address"])) + ", " + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Municipality"])) + ", " + CheckNullOrEmptyvalue(PostalCode) + ", " + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["province"])));
                lblPropertyDescription.Text = Convert.ToString(dt.Rows[0]["remarksforclients"]);
                string extras;
                if (dt.Rows[0]["extras"].ToString().Length > 5)
                {
                    extras = "<b style='float:left; width:80px;'>Extras :</b>" + "<div style='margin:0 0 0 96px;'>" + Convert.ToString(dt.Rows[0]["extras"]) + "</div>";
                }
                else
                {
                    extras = "";
                }

                lblCommunity.Text = Convert.ToString(dt.Rows[0]["Community"]);

                lblprovince.Text = CheckNullOrEmptyvalue(dt.Rows[0]["Municipality"].ToString());

                try
                {
                    lblStorey.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Style"]));
                }
                catch
                {
                    lblStorey.Text = "";
                }

                lblSubTypeofhome.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["typeown1out"]));
                string frontONNsew = "";
                try
                {
                    frontONNsew = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["FrontingOnNSEW"]));
                }
                catch
                { }
                if (frontONNsew.ToString() == "E")
                {
                    lblfronting.Text = "<b>Fronting On: </b>" + "East";
                }
                else if (frontONNsew.ToString() == "W")
                {
                    lblfronting.Text = "<b>Fronting On: </b>" + "West";
                }
                else if (frontONNsew.ToString() == "N")
                {
                    lblfronting.Text = "<b>Fronting On: </b>" + "North";
                }
                else if (frontONNsew.ToString() == "S")
                {
                    lblfronting.Text = "<b>Fronting On: </b>" + "South";
                }
                try
                {
                    lbltype.Text = Convert.ToString(dt.Rows[0]["TypeOwn1Out"]) + " " + Convert.ToString(dt.Rows[0]["Style"]);
                }
                catch
                {
                    lbltype.Text = Convert.ToString(dt.Rows[0]["TypeOwn1Out"]);
                }
                lblgarage.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["GarageType"]));
                try
                {
                    lblbasement122.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Basement1"]));
                    lblroom.Text        = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Rooms"]));
                    lblbed.Text         = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Bedrooms"]));
                    lblBedroom.Text     = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Bedrooms"]));
                    lblbath.Text        = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Washrooms"]));
                    lblWashRooms.Text   = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Washrooms"]));
                    lblDirCrossSt.Text  = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["DirectionsCrossStreets"]));
                    lblAreaLabel.Text   = "Area";
                    // lblAreaLabel.Text = CheckNullOrEmptyvalue(dt.Rows[0]["areacode"].ToString());
                    lblAreaValue.Text = CheckNullOrEmptyvalue(dt.Rows[0]["area"].ToString());
                    lblKitchen.Text   = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Kitchens"])) + "+" + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["KitchensPlus"]));
                    lblfamilyrm.Text  = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["FamilyRoom"]));
                    lblExterior.Text  = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Exterior1"]));
                }
                catch
                {
                    lblbasement122.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Basement1"]));
                    lblAreaLabel.Text   = "Office Area";
                    lblAreaValue.Text   = CheckNullOrEmptyvalue(dt.Rows[0]["OfficeAptarea"].ToString()) + " " + CheckNullOrEmptyvalue(dt.Rows[0]["officeaptareacode"].ToString());
                    lblBedLabel.Text    = "Total Area";
                    lblbed.Text         = CheckNullOrEmptyvalue(dt.Rows[0]["totalarea"].ToString()) + " " + CheckNullOrEmptyvalue(dt.Rows[0]["totalareacode"].ToString());
                    lblBathLabel.Text   = "Water";
                    lblbath.Text        = CheckNullOrEmptyvalue(dt.Rows[0]["Water"].ToString());
                }

                lblMLS1.Text       = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["MLS"]));
                lbltx.Text         = dt.Rows[0]["TotalTaxes"].ToString();
                lblBasement.Text   = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Basement1"]));
                lblGarageType.Text = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["GarageType"]));
                lblParking.Text    = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["ParkingSpaces"]));

                Adress adrs = new Adress();
                adrs.Address = lblAddressBar1.Text;
                adrs.GeoCode();
                string        lat = adrs.Latitude;
                string        lng = adrs.Longitude;
                StringBuilder sb  = new StringBuilder();
                DataSet       ds  = GetWalkingScore1(lblAddressBar1.Text, lat, lng);
                if (ds.Tables.Count > 0)
                {
                    imgg.ImageUrl = ds.Tables[0].Rows[0]["logo_url"].ToString();
                    lblwalk.Text  = ds.Tables[0].Rows[0]["walkscore"].ToString();

                    lblwalk.PostBackUrl = "http://www.walkscore.com/score/loc/lat=" + lat + "/lng=" + lng + "/?utm_source=http://roccobuyandsell.com&amp;utm_medium=ws_api&amp;utm_campaign=ws_api";



                    //lblwalk.PostBackUrl = "https://www.walkscore.com/score/loc/lat=" + lat + "/lng=" + lng + "/?utm_source=surjitpabley.only4agents.com%20%28Canadian%20Real%20Estate%20Association%29&utm_medium=ws_api&utm_campaign=ws_api";
                    //lblwalk.PostBackUrl = "http://www.walkscore.com/score/loc/lat=" + lat + "/lng=" + lng + " /?utm_source=http://surjitpabley.only4agents.com&amp;utm_medium=ws_api&amp;utm_campaign=ws_api";
                    //sb.Append("");
                    //sb.Append("<div>");
                    //sb.Append("<div>");
                    //sb.Append("<div id='walkscore-div-1'><p><a href='https://www.walkscore.com/' target='_blank'>");
                    //sb.Append("<img src='" + ds.Tables[0].Rows[0]["logo_url"].ToString() + "'><span class='walkscore-scoretext'>" + ds.Tables[0].Rows[0]["walkscore"].ToString() + "</span></a><span id='ws_info'>");
                    //sb.Append("<a target='_blank' href='https://www.redfin.com/how-walk-score-works'></a></span></p></div>");
                    //sb.Append("</div>");
                    //sb.Append("</div>");
                }
                Response.Write(sb);

                int       NoOfRoom = Convert.ToInt32("0" + lblroom.Text);
                DataTable dtRooms  = new DataTable();
                dtRooms.Columns.Add("Room", typeof(string));
                dtRooms.Columns.Add("Level", typeof(string));
                dtRooms.Columns.Add("RoomDim", typeof(string));
                dtRooms.Columns.Add("RoomDesc", typeof(string));

                for (int i = 0; i < NoOfRoom; i++)
                {
                    int    RowIndex  = i + 1;
                    string vRoom     = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Room" + RowIndex + ""]));
                    string vLevel    = CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Level" + RowIndex + ""])) != "" ? Convert.ToString(dt.Rows[0]["Level" + RowIndex + ""]) : "0";
                    string vRoomDim  = (CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Length"])) != "" ? (Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Length"])) : "0") + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Width"]) != "" ? ("x" + Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Width"])) : "");// Convert.ToString(dt.Rows[0]["Room1Length"]) + "x" + Convert.ToString(dt.Rows[0]["Room1Width"]);
                    string vRoomDesc = (CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Desc1"])) != "" ? (Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Desc1"])) : "----") + CheckNullOrEmptyvalue(Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Desc2"]) != "" ? ("," + Convert.ToString(dt.Rows[0]["Room" + RowIndex + "Desc2"])) : "");

                    DataRow dr = dtRooms.NewRow();
                    dr["Room"]     = vRoom;
                    dr["Level"]    = vLevel;
                    dr["RoomDim"]  = vRoomDim;
                    dr["RoomDesc"] = vRoomDesc;
                    dtRooms.Rows.Add(dr);
                    LVroom.DataSource = dtRooms;
                    LVroom.DataBind();
                }
            }
            catch (Exception ex)
            { }
        }
        internal async Task<EndType> ReadFieldValue(BufferedByteReader reader)
        {
            var valueBuilder = new StringBuilder();

            var nextByte = await reader.ReadByteAsync();

            var address = new AddressListFieldValue.Adress();
            Group group = new Group();
            var endType = EndType.None;
            while ((endType == EndType.None))
            {
                switch (nextByte)
                {
                    case (byte)SpecialByte.CarriageReturn:
                        endType = await ProcessEol(reader);
                        break;
                    case (byte)SpecialByte.Equals:
                        var resultString = await MimeQuotedString(reader);
                        if (resultString == "=")
                        {
                            MimeState = PreviousMimeQuoted.NotMime;
                            valueBuilder.Append('=');
                        }
                        else
                        {
                            if (MimeState == PreviousMimeQuoted.MimeQuoted)
                            {
                                if (valueBuilder.Length > 0 && valueBuilder[valueBuilder.Length - 1] == ' ')
                                {
                                    valueBuilder.Remove(valueBuilder.Length - 1, 1);
                                }
                            }
                            MimeState = PreviousMimeQuoted.MimeQuoted;
                            valueBuilder.Append(resultString).Append(' ');
                        }
                        break;
                    case (byte)SpecialByte.Space:
                        if (valueBuilder.Length > 0 && valueBuilder[valueBuilder.Length - 1] != ' ')
                        {
                            valueBuilder.Append(' ');
                        }
                        break;
                    case (byte)SpecialByte.LeftParenthesis: // "(": begin comment
                        await ReadComment(reader);
                        break;
                    case (byte)SpecialByte.BackSlash: // "\": begin "quoted character"
                        valueBuilder.Append(Convert.ToChar(nextByte));
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.Quote: //  """: begin quoted string
                        valueBuilder.Append(await ReadQuotedString(reader));
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.Colon: // ":": = end of group name
                        group.Name = valueBuilder.ToString().Trim();
                        valueBuilder = new StringBuilder();
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.LeftAngledBracket: // "<": begin email address  (mailbox)
                        address.Name = valueBuilder.ToString().Trim();
                        valueBuilder = new StringBuilder();
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.RightAngledBracket: // ">" : end of email address (mailbox)
                        address.MailBox = valueBuilder.ToString().Trim();
                        valueBuilder = new StringBuilder();
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.Comma: // "," : end of name-adress spec
                        AddressAdd
                            (
                                ((group.Name == null) ? this.Adresses : group.Members),
                                address,
                                valueBuilder
                            );
                        address = new Adress();
                        valueBuilder = new StringBuilder();
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    case (byte)SpecialByte.SemiColon: // ";" End of group
                        GroupAdd(group, address, valueBuilder);
                        group = new Group();
                        address = new Adress();
                        valueBuilder = new StringBuilder();
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                    default: // alle andere gevallen
                        valueBuilder.Append(Convert.ToChar(nextByte));
                        MimeState = PreviousMimeQuoted.NotMime;
                        break;
                }
                if (endType == EndType.None) nextByte = await reader.ReadByteAsync();
            }
            if (group.Name == null)
            {
                AddressAdd(this.Adresses, address, valueBuilder);
            }
            else
            {
                GroupAdd(group, address, valueBuilder);
            }
            return endType;
        }