Exemplo n.º 1
0
        private void Update_Form_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < DGV_row.Count; i++)
            {
                Updatable_DGV.Columns.Add(DGV_header[i], DGV_header[i]);
                NewData_DGV.Columns.Add(DGV_header[i], DGV_header[i]);
            }
            NewData_DGV.Rows.Add();

            switch (SelectedOption)
            {
            case "Update":
                for (int i = 0; i < DGV_row.Count; i++)
                {
                    Updatable_DGV.Rows[0].Cells[i].Value = DGV_row[i];
                    NewData_DGV.Rows[0].Cells[i].Value   = DGV_row[i];
                }
                OperationOption_lbl.Text       = "Изменить строку";
                NewData_DGV.AllowUserToAddRows = false;
                OperationRun_button.Text       = "Изменить";
                //
                if (TableName == "Маршруты")
                {
                    for (int i = 0; i < (int)RoutesColumnsIndexes.DepartmentTime; i++)
                    {
                        if (i == (int)RoutesColumnsIndexes.TrainName)
                        {
                            DataGridViewComboBoxCell CB_cell = new DataGridViewComboBoxCell
                            {
                                DataSource    = Presenter.GetAllNames("SELECT Название FROM Поезда"),
                                ValueMember   = "Name",
                                DisplayMember = "Name"
                            };
                            NewData_DGV.Rows[0].Cells[i]       = CB_cell;
                            NewData_DGV.Rows[0].Cells[i].Value = DGV_row[i];
                        }
                        else if (i == (int)RoutesColumnsIndexes.FistStopName || i == (int)RoutesColumnsIndexes.LastStopName)
                        {
                            DataGridViewComboBoxCell CB_cell = new DataGridViewComboBoxCell
                            {
                                DataSource    = Presenter.GetAllNames("SELECT Название FROM Остановки"),
                                ValueMember   = "Name",
                                DisplayMember = "Name"
                            };

                            NewData_DGV.Rows[0].Cells[i]       = CB_cell;
                            NewData_DGV.Rows[0].Cells[i].Value = DGV_row[i];
                        }
                    }
                }
                //
                break;

            case "Add":
                Updatable_DGV.Hide();
                OperationOption_lbl.Hide();
                OperationOption2_lbl.Text = "Добавить строки";
                NewData_DGV.Rows.Clear();
                OperationRun_button.Text = "Добавить";
                break;

            default:
                Close();
                break;
            }

            NewData_DGV.Columns[0].Visible   = false;
            NewData_DGV.ReadOnly             = false;
            Updatable_DGV.Columns[0].Visible = false;
        }
Exemplo n.º 2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Presenter.GetTableNames(SelectTable_CB);
     Presenter.GetTableNames(UpdateTable_CB);
 }
Exemplo n.º 3
0
 private void SaveStops_ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Presenter.GetDGV(Select_DGV, "Остановки");
     Configurate.SaveTableToTxt(Select_DGV, "stops.txt");
     Presenter.GetDGV(Select_DGV, "Маршруты");
 }
Exemplo n.º 4
0
 private void SaveTrains_ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Presenter.GetDGV(Select_DGV, "Поезда");
     Configurate.SaveTableToTxt(Select_DGV, "trains.txt");
     Presenter.GetDGV(Select_DGV, "Маршруты");
 }
Exemplo n.º 5
0
 private void Cancel_button_Click(object sender, EventArgs e)
 {
     Presenter.GetDGV(Update_DGV, UpdateTable_CB.Text, (int)OperationOption.UpdateRoutes);
 }
Exemplo n.º 6
0
 private void SearchValue_CB_SelectedIndexChanged(object sender, EventArgs e)
 {
     Presenter.GetDGV(Select_DGV, SelectTable_CB.Text, SearchOption_CB.SelectedIndex, SearchValue_CB.Text);
 }