Example #1
0
        // +---------------------------------------------------+
        // |			          ОБНОВЛЕНИЕ ДАННЫХ                  |
        // +---------------------------------------------------+
        private void Button_Save_Click(object sender, EventArgs e)
        {
            switch (TabMain.SelectedTab.Name)
            {
            case "FPage_CarBrand":
                CarBrand carBrand = new CarBrand
                {
                    BrandName = textBox1.Text
                };
                carBrand.EditRow(ID);
                break;

            case "FPage_CarModel":
                CarModel carModel = new CarModel
                {
                    Brand     = comboBox1.SelectedValue.ToString(),
                    ModelName = textBox2.Text
                };
                carModel.EditRow(ID);
                break;

            case "FPage_Cars":
                Cars cars = new Cars
                {
                    Model     = comboBox2.SelectedValue.ToString(),
                    Number    = textBox3.Text,
                    InvNumber = textBox4.Text,
                    Type      = comboBox3.SelectedValue.ToString()
                };
                cars.EditRow(ID);
                break;

            case "FPage_CarType":
                CarType carType = new CarType
                {
                    TypeCode   = textBox5.Text,
                    TypeName   = textBox6.Text,
                    Capacity   = textBox7.Text,
                    InWorkRate = textBox33.Text,
                    InWaitRate = textBox32.Text
                };
                carType.EditRow(ID);
                break;

            case "FPage_Drivers":
                Drivers drivers = new Drivers
                {
                    FirstName = textBox9.Text,
                    LastName  = textBox8.Text,
                    ThirdName = textBox10.Text,
                    Licence   = textBox11.Text,
                    Class     = textBox16.Text
                };
                drivers.EditRow(ID);
                break;

            case "FPage_Estimate":
                Estimate estimate = new Estimate
                {
                    PacketNumber     = textBox13.Text,
                    Order            = textBox14.Text,
                    TrackinglistNum  = comboBox4.SelectedValue.ToString(),
                    TrackinglistDate = dateTimePicker1.Value.ToShortDateString(),
                    Lot         = textBox15.Text,
                    Duration    = textBox12.Text,
                    InWorkTime  = textBox24.Text,
                    InWorkRate  = textBox25.Text,
                    InWorkHols  = textBox26.Text,
                    InWorkPrice = textBox31.Text,
                    InWaitTime  = textBox29.Text,
                    InWaitRate  = textBox30.Text,
                    InWaitHols  = textBox27.Text,
                    InWaitPrice = textBox28.Text,
                    FinalPrice  = textBox35.Text
                };
                estimate.EditRow(ID);
                break;

            case "FPage_Organizations":
                Organisations organisations = new Organisations
                {
                    Name  = textBox17.Text,
                    Ratio = comboBox5.SelectedIndex.ToString()
                };
                organisations.EditRow(ID);
                break;

            case "FPage_Staff":
                Staff staff = new Staff
                {
                    FirstName = textBox20.Text,
                    LastName  = textBox21.Text,
                    ThirdName = textBox19.Text,
                    Position  = comboBox6.SelectedValue.ToString()
                };
                staff.EditRow(ID);
                break;

            case "FPage_StaffPosition":
                StaffPosition staffPosition = new StaffPosition
                {
                    PositionName = textBox18.Text
                };
                staffPosition.EditRow(ID);
                break;

            case "FPage_Trackinglists":
                Trackinglists trackinglists = new Trackinglists
                {
                    Series         = textBox22.Text,
                    Number         = textBox23.Text,
                    Date           = dateTimePicker2.Value.ToShortDateString(),
                    Organization   = comboBox7.SelectedValue.ToString(),
                    Transport      = comboBox8.SelectedValue.ToString(),
                    Driver         = comboBox9.SelectedValue.ToString(),
                    Dispatcher     = comboBox10.SelectedValue.ToString(),
                    Medic          = comboBox11.SelectedValue.ToString(),
                    Mechanic       = comboBox12.SelectedValue.ToString(),
                    Organization_2 = comboBox13.SelectedValue.ToString(),
                    Organization_3 = comboBox14.SelectedValue.ToString()
                };
                trackinglists.EditRow(ID);
                break;
            }
        }