private void UpdateView() { using (var context = new ApplicationDBContext()) { employeesDataGridView.DataSource = context.GetEmployees(search).ToSortableBindingList();; employeesDataGridView.Columns[nameof(Employee.ID)].Visible = false; employeesDataGridView.Columns[nameof(Employee.Role)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.Role)); employeesDataGridView.Columns[nameof(Employee.FIO)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.FIO)); employeesDataGridView.Columns[nameof(Employee.ITN)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.ITN)); employeesDataGridView.Columns[nameof(Employee.Login)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.Login)); employeesDataGridView.Columns[nameof(Employee.Passport)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.Passport)); employeesDataGridView.Columns[nameof(Employee.PhoneNumber)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.PhoneNumber)); employeesDataGridView.Columns[nameof(Employee.Post)].HeaderText = Localizations.GetValueOrSelf(nameof(Employee.Post)); } }
private void ShowRent() { carTextBox.Text = Rent.Car.ToString(); employeeTextBox.Text = Rent.Employee.ToString(); clientTextBox.Text = Rent.Client.ToString(); typeOfPaymentTextBox.Text = Rent.TypeOfPayment; startDatePicker.Value = Rent.StartDate; daysUpDown.Value = Rent.RentalPeriod; endDatePicker.Value = Rent.StartDate.AddDays(Rent.RentalPeriod); servicesDataGridView.DataSource = Rent.AdditionalService; servicesDataGridView.Columns[nameof(ServiceInRentInfo.RentId)].Visible = false; servicesDataGridView.Columns[nameof(ServiceInRentInfo.ServiceInRentId)].Visible = false; servicesDataGridView.Columns[nameof(ServiceInRentInfo.Price)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Price)); servicesDataGridView.Columns[nameof(ServiceInRentInfo.Quantity)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Quantity)); servicesDataGridView.Columns[nameof(ServiceInRentInfo.Service)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Service)); }
private void RentCreateEdit_Load(object sender, EventArgs e) { servicesInfoList = new BindingList <ServiceInRentInfo>(); using (var context = new ApplicationDBContext()) { var search = Rent is null ? SearchCarParam.OnlyAvailable : SearchCarParam.Empty; carsComboBox.DataSource = context.GetCars(search).ToArray(); } using (var context = new ApplicationDBContext()) { clientsComboBox.DataSource = context.GetClients(SearchClientParam.Empty).ToArray(); } using (var context = new ApplicationDBContext()) { employeesComboBox.DataSource = context.GetEmployees(SearchEmployeeParam.Empty).ToArray(); } using (var context = new ApplicationDBContext()) { servicesList = new BindingList <Service>( context.GetServices(SearchServiceParam.Empty).ToList() ); } endDatePicker.Value = startDatePicker.Value.AddDays((int)daysUpDown.Value); servicesComboBox.DataSource = servicesList; servicesDataGridView.DataSource = servicesInfoList; servicesDataGridView.Columns[nameof(ServiceInRentInfo.RentId)].Visible = false; servicesDataGridView.Columns[nameof(ServiceInRentInfo.ServiceInRentId)].Visible = false; servicesDataGridView.Columns[nameof(ServiceInRentInfo.Price)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Price)); servicesDataGridView.Columns[nameof(ServiceInRentInfo.Quantity)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Quantity)); servicesDataGridView.Columns[nameof(ServiceInRentInfo.Service)].HeaderText = Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Service)); if (Rent != null) { ShowRent(); } SetPrice(); }
private void ShowEmployee() { fioTextBox.Text = Employee.FIO; passportTextBox.Text = Employee.Passport; phoneTextBox.Text = Employee.PhoneNumber; postTextBox.Text = Employee.Post; passwordTextBox.Text = Employee.Pass; loginTextBox.Text = Employee.Login; itnTextBox.Text = Employee.ITN; roleTextBox.Text = Localizations.GetValueOrSelf(Employee.Role.ToString()); }
public RentHistoryView(Reception[] receptions) { InitializeComponent(); receptionsDataGridView.DataSource = receptions.ToSortableBindingList(); receptionsDataGridView.Columns[nameof(Reception.Rent)].Visible = false; receptionsDataGridView.Columns[nameof(Reception.EmployeeConclusion)].Visible = false; receptionsDataGridView.Columns[nameof(Reception.Id)].HeaderText = Localizations.GetValueOrSelf(nameof(Reception.Id)); receptionsDataGridView.Columns[nameof(Reception.DateOfReceipt)].HeaderText = Localizations.GetValueOrSelf(nameof(Reception.DateOfReceipt)); }
private void UpdateView() { using (var context = new ApplicationDBContext()) { servicesDataGridView.DataSource = context.GetServices(search).ToSortableBindingList();; servicesDataGridView.Columns[nameof(Service.ID)].Visible = false; servicesDataGridView.Columns[nameof(Service.Specifications)].Visible = false; servicesDataGridView.Columns[nameof(Service.Name)].HeaderText = Localizations.GetValueOrSelf(nameof(Service.Name)); servicesDataGridView.Columns[nameof(Service.Price)].HeaderText = Localizations.GetValueOrSelf(nameof(Service.Price)); } }
private void UpdateView() { using (var context = new ApplicationDBContext()) { rentsDataGridView.DataSource = context.GetRents(search).ToSortableBindingList(); rentsDataGridView.Columns[nameof(Rent.ID)].Visible = false; var column1 = rentsDataGridView.Columns[nameof(Rent.AdditionalService)]; if (column1 != null) { column1.Visible = false; } rentsDataGridView.Columns[nameof(Rent.Car)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.Car)); rentsDataGridView.Columns[nameof(Rent.Client)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.Client)); rentsDataGridView.Columns[nameof(Rent.Employee)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.Employee)); rentsDataGridView.Columns[nameof(Rent.Price)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.Price)); rentsDataGridView.Columns[nameof(Rent.RentalPeriod)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.RentalPeriod)); rentsDataGridView.Columns[nameof(Rent.StartDate)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.StartDate)); rentsDataGridView.Columns[nameof(Rent.TypeOfPayment)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.TypeOfPayment)); rentsDataGridView.Columns[nameof(Rent.DepositAmount)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.DepositAmount)); rentsDataGridView.Columns[nameof(Rent.IsOpen)].HeaderText = Localizations.GetValueOrSelf(nameof(Rent.IsOpen)); } }
private void UpdateView() { using (var context = new ApplicationDBContext()) { // получаем список автомобилей carsDataGridView.DataSource = context.GetCars(search).ToSortableBindingList(); // скрываем столбец с ID carsDataGridView.Columns[nameof(Client.ID)].Visible = false; // переводим заголовки на русский язык carsDataGridView.Columns[nameof(Car.BodyType)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.BodyType)); carsDataGridView.Columns[nameof(Car.CarBrand)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.CarBrand)); carsDataGridView.Columns[nameof(Car.Color)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.Color)); carsDataGridView.Columns[nameof(Car.Damage)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.Damage)); carsDataGridView.Columns[nameof(Car.DepositAmount)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.DepositAmount)); carsDataGridView.Columns[nameof(Car.DriveType)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.DriveType)); carsDataGridView.Columns[nameof(Car.EngineVolume)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.EngineVolume)); carsDataGridView.Columns[nameof(Car.IsRented)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.IsRented)); carsDataGridView.Columns[nameof(Car.LicensePlate)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.LicensePlate)); carsDataGridView.Columns[nameof(Car.Model)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.Model)); carsDataGridView.Columns[nameof(Car.PricePerDay)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.PricePerDay)); carsDataGridView.Columns[nameof(Car.SteeringWheelLocation)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.SteeringWheelLocation)); carsDataGridView.Columns[nameof(Car.YearOfIssue)].HeaderText = Localizations.GetValueOrSelf(nameof(Car.YearOfIssue)); } }
private void UpdateView() { using (var context = new ApplicationDBContext()) { clientsDataGridView.DataSource = context.GetClients(search).ToSortableBindingList(); clientsDataGridView.Columns[nameof(Client.ID)].Visible = false; clientsDataGridView.Columns[nameof(Client.Role)].Visible = false; clientsDataGridView.Columns[nameof(Client.DateOfBirth)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.DateOfBirth)); clientsDataGridView.Columns[nameof(Client.DrivingLicense)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.DrivingLicense)); clientsDataGridView.Columns[nameof(Client.FIO)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.FIO)); clientsDataGridView.Columns[nameof(Client.Passport)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.Passport)); clientsDataGridView.Columns[nameof(Client.PhoneNumber)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.PhoneNumber)); clientsDataGridView.Columns[nameof(Client.DealsCount)].HeaderText = Localizations.GetValueOrSelf(nameof(Client.DealsCount)); } }
private void RolesComboBox_Format(object sender, ListControlConvertEventArgs e) { var role = ((Role)e.Value).ToString(); e.Value = Localizations.GetValueOrSelf(role); }