//private Upload506FileError GetItemsFromDatabase(string ext, string filePath, long startRecord = 0, long count = -1) //{ // Upload506FileError result = Upload506FileError.Success; // UploadMaster.Items.Clear(); // if (m_InputStream != null) // { // filePath = Path.ChangeExtension(Path.GetTempFileName(), ext); // byte[] buffer = new byte[8192]; // using (Stream output = File.OpenWrite(filePath)) // { // CopyStream(m_InputStream, output); // } // } // var connection = GetConnection(ext, filePath, true); // if (connection == null) // return Upload506FileError.UsupportedExtension; // using (connection) // { // try // { // connection.Open(); // var command = CreateSelectCommand(ext, connection, filePath); // var reader = command.ExecuteReader(); // if (reader != null) // { // if (!ValidateHeader(reader.GetSchemaTable())) // { // return Upload506FileError.IvalidHeaderFormat; // } // long i = -1; // long lastRecord = startRecord + count - 1; // while (reader.Read()) // { // i++; // if (count > 0 && i < startRecord) // continue; // if (count > 0 && i > lastRecord) // break; // var itemResult = AddItemFromDataReader(reader); // if (itemResult > 0) // result = Upload506FileError.IncorrectDataFormat; // } // reader.Close(); // } // connection.Close(); // } // catch (Exception ex) // { // LogError(ex); // result = Upload506FileError.Unknown; // } // } // return result; //} //private IDbCommand CreateSelectCommand(string ext, DbConnection connection, string filePath) //{ // switch (ext) // { // case ".mdb": // var oleConnection = connection as OleDbConnection; // var schemaTable = oleConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, // new object[] { null, null, null, "TABLE" }); // var tableName = schemaTable.Rows[0]["TABLE_NAME"]; // var cmd = new OleDbCommand("Select * From [" + tableName + "]", oleConnection); // cmd.CommandType = CommandType.Text; // return cmd; // case ".dbf": // var dbfConnection = connection as OleDbConnection; // var dbfCmd = new OleDbCommand("Select * From [" + Path.GetFileName(filePath) + "]", dbfConnection); // dbfCmd.CommandType = CommandType.Text; // return dbfCmd; // } // return null; //} //private IDbCommand CreateUpdateCommand(string ext, DbConnection connection, string filePath) //{ // switch (ext) // { // case ".mdb": // var oleConnection = connection as OleDbConnection; // var schemaTable = oleConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, // new object[] { null, null, null, "TABLE" }); // var tableName = schemaTable.Rows[0]["TABLE_NAME"]; // var cmd = new OleDbCommand("Select * From [" + tableName + "]", oleConnection); // cmd.CommandType = CommandType.Text; // return cmd; // case ".dbf": // var dbfConnection = connection as OleDbConnection; // var dbfCmd = new OleDbCommand("UPDATE [" + Path.GetFileName(filePath) + "] SET CaseID = ?, Status = ? Where RECNO() = ?", dbfConnection); // dbfCmd.Parameters.Add("@CaseID", OleDbType.Char); // dbfCmd.Parameters.Add("@Status", OleDbType.Char); // dbfCmd.Parameters.Add("@RecNo", OleDbType.Integer); // dbfCmd.CommandType = CommandType.Text; // return dbfCmd; // } // return null; //} //private void AddResultColumns(string ext, DbConnection connection, string filePath) //{ // switch (ext) // { // case ".mdb": // var oleConnection = connection as OleDbConnection; // var schemaTable = oleConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, // new object[] { null, null, null, "TABLE" }); // var tableName = schemaTable.Rows[0]["TABLE_NAME"]; // var cmd = new OleDbCommand("Select * From [" + tableName + "]", oleConnection); // cmd.CommandType = CommandType.Text; // break; // case ".dbf": // //var connectionStringDbf = string.Format(@"Data Source={0}; Provider=vfpoledb.1;Exclusive=No;Collating Sequence=Machine;CODEPAGE = 1251", Path.GetDirectoryName(filePath)); // //using (var dbfConnection = new OleDbConnection(connectionStringDbf)) // //{ // //if (connection.State == ConnectionState.Open) // // connection.Close(); // //dbfConnection.Open(); // var dbfConnection = (OleDbConnection)connection; // OleDbCommand dbfCmd = new OleDbCommand("", dbfConnection); // string sql = "ALTER TABLE [" + Path.GetFileName(filePath) + "] ADD COLUMN [CaseID] VARCHAR(200) NULL"; // dbfCmd.CommandType = CommandType.Text; // dbfCmd.CommandText = "ALTER TABLE [" + Path.GetFileName(filePath) + "] ADD COLUMN [CaseID] VARCHAR(200) NULL"; // dbfCmd.ExecuteNonQuery(); // dbfCmd.CommandText = "ALTER TABLE [" + Path.GetFileName(filePath) + "] ADD COLUMN [Status] VARCHAR(200) NULL"; // dbfCmd.ExecuteNonQuery(); // //dbfConnection.Close(); // //connection.Open(); // //} // break; // } //} //private DbConnection GetConnection(string ext, string filePath, bool useVpf = false) //{ // switch (ext) // { // case ".mdb": // m_SourceType = SourceType.Access; // var connectionString = string.Format(@"Data Source={0}; Provider=Microsoft.JET.OLEDB.4.0", filePath); // return new OleDbConnection(connectionString); // case ".dbf": // m_SourceType = SourceType.DBase; // var connectionStringDbf = useVpf ? // string.Format(@"Data Source={0}; Provider=vfpoledb.1;Exclusive=No;Collating Sequence=Machine;CODEPAGE = 1251", Path.GetDirectoryName(filePath)) : // string.Format(@"Data Source={0}; Provider=Microsoft.JET.OLEDB.4.0;Extended Properties=DBase IV; User ID=;Password=;", Path.GetDirectoryName(filePath)); // return new OleDbConnection(connectionStringDbf); // } // return null; //} #endregion #region unused methods //this method of initialization is fast and empty, but can cause problem on 64 bit PC because of absent 64 bit drivers. //it is left as one of possible variants for future //private int GetItemsFromExcel(string filePath) //{ // int result = 0; // string connectionString = // string.Format( // "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0;HDR=No;IMEX=1\"", // filePath); // UploadMaster.Items.Clear(); // var oleExcelConnection = new OleDbConnection(connectionString); // try // { // oleExcelConnection.Open(); // string sheetName = null; // using (var dtTablesList = oleExcelConnection.GetSchema("Tables")) // { // if (dtTablesList.Rows.Count > 0) // { // sheetName = dtTablesList.Rows[0]["TABLE_NAME"].ToString(); // } // dtTablesList.Clear(); // } // if (!string.IsNullOrEmpty(sheetName)) // { // var oleExcelCommand = oleExcelConnection.CreateCommand(); // oleExcelCommand.CommandText = "Select * From [" + sheetName + "]"; // oleExcelCommand.CommandType = CommandType.Text; // var oleExcelReader = oleExcelCommand.ExecuteReader(); // if (oleExcelReader != null) // { // if (oleExcelReader.Read()) // { // if (!ValidateHeader(oleExcelReader)) // { // return 3; // } // while (oleExcelReader.Read()) // { // var itemResult = AddItemFromDataReader(oleExcelReader); // if (itemResult > 0) // result = 4; // if (itemResult == -1)//read data until first empty line // break; // } // } // oleExcelReader.Close(); // } // } // oleExcelConnection.Close(); // m_ExcelFileWrapper.Read(filePath); // } // catch (Exception ex) // { // LogError(ex); // result = 5; // } // return result; //} /// <summary> /// </summary> /// <param name="allCaptions"></param> /// <returns></returns> private bool ValidateHeaderInternal(List <string> allCaptions) { m_HeaderErrors.Clear(); foreach (var cell in m_Upload506Cells) { int count = allCaptions.Count(c => c == cell); if (count == 0) { m_HeaderErrors.Add(string.Format(EidssMessages.Get("msg506AbsentColumn"), cell)); } if (count > 1) { m_HeaderErrors.Add(string.Format(EidssMessages.Get("msg506DuplicateColumn"), cell)); } } return(m_HeaderErrors.Count == 0); }
private void LoadPivotFilterVersionSixFromDB() { try { if (!string.IsNullOrEmpty(SettingsXml)) { CriteriaOperator criteria = CriteriaOperator.Parse(SettingsXml); SetFilterCriteriaForGrid(criteria); } } catch (Exception ex) { SetFilterCriteriaForGrid(null); string msg = EidssMessages.Get("errCannotRestoreAvrFilterFromDb", "Pivot Grid filter can't be restored from Database"); throw new AvrDbException(msg, ex); } }
public ColumnElement(AvrViewColumn col) { this.uniquePath = col.UniquePath; this.fullPath = col.FullPath; this.displayText = col.DisplayText; this.isColumn = true; this.info = col.IsAggregate ? EidssMessages.Get("AggregateColumn") + (col.AggregateFunction.HasValue ? ": " + col.AggregateFunctionName() : "") : EidssMessages.Get("OrdinaryColumn"); this.isAggregate = col.IsAggregate; if (col.IsAggregate) { this.aggrFunction = col.AggregateFunction; this.precision = col.Precision; this.sourceColumn = col.SourceViewColumn; this.denominatorColumn = col.DenominatorViewColumn; } }
public void SimpleValidationTest() { var panel = new BaseDetailForm(); panel.baseDataSet = InitDataset(); var rootValidator = new DateChainValidator(panel, null, "master", "today_100", "Today_100"); var yesterdayValidator = new DateChainValidator(panel, null, "master", "Today_1", "Today_1", null, false, null, false); rootValidator.AddChild(yesterdayValidator); var todayValidator = new DateChainValidator(panel, null, "master", "today", "Today", null, false, null, true); yesterdayValidator.AddChild(todayValidator); var row = panel.baseDataSet.Tables["master"].Rows[0]; test(rootValidator, row, null); var tomorrowValidator = new DateChainValidator(panel, null, "master", "tomorrow", "Tomorrow", null, false, null, true); yesterdayValidator.AddChild(tomorrowValidator); test(rootValidator, row, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Tomorrow", row["tomorrow"], BvMessages.Get("CurrentDate"), DateTime.Today)); tomorrowValidator.CompareWithCurrentDate = false; test(rootValidator, row, null); row["today"] = DBNull.Value; test(rootValidator, row, null); test(todayValidator, row, null); test(yesterdayValidator, row, null); test(tomorrowValidator, row, null); row["today"] = DateTime.Today.AddDays(1); test(rootValidator, row, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today", row["today"], BvMessages.Get("CurrentDate"), DateTime.Today)); row["today"] = DateTime.Today.AddDays(-2); test(rootValidator, row, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today_1", row["today_1"], "Today", row["today"])); test(todayValidator, row, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today_1", row["today_1"], "Today", row["today"])); test(yesterdayValidator, row, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today_1", row["today_1"], "Today", row["today"])); test(tomorrowValidator, row, null); }
private void DeleteSelected() { var msg = EidssMessages.GetForCurrentLang("gis_Message_DelZone", "Would you like to delete selected buffer zone?"); var caption = EidssMessages.GetForCurrentLang("gis_Caption_DelZone", "Delete buffer zone"); if (MessageForm.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (m_SelectedFeature != null) { //MapImage.Cursor = Cursors.WaitCursor; if (!m_IsMoveMode) { ((EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_TargetLayerGuid)).DeleteZone( (long)m_SelectedFeature["idfsGeoObject"]); } else { ((EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_LastMovedTargetLayerGuid)).DeleteZone( (long)m_SelectedFeature["idfsGeoObject"]); } m_SelectedFeature = null; if (m_IsMoveMode) { m_MiApplyMovement.Visible = false; m_MiCancelMovement.Visible = false; m_MiMove.Visible = true; } if (UserDbLayersManager.GetLayerMetadata(m_TargetLayerGuid).m_PivotalLayer != PivotLayerType.None) { m_MiMove.Visible = false; } m_IsMoveMode = false; m_MapImage.CommandToolPress -= m_MapImage_CommandToolPress; //MapImage.Cursor = Cursors.Default; MapImage.Refresh(); } } }
protected override void OnClick() { //need add new extensions var strFilter = EidssMessages.Get("gis_FilterJpg", "JPEG Files|*.jpg", ModelUserContext.CurrentLanguage); var saveFileDialog = new SaveFileDialog { Filter = strFilter, DefaultExt = "jpg" }; if (saveFileDialog.ShowDialog() == DialogResult.OK) { var bitmap = m_MapImage.GetMapImage(297, 210, 300); if (bitmap == null) { return; } bitmap.Save(saveFileDialog.FileName, ImageFormat.Jpeg); } }
public ChartExportDTO ExportChartToJpg(ChartTableDTO zippedData) { try { string layoutName = AvrDbHelper.GetLayoutNameForLog(zippedData.ViewId); Stopwatch watch = TraceMethodCall(layoutName, zippedData); EidssAvrServiceInitializer.CheckAndInitEidssCore(); ChartExportDTO result; using (new CultureInfoTransaction(new CultureInfo(CustomCultureHelper.SupportedLanguages[zippedData.Lang]))) { VirtualChart virtualChart = null; try { lock (m_ChartSyncLock) { virtualChart = new VirtualChart(m_Container); } result = virtualChart.ExportChartToJpg(zippedData, m_ChartSyncLock); } finally { if (virtualChart != null) { lock (m_ChartSyncLock) { virtualChart.Dispose(); } } } } TraceMethodCallFinished(watch, layoutName, zippedData); return(result); } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle, zippedData); string format = EidssMessages.Get("msgCouldNotExportChart", "Could not get Export chart from View. ViewID={0}, Lang={1}"); string msg = String.Format(format, zippedData.ViewId, zippedData.Lang); throw new AvrDataException(msg, ex); } }
public DatabaseNames GetDatabaseName() { try { TraceMethodCall(); return(AvrDbHelper.GetDatabaseNames()); } catch (AvrDataException ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle); throw; } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle); string message = EidssMessages.Get("msgAvrServiceDbNameError", "Could not get service Database names due to internal error."); throw new AvrDataException(message, ex); } }
public DateTime GetQueryRefreshDateTime(long queryId, string lang) { try { if (queryId < 0) { return(DateTime.Now); } TraceMethodCall(queryId, AvrDbHelper.GetQueryNameForLog(queryId), lang); return(AvrDbHelper.GetQueryRefreshDateTime(queryId, lang)); } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle); string format = EidssMessages.Get("msgCouldNotGetQueryCache", "Could not get query cashe refresh date and time for Query ID={0}"); throw new AvrDataException(String.Format(format, queryId), ex); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (m_AskForExit && WinUtils.ConfirmMessage(EidssMessages.Get("msgCloseApp", "Close application?"), EidssMessages.Get("lbCloseAppCaption", "Close Application")) == false) { e.Cancel = true; } if (e.Cancel == false) { if (!BaseFormManager.CloseAll(true)) { e.Cancel = true; } } if (e.Cancel == false) { ExitApp(false); } }
public bool ValidateItems() { var dict = new Dictionary <string, int>(); Items.ForEach(i => { if (dict.ContainsKey(i.HSERV)) { dict[i.HSERV] = dict[i.HSERV] + 1; } else { dict.Add(i.HSERV, 1); } }); var HSERVmaster = BaseSettings.Uploading506HSERVUnique ? dict.OrderByDescending(i => i.Value).FirstOrDefault().Key : ""; var result = true; Items.ForEach(i => { var t = i.ValidateItem(HSERVmaster); result = result && t; }); if (!ValidateDuplicates()) { result = false; } if (result) { SetState(Upload506MasterState.ReadyForCheckDuplicates); } else { //using (var fileProcessor = new Upload506FileProcessor(this)) //{ // fileProcessor.FlushErrors(); //} SetError(Upload506FileError.ValidationError, string.Format(EidssMessages.Get("msgUploadFileValidationError"), GetErrorFileName())); } return(result); }
public void MasterDetailValidationTest() { var panel = new BaseDetailForm(); panel.baseDataSet = InitDataset(); var rootValidator = new DateChainValidator(panel, null, "master", "today_100", "Today_100"); var yesterdayValidator = new DateChainValidator(panel, null, "detail", "Today_1", "Today_1", null, false, null, false); rootValidator.AddChild(yesterdayValidator); var todayValidator = new DateChainValidator(panel, null, "detail", "today", "Today", null, false, null, true); yesterdayValidator.AddChild(todayValidator); var masterRow = panel.baseDataSet.Tables["master"].Rows[0]; var detailRow1 = panel.baseDataSet.Tables["detail"].Rows[0]; var detailRow2 = panel.baseDataSet.Tables["detail"].Rows[1]; test(rootValidator, masterRow, null); test(todayValidator, detailRow1, null); test(todayValidator, detailRow2, null); detailRow2["today"] = DBNull.Value; test(rootValidator, masterRow, null); test(todayValidator, detailRow1, null); test(todayValidator, detailRow2, null); detailRow2["today"] = DateTime.Today.AddDays(1); test(rootValidator, masterRow, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today", detailRow2["today"], BvMessages.Get("CurrentDate"), DateTime.Today)); detailRow2["today"] = DateTime.Today.AddDays(1); test(todayValidator, detailRow1, null); test(todayValidator, detailRow2, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today", detailRow2["today"], BvMessages.Get("CurrentDate"), DateTime.Today)); detailRow2["today"] = DateTime.Today.AddDays(-2); test(rootValidator, masterRow, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today_1", detailRow2["today_1"], "Today", detailRow2["today"])); detailRow2["today"] = DateTime.Today.AddDays(-2); test(todayValidator, detailRow1, null); test(todayValidator, detailRow2, string.Format(EidssMessages.Get("ErrUnstrictChainDate"), "Today_1", detailRow2["today_1"], "Today", detailRow2["today"])); }
public AvrViewColumn AddAggregateColumn() { // if there is no columns in this band - return null if (this is AvrView && Columns.FindAll(col => !col.IsToDelete && col.IsVisible).Count == 0) { return(null); } var colName = EidssMessages.Get("AggregateColumn", "Aggregate Column"); var colFieldName = "AggregateColumn" + DateTime.Now.TimeOfDay; var newCol = new AvrViewColumn(-1, colFieldName, colName, AvrView.DefaultFieldWidth) { IsAggregate = true, Order_Pivot = Columns.Count, OriginalName = colName, UniquePath = colFieldName }; AddColumn(newCol); return(newCol); }
protected override void OnClick() { // set map project state to New condition if (MapImage != null) { var mapControl = MapImage.Parent; if (mapControl != null) { var mapForm = mapControl.Parent; if (mapForm != null & mapForm is CustomizeMapForm) { if (((CustomizeMapForm)mapForm).GetMapProjectState() == MapUtils.MapProjectState.Unsaved) { var msg = EidssMessages.GetForCurrentLang("gis_Form_NewMapProject_SaveMsg", "Would you like to save changes of the current Map Project?"); //"Would you like to save changes of the current Map Project?"; var caption = ""; var dr = MessageForm.Show(msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { if (((CustomizeMapForm)mapForm).SaveMapProject(false)) { // create new CreateNewProject((CustomizeMapForm)mapForm); } } else if (dr == DialogResult.No) { CreateNewProject((CustomizeMapForm)mapForm); } } else { // create new CreateNewProject((CustomizeMapForm)mapForm); } } } } }
public void AddEventLayer(DataSet dataSource, EventLayerSettings settings) { bv.common.Core.Utils.CheckNotNull(dataSource, "dataSource"); bv.common.Core.Utils.CheckNotNull(settings, "settings"); if (dataSource.Tables.Count != 2) { throw new AvrException("Map DataSet should have 2 tables."); } DataTable data = dataSource.Tables[0]; DataTable dictionary = dataSource.Tables[1]; CheckTableColumnExists(data, "id"); CheckTableColumnExists(data, "x"); CheckTableColumnExists(data, "y"); CheckTableColumnExists(dictionary, "ColumnName"); CheckTableColumnExists(dictionary, "ColumnDescription"); CheckTableColumnExists(dictionary, "blnIsGradient"); CheckTableColumnExists(dictionary, "blnIsChart"); string mapTitle = dataSource.DataSetName; string layerName = EidssMessages.Get("gis_avrData", "AVR Data", ModelUserContext.CurrentLanguage); string connection = ConnectionManager.DefaultInstance.ConnectionString; // todo: [Timur] Implement Freezed = true; m_mapImage.SomeTimeAfterMapRefreshed += m_mapImage_SomeTimeAfterMapRefreshed; AddEventLayer(mapTitle, layerName, dataSource, connection); if (settings != null) { SetMapSettings(settings); } m_Settings = _GetMapSettings(); }
public ActionResult SetSelectedPatient(string root, string selectedId) { long idfHumanActual = long.Parse(selectedId); long key = long.Parse(root); long rootKey = (long)((IObject)ModelStorage.GetRoot(Session.SessionID, key, null)).Key; var rootHumanCase = ModelStorage.Get(Session.SessionID, rootKey, null) as HumanCase; var data = new CompareModel(); using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { var patientAccessor = Patient.Accessor.Instance(null); Patient patient = patientAccessor.SelectByKey(manager, idfHumanActual); var contactedPersonAccessor = ContactedCasePerson.Accessor.Instance(null); ContactedCasePerson contactedPerson = contactedPersonAccessor.Create(manager, rootHumanCase, rootKey); contactedPerson.Person = contactedPerson.Person.CopyFrom(manager, patient); long idfPatientRootHuman = patient.idfRootHuman.HasValue ? patient.idfRootHuman.Value : patient.idfHuman; int contactedPersonCount = rootHumanCase.ContactedPerson.Where(x => x.Person.idfRootHuman.Value == idfPatientRootHuman).Count(); if (contactedPersonCount > 0) { string errorMessage = EidssMessages.Get("errContactedPersonDuplicates"); data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); } else if (rootHumanCase.Patient.idfRootHuman == idfPatientRootHuman) { string errorMessage = EidssMessages.Get("errContactedPersonDuplicateRootHuman"); data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); } else { //rootHumanCase.ContactedPerson.Add(contactedPerson); //TODO: remove previous contact contactedPerson.NewObject = true; ModelStorage.Put(Session.SessionID, key, contactedPerson.idfContactedCasePerson, null, contactedPerson); data.Add("idfContactedCasePerson", "", "", contactedPerson.idfContactedCasePerson.ToString(), false, false, false); } } return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = data }); }
private bool ReloadMenu() { m_LangageInitialized = false; ResetLanguage(ModelUserContext.CurrentLanguage); try { WinClientContext.SiteCaption = "( " + EidssSiteContext.Instance.SiteType + " - " + EidssSiteContext.Instance.SiteID + ") " + EidssSiteContext.Instance.SiteABR; } catch (Exception ex) { ErrorForm.ShowError( EidssMessages.Get("errSiteNotDefined", "EIDSS site is not defined. Please reinstall the application with correct Site ID"), ex); ExitApp(true); return(false); } return(true); }
public void DeleteQueryCacheForLanguage(long queryId, string lang, bool leaveLastRecord) { try { TraceMethodCall(queryId, AvrDbHelper.GetQueryNameForLog(queryId), lang); int numberDeleted = AvrDbHelper.DeleteQueryCache(queryId, lang, leaveLastRecord); if (numberDeleted != 0) { string msg = String.Format("Deleted '{0}' old cache records for Query '{1}' for language '{2}'", numberDeleted, queryId, lang); m_Trace.Trace(m_TraceTitle, msg); } } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle, queryId, lang); string format = EidssMessages.Get("msgCouldNotDeleteQueryCache", "Could not delete query cashe. Query ID={0}, Language={1}"); throw new AvrDataException(String.Format(format, queryId, lang), ex); } }
public static string GetLayoutNameWithPrefix(string layoutName, long queryId, long layoutId, string lang, bool isNewObject) { Utils.CheckNotNullOrEmpty(lang, "lang"); var result = layoutName; for (var index = 0; index < int.MaxValue; index++) { var strIndex = index > 0 ? string.Format(" ({0})", index) : string.Empty; var prefix = EidssMessages.Get("msgCopyPrefix", "Copy{0} of", lang); prefix = string.Format(Utils.Str(prefix).Trim(), strIndex); var format = EidssMessages.Get("msgCopyFormat", "{0} {1}", lang); result = string.Format(format, prefix, Utils.Str(layoutName)); if (!IsLayoutExists(result, queryId, layoutId, lang, isNewObject)) { break; } } return(result); }
protected override void OnClick() { if (ZipConstants.DefaultCodePage == 1) { ZipConstants.DefaultCodePage = 437; //bug in OEMCodePage property TODO[enikulin]: is it need? } var strTitle = EidssMessages.GetForCurrentLang("gis_Caption_SaveOpenMpk", "Select map pack"); var strFilter = EidssMessages.GetForCurrentLang("gis_FilterMpk", "Map pack files | *.mpk"); var strError = EidssMessages.GetForCurrentLang("gis_SaveMpkError", "Map can't be saved!"); var strComplete = EidssMessages.GetForCurrentLang("gis_SaveMpkComplete", "Map has been successfully exporting!"); var strCompleteTitle = EidssMessages.GetForCurrentLang("gis_MpkCompleteTitle", "EIDDS Maps"); var saveFileDialog = new SaveFileDialog { Title = strTitle, OverwritePrompt = true, Filter = strFilter }; if (saveFileDialog.ShowDialog(null) == DialogResult.OK) { try { var map = m_MapImage.Map; var settings = m_MapImage.MapSettings; using (new TemporaryWaitCursor()) { MapPacker.PackMap(map, settings, Path.GetFileNameWithoutExtension(saveFileDialog.FileName), saveFileDialog.FileName); } MessageForm.Show(strComplete, strCompleteTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { //TODO[enikulin]: Change this code! //(new EIDSSErrorMessage("errCantSaveMap", strError, ex) ErrorForm.ShowError(strError, ex); } } }
void TimerUpdateListener_Elapsed(object sender, EventArgs e) { if (!UpdateMessenger.CanConnect()) { //if there is no connection, let's check updates more rarely TimerUpdateListener.Interval = 100 * 1000; return; } //Restore default listen interval if connection exists TimerUpdateListener.Interval = UpdateMessenger.ListenInterval; //обновим, что данный экземпляр EIDSS ещё живёт UpdateMessenger.CreateRunningApps(ModelUserContext.ClientID, AppCode); //проверяем не начался ли апдейт //апдейт можно игнорировать, если соблюдаются те же бизнес-правила, что и для старта приложения if (!UpdateMessenger.CanRunApplication(ModelUserContext.ClientID, AppCode)) { //отключаем один таймер и включаем другой, который через 10 минут принудительно выключит приложение TimerUpdateListener.Enabled = false; TimerExit.Enabled = true; ErrorForm.ShowMessageDirect(EidssMessages.Get("ApplicationMustBeClosed")); } }
public static string GetPaswordError(string password, string confirmPassword, EidssSecurityManager security = null) { if (security == null) { security = new EidssSecurityManager(); } if (confirmPassword != password) { return(EidssMessages.Get("msgConfirmPasswordError")); } int minimumLength = security.GetIntPolicyValue("intPasswordMinimalLength", 5); if (password.Length < minimumLength) { return(string.Format(EidssMessages.Get("msgPasswordTooShort"), minimumLength)); } if (!security.ValidatePassword(password)) { return(SecurityMessages.GetLoginErrorMessage(8)); } return(null); }
private string GetMessageByCode(Upload506FileError errorCode) { string errorMessage; switch (errorCode) { case Upload506FileError.Success: errorMessage = null; break; case Upload506FileError.NullFile: // file doesn't exists errorMessage = EidssMessages.Get("msgUploadFileNullFile"); break; case Upload506FileError.IncorrectDataFormat: // incorrect data format in some cells errorMessage = string.Format(EidssMessages.Get("msgUploadFileValidationError"), GetErrorFileName()); break; case Upload506FileError.UsupportedExtension: // usupported extension errorMessage = EidssMessages.Get("msg506UnsupportedExtention"); break; case Upload506FileError.InvalidFileFormat: // invalid file format, error duirng file reading errorMessage = EidssMessages.Get("msgUploadFileInvalidFormat"); break; case Upload506FileError.TooManyRows: // invalid file format, error duirng file reading errorMessage = EidssMessages.Get("msgUploadFileTooManyRows"); break; default: errorMessage = EidssMessages.Get("msgUploadFileError"); break; } return(errorMessage); }
void m_MapSelectBarItem_EditValueChanged(object sender, EventArgs e) { if (m_SelfRefresh) { return; } var cea = new CancelEventArgs(); OnMapChanging(cea); if (cea.Cancel) { m_MapSelectBarItem.EditValueChanged -= m_MapSelectBarItem_EditValueChanged; m_MapSelectBarItem.EditValue = m_OldMapName; m_MapSelectBarItem.EditValueChanged += m_MapSelectBarItem_EditValueChanged; return; } if (m_MapControl != null && m_MapControl.Map != null && m_MapControl.Image != null) { var selectedValue = m_MapSelectBarItem.EditValue as String; string mapFileName; if (selectedValue == MapProjectsStorage.DefaultMapName) { mapFileName = MapProjectsStorage.DefaultMapPath; } else { mapFileName = MapProjectsStorage.GetMapFullPath(MapProjectsStorage.CustomProjectsPath, selectedValue); } var msg = EidssMessages.GetForCurrentLang("gis_Message_OpenMap", "Would you like to open this map?"); var caption = EidssMessages.GetForCurrentLang("gis_Caption_OpenMap", "Open map: "); var errMsg = EidssMessages.GetForCurrentLang("gis_ErrMessage_OpenMap", "Can't open selected map."); if (MessageForm.Show(msg, caption + selectedValue, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var extent = m_MapControl.Map.Envelope.Clone(); try { //check AVR layers and store it for future use if (m_MapControl.Parent is AvrMapControl) { //EventLayer eventLayer = null; LayerGroup eventGroup = null; //foreach (var layer in m_MapControl.Map.Layers) //{ // if (!(layer is EventLayer)) continue; // eventLayer = (EventLayer) layer; // break; //} foreach (LayerGroup layer in m_MapControl.Map.Layers.OfType <LayerGroup>()) { eventGroup = layer; if (eventGroup.Tag.ToString() != "eventgroup") { continue; } eventGroup = layer; break; } var pos = m_MapControl.Map.Layers.IndexOf(eventGroup); (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName); if (eventGroup != null) { m_MapControl.Map.Layers.Insert(pos, eventGroup); } ((AvrMapControl)(m_MapControl.Parent)).UseDynamicData(); Content.RefreshMapContent(); } else { (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName); } m_OldMapName = selectedValue; } catch (Exception ex) { ErrorForm.ShowErrorDirect(errMsg, ex); //return old value m_SelfRefresh = true; m_MapSelectBarItem.EditValue = m_OldMapName; m_SelfRefresh = false; return; } m_MapControl.Map.ZoomToBox(extent); m_MapControl.Refresh(); //deactivate all edit tools if ((m_MapControl.Parent as MapControl).DefaultTool is ControllerMapTool) { ((m_MapControl.Parent as MapControl).DefaultTool as ControllerMapTool).IsActive = true; } } else { //return old value m_SelfRefresh = true; m_MapSelectBarItem.EditValue = m_OldMapName; m_SelfRefresh = false; } } }
private bool Login() { if (!BaseFormManager.CloseAll(true)) { return(true); } if (m_ActivityMonitor != null) { m_ActivityMonitor.Enabled = false; } var manager = new EidssSecurityManager(); manager.LogOut(); Visible = false; if (!LoginForm.DefaultLogin()) { ExitApp(true); return(false); } //reset connection UpdateMessenger.SetConnection((SqlConnection)ConnectionManager.CreateNew().Connection); //check for can run application if (!UpdateMessenger.CanRunApplication(ModelUserContext.ClientID, AppCode)) { ErrorForm.ShowMessageDirect(EidssMessages.Get("ApplicationMustBeClosed")); ExitApp(true); return(false); } if (m_Server == null) { try { RemotingServer.Init(); RemoteEventManager.Singleton.MainForm = this; m_Server = RemoteEventManager.Singleton; } catch (Exception) { ErrorForm.ShowMessageDirect(EidssMessages.Get("errRemotingSockeError", "Unable to start server for communication with EIDSS Client Agent. Please check that no EIDSS application is started in other Windows session or ask adminisrtators to correct TCP port used by EIDSS. If you see this message, you will be not able to open EIDSS form directly from EIDSS Client Agent. Other EIDSS functionality is not changed.")); } } CommonResourcesCache.Reset(); EIDSS_LookupCacheHelper.Init(); BaseForm.ReplicationNeeded = EidssSiteContext.Instance.RealSiteType != SiteType.CDR; CustomCultureHelper.CurrentCountry = EidssSiteContext.Instance.CountryID; if (EidssSiteContext.Instance.IsAzerbaijanCustomization) { panel1.BackgroundImage = Properties.Resources.EIDSS_AZ_Background; Appearance.BackColor = Color.White; } else if (EidssSiteContext.Instance.IsIraqCustomization) { panel1.BackgroundImage = Properties.Resources.EIDSS_IQ_Background; Appearance.BackColor = Color.White; //Appearance.BackColor =Color.FromArgb(96,199,242); } else if (EidssSiteContext.Instance.IsThaiCustomization) { panel1.BackgroundImage = Properties.Resources.EIDSS_TH_Logo; Appearance.BackColor = Color.White; //Appearance.BackColor =Color.FromArgb(96,199,242); } else { panel1.BackgroundImage = Properties.Resources.EIdss_background; Appearance.BackColor = Color.FromArgb(184, 199, 230); } //eidss.model.Core.EidssSiteContext.Instance.CountryID = EIDSS.model.Core.EidssSiteContext.Instance.CountryID; Splash.ShowSplash(); if (!ReloadMenu()) { return(false); } Visible = true; InitAutoLogoutMonitor(); if (BaseSettings.ScanFormsMode) { MessageBox.Show("Change config setting 'ScanFormsMode' to false!!", "ScanFormsMode = true!!"); } return(true); }
public FileResult ExportQueryRoutines(long queryId, int exportType) { if (exportType != 0 && exportType != 1 && exportType != 2) { throw new ArgumentException(EidssMessages.Get("ExportTypeError"), "exportType"); } // export to Access. It's impossible without creating temp file if (exportType == 2) { const int effortCount = 10; int effortNum = 1; WindowsLogHelper.WriteToEventLogWindows("Try to export data to MS Access", EventLogEntryType.Information); //var path = Path.Combine(Path.GetTempPath(), DateTime.Now.Ticks.ToString()); string path = Path.Combine(Server.MapPath("~/App_Data/ExportQueryFiles"), DateTime.Now.Ticks.ToString()); string filename = Path.ChangeExtension(path, "mdb"); WindowsLogHelper.WriteToEventLogWindows(String.Format("Full path = {0}", filename), EventLogEntryType.Information); AccessExporter.ExportAnyCPU(queryId, ModelUserContext.CurrentLanguage, filename); //Thread.Sleep(6000); var fileBytes = new byte[0]; while (effortNum <= effortCount) { try { effortNum++; fileBytes = System.IO.File.ReadAllBytes(filename); break; } catch (Exception) { Thread.Sleep(1000); } } if (fileBytes.Length == 0) { throw new ArgumentException(EidssMessages.Get("Cantreadfile")); } //пробуем удалить файл effortNum = 1; while (effortNum <= effortCount) { try { effortNum++; System.IO.File.Delete(filename); break; } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { } } return(File(fileBytes, MediaTypeNames.Application.Octet, Path.GetFileName(filename))); } // Export to Excel ExportType type = exportType == 0 ? ExportType.Xls : ExportType.Xlsx; CachedQueryResult queryResult = ServiceClientHelper.ExecQuery(queryId, false, string.Empty, true); if (!string.IsNullOrEmpty(queryResult.ErrorMessage)) { //todo:[mike] return queryResult.ErrorMessage to user } List <byte[]> fileBytesList = NpoiExcelWrapper.QueryLineListToExcel(queryResult.QueryTable, type); if (fileBytesList.Count == 0) { throw new AvrDataException(string.Format("Could not export query '{0}' to Excel", queryId)); } // todo: [ELeonov] Should return multifile result if fileBytesList contains more than one element (see task 9516) return(File(fileBytesList[0], MediaTypeNames.Application.Octet, "QueryLineList." + type)); }
public ViewDTO GetCachedView(string sessionId, long layoutId, string lang) { try { m_ViewSemaphore.Wait(); var layout = AvrDbHelper.GetLayoutDTO(layoutId); Stopwatch watch = TraceMethodCall(sessionId, layoutId, layout.DefaultLayoutName, lang); EidssAvrServiceInitializer.CheckAndInitEidssCore(); ViewDTO view = null; var cacheKey = new QueryCacheKey(layout.QueryId, lang, layout.UseArchivedData); long? queryCacheId = AvrDbHelper.GetQueryCacheId(cacheKey, RefreshedCacheOnUserCallAfterDays); if (queryCacheId.HasValue) { var viewCacheId = AvrDbHelper.GetViewCacheId(queryCacheId.Value, layoutId, RefreshedCacheOnUserCallAfterDays); if (viewCacheId.HasValue) { view = AvrDbHelper.GetViewCache(viewCacheId.Value, false); } } if (view == null) { AvrPivotViewModel model = VirtualPivot.CreateAvrPivotViewModel(layoutId, lang, m_Container); string xmlViewHeader = AvrViewSerializer.Serialize(model.ViewHeader); byte[] zippedViewHeader = BinaryCompressor.ZipString(xmlViewHeader); BaseTableDTO serializedDTO = BinarySerializer.SerializeFromTable(model.ViewData); BaseTableDTO zippedDTO = BinaryCompressor.Zip(serializedDTO); view = new ViewDTO(zippedDTO, zippedViewHeader); queryCacheId = AvrDbHelper.GetQueryCacheId(cacheKey, RefreshedCacheOnUserCallAfterDays); if (queryCacheId.HasValue) { AvrDbHelper.SaveViewCache(queryCacheId.Value, layoutId, view); } } TraceMethodCallFinished(watch, sessionId, layoutId, layout.DefaultLayoutName, lang); return(view); } catch (OutOfMemoryException ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle, sessionId, layoutId, lang); throw new AvrDataException(EidssMessages.Get("ErrAVROutOfMemory"), ex); } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle, sessionId, layoutId, lang); string format = EidssMessages.Get("msgCouldNotGetViewData", "Could not get View Data from Layout. LayoutID={0}, Lang={1}, SessionId={2}"); string msg = String.Format(format, layoutId, lang, sessionId); throw new AvrDataException(msg, ex); } finally { m_ViewSemaphore.Release(); } }
public void ResetLanguage(string langID) { if (Localizer.SupportedLanguages.ContainsKey(langID) == false) { langID = Localizer.lngEn; } if (m_LangageInitialized && ModelUserContext.CurrentLanguage == langID) { return; } if (!BaseFormManager.CloseNonListForms(true)) { return; } //if (BaseForm.SaveAllOpenedForms == false) //{ // return; //} Cursor = Cursors.WaitCursor; try { Enabled = false; //BaseForm.SetEnabled(false); SuspendLayout(); ModelUserContext.CurrentLanguage = langID; //Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName if (LookupCache.Language != langID) { LookupCache.Reload(); } langID = CustomCultureHelper.GetCustomCultureName(langID); var cultureInfo = new CultureInfo(langID); EidssSiteContext.Instance.UpdateDateTimeFormat(cultureInfo); //EidssSiteContext.Instance.Clear(); if (m_LangageInitialized) { EidssEventLog.Instance.CreateEvent(EventType.ClientUILanguageChanged, null, null); } m_LangageInitialized = true; Thread.CurrentThread.CurrentUICulture = cultureInfo; Thread.CurrentThread.CurrentCulture = cultureInfo; WinClientContext.InitFont(); CommonResourcesCache.Reset(); ToolTipController.InitTooltipController(); DefaultBarAndDockingController1.InitBarAppearance(); tbToolbar.Appearance.InitAppearance(); tbMenu.Appearance.InitAppearance(); tbStatusbar.Appearance.InitAppearance(); Appearance.InitAppearance(); WinClientContext.ApplicationCaption = EidssMessages.Get("EIDSS_Caption", "Electronic Integrated Disease Surveillance System"); Text = GetCaption(WinClientContext.ApplicationCaption); barManager1.RightToLeft = (Localizer.IsRtl) ? DefaultBoolean.True : DefaultBoolean.False; RightToLeft = (Localizer.IsRtl) ? RightToLeft.Yes : RightToLeft.No; RightToLeftLayout = Localizer.IsRtl; sbiUser.Caption = EidssUserContext.User.FullName; sbiOrganization.Caption = EidssSiteContext.Instance.OrganizationName; sbiSite.Caption = (EidssSiteContext.Instance.SiteType + @"-" + EidssSiteContext.Instance.SiteCode); sbiCountry.Caption = EidssSiteContext.Instance.CountryName; var resources = new ResourceManager(typeof(MainForm)); sbiCountryLabel.Caption = resources.GetString("sbiCountryLabel.Caption"); sbiCountryLabel.Description = resources.GetString("sbiCountryLabel.Description"); sbiCountryLabel.Hint = resources.GetString("sbiCountryLabel.Hint"); sbiSiteLable.Caption = resources.GetString("sbiSiteLable.Caption"); sbiSiteLable.Description = resources.GetString("sbiSiteLable.Description"); sbiSiteLable.Hint = resources.GetString("sbiSiteLable.Hint"); sbiOrganizationLable.Caption = resources.GetString("sbiOrganizationLable.Caption"); sbiOrganizationLable.Description = resources.GetString("sbiOrganizationLable.Description"); sbiOrganizationLable.Hint = resources.GetString("sbiOrganizationLable.Hint"); sbiUserLabel.Caption = resources.GetString("sbiUserLabel.Caption"); sbiUserLabel.Description = resources.GetString("sbiUserLabel.Description"); sbiUserLabel.Hint = resources.GetString("sbiUserLabel.Hint"); DesignControlManager.Create(this); RegisterActions(); BaseFormManager.ResetLanguage(); EidssSiteContext.ReportFactory.ResetLanguage(); WinUtils.SwitchInputLanguage(); BasicSyndromicSurveillanceListItem.Init(); } catch (Exception ex) { Dbg.Debug(ex.ToString()); } finally { if (m_LanguageMenu.ToolbarItem != null && m_LanguageMenu.MenuItem != null) { if (IsLangMenuWithoutFlags) { m_LanguageMenu.ToolbarItem.Caption = Localizer.GetMenuLanguageName(ModelUserContext.CurrentLanguage); } else { if (ModelUserContext.CurrentLanguage == Localizer.lngEn) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.English; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.English; } else if (ModelUserContext.CurrentLanguage == Localizer.lngRu) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Russian; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Russian; } else if (ModelUserContext.CurrentLanguage == Localizer.lngAzLat) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Azery; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Azery; } else if (ModelUserContext.CurrentLanguage == Localizer.lngGe) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Georgian; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Georgian; } else if (ModelUserContext.CurrentLanguage == Localizer.lngKz) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Kazakhstan; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Kazakhstan; } else if (ModelUserContext.CurrentLanguage == Localizer.lngAr) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Armenian; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Armenian; } else if (ModelUserContext.CurrentLanguage == Localizer.lngUk) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Ukrainian; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Ukrainian; } else if (ModelUserContext.CurrentLanguage == Localizer.lngIraq) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Iraq; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Iraq; } else if (ModelUserContext.CurrentLanguage == Localizer.lngLaos) { m_LanguageMenu.ToolbarItem.LargeImageIndex = -1; m_LanguageMenu.MenuItem.ImageIndex = -1; } else if (ModelUserContext.CurrentLanguage == Localizer.lngVietnam) { m_LanguageMenu.ToolbarItem.LargeImageIndex = -1; m_LanguageMenu.MenuItem.ImageIndex = -1; } else if (ModelUserContext.CurrentLanguage == Localizer.lngThai) { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.Thailand; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.Thailand; } else { m_LanguageMenu.ToolbarItem.LargeImageIndex = (int)MenuIcons.English; m_LanguageMenu.MenuItem.ImageIndex = (int)MenuIconsSmall.English; } } m_LanguageMenu.ToolbarItem.Hint = Localizer.GetLanguageName(ModelUserContext.CurrentLanguage); } Enabled = true; //BaseForm.SetEnabled(true); Cursor = Cursors.Default; ResumeLayout(); BringToFront(); Activate(); } }
private QueryTableHeaderDTO GetInternalCachedQueryTableHeader(long queryId, bool isSchedulerCall, string lang, bool isArchive) { try { string queryName = AvrDbHelper.GetQueryNameForLog(queryId); Stopwatch watch = TraceMethodCall(queryId, queryName, lang, isArchive); EidssAvrServiceInitializer.CheckAndInitEidssCore(); var cacheKey = new QueryCacheKey(queryId, lang, isArchive); long?id = AvrDbHelper.GetQueryCacheId(cacheKey, RefreshedCacheOnUserCallAfterDays); if (!id.HasValue) { bool needExecute; lock (m_CacheSyncLock) { needExecute = !m_QueryCacheList.Contains(cacheKey); if (needExecute) { m_QueryCacheList.Add(cacheKey); if (!m_QueryCacheSyncLock.ContainsKey(cacheKey)) { m_QueryCacheSyncLock.Add(cacheKey, new object()); } if (!m_QueryCacheErrors.ContainsKey(cacheKey)) { m_QueryCacheErrors.Add(cacheKey, false); } } } lock (m_QueryCacheSyncLock[cacheKey]) { try { if (needExecute) { try { id = AvrDbHelper.GetQueryCacheId(cacheKey, RefreshedCacheOnUserCallAfterDays); if (!id.HasValue) { QueryTableModel tableModel = AvrDbHelper.GetQueryResult(queryId, lang, isArchive); id = AvrDbHelper.SaveQueryCache(tableModel); } } finally { lock (m_CacheSyncLock) { m_QueryCacheErrors[cacheKey] = !id.HasValue; m_QueryCacheList.Remove(cacheKey); } } } else { while (true) { lock (m_CacheSyncLock) { if (!m_QueryCacheList.Contains(cacheKey)) { break; } } Monitor.Wait(m_QueryCacheSyncLock[cacheKey]); } lock (m_CacheSyncLock) { if (m_QueryCacheErrors[cacheKey]) { string message = EidssMessages.Get("msgCouldNotGetQueryCacheHeaderGeneral", "Could not get header of query cashe table. For detail see previous exception logged"); throw new AvrDataException(message); } } id = AvrDbHelper.GetQueryCacheId(cacheKey, RefreshedCacheOnUserCallAfterDays, true); } } finally { Monitor.PulseAll(m_QueryCacheSyncLock[cacheKey]); } } } if (!id.HasValue) { string msg = EidssMessages.Get("msgCouldNotGetQueryCacheId", "Could not get query cashe ID. See log for more details."); throw new AvrDataException(msg); } QueryTableHeaderDTO header = AvrDbHelper.GetQueryCacheHeader(id.Value, isSchedulerCall, isArchive); TraceMethodCallFinished(watch, queryId, queryName, lang, isArchive); return(header); } catch (Exception ex) { m_Trace.TraceMethodException(ex, Utils.GetCurrentMethodName(), m_TraceTitle, queryId, lang); string format = EidssMessages.Get("msgCouldNotGetQueryCacheHeader", "Could not get header of query cashe table. Query ID={0}, Language={1}"); throw new AvrDataException(String.Format(format, queryId, lang), ex); } }
internal static string TranslateLayerName(string layerName) { switch (layerName) { case SystemLayerNames.Countries: return(EidssMessages.GetForCurrentLang("gis_LayerNames_Country", "Countries")); case SystemLayerNames.Regions: return(EidssMessages.GetForCurrentLang("gis_LayerNames_Regions", "Regions")); case SystemLayerNames.Rayons: return(EidssMessages.GetForCurrentLang("gis_LayerNames_Rayons", "Rayons")); case SystemLayerNames.Settlements: return(EidssMessages.GetForCurrentLang("gis_LayerNames_Settlements", "Settlements")); case "gisWKBEarthRoad": return(EidssMessages.GetForCurrentLang("gis_LayerNames_EarthRoad", "Earth roads")); case "gisWKBHighway": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Highway", "Highways")); case "gisWKBInlandWater": return(EidssMessages.GetForCurrentLang("gis_LayerNames_InlandWater", "Inland water")); case "gisWKBLake": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Lake", "Lakes")); case "gisWKBMainRiver": return(EidssMessages.GetForCurrentLang("gis_LayerNames_MainRiver", "Main rivers")); case "gisWKBMajorRoad": return(EidssMessages.GetForCurrentLang("gis_LayerNames_MajorRoad", "Major roads")); case "gisWKBRailroad": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Railroad", "Railroads")); case "gisWKBRiver": return(EidssMessages.GetForCurrentLang("gis_LayerNames_River", "Rivers")); case "gisWKBSea": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Sea", "Sea")); case "gisWKBSmallRiver": return(EidssMessages.GetForCurrentLang("gis_LayerNames_SmallRiver", "Small rivers")); case "gisWKBForest": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Forest", "Forests")); case "gisWKBLanduse": return(EidssMessages.GetForCurrentLang("gis_LayerNames_Landuse", "Land use")); case "gisWKBRuralDistrict": return(EidssMessages.GetForCurrentLang("gis_LayerNames_RuralDistrict", "Rural districts")); case "gisWKBDistrict": return(EidssMessages.GetForCurrentLang("gis_LayerNames_District", "Districts")); default: return(layerName); } }