private void Button_Click(object sender, RoutedEventArgs e) //обновление { if (RealtorLastName.Text != "" && RealtorName.Text != "" && RealtorMiddleName.Text != "") { RealtorEntities db = new RealtorEntities(); Realtor realtor = db.Realtor.Find(SecurityContext.idRealtor); realtor.LastName = RealtorLastName.Text; realtor.MiddleName = RealtorMiddleName.Text; realtor.Name = RealtorName.Text; realtor.Comission = RealtorCommis.Text; if (MessageBox.Show("Вы уверены что хотите обновить данного риелтора?", "Обновление", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { db.Realtor.Create(); db.SaveChanges(); RealtorList re = new RealtorList(); this.Hide(); re.Show(); } } else { MessageBox.Show("Заполните обязательные поля"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { ClientLi.ItemsSource = dtClient.DefaultView; RealtorEntities db = new RealtorEntities(); var apart = db.Apartment.Find(SecurityContext.id); Floor.Text = apart.Floor.ToString(); Rooms.Text = apart.NumberOfRooms.ToString(); Square.Text = apart.square.ToString(); if (SecurityContext.autovxod == 3) { for (int i = 0; i < dtClient.Rows.Count; i++) { if (int.Parse(dtClient.Rows[i].ItemArray[0].ToString()) == apart.IdClient) { ClientLi.SelectedIndex = i; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click_1(object sender, RoutedEventArgs e) //обновление { if (Password.Text != "" && Login.Text != "") { RealtorEntities db = new RealtorEntities(); Manager manager = db.Manager.Find(SecurityContext.idManager); manager.Login = Login.Text; manager.Password = Password.Text; if (MessageBox.Show("Вы уверены что хотите обновить данного менеджера?", "Обнволение", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { db.Manager.Create(); db.SaveChanges(); ManagerList re = new ManagerList(); this.Hide(); re.Show(); } } else { MessageBox.Show("Заполните все поля"); } }
public static DataTable GetClientList() { if (SecurityContext.autovxod == 3) { RealtorEntities db = new RealtorEntities(); DataTable dtClient = new DataTable(); dtClient.Columns.Add("id"); dtClient.Columns.Add("Фамилия"); dtClient.Columns.Add("Имя"); dtClient.Columns.Add("Отчество"); dtClient.Columns.Add("Номер телефона"); dtClient.Columns.Add("Логин"); dtClient.Columns.Add("Пароль"); var Query = db.Client; foreach (var rel in Query) { dtClient.Rows.Add(rel.id, rel.LastName, rel.Name, rel.MiddleName, rel.Phone, rel.Login, rel.Password); } return(dtClient); } else { DataTable dtClient = new DataTable(); return(dtClient); } }
public static DataTable GetProtertList() { RealtorEntities db = new RealtorEntities(); DataTable dtProtert = new DataTable(); var Query = from propert in db.property select new { propert.idProperty, cit = propert.City, str = propert.Street, Numbers = propert.Number, Coordinat = propert.latitude + " " + propert.Longitude, }; dtProtert.Columns.Add("id"); dtProtert.Columns.Add("Город"); dtProtert.Columns.Add("Улица"); dtProtert.Columns.Add("Номер дома(квартиры)"); dtProtert.Columns.Add("Координаты"); foreach (var rel in Query) { dtProtert.Rows.Add(rel.idProperty, rel.cit, rel.str, rel.Numbers, rel.Coordinat); } return(dtProtert); }
private void Button_Click(object sender, RoutedEventArgs e) //создание меденжера { try { if (Password.Text != "" && Login.Text != "" && Last.Text != "" && First.Text != "" && Mid.Text != "") { var regex = new Regex(@"(.*[!,@,#,$,%,^,&,*,(,),+,_,=,?,№,;,+,=,<,>,',\,|,/,.,\,:,-])"); if (regex.IsMatch(Last.Text) || regex.IsMatch(First.Text) || regex.IsMatch(Mid.Text)) { MessageBox.Show("Некорректный ввод данных проверьте поле ФИО"); } else { regex = new Regex(@"(.*[0-9])"); if (regex.IsMatch(Last.Text) || regex.IsMatch(First.Text) || regex.IsMatch(Mid.Text)) { MessageBox.Show("Некорректный ввод данных проверьте поле ФИО "); } else { RealtorEntities db = new RealtorEntities(); Manager save = new Manager { LastName = Last.Text, Name = First.Text, MiddleName = Mid.Text, Login = Login.Text, Password = Password.Text, rol = "Manager", }; if (MessageBox.Show("Вы уверены что хотите сохранить данные?", "Сохранение", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { db.Manager.Add(save); db.SaveChanges(); if (MessageBox.Show("Перейти на форму списка менеджеров?", "Данные успешно сохранены", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { ManagerList re = new ManagerList(); this.Hide(); re.Show(); } } } } } else { MessageBox.Show("Вы заполнили не все поля"); } } catch { MessageBox.Show("Данный логин уже занят"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); RealtorLi.ItemsSource = dtRealtor.DefaultView; ClientLi.ItemsSource = dtClient.DefaultView; PropertLi.ItemsSource = dtProtert.DefaultView; Sentence sentence = db.Sentence.Find(SecurityContext.idSentence); Price.Text = sentence.Price.ToString(); for (int i = 0; i < dtClient.Rows.Count; i++) { if (int.Parse(dtClient.Rows[i].ItemArray[0].ToString()) == sentence.IdClient) { ClientLi.SelectedIndex = i; } } for (int i = 0; i < dtProtert.Rows.Count; i++) { if (int.Parse(dtProtert.Rows[i].ItemArray[0].ToString()) == sentence.IdProperty) { PropertLi.SelectedIndex = i; } } for (int i = 0; i < dtRealtor.Rows.Count; i++) { if (int.Parse(dtRealtor.Rows[i].ItemArray[0].ToString()) == sentence.IdRealtor) { RealtorLi.SelectedIndex = i; } } }
private void Button_Click_2(object sender, RoutedEventArgs e) //удаление { try { RealtorEntities db = new RealtorEntities(); Client client = db.Client.Find(SecurityContext.idClient); if (MessageBox.Show("Вы уверены что хотите удалить данного клиента?", "Удаление", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { db.Client.Remove(db.Client.Where(dr => dr.id == SecurityContext.idClient).FirstOrDefault()); db.SaveChanges(); ClientList re = new ClientList(); this.Hide(); re.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click_1(object sender, RoutedEventArgs e) //обновление { try { if (Email.Text != "" || phone.Text != "") { RealtorEntities db = new RealtorEntities(); Client client = db.Client.Find(SecurityContext.idClient); client.LastName = ClientLastName.Text; client.MiddleName = ClientMiddleName.Text; client.Name = ClientName.Text; client.Phone = phone.Text; client.Email = Email.Text; if (MessageBox.Show("Вы уверены что хотите обновить данного клиента?", "Обнволение", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { db.Client.Create(); db.SaveChanges(); ClientList re = new ClientList(); this.Hide(); re.Show(); } } else { MessageBox.Show("Вы должны заполнить Номер телефона или Эл.почту"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Grid_Loaded(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); var manager = db.Manager.Find(SecurityContext.idManager); Login.Text = manager.Login; Password.Text = manager.Password; }
private void Grid_Loaded(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); var realtor = db.Realtor.Find(SecurityContext.idRealtor); RealtorLastName.Text = realtor.LastName; RealtorName.Text = realtor.Name; RealtorMiddleName.Text = realtor.MiddleName; RealtorCommis.Text = realtor.Comission; }
private void Grid_Loaded(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); var client = db.Client.Find(SecurityContext.idClient); ClientLastName.Text = client.LastName; ClientName.Text = client.Name; ClientMiddleName.Text = client.MiddleName; phone.Text = client.Phone; Email.Text = client.Email; }
private void Button_Click_2(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); Client client = db.Client.Find(SecurityContext.idClient); db.Client.Remove(db.Client.Where(dr => dr.id == SecurityContext.idClient).FirstOrDefault()); db.SaveChanges(); ClientList re = new ClientList(); this.Hide(); re.Show(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); Realtor realtor = db.Realtor.Find(SecurityContext.idRealtor); db.Realtor.Remove(db.Realtor.Where(dr => dr.id == SecurityContext.idRealtor).FirstOrDefault()); db.SaveChanges(); RealtorList re = new RealtorList(); this.Hide(); re.Show(); }
public static DataTable GetSentencList() { RealtorEntities db = new RealtorEntities(); DataTable dtSentence = new DataTable(); var query = from sentence in db.Sentence join realtor in db.Realtor on sentence.IdRealtor equals realtor.id join client in db.Client on sentence.IdClient equals client.id join propert in db.property on sentence.IdProperty equals propert.idProperty select new { sentence.IdSentence, cli = client.id, cl = client.id + realtor.id, FioClient = client.LastName + " " + client.Name + " " + client.MiddleName, phone = client.Phone, FioRealtor = realtor.LastName + " " + realtor.Name + " " + realtor.MiddleName, Comiss = realtor.Comission, cit = propert.City, str = propert.Street, Numbers = propert.Number, Coordinat = propert.latitude + " " + propert.Longitude, sentence.Price }; dtSentence.Columns.Add("Номер предложения"); dtSentence.Columns.Add("Уникальный номер"); dtSentence.Columns.Add("ФИО клиента"); dtSentence.Columns.Add("Номер телефона клиента"); dtSentence.Columns.Add("ФИО риелтора"); dtSentence.Columns.Add("Доля комисси"); dtSentence.Columns.Add("Город"); dtSentence.Columns.Add("Улица"); dtSentence.Columns.Add("Номер дома"); dtSentence.Columns.Add("Координаты"); dtSentence.Columns.Add("Цена"); foreach (var rel in query) { if (SecurityContext.autovxod == 3) { dtSentence.Rows.Add(rel.IdSentence, rel.cl, rel.FioClient, rel.phone, rel.FioRealtor, rel.Comiss, rel.cit, rel.str, rel.Numbers, rel.Coordinat, rel.Price); } if (SecurityContext.autovxod == 1) { if (SecurityContext.idClient == rel.cli) { dtSentence.Rows.Add(rel.IdSentence, rel.cl, rel.FioClient, rel.phone, rel.FioRealtor, rel.Comiss, rel.cit, rel.str, rel.Numbers, rel.Coordinat, rel.Price); } } } return(dtSentence); }
public static DataTable GetDemandlList() { RealtorEntities db = new RealtorEntities(); DataTable dtDemand = new DataTable(); var query = from demand in db.demand join realtor in db.Realtor on demand.IdRealtor equals realtor.id join client in db.Client on demand.IdClient equals client.id join NameTyp in db.NameTypPropetry on demand.NameType equals NameTyp.IdNamyType select new { demand.IdDemand, cli = client.id, cl = client.id + realtor.id, FioClient = client.LastName + " " + client.Name + " " + client.MiddleName, phone = client.Phone, FioRealtor = realtor.LastName + " " + realtor.Name + " " + realtor.MiddleName, Comiss = realtor.Comission, NameTyp = NameTyp.NameType, demand.MinPrice, demand.MaxPrice }; dtDemand.Columns.Add("Номер потребности"); dtDemand.Columns.Add("Уникальный норме"); dtDemand.Columns.Add("ФИО клиента"); dtDemand.Columns.Add("Номер телефона клиента"); dtDemand.Columns.Add("ФИО риелтора"); dtDemand.Columns.Add("Доля комисси"); dtDemand.Columns.Add("Тип объекта недвижимости"); dtDemand.Columns.Add("Минимальная цена"); dtDemand.Columns.Add("Максимальная цена"); foreach (var rel in query) { if (SecurityContext.autovxod == 3) { dtDemand.Rows.Add(rel.IdDemand, rel.cl, rel.FioClient, rel.phone, rel.FioRealtor, rel.Comiss, rel.NameTyp, rel.MinPrice, rel.MaxPrice); } if (SecurityContext.autovxod == 1) { if (SecurityContext.idClient == rel.cli) { dtDemand.Rows.Add(rel.IdDemand, rel.cl, rel.FioClient, rel.phone, rel.FioRealtor, rel.Comiss, rel.NameTyp, rel.MinPrice, rel.MaxPrice); } } } return(dtDemand); }
private void Button_Click(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); Realtor realtor = db.Realtor.Find(SecurityContext.idRealtor); realtor.LastName = RealtorLastName.Text; realtor.MiddleName = RealtorMiddleName.Text; realtor.Name = RealtorName.Text; realtor.Comission = RealtorCommis.Text; db.Realtor.Create(); db.SaveChanges(); RealtorList re = new RealtorList(); this.Hide(); re.Show(); }
public static DataTable GetRealtorList() { RealtorEntities db = new RealtorEntities(); DataTable dtManager = new DataTable(); dtManager.Columns.Add("id"); dtManager.Columns.Add("Логин"); dtManager.Columns.Add("Пароль"); var Query = db.Manager; foreach (var rel in Query) { dtManager.Rows.Add(rel.IdManager, rel.Login, rel.Password); } return(dtManager); }
public static DataTable GetLand() { RealtorEntities db = new RealtorEntities(); DataTable dtLand = new DataTable(); dtLand.Columns.Add("id"); dtLand.Columns.Add("Площадь"); var Query = db.Land; foreach (var rel in Query) { dtLand.Rows.Add(rel.IdLand, rel.square); } return(dtLand); }
public static DataTable GetApart() { RealtorEntities db = new RealtorEntities(); DataTable dtApart = new DataTable(); dtApart.Columns.Add("id"); dtApart.Columns.Add("Этаж"); dtApart.Columns.Add("Количество комнат"); dtApart.Columns.Add("Площадь (в м2)"); var Query = db.Apartment; foreach (var rel in Query) { dtApart.Rows.Add(rel.IdApartment, rel.Floor, rel.NumberOfRooms, rel.square); } return(dtApart); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { RealtorEntities db = new RealtorEntities(); var prop = db.property.Find(SecurityContext.idProperty); City.Text = prop.City; Street.Text = prop.Street; NumberHous.Text = prop.Number.ToString(); LaT.Text = prop.latitude.ToString(); Long.Text = prop.Longitude.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static DataTable GetHouse() { RealtorEntities db = new RealtorEntities(); DataTable dtHouse = new DataTable(); dtHouse.Columns.Add("id"); dtHouse.Columns.Add("Этажность"); dtHouse.Columns.Add("Количество комнат"); dtHouse.Columns.Add("Площадь"); var Query = db.House; foreach (var rel in Query) { dtHouse.Rows.Add(rel.IdHouse, rel.Storeys, rel.NumberOfRooms, rel.square); } return(dtHouse); }
private void Button_Click_2(object sender, RoutedEventArgs e) //удаление { RealtorEntities db = new RealtorEntities(); Manager manager = db.Manager.Find(SecurityContext.idManager); if (MessageBox.Show("Вы уверены что хотите удалить данного менеджера?", "Удаление", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { db.Manager.Remove(db.Manager.Where(dr => dr.IdManager == SecurityContext.idManager).FirstOrDefault()); db.SaveChanges(); ManagerList re = new ManagerList(); this.Hide(); re.Show(); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); Client client = db.Client.Find(SecurityContext.idClient); client.LastName = ClientLastName.Text; client.MiddleName = ClientMiddleName.Text; client.Name = ClientName.Text; client.Phone = phone.Text; client.Email = Email.Text; db.Client.Create(); db.SaveChanges(); ClientList re = new ClientList(); this.Hide(); re.Show(); }
private void Grid_Loaded(object sender, RoutedEventArgs e) { try { RealtorEntities db = new RealtorEntities(); var client = db.Client.Find(SecurityContext.idClient); ClientLastName.Text = client.LastName; ClientName.Text = client.Name; ClientMiddleName.Text = client.MiddleName; phone.Text = client.Phone; Log.Text = client.Login; Pas.Text = client.Password; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static DataTable GetClientList() { RealtorEntities db = new RealtorEntities(); DataTable dtClient = new DataTable(); dtClient.Columns.Add("id"); dtClient.Columns.Add("Фамилия"); dtClient.Columns.Add("Имя"); dtClient.Columns.Add("Отчество"); dtClient.Columns.Add("Номер телефона"); var Query = db.Client; foreach (var rel in Query) { dtClient.Rows.Add(rel.id, rel.LastName, rel.Name, rel.MiddleName, rel.Phone); } return(dtClient); }
public static DataTable GetRealtorList() { RealtorEntities db = new RealtorEntities(); DataTable dtRealtor = new DataTable(); dtRealtor.Columns.Add("id"); dtRealtor.Columns.Add("Фамилия"); dtRealtor.Columns.Add("Имя"); dtRealtor.Columns.Add("Отчество"); dtRealtor.Columns.Add("Доля комисси"); var Query = db.Realtor; foreach (var rel in Query) { dtRealtor.Rows.Add(rel.id, rel.LastName, rel.Name, rel.MiddleName, rel.Comission); } return(dtRealtor); }
private void Button_Click(object sender, RoutedEventArgs e) { RealtorEntities db = new RealtorEntities(); Realtor save = new Realtor { LastName = RealtorLastName.Text, Name = RealtorName.Text, MiddleName = RealtorMiddleName.Text, Comission = RealtorCommis.Text, }; db.Realtor.Add(save); db.SaveChanges(); MessageBox.Show("Реалтор добавлен"); RealtorList reg = new RealtorList(); this.Hide(); reg.Show(); }
public static DataTable GetApartList() { RealtorEntities db = new RealtorEntities(); DataTable dtType = new DataTable(); dtType.Columns.Add("Номер"); dtType.Columns.Add("Этаж"); dtType.Columns.Add("Количество комнат"); dtType.Columns.Add("Площадь (в м2)"); if (SecurityContext.autovxod == 3) { dtType.Columns.Add("Номер клиента"); dtType.Columns.Add("ФИО клиента"); } var query = from apart in db.Apartment join cllient in db.Client on apart.IdClient equals cllient.id select new { apart.IdApartment, apart.NumberOfRooms, apart.Floor, apart.square, FIOC = cllient.LastName + " " + cllient.Name + " " + cllient.MiddleName, cl = cllient.id }; foreach (var rel in query) { if (SecurityContext.autovxod == 3) { dtType.Rows.Add(rel.IdApartment, rel.Floor, rel.NumberOfRooms, rel.square, rel.cl, rel.FIOC); } if (SecurityContext.autovxod == 1) { if (SecurityContext.idClient == rel.cl) { dtType.Rows.Add(rel.IdApartment, rel.Floor, rel.NumberOfRooms, rel.square); } } } return(dtType); }
public static DataTable GetHouseList() { RealtorEntities db = new RealtorEntities(); DataTable dtHouse = new DataTable(); dtHouse.Columns.Add("id"); dtHouse.Columns.Add("Этажность"); dtHouse.Columns.Add("Количество комнат"); dtHouse.Columns.Add("Площадь (в м2)"); if (SecurityContext.autovxod == 3) { dtHouse.Columns.Add("Номер клиента"); dtHouse.Columns.Add("ФИО клиента"); } var query = from hous in db.House join cllient in db.Client on hous.IdClient equals cllient.id select new { hous.IdHouse, hous.NumberOfRooms, hous.Storeys, hous.square, FIOC = cllient.LastName + " " + cllient.Name + " " + cllient.MiddleName, cl = cllient.id }; foreach (var rel in query) { if (SecurityContext.autovxod == 3) //менеджер { dtHouse.Rows.Add(rel.IdHouse, rel.Storeys, rel.NumberOfRooms, rel.square, rel.cl, rel.FIOC); } if (SecurityContext.autovxod == 1) //Риелтор { if (SecurityContext.idClient == rel.cl) { dtHouse.Rows.Add(rel.IdHouse, rel.Storeys, rel.NumberOfRooms, rel.square); } } } return(dtHouse); }