Example #1
0
        void edit_elementGoal()
        {
            if (dataGridView4.CurrentRow == null) return;

            var newGoalRow = ((DataRowView)dataGridView4.CurrentRow.DataBoundItem).Row;

            var name = newGoalRow["Name"].ToString();
            var allSum = newGoalRow["AllSum"].ToString();
            var comment = newGoalRow["Comment"].ToString();
            var HistoryID = newGoalRow["HistoryID"].ToString();

            using (
            var faeg = new Form_AddEditGoal(name, allSum, comment, HistoryID, dataSet1))
            {
                faeg.ShowDialog();

                if (faeg.DialogResult == DialogResult.OK)
                {
                    newGoalRow["name"] = faeg.txb_GoalName.Text;
                    newGoalRow["AllSum"] = faeg.txb_GoalSum.Text;
                    newGoalRow["Comment"] = faeg.txb_GoalComment.Text;
                    newGoalRow["History"] = Goal.History.ToString(CultureInfo.InvariantCulture);
                }

                saveData();
            }
        }
Example #2
0
        void tsb_AddGoal_Click_1(object sender, EventArgs e)
        {
            using (var faeg = new Form_AddEditGoal("", "", "", "-1", dataSet1))
            {
                if (faeg.ShowDialog() == DialogResult.OK)
                {
                    var newGoalRow = dataSet1.Tables["Goal"].NewRow();

                    newGoalRow["name"] = faeg.txb_GoalName.Text;
                    newGoalRow["AllSum"] = (faeg.txb_GoalSum.Text == "") ? "0" : faeg.txb_GoalSum.Text;
                    newGoalRow["Comment"] = faeg.txb_GoalComment.Text;

                    dataSet1.Tables["Goal"].Rows.Add(newGoalRow);
                }

                saveData();
            }
        }