private void fillFields(DataRow row) { ID = Convert.ToInt32(row.ItemArray[0]); int idFuelCard; int.TryParse(row.ItemArray[1].ToString(), out idFuelCard); FuelCard = FuelCardList.getInstance().getItem(idFuelCard); int idDriver; int.TryParse(row.ItemArray[2].ToString(), out idDriver); Driver = DriverList.getInstance().getItem(idDriver); DateTime dateBegin; DateTime.TryParse(row.ItemArray[3].ToString(), out dateBegin); DateBegin = dateBegin; DateTime dateEnd; if (DateTime.TryParse(row.ItemArray[4].ToString(), out dateEnd)) { DateEnd = dateEnd; } }
private void SetFormatFuelCard() { HideColumn("Начало использования"); HideColumn("Окончание использования"); FuelCardList fuelCardList = FuelCardList.getInstance(); foreach (DataGridViewRow row in _dgv.Rows) { int id; int.TryParse(row.Cells[1].Value.ToString(), out id); FuelCard fuelCard = fuelCardList.getItem(id); if (fuelCard.IsVoid) { row.DefaultCellStyle.BackColor = BBColors.bbGray4; } else if (row.Cells["Водитель"].Value.ToString() == "(Резерв)") { row.DefaultCellStyle.BackColor = BBColors.bbGreen3; } else { row.DefaultCellStyle.BackColor = Color.White; } } }
public override void Save() { string dateEndSql = string.Empty; if (_dateEnd.Year != 1) { dateEndSql = string.Concat(_dateEnd.Year.ToString(), "-", _dateEnd.Month.ToString(), "-", _dateEnd.Day.ToString()); } ID = Convert.ToInt32(_provider.Insert("FuelCard", ID, _idFuelCardType, _number, dateEndSql, _idRegion, _pin, _lost, Comment)); FuelCardList fuelCardList = FuelCardList.getInstance(); fuelCardList.Add(this); }
static FuelLoader() { erorrs = new List <string>(); fuelCardList = FuelCardList.getInstance(); engineTypeList = EngineTypeList.getInstance(); benzin = engineTypeList.getItem(BENZIN_ID); disel = engineTypeList.getItem(DIESEL_ID); loaders = new Dictionary <FuelReport, Action <ExcelDoc> >(); loaders.Add(FuelReport.Петрол, LoadPetrol); loaders.Add(FuelReport.Neste, LoadNeste); loaders.Add(FuelReport.Чеки, LoadChecks); }
public Fuel(DataRow row) { Id = Convert.ToInt32(row[0].ToString()); int idFuelCard; int.TryParse(row[1].ToString(), out idFuelCard); FuelCard = FuelCardList.getInstance().getItem(idFuelCard); Date = Convert.ToDateTime(row[2].ToString()); Value = Convert.ToDouble(row[3].ToString()); int idEngineType; int.TryParse(row[4].ToString(), out idEngineType); EngineType = EngineTypeList.getInstance().getItem(idFuelCard); }
private void DoubleClickFuelCard(Point point) { int id = _dgvMain.GetCarID(); if (id == 0) { return; } FuelCardList fuelCardList = FuelCardList.getInstance(); FuelCard fuelCard = fuelCardList.getItem(id); FuelCard_AddEdit fuelCardAddEdit = new FuelCard_AddEdit(fuelCard); if (fuelCardAddEdit.ShowDialog() == DialogResult.OK) { loadCars(); } }