private void Replacing(kipEntities context, Guid InEquipment, Guid OutEquipment, MVPS mvps, string input) { bool onShed = false; if (input == "По сроку.") { onShed = true; } Equipment InEq = context.EquipmentSet.Where(b => b.Id == InEquipment).Single(); Equipment OutEq = context.EquipmentSet.Where(b => b.Id == OutEquipment).Single(); Worker performer = context.WorkerSet.Where(b => b.Id == worker.Id).Single(); ReplacingLog replacing = new ReplacingLog { date = DateTime.Now, description = input, Installed = InEq, MVPS = mvps, onShedule = onShed, Removed = OutEq, Worker = performer }; context.ReplacingLogSet.Add(replacing); }
public static void FillGrid(ListBox list, DataGridView view) { var str = ""; if (list.SelectedItem != null) { str = list.SelectedItem.ToString(); } gridView = view; listBox = list; switch (str) { case "Оборудование": Equipment.FillGrid(view); break; case "Типы оборудования": EquipmentType.FillGrid(view); break; case "Производители": Manufacturer.FillGrid(view); break; case "Типы систем": SystemType.FillGrid(view); break; case "Роли МВПС": MVPSRole.FillGrid(view); break; case "Типы МВПС": MVPSType.FillGrid(view); break; case "МВПС": MVPS.FillGrid(view); break; case "Правила компелктования": EquipmentRule.FillGrid(view); break; case "Замены оборудования": ReplacingLog.FillGrid(view); break; case "Работники": Worker.FillGrid(view); break; case "Должности": Position.FillGrid(view); break; case "График ТО и ТР": Shedule.FillGrid(view); break; case "Журнал проверки/ремонта": ServiceLog.FillGrid(view); break; default: break; } }
private void AddRow(ReplacingLog _event, string str) { var row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell { Value = _event.date.ToString("dd.MM.yy H:mm") }); row.Cells.Add(new DataGridViewTextBoxCell { Value = str + " " + _event.MVPS.GetSpec() }); row.Cells.Add(new DataGridViewTextBoxCell { Value = _event.Worker.GetFIO() }); switch (str) { case "Установка": row.Cells.Add(new DataGridViewTextBoxCell { Value = "" }); break; default: row.Cells.Add(new DataGridViewTextBoxCell { Value = _event.description }); break; } if (_event.onShedule) { switch (str) { case "Установка": row.DefaultCellStyle.BackColor = Color.DarkSeaGreen; break; case "Cнят": row.DefaultCellStyle.BackColor = Color.DarkCyan; break; default: break; } } else { switch (str) { case "Установка": row.DefaultCellStyle.BackColor = Color.DarkSeaGreen; break; case "Cнят": row.DefaultCellStyle.ForeColor = Color.White; row.DefaultCellStyle.BackColor = Color.DarkRed; break; default: break; } } dataGridView1.Rows.Add(row); }