public void Create() { //daysTableAdapter.FillByMonth(tDayDataSet.Days, FirstDayOfMonth, LastDayOfMonth); if (!IsCreate()) { profilesTableAdapter.Fill(tDayDataSet.Profiles); foreach (DataRow _profile in tDayDataSet.Profiles) { if ((int)_profile["Category"] < (int)Enums.Category.BoardMember) { BillsItem Item = new BillsItem((int)_profile["ProfileId"], FirstDayOfMonth, LastDayOfMonth); Item.Insert(); } } //billsTableAdapter.DeleteByMonth(FirstDayOfMonth, LastDayOfMonth); //Удаляем все существующие записи за текущий месяц } }
private void toolStripButton12_Click(object sender, EventArgs e) { if (dataGridView7.SelectedCells.Count > 0) { TDayDataSet tempSet = new TDayDataSet(); Bill _Bill = new Bill(); billsTableAdapter.FillByMonth(tempSet.Bills, _Bill.FirstDayOfMonth, _Bill.LastDayOfMonth); int Index = -1; foreach (DataRow Row in tempSet.Bills) { if ((int)Row["ProfileId"] == (int)dataGridView7.Rows[dataGridView7.SelectedCells[0].RowIndex].Cells["dataGridViewTextBoxColumn1"].Value) { Index = (int)Row["BillId"]; break; } } if (Index != -1) { panel8.Visible = false; foreach (DataGridViewRow Row in dataGridView5.Rows) { if ((int)Row.Cells["billIdDataGridViewTextBoxColumn"].Value == Index) { DataGridViewCellEventArgs eve = new DataGridViewCellEventArgs(0, Row.Index); dataGridView5_CellClick(sender, eve); dataGridView5.Rows[Row.Index].Selected = true; break; } } } else { BillsItem item = new BillsItem((int)dataGridView7.Rows[dataGridView7.SelectedCells[0].RowIndex].Cells["dataGridViewTextBoxColumn1"].Value, _Bill.FirstDayOfMonth, _Bill.LastDayOfMonth); item.Insert(); billsTableAdapter.Fill(tDayDataSet.Bills); panel8.Visible = false; dataGridView7.Rows[dataGridView7.Rows.Count - 1].Selected = true; } } }