private void AddStation() { if (String.IsNullOrEmpty(tbRTSurname.Text)) { MessageBox.Show("Введите название станции!"); return; } if (String.IsNullOrEmpty(tbRTName.Text)) { MessageBox.Show("Введите телефон"); return; } if (String.IsNullOrEmpty(tbRTPatronymic.Text)) { MessageBox.Show("Введите ФИО начальника!"); return; } if (String.IsNullOrEmpty(tbRTPassport.Text)) { MessageBox.Show("Введите отдаленность в КМ!"); return; } string name = tbRTSurname.Text; string phoneNumber = tbRTName.Text; string chief = tbRTPatronymic.Text; int distance = int.Parse(tbRTPassport.Text); StationDAL.Insert(name, phoneNumber, chief, distance); dgvRT.DataSource = StationDAL.GetAllStations(); ClearText(); }
private void FillingStation() { foreach (Station s in StationDAL.GetAllStations()) { cbStation.Items.Add(s.Name); } }
public fmAddIntermediateStation() { InitializeComponent(); foreach (Station s in StationDAL.GetAllStations()) { cbS.Items.Add(s.Name); } }
private void cbStationsFilling() { foreach (Station s in StationDAL.GetAllStations()) { cbTableDS.Items.Add(s.Name); cbTableAS.Items.Add(s.Name); cbTripsAS.Items.Add(s.Name); cbTripsDS.Items.Add(s.Name); } cbTableDS.SelectedIndex = cbTableAS.SelectedIndex = cbTripsDS.SelectedIndex = cbTripsAS.SelectedIndex = 0; }
private void SettingVisibleStations() { if (Type == TrainTableConst.DepartureStation || Type == TrainTableConst.ArrivalStation) { tbValue2.Visible = false; cbNewV.Visible = true; foreach (Station s in StationDAL.GetAllStations()) { cbNewV.Items.Add(s.Name); } } }
private void updateStation() { string type = dgvRT.SelectedCells[0].OwningColumn.Name; string value = dgvRT.SelectedCells[0].Value.ToString(); Type typeTable = dgvRT.SelectedCells[0].OwningRow.DataBoundItem.GetType(); int id = (dgvRT.SelectedCells[0].OwningRow.DataBoundItem as Station).Id_Station; fmChangeValueRT f = new fmChangeValueRT(type, value, id, typeTable); f.Text = dgvRT.SelectedCells[0].OwningColumn.HeaderText; if (f.ShowDialog() == DialogResult.OK) { MessageBox.Show("Значение изменено"); dgvRT.DataSource = StationDAL.GetAllStations(); } }
private void VisibleStations() { dgvRT.Columns[0].DataPropertyName = "Name"; dgvRT.Columns[1].DataPropertyName = "PhoneNumber"; dgvRT.Columns[2].DataPropertyName = "Chief"; dgvRT.Columns[3].DataPropertyName = "DistanceInKM"; dgvRT.Columns[0].Name = "Name"; dgvRT.Columns[1].Name = "PhoneNumber"; dgvRT.Columns[2].Name = "Chief"; dgvRT.Columns[3].Name = "DistanceInKM"; dgvRT.Columns[0].HeaderText = "Название станции"; dgvRT.Columns[1].HeaderText = "Телефон"; dgvRT.Columns[2].HeaderText = "Начальник"; dgvRT.Columns[3].HeaderText = "Отдаленность в км"; lbRTSurname.Text = "Название станции"; lbRTName.Text = "Телефон"; lbRTPatronymic.Text = "Начальник"; lbRTPassport.Text = "Отдаленность в км"; dgvRT.Columns[1].Visible = true; dgvRT.DataSource = StationDAL.GetAllStations(); }
private void DelStation(int id) { StationDAL.Delete(id); dgvRT.DataSource = StationDAL.GetAllStations(); }