Another fixation.
This commit is contained in:
parent
dc140799a2
commit
3cb983b7dc
@ -62,7 +62,8 @@ namespace TransportCompamyMongoDBImplementer.Implements
|
|||||||
|
|
||||||
var truckingCollection = context.ConnectToMongo<Trucking>("trucking");
|
var truckingCollection = context.ConnectToMongo<Trucking>("trucking");
|
||||||
|
|
||||||
return truckingCollection.Find(x => !string.IsNullOrEmpty(model.MongoId) && x.Id == model.MongoId)
|
//не забудь, что тут сделал исправление для поиска по id клиента в MongoDB
|
||||||
|
return truckingCollection.Find(x => x.Client.Id == model.MongoId)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -50,6 +50,7 @@ namespace TransportCompany
|
|||||||
if (view != null)
|
if (view != null)
|
||||||
{
|
{
|
||||||
textBoxTransport.Text = view.Tranport;
|
textBoxTransport.Text = view.Tranport;
|
||||||
|
textBoxTypeTransportation.Text = view.TransportationType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -29,6 +29,7 @@ namespace TransportCompany
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_truckingLogic = truckingLogic;
|
_truckingLogic = truckingLogic;
|
||||||
_clientLogic = clientLogic;
|
_clientLogic = clientLogic;
|
||||||
|
_mongo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -70,7 +71,16 @@ namespace TransportCompany
|
|||||||
if (listClients != null)
|
if (listClients != null)
|
||||||
{
|
{
|
||||||
comboBoxEmails.DisplayMember = "Email";
|
comboBoxEmails.DisplayMember = "Email";
|
||||||
comboBoxEmails.ValueMember = "Id";
|
|
||||||
|
if (_mongo)
|
||||||
|
{
|
||||||
|
comboBoxEmails.ValueMember = "MongoId";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
comboBoxEmails.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
comboBoxEmails.DataSource = listClients;
|
comboBoxEmails.DataSource = listClients;
|
||||||
comboBoxEmails.SelectedItem = null;
|
comboBoxEmails.SelectedItem = null;
|
||||||
}
|
}
|
||||||
@ -103,6 +113,8 @@ namespace TransportCompany
|
|||||||
|
|
||||||
if (service is FormTransport form)
|
if (service is FormTransport form)
|
||||||
{
|
{
|
||||||
|
form.SetMongo = _mongo;
|
||||||
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
@ -180,7 +192,14 @@ namespace TransportCompany
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = _truckingLogic.ReadList(null).Where(x => x.ClientId == comboBoxEmails.SelectedIndex).ToList();
|
if (_mongo)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = _truckingLogic.ReadList(new TruckingSearchModel { MongoId = comboBoxEmails.SelectedValue.ToString() });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = _truckingLogic.ReadList(null).Where(x => x.ClientId == comboBoxEmails.SelectedIndex).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,6 +258,7 @@ namespace TransportCompany
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
//ïåðåäà÷à äàííûõ èç Postgresql â MongoDB
|
||||||
private void TransferDataToolStripMenuItem_Click(object sender, EventArgs e)
|
private void TransferDataToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormTransferData));
|
var service = Program.ServiceProvider?.GetService(typeof(FormTransferData));
|
||||||
@ -249,6 +269,7 @@ namespace TransportCompany
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ðàáîòà ñ Postgresql
|
||||||
private void StartPostgresqlToolStripMenuItem_Click(object sender, EventArgs e)
|
private void StartPostgresqlToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mongo = false;
|
_mongo = false;
|
||||||
@ -261,6 +282,7 @@ namespace TransportCompany
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ðàáîòà ñ MongoBD
|
||||||
private void StartMongoDBToolStripMenuItem_Click(object sender, EventArgs e)
|
private void StartMongoDBToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mongo = true;
|
_mongo = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user