Exemplo n.º 1
0
        /// <summary>
        /// добавить новый этап работы в проект
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNewStage_Click(object sender, EventArgs e)
        {
            InsertStageForm frm = new InsertStageForm();

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                ProjectStage stage = new ProjectStage();

                stage.Koef      = frm.StageKoef;
                stage.StageName = frm.StageName;

                try
                {
                    stage.Plan_consumption = float.Parse(frm.Plan_consumption);
                    stage.Plan_volume      = float.Parse(frm.Plan_volume);

                    stage.Plan_density  = float.Parse(frm.Plan_density);
                    stage.Plan_pressure = float.Parse(frm.Plan_pressure);
                }
                catch { }

                edited.Stages.Add(stage);
                InsertStageInList(stage);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// редактируем этап
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editStage_Click(object sender, EventArgs e)
        {
            if (listViewStages.SelectedItems != null &&
                listViewStages.SelectedItems.Count > 0)
            {
                ProjectStage selected = listViewStages.SelectedItems[0].Tag as ProjectStage;
                if (selected != null)
                {
                    InsertStageForm frm = new InsertStageForm();

                    frm.StageName = selected.StageName;
                    frm.StageKoef = selected.Koef;

                    frm.Plan_consumption = string.Format("{0:F2}", selected.Plan_consumption);
                    frm.Plan_volume      = string.Format("{0:F2}", selected.Plan_volume);

                    frm.Plan_density  = string.Format("{0:F2}", selected.Plan_density);
                    frm.Plan_pressure = string.Format("{0:F2}", selected.Plan_pressure);

                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        selected.Koef      = frm.StageKoef;
                        selected.StageName = frm.StageName;

                        try
                        {
                            selected.Plan_consumption = float.Parse(frm.Plan_consumption);
                            selected.Plan_volume      = float.Parse(frm.Plan_volume);

                            selected.Plan_density  = float.Parse(frm.Plan_density);
                            selected.Plan_pressure = float.Parse(frm.Plan_pressure);
                        }
                        catch { }

                        listViewStages.SelectedItems[0].SubItems[1].Text = selected.StageName;
                        listViewStages.SelectedItems[0].SubItems[2].Text = selected.Koef.ToString();
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// добавить новый этап работы в проект
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNewStage_Click(object sender, EventArgs e)
        {
            InsertStageForm frm = new InsertStageForm();
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                ProjectStage stage = new ProjectStage();

                stage.Koef = frm.StageKoef;
                stage.StageName = frm.StageName;

                try
                {
                    stage.Plan_consumption = float.Parse(frm.Plan_consumption);
                    stage.Plan_volume = float.Parse(frm.Plan_volume);

                    stage.Plan_density = float.Parse(frm.Plan_density);
                    stage.Plan_pressure = float.Parse(frm.Plan_pressure);
                }
                catch { }

                edited.Stages.Add(stage);
                InsertStageInList(stage);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// редактируем этап
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editStage_Click(object sender, EventArgs e)
        {
            if (listViewStages.SelectedItems != null &&
                listViewStages.SelectedItems.Count > 0)
            {
                ProjectStage selected = listViewStages.SelectedItems[0].Tag as ProjectStage;
                if (selected != null)
                {
                    InsertStageForm frm = new InsertStageForm();

                    frm.StageName = selected.StageName;
                    frm.StageKoef = selected.Koef;

                    frm.Plan_consumption = string.Format("{0:F2}", selected.Plan_consumption);
                    frm.Plan_volume = string.Format("{0:F2}", selected.Plan_volume);

                    frm.Plan_density = string.Format("{0:F2}", selected.Plan_density);
                    frm.Plan_pressure = string.Format("{0:F2}", selected.Plan_pressure);

                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        selected.Koef = frm.StageKoef;
                        selected.StageName = frm.StageName;

                        try
                        {
                            selected.Plan_consumption = float.Parse(frm.Plan_consumption);
                            selected.Plan_volume = float.Parse(frm.Plan_volume);

                            selected.Plan_density = float.Parse(frm.Plan_density);
                            selected.Plan_pressure = float.Parse(frm.Plan_pressure);
                        }
                        catch { }

                        listViewStages.SelectedItems[0].SubItems[1].Text = selected.StageName;
                        listViewStages.SelectedItems[0].SubItems[2].Text = selected.Koef.ToString();
                    }
                }
            }
        }