private void openFileDialog4_FileOk(object sender, System.ComponentModel.CancelEventArgs e) { var fileInfo = new System.IO.FileInfo(openFileDialog4.FileName); string sFileName = Path.GetFileNameWithoutExtension(openFileDialog4.FileName); string sExtension = fileInfo.Extension; string sPath = openFileDialog4.FileName; bool bMarketing = cbMarketing.Checked; bool bMClients = cbMClients.Checked; bool bMCreateDate = cbMCreateDate.Checked; object MCreateDateFrom = dtpMCreateDateFrom.Value; object MCreateDateTo = dtpMCreateDateTo.Value; bool bMDispDate = false; object MDispDateFrom = dtpMDispDateFrom.Value; object MDispDateTo = dtpMDispDateTo.Value; bool bZOV = cbZOV.Checked; bool bZClients = cbZClients.Checked; bool bZCreateDate = cbZCreateDate.Checked; object ZCreateDateFrom = dtpZCreateDateFrom.Value; object ZCreateDateTo = dtpZCreateDateTo.Value; bool bZDispDate = cbZDispDate.Checked; object ZDispDateFrom = dtpZDispDateFrom.Value; object ZDispDateTo = dtpZDispDateTo.Value; int MainOrderID = -1; if (dgvMainOrders.SelectedRows.Count > 0 && dgvMainOrders.SelectedRows[0].Cells["MainOrderID"].Value != DBNull.Value) { MainOrderID = Convert.ToInt32(dgvMainOrders.SelectedRows[0].Cells["MainOrderID"].Value); } Thread T = new Thread(delegate() { SplashWindow.CreateSmallSplash(ref TopForm, "Загрузка данных с сервера.\r\nПодождите..."); }); T.Start(); while (!SplashWindow.bSmallCreated) { ; } if (Convert.ToInt32(dgvMainOrders.SelectedRows[0].Cells["FirmType"].Value) == 1) { OrdersManager.AttachMFoto(sExtension, sFileName, sPath, MainOrderID); } if (Convert.ToInt32(dgvMainOrders.SelectedRows[0].Cells["FirmType"].Value) == 0) { OrdersManager.AttachZFoto(sExtension, sFileName, sPath, MainOrderID); } OrdersManager.FilterOrders( bMarketing, bMClients, bMCreateDate, MCreateDateFrom, MCreateDateTo, bMDispDate, MDispDateFrom, MDispDateTo, bZOV, bZClients, bZCreateDate, ZCreateDateFrom, ZCreateDateTo, bZDispDate, ZDispDateFrom, ZDispDateTo); while (SplashWindow.bSmallCreated) { SmallWaitForm.CloseS = true; } }