Esempio n. 1
0
        private void EditOborot(object sender, EventArgs e)
        {
            var editRow   = mainDataGW.SelectedRows[0];
            var updOborot = new Oborot()
            {
                AccountNameId = _service.AccountNameId,
                OborotId      = (int)editRow.Cells[0].Value,
                Date          = (DateTime)editRow.Cells[1].Value,
                CategoryId    = (int)editRow.Cells[2].Value,
                Category      = (string)editRow.Cells[3].Value,
                SubCategoryId = (int?)editRow.Cells[4].Value,
                SubCategory   = (string)editRow.Cells[5].Value,
                Count         = (double)editRow.Cells[6].Value,
                Summa         = (decimal)editRow.Cells[7].Value,
                CurrencyId    = (int)editRow.Cells[8].Value,
                Currency      = (string)editRow.Cells[9].Value,
                Note          = (string)editRow.Cells[10].Value
            };

            var form   = new OborotForm(_service, updOborot);
            var result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                UpdateOborotInTable(form.UpdatedOborot);
                UpdateOborotToDbAsync(form.UpdatedOborot);
            }
        }
Esempio n. 2
0
        private void AddOborot(object sender, EventArgs e)
        {
            var form   = new OborotForm(_service);
            var result = form.ShowDialog();

            if (result == DialogResult.OK || result == DialogResult.Retry)
            {
                InsertOborotsToDbAsync(form.InsertedOborots);
            }
        }