示例#1
0
        private void Add_B_Click(object sender, EventArgs e)
        {
            DialogCalc Dialog = new DialogCalc()
            {
                Text = "Создание расчета"
            };
            var mytask = dGVTasks.CurrentRow.DataBoundItem as MyTask;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                //true - создать авторасчет, заменить на открытие формы с выбором процентов участия пластов в шихте
                if (Dialog.cBCalcAuto.Checked)
                {
                    repository.AddCalc(new Calc()
                    {
                        MyTask        = mytask.PK_Task,
                        NameCalc      = Dialog.tBNameCalc.Text,
                        Participation = "Без автопостроения"
                    });
                }
                else
                {
                    repository.AddCalc(new Calc()
                    {
                        MyTask        = mytask.PK_Task,
                        NameCalc      = Dialog.tBNameCalc.Text,
                        Participation = "Без автопостроения"
                    });
                }
            }
            LoadCalcs();
        }
示例#2
0
        private void Edit_B_Click(object sender, EventArgs e)
        {
            var    change     = dGVCalcs.CurrentRow.DataBoundItem as Calc;
            string name       = change.NameCalc.ToString(),
                   part       = change.Participation.ToString();
            DialogCalc Dialog = new DialogCalc(name, part)
            {
                Text = "Изменение расчета"
            };

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                repository.AddCalc(new Calc()
                {
                    PK_Calc       = change.PK_Calc,
                    MyTask        = change.MyTask,
                    NameCalc      = Dialog.tBNameCalc.Text,
                    Participation = "Без автопостроения"
                });
            }
            LoadCalcs();
        }