теперь все работает
This commit is contained in:
parent
3b98ee933a
commit
fd475481ef
@ -33,30 +33,6 @@ namespace TransportGuide
|
||||
|
||||
private void FormRoute_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new RouteSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.Name;
|
||||
textBoxIP.Text = view.IP.ToString();
|
||||
_RouteStops = view.StopRoutes ?? new
|
||||
Dictionary<int, (IStopModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var list = _logicTT.ReadList(null);
|
||||
@ -75,6 +51,36 @@ namespace TransportGuide
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new RouteSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.Name;
|
||||
textBoxIP.Text = view.IP.ToString();
|
||||
comboBoxTransportType.Text = view.TransportTypeName;
|
||||
_RouteStops = view.StopRoutes ?? new Dictionary<int, (IStopModel, int)>();
|
||||
LoadData();
|
||||
//foreach (var el in view.StopRoutes.Values)
|
||||
//{
|
||||
// dataGridView.Rows.Add(new object[] {el.Item1.Name, el.Item2});
|
||||
//}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
@ -87,7 +93,6 @@ namespace TransportGuide
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.Name, pc.Value.Item2 });
|
||||
}
|
||||
//textBoxIP.Text = CalcIP().ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -66,6 +66,7 @@ namespace TransportGuideDatabaseImplements.Models
|
||||
{
|
||||
Name = model.Name;
|
||||
IP = model.IP;
|
||||
TransportTypeId = model.TransportTypeId;
|
||||
}
|
||||
|
||||
public RouteViewModel GetViewModel
|
||||
@ -80,6 +81,7 @@ namespace TransportGuideDatabaseImplements.Models
|
||||
IP = IP,
|
||||
Name = Name,
|
||||
TransportTypeName = context.TransportTypes.FirstOrDefault(x => x.Id == TransportTypeId)?.Name ?? string.Empty,
|
||||
StopRoutes = StopRoutes
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user