private void RefreshRentView() { try { DateTime?dtFrom = dtpFromDate.Value.ToDate(); DateTime?dtTill = dtpTillDate.Value.ToDateTimeorNull(); using (TaxiDataContext db = new TaxiDataContext()) { var list = db.stp_AddAllDriverRent(dtFrom, dtTill).ToList(); int cnt = list.Count; grdDriverRent.RowCount = cnt; for (int i = 0; i < cnt; i++) { grdDriverRent.Rows[i].Cells["Check"].Value = true; grdDriverRent.Rows[i].Cells[COLS.Id].Value = list[i].Id; grdDriverRent.Rows[i].Cells[COLS.DriverNo].Value = list[i].DriverNo; grdDriverRent.Rows[i].Cells[COLS.DriverRent].Value = list[i].DriverMonthlyRent.ToDecimal(); // ADD PDA RENT grdDriverRent.Rows[i].Cells[COLS.DriverPDARent].Value = list[i].PDARent.ToDecimal(); if (list[i].RentId == 0) { grdDriverRent.Rows[i].Cells[COLS.OldBalance].Value = list[i].InitialBalance; } else { grdDriverRent.Rows[i].Cells[COLS.OldBalance].Value = list[i].OldBalance; } grdDriverRent.Rows[i].Cells[COLS.InitialBalance].Value = list[i].InitialBalance; grdDriverRent.Rows[i].Cells[COLS.RentId].Value = null; grdDriverRent.Rows[i].Cells[COLS.RentPay].Value = null; grdDriverRent.Rows[i].Cells[COLS.RentDue].Value = null; grdDriverRent.Rows[i].Cells[COLS.CurrBalance].Value = null; grdDriverRent.Rows[i].Cells[COLS.AccountsTotal].Value = null; } } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }