public void FillDataGrid() { db = new DBcontext(); db.Trades.Load(); var resultGrid = from trade in db.Trades.Local.ToList() join s in db.Sales on trade.trade_id equals s.sale_id join c in db.Clients on trade.buyer_id equals c.client_id join a in db.Agents on trade.agent_id equals a.agent_id join o in db.ObjectEstates on trade.object_id equals o.object_id join sell in db.Clients on o.owner_id equals sell.client_id select new { date = trade.date.ToShortDateString(), dateToDispley = trade.date.Date, address = o.address, addressToDispley = o.object_id, price = s.price + " ₽", priceToDispley = s.price.ToString(), FIObuyer = c.full_name, FIObuyer_id = c.client_id, FIOseller = sell.full_name, FIOseller_id = sell.client_id, FIOagent = a.full_name, FIOagent_id = a.agent_id, IDSale = trade.trade_id, }; SaleTradeGrid.ItemsSource = resultGrid.ToList(); }
public AgentProfileWindow(Agent a) { InitializeComponent(); db = new DBcontext(); agent = a; FIO.Text = a.full_name; Birthday.Text = a.birthday.ToShortDateString(); HomeAddress.Text = a.address; PassportDate.Text = a.passport_date.ToShortDateString(); PassportIssuedBy.Text = a.passport_issued_by; PassportSeriesNumber.Text = a.passport_series_number; Phone.Text = a.phone_number; INN.Text = a.INN; db.Sales.Load(); db.Rents.Load(); db.ObjectEstates.Load(); db.Agents.Load(); db.Trades.Load(); FillDataGrid(a); Kol.Text = AgentTrade.Items.Count.ToString(); Kol2.Text = AgentTrade2.Items.Count.ToString(); }
public EstateFlatPage() { InitializeComponent(); db = new DBcontext(); db.Flats.Load(); FillDataGrid(); }
public BuyersPage() { InitializeComponent(); db = new DBcontext(); db.Clients.Load(); FillDataGrid(); }
public AddClientWindow() { InitializeComponent(); db = new DBcontext(); db.Roles.Load(); Fill_AddClientWindow(); }
public EstateHousePage() { InitializeComponent(); db = new DBcontext(); db.Houses.Load(); FillDataGrid(); }
public AddObjectEstateWindow() { InitializeComponent(); db = new DBcontext(); db.Status.Load(); db.Clients.Load(); db.Roles.Load(); Fill_AddObjectEstateWindow(); }
public void FillDataGrid() { db = new DBcontext(); db.ObjectEstates.Load(); var resultGrid = from ObjectE in db.ObjectEstates.Local.ToList() join c in db.Clients on ObjectE.owner_id equals c.client_id join s in db.Status on ObjectE.status_id equals s.status_id select new { Address = (db.Flats.Find(ObjectE.object_id) != null) ? ObjectE.address + ", кв. " + ObjectE.Flat.flat_number : ObjectE.address, AddressToDispley = ObjectE.address, Square = ObjectE.square.ToString() + " кв.м.", Price = ObjectE.price.ToString() + " ₽", FIOowner = c.full_name, FIOowner_id = c.client_id, Kind = (db.Houses.Find(ObjectE.object_id) != null) ? "Частный дом" : "Квартира", Status = s.name, Status_id = s.status_id, CadastralNumber = ObjectE.cadastral_number, PriceToDispley = ObjectE.price.ToString(), SquareToDispley = ObjectE.square.ToString(), IDObject = ObjectE.object_id, }; EstateObjectsGrid.ItemsSource = resultGrid.ToList(); var resultGrid2 = from ObjectE in db.ObjectEstates.Local.ToList() join c in db.Clients on ObjectE.owner_id equals c.client_id join s in db.Status on ObjectE.status_id equals s.status_id where s.status_id == 1 || s.status_id == 5 select new { Address = (db.Flats.Find(ObjectE.object_id) != null) ? ObjectE.address + ", кв. " + ObjectE.Flat.flat_number : ObjectE.address, AddressToDispley = ObjectE.address, Square = ObjectE.square.ToString() + " кв.м.", Price = ObjectE.price.ToString() + " ₽", FIOowner = c.full_name, FIOowner_id = c.client_id, Kind = (db.Houses.Find(ObjectE.object_id) != null) ? "Частный дом" : "Квартира", Status = s.name, Status_id = s.status_id, CadastralNumber = ObjectE.cadastral_number, PriceToDispley = ObjectE.price.ToString(), SquareToDispley = ObjectE.square.ToString(), IDObject = ObjectE.object_id, }; EstateObjectsGrid2.ItemsSource = resultGrid2.ToList(); }
public AddTradeWindow() { InitializeComponent(); db = new DBcontext(); db.Clients.Load(); db.ObjectEstates.Load(); db.Agents.Load(); db.Roles.Load(); Fill_AddClientWindow(); }
public EstateAllPage() { InitializeComponent(); db = new DBcontext(); db.ObjectEstates.Load(); db.Clients.Load(); db.Status.Load(); db.Flats.Load(); db.Houses.Load(); FillDataGrid(); }
public void FillDataGrid() { db = new DBcontext(); db.Clients.Load(); db.Trades.Load(); var resultGrid = from Client in db.Clients.Local.ToList() where Client.role_id == 2 select new { FIObuyer = Client.full_name, BirthDate = Client.birthday.ToShortDateString(), Address = Client.address, Phone = Client.phone_number, PassportDate = Client.passport_date.Date, PassportIssuedBy = Client.passport_issued_by, PassportSeriesNumber = Client.passport_series_number, RoleBuyer = Client.role_id, dateBirthToDispley = Client.birthday.Date, datePassportToDispley = Client.passport_date.Date, IDBuyer = Client.client_id, }; BuyersGrid.ItemsSource = resultGrid.ToList(); var resultGrid2 = from Client in db.Clients.Local.ToList() join t in db.Trades on Client.client_id equals t.buyer_id where Client.role_id == 2 select new { FIObuyer = Client.full_name, BirthDate = Client.birthday.ToShortDateString(), Address = Client.address, Phone = Client.phone_number, PassportDate = Client.passport_date.Date, PassportIssuedBy = Client.passport_issued_by, PassportSeriesNumber = Client.passport_series_number, RoleBuyer = Client.role_id, dateBirthToDispley = Client.birthday.Date, datePassportToDispley = Client.passport_date.Date, IDBuyer = Client.client_id, }; var endResult = resultGrid.Except(resultGrid2).ToList(); BuyersGrid2.ItemsSource = endResult.ToList(); }
public RentTradePage() { InitializeComponent(); db = new DBcontext(); db.Trades.Load(); db.Clients.Load(); db.ObjectEstates.Load(); db.Agents.Load(); db.Sales.Load(); db.Rents.Load(); FillDataGrid(); }
public void FillDataGrid() { db = new DBcontext(); db.Clients.Load(); db.Trades.Load(); db.ObjectEstates.Load(); var resultGrid = from Client in db.Clients.Local.ToList() where Client.role_id == 1 select new { FIOseller = Client.full_name, BirthDate = Client.birthday.ToShortDateString(), Address = Client.address, Phone = Client.phone_number, PassportDate = Client.passport_date.Date, PassportIssuedBy = Client.passport_issued_by, PassportSeriesNumber = Client.passport_series_number, RoleSeller = Client.role_id, dateBirthToDispley = Client.birthday.Date, datePassportToDispley = Client.passport_date.Date, IDSeller = Client.client_id, }; SellersGrid.ItemsSource = resultGrid.ToList(); var resultGrid2 = from Client in db.Clients.Local.ToList() join o in db.ObjectEstates on Client.client_id equals o.owner_id where Client.role_id == 1 && o.status_id == 1 select new { FIOseller = Client.full_name, BirthDate = Client.birthday.ToShortDateString(), Address = Client.address, Phone = Client.phone_number, PassportDate = Client.passport_date.Date, PassportIssuedBy = Client.passport_issued_by, PassportSeriesNumber = Client.passport_series_number, RoleSeller = Client.role_id, dateBirthToDispley = Client.birthday.Date, datePassportToDispley = Client.passport_date.Date, IDSeller = Client.client_id, }; SellersGrid2.ItemsSource = resultGrid2.ToList(); }
public EditAgentWindow(Agent a) { db = new DBcontext(); agent = a; InitializeComponent(); FIOagent.Text = a.full_name; BirthDate.Text = a.birthday.ToString(); PassportSeriesNumber.Text = a.passport_series_number; PassportDate.Text = a.passport_date.ToString(); PassportIssuedBy.Text = a.passport_issued_by; Address.Text = a.address; Phone.Text = a.phone_number; INN.Text = a.INN; }
public EditClientWindow(Client c) { db = new DBcontext(); db.Roles.Load(); client = c; InitializeComponent(); FIOclient.Text = c.full_name; BirthDate.Text = c.birthday.ToString(); PassportSeriesNumber.Text = c.passport_series_number; PassportDate.Text = c.passport_date.ToString(); PassportIssuedBy.Text = c.passport_issued_by; Address.Text = c.address; Phone.Text = c.phone_number; RoleCB.ItemsSource = db.Roles.Local; RoleCB.SelectedItem = db.Roles.Find(client.role_id); }
public EditTradeWindow(Trade t) { db = new DBcontext(); db.Clients.Load(); db.Agents.Load(); db.ObjectEstates.Load(); db.Rents.Load(); db.Sales.Load(); trade = t; InitializeComponent(); DateTrade.Text = t.date.ToShortDateString(); AddressCB.ItemsSource = db.ObjectEstates.Local; AddressCB.SelectedItem = db.ObjectEstates.Find(trade.object_id); BuyerCB.ItemsSource = db.Clients.Local; BuyerCB.SelectedItem = db.Clients.Find(trade.buyer_id); AgentCB.ItemsSource = db.Agents.Local; AgentCB.SelectedItem = db.Agents.Find(trade.agent_id); if (db.Sales.Find(t.trade_id) != null) { sale = db.Sales.Find(t.trade_id); SaleGrid.Visibility = Visibility.Visible; RentGrid.Visibility = Visibility.Collapsed; Price.Text = sale.price.ToString(); } else { rent = db.Rents.Find(t.trade_id); SaleGrid.Visibility = Visibility.Collapsed; RentGrid.Visibility = Visibility.Visible; DateStartRent.Text = rent.date_start.ToShortDateString(); DateEndRent.Text = rent.date_end.ToShortDateString(); PriceRent.Text = rent.rent_price.ToString(); } }
public EditObjectEstateWindow(ObjectEstate o) { db = new DBcontext(); db.Clients.Load(); db.Status.Load(); db.Flats.Load(); db.Houses.Load(); objectestate = o; InitializeComponent(); AddressObject.Text = o.address; CadastralNumber.Text = o.cadastral_number; Square.Text = o.square.ToString(); PriceObjectEstate.Text = o.price.ToString(); OwnerCB.ItemsSource = db.Clients.Local; OwnerCB.SelectedItem = db.Clients.Find(objectestate.owner_id); StatusCB.ItemsSource = db.Status.Local; StatusCB.SelectedItem = db.Status.Find(objectestate.status_id); if (db.Flats.Find(o.object_id) != null) { flat = db.Flats.Find(o.object_id); FlatGrid.Visibility = Visibility.Visible; HouseGrid.Visibility = Visibility.Collapsed; NumberFlat.Text = flat.flat_number.ToString(); NumberFloor.Text = flat.number_floor.ToString(); QuantityRooms.Text = flat.quantity_rooms.ToString(); } else { house = db.Houses.Find(o.object_id); FlatGrid.Visibility = Visibility.Collapsed; HouseGrid.Visibility = Visibility.Visible; PlotSize.Text = house.plot_size.ToString(); QuantityFloors.Text = house.quantity_floors.ToString(); } }
private void ButtonFilter_Click(object sender, RoutedEventArgs e) { using (DBcontext db1 = new DBcontext()) { db1.Agents.Load(); db1.Clients.Load(); db1.ObjectEstates.Load(); db1.Rents.Load(); db1.Trades.Load(); var resultGrid = from t in db1.Trades.Local.ToList() join a in db1.Agents on t.agent_id equals a.agent_id join c in db1.Clients on t.buyer_id equals c.client_id join o in db1.ObjectEstates on t.object_id equals o.object_id join r in db1.Rents on t.trade_id equals r.rent_id join sell in db.Clients on o.owner_id equals sell.client_id where ( (FromDP.Text == "" && ToDP.Text == "" || FromDP.Text == "1/1/0001" && ToDP.Text == "1/1/0001") || (DateTime.Parse(ToDP.Text) >= DateTime.Parse(FromDP.Text) && t.date >= DateTime.Parse(FromDP.Text) && t.date <= DateTime.Parse(ToDP.Text)) ) select new { date = t.date.ToShortDateString(), address = o.address, dateStart = r.date_start.ToShortDateString(), dateEnd = r.date_end.ToShortDateString(), price = r.rent_price + " ₽ в месяц", FIObuyer = c.full_name, FIOseller = sell.full_name, FIOagent = a.full_name, IDRent = t.trade_id }; RentTradeGrid.ItemsSource = resultGrid.ToList(); } //FromDP.Text = ""; //ToDP.Text = ""; }
public ClientProfileWindow(Client c) { InitializeComponent(); db = new DBcontext(); client = c; FIO.Text = c.full_name; Birthday.Text = c.birthday.ToShortDateString(); HomeAddress.Text = c.address; PassportDate.Text = c.passport_date.ToShortDateString(); PassportIssuedBy.Text = c.passport_issued_by; PassportSeriesNumber.Text = c.passport_series_number; Phone.Text = c.phone_number; db.Sales.Load(); db.ObjectEstates.Load(); db.Clients.Load(); db.Trades.Load(); FillDataGrid(c); Kol.Text = ClientTrade.Items.Count.ToString(); KolOb.Text = ClientObjectGrid.Items.Count.ToString(); }
public void FillDataGrid() { db = new DBcontext(); db.Trades.Load(); var resultGrid = from trade in db.Trades.Local.ToList() join r in db.Rents on trade.trade_id equals r.rent_id join c in db.Clients on trade.buyer_id equals c.client_id join a in db.Agents on trade.agent_id equals a.agent_id join o in db.ObjectEstates on trade.object_id equals o.object_id join sell in db.Clients on o.owner_id equals sell.client_id select new { date = trade.date.ToShortDateString(), dateToDispley = trade.date.Date, address = o.address, addressToDispley = o.object_id, dateStart = r.date_start.ToShortDateString(), dateStartToDisplay = r.date_start.Date, dateEnd = r.date_end.ToShortDateString(), dateEndToDispley = r.date_end.Date, price = r.rent_price + " ₽ в месяц", priceToDispley = r.rent_price.ToString(), FIObuyer = c.full_name, FIObuyer_id = c.client_id, FIOseller = sell.full_name, FIOseller_id = sell.client_id, FIOagent = a.full_name, FIOagent_id = a.agent_id, IDRent = trade.trade_id }; RentTradeGrid.ItemsSource = resultGrid.ToList(); }
public void FillDataGrid() { db = new DBcontext(); db.Agents.Load(); var resultGrid = from Agent in db.Agents.Local.ToList() select new { agentFIO = Agent.full_name, dateBirth = Agent.birthday.ToShortDateString(), passportNumber = Agent.passport_series_number, passportDate = Agent.passport_date.ToShortDateString(), passportIssuedBy = Agent.passport_issued_by, homeAdress = Agent.address, phone = Agent.phone_number, inn = Agent.INN, IDAgent = Agent.agent_id, dateBirthToDispley = Agent.birthday.Date, datePassportToDispley = Agent.passport_date.Date, }; AgentsGrid.ItemsSource = resultGrid.ToList(); }
public void FillDataGrid() { db = new DBcontext(); db.Status.Load(); db.Roles.Load(); var resultGrid = from s in db.Status.Local.ToList() select new { NameStatus = s.name, IDstatus = s.status_id, }; StatusGrid.ItemsSource = resultGrid.ToList(); var resultGrid2 = from r in db.Roles.Local.ToList() select new { NameRole = r.name, IDrole = r.role_id, }; RoleGrid.ItemsSource = resultGrid2.ToList(); }
public void RefreshAgentsGrid() { db = new DBcontext(); db.Agents.Load(); AgentsGrid.ItemsSource = db.Agents.Local; }
public AddAgentWindow() { InitializeComponent(); db = new DBcontext(); }