Пример #1
0
        private void btSave_Click(object sender, EventArgs e)
        {
            Report r = new Report();
            r.date = ((DateTime)reportDate.Value);
            if (tbHours.Text.Length > 0)
            {
                r.expenditure = Convert.ToInt16(tbHours.Text);
            }
            else
            {
                r.expenditure = 0;
            }
            r.setProject((Project)cbProject.SelectedItem);
            r.setTask((Task)cbTask.SelectedItem);
            r.setUser(Utils.currentUser);
            r.description = tbDecription.Text;
            if (report != null)
            {
                if (report.id != 0)
                {
                    r.id = report.id;
                }
            }

            Simplifier.insertOrUpdate(r);
            ((Reports)this.parent).refreshView();
            this.Close();
        }