Beispiel #1
0
        /// <summary>
        /// Загрузить информацию о свечах
        /// </summary>
        /// <param name="root"></param>
        protected void LoadCandles(XmlNode root)
        {
            if (root != null && root.Name == "candles")
            {
                if (root.HasChildNodes)
                {
                    foreach (XmlNode child in root.ChildNodes)
                    {
                        switch (child.Name)
                        {
                        case tubeInfo.rootName:

                            try
                            {
                                tubeInfo info = new tubeInfo();
                                info.Load(child);

                                tubes.Add(info);
                            }
                            catch { }
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void accept_Click(object sender, EventArgs e)
        {
            try
            {
                float s_candle = SgtApplication.ParseSingle(textBoxSizeCandle.Text);
                if (float.IsNaN(s_candle) == false)
                {
                    if (s_candle >= 0)
                    {
                        _app.Technology.P0203.SizeCandle = s_candle;
                    }
                    else
                    {
                        MessageBox.Show(this, "Средняя длина свечи не может быть меньше нуля", "Сообщение",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        textBoxSizeCandle.Focus();
                        textBoxSizeCandle.SelectAll();

                        DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(this, "Указано не корректное значение средней длины свечи", "Сообщение",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    textBoxSizeCandle.Focus();
                    textBoxSizeCandle.SelectAll();

                    DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                float s_lower = SgtApplication.ParseSingle(textBoxLowerSizeCandle.Text);
                if (float.IsNaN(s_lower) == false)
                {
                    if (s_lower >= 0)
                    {
                        _app.Technology.P0203.LowerSizeCandle = s_lower;
                    }
                    else
                    {
                        MessageBox.Show(this, "Нижняя граница длины свечи не может быть меньше нуля", "Сообщение",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        textBoxLowerSizeCandle.Focus();
                        textBoxLowerSizeCandle.SelectAll();

                        DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(this, "Указано не корректное значение нижней границы длины свечи", "Сообщение",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    textBoxLowerSizeCandle.Focus();
                    textBoxLowerSizeCandle.SelectAll();

                    DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                float s_upper = SgtApplication.ParseSingle(textBoxUpperSizeCandle.Text);
                if (float.IsNaN(s_upper) == false)
                {
                    if (s_upper >= 0)
                    {
                        _app.Technology.P0203.UpperSizeCandle = s_upper;
                    }
                    else
                    {
                        MessageBox.Show(this, "Верхняя граница длины свечи не может быть меньше нуля", "Сообщение",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        textBoxUpperSizeCandle.Focus();
                        textBoxUpperSizeCandle.SelectAll();

                        DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(this, "Указано не корректное значение верхней границы длины свечи", "Сообщение",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    textBoxUpperSizeCandle.Focus();
                    textBoxUpperSizeCandle.SelectAll();

                    DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                float dep = SgtApplication.ParseSingle(textBoxDop.Text);
                if (float.IsNaN(dep) == false)
                {
                    if (dep >= 0)
                    {
                        _app.Technology.P0203.Deviation = dep;
                    }
                    else
                    {
                        MessageBox.Show(this, "Значение допустимого отклонения не может быть меньше нуля", "Сообщение",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        textBoxDop.Focus();
                        textBoxDop.SelectAll();

                        DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(this, "Указано не корректное значение допустимого отклонения", "Сообщение",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    textBoxDop.Focus();
                    textBoxDop.SelectAll();

                    DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                if (check_rows())
                {
                    foreach (DataGridViewRow row in dataGridView1.Rows)
                    {
                        if (row != null)
                        {
                            if (row.Tag != null)
                            {
                                tubeInfo r_info = row.Tag as tubeInfo;
                                if (r_info != null)
                                {
                                    r_info.Lenght = float.Parse(row.Cells[1].Value.ToString());
                                    r_info.Number = int.Parse(row.Cells[2].Value.ToString());

                                    r_info.Comment = row.Cells[3].Value.ToString();
                                }
                            }
                        }
                    }
                }
                else
                {
                    DialogResult = DialogResult.None;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Редактируем трубку
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows != null)
                {
                    if (dataGridView1.SelectedRows.Count > 0)
                    {
                        DataGridViewRow selected = dataGridView1.SelectedRows[0];
                        if (selected != null && selected.Tag != null)
                        {
                            tubeInfo sel_tube = selected.Tag as tubeInfo;
                            if (sel_tube != null)
                            {
                                int sel_index = selected.Index;
                                if (sel_index > -1 && sel_index < dataGridView1.Rows.Count)
                                {
                                    if (sel_index == 0)
                                    {
                                        // -------- редактируем выбранную трубку

                                        DrillingShaftTubeForm frm = new DrillingShaftTubeForm();

                                        frm.textBoxLenght.Text = selected.Cells[1].Value.ToString();
                                        frm.textBoxNumber.Text = selected.Cells[2].Value.ToString();

                                        frm.textBoxComment.Text = selected.Cells[3].Value.ToString();

                                        if (frm.ShowDialog(this) == DialogResult.OK)
                                        {
                                            selected.Cells[1].Value = frm.textBoxLenght.Text;
                                            selected.Cells[2].Value = frm.textBoxNumber.Text;
                                            selected.Cells[3].Value = frm.textBoxComment.Text;
                                            selected.Cells[4].Value = frm.textBoxLenght.Text;

                                            calc_data_grid();
                                        }
                                    }
                                    else
                                    {
                                        int             f_index = sel_index - 1;
                                        DataGridViewRow f_row   = dataGridView1.Rows[f_index];

                                        if (f_row != null)
                                        {
                                            float len = SgtApplication.ParseSingle(f_row.Cells[1].Value.ToString());
                                            if (len <= 0)
                                            {
                                                MessageBox.Show(this, "Текущую трубку нельзя редактировать, потому что не определенна предыдущая трубка", "Сообщение",
                                                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                            }
                                            else
                                            {
                                                // -------- редактируем выбранную трубку

                                                DrillingShaftTubeForm frm = new DrillingShaftTubeForm();

                                                frm.textBoxLenght.Text = selected.Cells[1].Value.ToString();

                                                if (sel_tube.Lenght <= 0)
                                                {
                                                    frm.textBoxNumber.Text = f_row.Cells[2].Value.ToString();
                                                }
                                                else
                                                {
                                                    frm.textBoxNumber.Text = selected.Cells[2].Value.ToString();
                                                }

                                                frm.textBoxComment.Text = selected.Cells[3].Value.ToString();

                                                if (frm.ShowDialog(this) == DialogResult.OK)
                                                {
                                                    selected.Cells[1].Value = frm.textBoxLenght.Text;
                                                    selected.Cells[2].Value = frm.textBoxNumber.Text;
                                                    selected.Cells[3].Value = frm.textBoxComment.Text;

                                                    calc_data_grid();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Загрузить информацию о свечах
        /// </summary>
        /// <param name="root"></param>
        protected void LoadCandles(XmlNode root)
        {
            if (root != null && root.Name == "candles")
            {
                if (root.HasChildNodes)
                {
                    foreach (XmlNode child in root.ChildNodes)
                    {
                        switch (child.Name)
                        {
                            case tubeInfo.rootName:

                                try
                                {
                                    tubeInfo info = new tubeInfo();
                                    info.Load(child);

                                    tubes.Add(info);
                                }
                                catch { }
                                break;

                            default:
                                break;
                        }
                    }
                }
            }
        }