public UnitRepair(UnitAccount arg) { UnitAccount = arg; Defect = ""; RepairPlace = ""; SendDate = new DateTime(); ReceivedDate = new DateTime(); Completed = false; LastUpdate = new DateTime(); }
public UnitRepair(int id, UnitAccount account, string defect, string repairPlace, DateTime sendDate, DateTime receivedDate, bool completed, DateTime lastUpdate) { Id = id; UnitAccount = account; Defect = defect; RepairPlace = repairPlace; SendDate = sendDate; ReceivedDate = receivedDate; Completed = completed; LastUpdate = lastUpdate; }
public AddEditHardware(UnitAccount account) { InitializeComponent(); // Insert code required on object creation below this point. FillComboBoxes(); _account = account; if (account.Id > 0) FillAccount(); }
public HardEdit(int id) { InitializeComponent(); // Insert code required on object creation below this point. _types = _typeMapper.FindAll(); _makers = _makerMapper.FindAll(); UnitType.ItemsSource = _types; Maker.ItemsSource = _makers; _account = _accountMapper.Find(id); FillExistAccountParams(_account); }
public HardDescr(int id) { InitializeComponent(); // Insert code required on object creation below this point. _account = _accountMapper.Find(id); _repair = _repairMapper.FindByAccount(_account); Title = _account.ModelInfo.ModelType.Name + " " + _account.ModelInfo.Name; TitleRb.Document = InitializeTable(_mainTable); DescrBox.Document = InitializeTable(_descrTable); SetImage(_account.ModelInfo.Name); FillShortDescription(_mainTable, _account); FillDescription(_descrTable, _account); }
private string GetMainParams(UnitAccount account) { string result = ""; foreach (var feature in account.Features) result += feature.Param.Name + ": " + feature.Value + "\r\n"; var model = account.ModelInfo; foreach (var feature in model.Features) { if (feature.Param.IsMain) result += feature.Param.Name + ": " + feature.Value + "\r\n"; } if (result.Length > 0) result = result.Remove(result.Length - 2); return result; }
private void FillDescription(Table table, UnitAccount account) { if (table.RowGroups[0].Rows.Count != 0) table.RowGroups[0].Rows.Clear(); AddTitleRow(table, "Описание"); foreach (var feature in account.ModelInfo.Features) AddDescrRow(table, feature.Param.Name, feature.Value); AddTitleRow(table, "Доп. информация"); foreach (var feature in account.Features) AddDescrRow(table, feature.Param.Name, feature.Value); AddTitleRow(table, "Ремонт"); foreach (var repair in _repair) { string key = repair.SendDate.ToString("yyyy.MM.dd") + " - "; if (repair.ReceivedDate > repair.SendDate) key += repair.ReceivedDate.ToString("yyyy.MM.dd"); else key += "Н.В."; AddDescrRow(table, key, repair.Defect); } }
private void FillShortDescription(Table table, UnitAccount account) { if (table.RowGroups[0].Rows.Count != 0) table.RowGroups[0].Rows.Clear(); AddTitleRow(table, account.ModelInfo.ModelType.Name); AddTitleRow(table, account.ModelInfo.ModelMaker.Name + " " + account.ModelInfo.Name); AddDescrRow(table, "Инв. №:", account.Inventory); AddDescrRow(table, "№ Карты:", account.Card.ToString()); foreach (var row in table.RowGroups[0].Rows) row.Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); }
private void FillExistAccountParams(UnitAccount account) { if (_account.Id > 0) { var model = account.ModelInfo; UnitType.SelectedItem = model.ModelType; Maker.SelectedItem = model.ModelMaker; Model.Text = model.Name; for (int i = 0; i < model.Features.Count; ++i) _mainParams[i].Value.Text = model.Features[i].Value; for (int i = 0; i < account.Features.Count; i++) _addParams[i].Value.Text = account.Features[i].Value; Inventory.Text = account.Inventory; Card.Text = account.Card.ToString(CultureInfo.InvariantCulture); Comments.Document.Blocks.Clear(); Comments.Document.Blocks.Add(new Paragraph(new Run(_account.Comments))); } else UnitType.SelectedIndex = 0; UnitType.Focus(); }