Пример #1
0
        public void updateTable()
        {
            DateTime date = DateTime.Now;

            if (dtStartDate.Value.Date < dtEndDate.Value.Date && dtStartDate.Value.Date >= date)
            {
                Helper        helper = new Helper();
                ActionWithDB  api    = new ActionWithDB();
                SqlDataReader reader = api.checkingFreeSpace(dtStartDate.Value.Date, dtEndDate.Value.Date);
                if (tbClubCard.Text != "")
                {
                    int discont = api.getDiscont(dtStartDate.Value.Date, tbClubCard.Text);
                    helper.clearDataGridView(dGVFreePlace);
                    int i = 0;
                    while (reader.Read())
                    {
                        dGVFreePlace.RowCount++;
                        dGVFreePlace.Rows[i].Cells[0].Value = reader[0].ToString();
                        dGVFreePlace.Rows[i].Cells[1].Value = reader[1].ToString();
                        dGVFreePlace.Rows[i].Cells[2].Value = reader[2].ToString();
                        dGVFreePlace.Rows[i].Cells[3].Value = discont;
                        dGVFreePlace.Rows[i].Cells[4].Value = api.getTotalCost(discont, dGVFreePlace.Rows[i].Cells[2].Value.ToString());
                        i++;
                    }
                }
            }
            else
            {
                Helper helper = new Helper();
                helper.clearDataGridView(dGVFreePlace);
            }
        }