public void SetInitialNormParams()
        {
            if ((_normparams != null) && (_normparams.Parameters != null))
            {
                FillTehPosInstanceCombobox();
                FillTipArmaturaCombobox();
                FillTipPrivodaCombobox();
                FillTipElectrodvigatelCombobox();

                comboBox_TehPosInstance.SelectedValue     = _normparams.TehPosInstanceId;
                comboBox_TipArmatura.SelectedValue        = _normparams.TipArmaturaId;
                comboBox_TipPrivoda.SelectedValue         = _normparams.TipPrivodaId;
                comboBox_TipElectroDvigatel.SelectedValue = _normparams.TipElectrodvigatelId;

                txtBox_N_oboroty.Text    = _normparams.Parameters[0].Values[0].Value;
                txtBox_TU_OST_Chart.Text = _normparams.TU_OST_CHART;
                txtBox_Diap_M_Min.Text   = _normparams.Parameters[2].Values[0].Value;
                txtBox_Diap_M_Max.Text   = _normparams.Parameters[2].Values[1].Value;
                txtBox_P_norm.Text       = _normparams.Parameters[3].Values[0].Value;
                txtBox_O_Tip_upr.Text    = _normparams.Parameters[4].Values[0].Value;
                txtBox_Z_Tip_upr.Text    = _normparams.Parameters[5].Values[0].Value;
                txtBox_Rab_Sreda.Text    = _normparams.Parameters[6].Values[0].Value;
                txtBox_Davlenie.Text     = _normparams.Parameters[7].Values[0].Value;
                txtBox_Temp.Text         = _normparams.Parameters[8].Values[0].Value;
                txtBox_L_kabb.Text       = _normparams.Parameters[9].Values[0].Value;
                txtBox_S_kabb.Text       = _normparams.Parameters[10].Values[0].Value;
                txtBox_R_ED.Text         = _normparams.Parameters[11].Values[0].Value;
                txtBox_R_SUMM.Text       = _normparams.Parameters[12].Values[0].Value;

                M_nastr.SetOpenCloseParams(_normparams.Parameters[13], _normparams.Parameters[21]);
                M_rab.SetOpenCloseParams(_normparams.Parameters[14], _normparams.Parameters[22]);
                M_rab_sreda.SetOpenCloseParams(_normparams.Parameters[15], _normparams.Parameters[23]);
                M_koleb.SetOpenCloseParams(_normparams.Parameters[16], _normparams.Parameters[24]);
                M_zatyag.SetOpenCloseParams(_normparams.Parameters[17], _normparams.Parameters[25]);
                M_zatyag2.SetOpenCloseParams(_normparams.Parameters[18], _normparams.Parameters[26]);
                M_sryv.SetOpenCloseParams(_normparams.Parameters[19], _normparams.Parameters[27]);
                T_hoda.SetOpenCloseParams(_normparams.Parameters[20], _normparams.Parameters[28]);

                P_nastr.SetOpenCloseParams(_normparams.Parameters[29], _normparams.Parameters[36]);
                P_rab.SetOpenCloseParams(_normparams.Parameters[30], _normparams.Parameters[37]);
                P_rab_sreda.SetOpenCloseParams(_normparams.Parameters[31], _normparams.Parameters[38]);
                P_koleb.SetOpenCloseParams(_normparams.Parameters[32], _normparams.Parameters[39]);
                P_zatyag.SetOpenCloseParams(_normparams.Parameters[33], _normparams.Parameters[40]);
                P_zatyag2.SetOpenCloseParams(_normparams.Parameters[34], _normparams.Parameters[41]);
                P_sryv.SetOpenCloseParams(_normparams.Parameters[35], _normparams.Parameters[42]);

                txtBox_O_Formula_A.Text = _normparams.Parameters[43].Values[0].Value;
                txtBox_O_Formula_B.Text = _normparams.Parameters[43].Values[1].Value;
                txtBox_Z_Formula_A.Text = _normparams.Parameters[44].Values[0].Value;
                txtBox_Z_Formula_B.Text = _normparams.Parameters[44].Values[1].Value;
            }
        }
        public void SetEditMode(bool editMode = true)
        {
            tblPanel_dbData.Visible = editMode;

            txtBox_N_oboroty.ReadOnly = !editMode;
            //txtBox_TU_OST_Chart.ReadOnly = !editMode;
            txtBox_Diap_M_Min.ReadOnly = !editMode;
            txtBox_Diap_M_Max.ReadOnly = !editMode;
            txtBox_P_norm.ReadOnly     = !editMode;
            txtBox_O_Tip_upr.ReadOnly  = !editMode;
            txtBox_Z_Tip_upr.ReadOnly  = !editMode;
            txtBox_Rab_Sreda.ReadOnly  = !editMode;
            txtBox_Davlenie.ReadOnly   = !editMode;
            txtBox_Temp.ReadOnly       = !editMode;
            txtBox_L_kabb.ReadOnly     = !editMode;
            txtBox_S_kabb.ReadOnly     = !editMode;
            txtBox_R_ED.ReadOnly       = !editMode;
            txtBox_R_SUMM.ReadOnly     = !editMode;

            M_nastr.SetEditMode(editMode);
            M_rab.SetEditMode(editMode);
            M_rab_sreda.SetEditMode(editMode);
            M_koleb.SetEditMode(editMode);
            M_zatyag.SetEditMode(editMode);
            M_zatyag2.SetEditMode(editMode);
            M_sryv.SetEditMode(editMode);
            T_hoda.SetEditMode(editMode);

            P_nastr.SetEditMode(editMode);
            P_rab.SetEditMode(editMode);
            P_rab_sreda.SetEditMode(editMode);
            P_koleb.SetEditMode(editMode);
            P_zatyag.SetEditMode(editMode);
            P_zatyag2.SetEditMode(editMode);
            P_sryv.SetEditMode(editMode);

            txtBox_O_Formula_A.ReadOnly = !editMode;
            txtBox_O_Formula_B.ReadOnly = !editMode;
            txtBox_Z_Formula_A.ReadOnly = !editMode;
            txtBox_Z_Formula_B.ReadOnly = !editMode;
        }
        public void CancelChanges()
        {
            M_nastr.CancelChanges();
            M_rab.CancelChanges();
            M_rab_sreda.CancelChanges();
            M_koleb.CancelChanges();
            M_zatyag.CancelChanges();
            M_zatyag2.CancelChanges();
            M_sryv.CancelChanges();
            T_hoda.CancelChanges();

            P_nastr.CancelChanges();
            P_rab.CancelChanges();
            P_rab_sreda.CancelChanges();
            P_koleb.CancelChanges();
            P_zatyag.CancelChanges();
            P_zatyag2.CancelChanges();
            P_sryv.CancelChanges();

            SetInitialNormParams();
        }
        public void AcceptChanges()
        {
            M_nastr.AcceptChanges();
            M_rab.AcceptChanges();
            M_rab_sreda.AcceptChanges();
            M_koleb.AcceptChanges();
            M_zatyag.AcceptChanges();
            M_zatyag2.AcceptChanges();
            M_sryv.AcceptChanges();
            T_hoda.AcceptChanges();

            P_nastr.AcceptChanges();
            P_rab.AcceptChanges();
            P_rab_sreda.AcceptChanges();
            P_koleb.AcceptChanges();
            P_zatyag.AcceptChanges();
            P_zatyag2.AcceptChanges();
            P_sryv.AcceptChanges();

            _normparams.TehPosInstanceId     = (int)comboBox_TehPosInstance.SelectedValue;
            _normparams.TipArmaturaId        = (int)comboBox_TipArmatura.SelectedValue;
            _normparams.TipPrivodaId         = (int)comboBox_TipPrivoda.SelectedValue;
            _normparams.TipElectrodvigatelId = (int)comboBox_TipElectroDvigatel.SelectedValue;

            _normparams.Parameters[0].Values[0].Value  = txtBox_N_oboroty.Text;
            _normparams.Parameters[1].Values[0].Value  = txtBox_TU_OST_Chart.Text;
            _normparams.Parameters[2].Values[0].Value  = txtBox_Diap_M_Min.Text;
            _normparams.Parameters[2].Values[1].Value  = txtBox_Diap_M_Max.Text;
            _normparams.Parameters[3].Values[0].Value  = txtBox_P_norm.Text;
            _normparams.Parameters[4].Values[0].Value  = txtBox_O_Tip_upr.Text;
            _normparams.Parameters[5].Values[0].Value  = txtBox_Z_Tip_upr.Text;
            _normparams.Parameters[6].Values[0].Value  = txtBox_Rab_Sreda.Text;
            _normparams.Parameters[7].Values[0].Value  = txtBox_Davlenie.Text;
            _normparams.Parameters[8].Values[0].Value  = txtBox_Temp.Text;
            _normparams.Parameters[9].Values[0].Value  = txtBox_L_kabb.Text;
            _normparams.Parameters[10].Values[0].Value = txtBox_S_kabb.Text;
            _normparams.Parameters[11].Values[0].Value = txtBox_R_ED.Text;
            _normparams.Parameters[12].Values[0].Value = txtBox_R_SUMM.Text;

            _normparams.Parameters[13] = M_nastr.ParameterOpen;
            _normparams.Parameters[21] = M_nastr.ParameterClose;
            _normparams.Parameters[14] = M_rab.ParameterOpen;
            _normparams.Parameters[22] = M_rab.ParameterClose;
            _normparams.Parameters[15] = M_rab_sreda.ParameterOpen;
            _normparams.Parameters[23] = M_rab_sreda.ParameterClose;
            _normparams.Parameters[16] = M_koleb.ParameterOpen;
            _normparams.Parameters[24] = M_koleb.ParameterClose;
            _normparams.Parameters[17] = M_zatyag.ParameterOpen;
            _normparams.Parameters[25] = M_zatyag.ParameterClose;
            _normparams.Parameters[18] = M_zatyag2.ParameterOpen;
            _normparams.Parameters[26] = M_zatyag2.ParameterClose;
            _normparams.Parameters[19] = M_sryv.ParameterOpen;
            _normparams.Parameters[27] = M_sryv.ParameterClose;
            _normparams.Parameters[20] = T_hoda.ParameterOpen;
            _normparams.Parameters[28] = T_hoda.ParameterClose;

            _normparams.Parameters[29] = P_nastr.ParameterOpen;
            _normparams.Parameters[36] = P_nastr.ParameterClose;
            _normparams.Parameters[30] = P_rab.ParameterOpen;
            _normparams.Parameters[37] = P_rab.ParameterClose;
            _normparams.Parameters[31] = P_rab_sreda.ParameterOpen;
            _normparams.Parameters[38] = P_rab_sreda.ParameterClose;
            _normparams.Parameters[32] = P_koleb.ParameterOpen;
            _normparams.Parameters[39] = P_koleb.ParameterClose;
            _normparams.Parameters[33] = P_zatyag.ParameterOpen;
            _normparams.Parameters[40] = P_zatyag.ParameterClose;
            _normparams.Parameters[34] = P_zatyag2.ParameterOpen;
            _normparams.Parameters[41] = P_zatyag2.ParameterClose;
            _normparams.Parameters[35] = P_sryv.ParameterOpen;
            _normparams.Parameters[42] = P_sryv.ParameterClose;

            _normparams.Parameters[43].Values[0].Value = txtBox_O_Formula_A.Text;
            _normparams.Parameters[43].Values[1].Value = txtBox_O_Formula_B.Text;
            _normparams.Parameters[44].Values[0].Value = txtBox_Z_Formula_A.Text;
            _normparams.Parameters[44].Values[1].Value = txtBox_Z_Formula_B.Text;
        }