private QueryFilterControl CreateFilterControl(string lang = "en") { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); ConnectionManager.DefaultInstance.SetCredentials(Config.GetSetting("EidssConnectionString")); EidssUserContext.Init(); context = ModelUserContext.Instance as EidssUserContext; Security = new EidssSecurityManager(); int result = Security.LogIn(Organizaton, Admin, AdminPassword); Assert.AreEqual(0, result); EIDSS_LookupCacheHelper.Init(); EidssUserContext.CurrentLanguage = lang; var queryDb = new Query_DB(); var querySearchObjectDb = new QuerySearchObject_DB(); var queryDs = queryDb.LoadDetailData(QueryId); DataRow row = queryDs.Tables[Query_DB.TasQueryObjectTree].Rows[0]; var searchObjectsDs = querySearchObjectDb.LoadDetailData(row["idfQuerySearchObject"]); var form = new Form(); var filter = new QueryFilterControl { Parent = form, Dock = DockStyle.Fill }; filter.Init(); filter.Bind((long)queryDs.Tables[1].Rows[0]["idfQuerySearchObject"], searchObjectsDs); return(filter); }
private static void Init() { Config.DefaultGlobalConfigFileName = Constants.GlobalEidssConfigName; DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init(); EIDSS_LookupCacheHelper.Init(); }
protected void Application_Start(object sender, EventArgs e) { var connectionCredentials = new ConnectionCredentials(); DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString); EidssUserContext.Init(); }
protected void Application_Start() { var connectionCredentials = new ConnectionCredentials(); TranslationToolHelper.SetDefaultTranslationPath(); DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString); EidssUserContext.Init(); CustomCultureHelper.CurrentCountry = EidssSiteContext.Instance.CountryID; EIDSS_LookupCacheHelper.Init(); LookupCacheListener.Cleanup(); LookupCacheListener.Listen(); Localizer.MenuMessages = EidssMenu.Instance; ClassLoader.Init("eidss_db.dll", bv.common.Core.Utils.GetDesktopExecutingPath()); //AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); InputBuilder.BootStrap(); BaseFieldValidator.FieldCaptions = EidssFields.Instance; ModelBinders.Binders.DefaultBinder = new DevExpressEditorsBinder(); SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin")); XtraWebLocalizer.Activate(); }
public static void InitEidssCore() { DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init(); Localizer.MenuMessages = EidssMenu.Instance; BaseFieldValidator.FieldCaptions = EidssFields.Instance; }
public void MyTestInitialize() { lock (m_Lock) { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", null)); EidssUserContext.Init(); EidssUserContext.ApplicationName = "test"; } }
public static void InitDBAndLogin() { InitSupportedLanguages(); EIDSS_LookupCacheHelper.Init(); EidssUserContext.Init(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); var target = new EidssSecurityManager(); int result = target.LogIn(Organizaton, Admin, AdminPassword); Assert.AreEqual(0, result); }
protected void Application_Start(object sender, EventArgs e) { var connectionCredentials = new ConnectionCredentials(); DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString); EidssUserContext.Init(); LookupCacheListener.Cleanup(); LookupCacheListener.Listen(); Localizer.MenuMessages = EidssMenu.Instance; AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); }
public void TestInitialize() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); ConnectionManager.DefaultInstance.SetCredentials(Config.GetSetting("EidssConnectionString")); EidssUserContext.Init(); context = ModelUserContext.Instance as EidssUserContext; m_Security = new EidssSecurityManager(); int result = m_Security.LogIn(Organizaton, Admin, AdminPassword); Assert.AreEqual(0, result); EIDSS_LookupCacheHelper.Init(); //while(!LookupCache.Filled) // Thread.Sleep(500); ModelUserContext.CurrentLanguage = "en"; }
public void FarmPanelCollection() { EidssUserContext.Init(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); using (var context = ModelUserContext.Instance as EidssUserContext) { var target = new EidssSecurityManager(); int result = target.LogIn(Organizaton, Admin, AdminPassword); Assert.AreEqual(0, result); using (var manager = DbManagerFactory.Factory.Create(context)) { var acc = VetCase.Accessor.Instance(null); var vetcase = (VetCase)acc.CreateNew(manager, null, (int)HACode.Livestock); var panel = vetcase.Farm; var herdaccessor = VetFarmTree.Accessor.Instance(null); VetFarmTree farm = panel.FarmTree[0]; VetFarmTree herd = herdaccessor.CreateHerd(manager, panel, farm); VetFarmTree spec = herdaccessor.CreateSpecies(manager, panel, herd); spec.SpeciesType = spec.SpeciesTypeLookup.FirstOrDefault(c => c.idfsBaseReference == 837790000000); //spec.idfsSpeciesTypeReference = 837790000000; panel.FarmTree.Add(herd); panel.FarmTree.Add(spec); panel.Address.Region = panel.Address.RegionLookup.FirstOrDefault(); panel.Address.Rayon = panel.Address.RayonLookup.FirstOrDefault(); panel.Address.Settlement = panel.Address.SettlementLookup.FirstOrDefault(); var animal = (AnimalListItem)AnimalListItem.Accessor.Instance(null).CreateNew(manager, vetcase, (int)HACode.Livestock); animal.idfSpecies = spec.idfParty; animal.idfHerd = herd.idfParty; animal.idfCase = vetcase.idfCase; vetcase.AnimalList.Add(animal); //vetcase.Validation += new ValidationEvent(panel_Validation); //acc.Post(manager, vetcase); //vetcase.Validation -= panel_Validation; } } }
public void MyTestInitialize() { //DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", "")); //ClassLoader.Init("eidss*.dll", Environment.MachineName.Equals("LEONOV") ? @"c:\Projects\EIDSS4\eidss.main\bin\Debug\" : null); ClassLoader.Init("eidss*.dll", null); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", "")); EidssUserContext.Init(); var target = new EidssSecurityManager(); const string organizaton = "NCDC&PH"; const string admin = "test_admin"; //const string User = "******"; const string adminPassword = "******"; //const string UserPassword = "******"; int result = target.LogIn(organizaton, admin, adminPassword); Assert.AreEqual(0, result); }
//[Ignore] public void VsSummaryTableTest() { EidssUserContext.Init(); var session = VsSessionTest.GetTestSession(); var frm = new Form { Size = new Size(500, 300), StartPosition = FormStartPosition.CenterScreen, }; var navBarControl = new NavBarControl(); frm.Controls.Add(navBarControl); navBarControl.Dock = DockStyle.Fill; navBarControl.FillTestSummary(SummaryTable.GetSummaryTables(session.FieldTests)); frm.ShowDialog(); EidssUserContext.Clear(); }
public void TestCompareSQLtoCS() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); ConnectionManager.DefaultInstance.SetCredentials(Config.GetSetting("EidssConnectionString")); EidssUserContext.Init(); using (var manager = DbManagerFactory.Factory.Create()) { for (int year = 1900; year <= 2050; year++) { for (int day = 24; day <= 31; day++) { DateTime dt = new DateTime(year, 12, day); Assert.AreEqual(DatePeriodHelper.GetWeekOfYear(dt), manager.SetCommand("SET DATEFIRST 1; select dbo.fnWeekDatepart('" + dt.ToString("yyyyMMdd") + "')").ExecuteScalar()); } for (int day = 1; day <= 7; day++) { DateTime dt = new DateTime(year, 1, day); Assert.AreEqual(DatePeriodHelper.GetWeekOfYear(dt), manager.SetCommand("SET DATEFIRST 1; select dbo.fnWeekDatepart('" + dt.ToString("yyyyMMdd") + "')").ExecuteScalar()); } } } }
public void ImportFromMdbFileTest() { string path = PathToTestFolder.Get(TestFolders.Db) + "Data\\"; long start = 1009508; long chunkSize = 10000; EidssUserContext.Init(); DbManagerFactory.SetSqlFactory(bv.common.Configuration.Config.GetSetting("EidssConnectionString")); for (long i = start; i < 1009509; i += chunkSize) { var timer = new PerformanceTimer("mdb records loading", 0); using (var _manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { var _accessor = Upload506Master.Accessor.Instance(null); var _master = _accessor.CreateNewT(_manager, null); var result = _master.GetItems(path + "Cddata.mdb", i, chunkSize); timer.Stop(); Debug.WriteLine("records from {0} to {1} loading time:{2}", i, i + chunkSize, timer.Time()); timer = new PerformanceTimer("set item resolution", 0); foreach (var item in _master.Items) { item.Resolution = (int)Upload506Resolution.Created; } timer.Stop(); Debug.WriteLine("set item resolution time:{0}", timer.Time()); Assert.AreEqual(Upload506FileError.Success, result); Assert.AreEqual(chunkSize, _master.Items.Count); Assert.AreEqual(Upload506MasterState.ReadyForValidation, _master.GetState()); timer = new PerformanceTimer("post", 0); Assert.IsTrue(_accessor.Post(_manager, _master)); timer.Stop(); Debug.WriteLine("records from {0} to {1} posting time:{2}", i, i + chunkSize, timer.Time()); } } EidssUserContext.Clear(); }
public void TestInit() { DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init(); }
public void FFDeterminantWindowTest() { EidssUserContext.Init(); var dbService = new DbService(); var transactionOpened = false; SqlTransaction transaction = null; try { if (dbService.Connection.State == ConnectionState.Closed) { dbService.Connection.Open(); } Assert.IsTrue(dbService.Connection.State == ConnectionState.Open); dbService.LoadFormTypes(); Assert.IsTrue(dbService.MainDataSet.FormTypes.Count > 0); dbService.LoadSections(null, null, null); Assert.IsTrue(dbService.MainDataSet.Sections.Count > 0); dbService.LoadParameters(null, null); Assert.IsTrue(dbService.MainDataSet.Parameters.Count > 0); var rowFormType = Enumerable.Where(dbService.MainDataSet.FormTypes, c => c.idfsFormType == (long)FFTypeEnum.VectorTypeSpecificData). SingleOrDefault(); Assert.IsNotNull(rowFormType); #region Создаём новый шаблон var rowTemplate = dbService.MainDataSet.Templates.NewTemplatesRow(); rowTemplate.idfsFormType = rowFormType.idfsFormType; //если это первый шаблон в своём типе формы, то сделаем его UNI rowTemplate.blnUNI = (dbService.GetTemplatesByFormType(rowFormType.idfsFormType).Length == 0); rowTemplate.DefaultName = "Template1"; rowTemplate.NationalName = "Template1"; rowTemplate.NationalLongName = "Template Long name 1"; rowTemplate.langid = ModelUserContext.CurrentLanguage; dbService.MainDataSet.Templates.AddTemplatesRow(rowTemplate); #endregion var form = new FFDeterminants(dbService, rowTemplate); BaseFormManager.ShowModal(form, null); //BaseFormManager.ShowModal(form, null, ref id, null, null); Assert.IsNotNull(form.SelectedDeterminantsRow); //присваиваем шаблону выбранный детерминант var determinant = dbService.CreateTemplateDeterminantValuesRow(form.SelectedDeterminantsRow, rowTemplate.idfsFormTemplate, rowTemplate.idfsFormType); //сохраняем transaction = (SqlTransaction)dbService.Connection.BeginTransaction(); transactionOpened = true; dbService.PostDetail(dbService.MainDataSet, 0, transaction); // Assert.IsTrue(determinant.idfDeterminantValue > -1); Assert.IsTrue(rowTemplate.idfsFormTemplate > -1); transaction.Commit(); transactionOpened = false; //создаём новый датасервис, чтобы проверить, сохранились ли детерминанты var dbService2 = new DbService(); dbService2.LoadTemplateDeterminants(rowTemplate.idfsFormTemplate); var determinantTemplate = dbService2.MainDataSet.TemplateDeterminantValues.SingleOrDefault(c => c.idfDeterminantValue == determinant.idfDeterminantValue); Assert.IsNotNull(determinantTemplate); #region удаляем добавленные элементы dbService.DeleteDeterminantsFromTemplate(rowTemplate.idfsFormTemplate); rowTemplate.Delete(); #endregion dbService.PostDetail(dbService.MainDataSet, 0, null); //transaction.Rollback(); //transactionOpened = false; } finally { if ((transaction != null) && transactionOpened) { transaction.Rollback(); } if (dbService.Connection.State != ConnectionState.Closed) { dbService.Connection.Close(); } } EidssUserContext.Clear(); }
static void Main(string[] args) { Config.DefaultGlobalConfigFileName = Constants.GlobalEidssConfigName; bool showMessage = true; if (!OneInstanceApp.Run(true, ref showMessage)) { if (showMessage) { ErrorForm.ShowMessage("msgEIDSSRunning", "You can\'t run multiple EIDSS instances simultaneously. Other instance of EIDSS is running already"); } return; } //Application.SetCompatibleTextRenderingDefault(False) var eh = new UnhandledExceptionHandler(); // Adds the event handler to the event. Application.ThreadException += eh.OnThreadException; try { DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init( () => EidssSiteContext.Instance.SiteType != SiteType.CDR && WinUtils.ConfirmMessage(BvMessages.Get("msgReplicationPrompt", "Start the replication to transfer data on other sites?"), BvMessages.Get("msgREplicationPromptCaption", "Confirm Replication")), () => { EidssEventLog.Instance.CheckNotificationService(); EidssEventLog.Instance.StartReplication(); } ); ClassLoader.Init("bv_common.dll", null); ClassLoader.Init("bvwin_common.dll", null); ClassLoader.Init("bv.common.dll", null); ClassLoader.Init("bv.winclient.dll", null); ClassLoader.Init("eidss*.dll", null); Localizer.MenuMessages = EidssMenu.Instance; TranslationToolHelper.RootPath = Directory.GetParent(Application.CommonAppDataPath).FullName; WinClientContext.ApplicationCaption = EidssMessages.Get("EIDSS_Caption", "Electronic Integrated Disease Surveillance System"); WinClientContext.Init(); //DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.eidssmoneyskin).Assembly); if (!string.IsNullOrEmpty(BaseSettings.SkinAssembly) && File.Exists(BaseSettings.SkinAssembly)) { DevExpress.Skins.SkinManager.Default.RegisterAssembly( Assembly.LoadFrom(BaseSettings.SkinAssembly)); } else { DevExpress.Skins.SkinManager.Default.RegisterAssembly( typeof(DevExpress.UserSkins.eidssskin).Assembly); } //DevExpress.UserSkins.BonusSkins.Register(); //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(False) DevExpress.Skins.SkinManager.EnableFormSkins(); Application.DoEvents(); Splash.ShowSplash(); //BV.common.db.Core.ConnectionManager.DefaultInstance.ConfigFilesToSave = new string[] {"EIDSS_ClientAgent.exe.config"}; //string appdir = System.IO.Path.GetDirectoryName(Application.ExecutablePath); //var defHelpName = Config.GetSetting("HelpUrl", "file:///" + appdir.Replace("\\", "/") + "/WebHelp_EIDSS_with_Search/"); var defHelpName = Config.GetSetting("HelpUrl"); WinClientContext.HelpNames.Add(Localizer.lngEn, Config.GetSetting("HelpUrl." + Localizer.lngEn, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngRu, Config.GetSetting("HelpUrl." + Localizer.lngRu, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngGe, Config.GetSetting("HelpUrl." + Localizer.lngGe, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngKz, Config.GetSetting("HelpUrl." + Localizer.lngKz, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngUzCyr, Config.GetSetting("HelpUrl." + Localizer.lngUzCyr, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngUzLat, Config.GetSetting("HelpUrl." + Localizer.lngUzLat, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngAzLat, Config.GetSetting("HelpUrl." + Localizer.lngAzLat, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngUk, Config.GetSetting("HelpUrl." + Localizer.lngUk, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngAr, Config.GetSetting("HelpUrl." + Localizer.lngAr, defHelpName)); WinClientContext.HelpNames.Add(Localizer.lngThai, Config.GetSetting("HelpUrl." + Localizer.lngThai, defHelpName)); //DevXLocalizer.ForceResourceAdding(); DevXLocalizer.Init(); WinClientContext.FieldCaptions = EidssFields.Instance; BaseFieldValidator.FieldCaptions = EidssFields.Instance; ErrorForm.Messages = EidssMessages.Instance; BaseActionPanel.Messages = EidssMessages.Instance; ErrorMessage.Messages = EidssMessages.Instance; BvLookupColumnInfo.Messages = EidssMessages.Instance; bv.common.win.BaseValidator.Messages = EidssMessages.Instance; bv.common.win.BaseForm.EventLog = EidssEventLog.Instance; bv.common.win.BaseDetailForm.cancelMode = bv.common.win.BaseDetailForm.CancelCloseMode.CallPost; //CheckHelpRegistration(); //LayoutHelper.Init(); Application.EnableVisualStyles(); //DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true; //Application.SetCompatibleTextRenderingDefault(false); ActionLocker.ShowWaitDialog = WaitDialog.ShowWaitDialog; ActionLocker.CloseWaitDialog = WaitDialog.CloseWaitDialog; Application.Idle += ApplicationOnIdle; SecurityLog.WriteToEventLogDB(null, SecurityAuditEvent.ProcessStart, true, null, null, "EIDSS is started", SecurityAuditProcessType.Eidss); Dbg.Debug("EIDSS is started with ClientID {0}", ModelUserContext.ClientID); Application.Run(new MainForm()); Utils.SaveUsedXtraResource(); } catch (Exception ex) { MessageForm.Show(ex.ToString(), "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); MainForm.ExitApp(true); } }
public void StatisticImportTest() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", "")); EidssUserContext.Init(); using (var context = EidssUserContext.Instance) { StatisticHelper helper = new StatisticHelper(); int result = helper.Import(PathToTestFolder.Get(TestFolders.Db) + "Data\\StatisticData_Errors.csv", false); Assert.AreEqual(0, result); //Assert.AreEqual(4, helper.RowsAffected); Assert.AreEqual(10, helper.Errors.Count); Assert.AreEqual("errMissingField", helper.Errors[0].MessageID); Assert.AreEqual(0, helper.Errors[0].LineNumber); Assert.AreEqual("errInvalidStatisticType", helper.Errors[1].MessageID); Assert.AreEqual(1, helper.Errors[1].LineNumber); Assert.AreEqual("errInvalidStatisticValue", helper.Errors[2].MessageID); Assert.AreEqual(2, helper.Errors[2].LineNumber); Assert.AreEqual("errInvalidDateFormat", helper.Errors[3].MessageID); Assert.AreEqual(3, helper.Errors[3].LineNumber); Assert.AreEqual("errInvalidYearStartDate", helper.Errors[4].MessageID); Assert.AreEqual(4, helper.Errors[4].LineNumber); Assert.AreEqual("errInvalidCountry", helper.Errors[5].MessageID); Assert.AreEqual(5, helper.Errors[5].LineNumber); Assert.AreEqual("errInvalidRegion", helper.Errors[6].MessageID); Assert.AreEqual(6, helper.Errors[6].LineNumber); Assert.AreEqual("errInvalidRayon", helper.Errors[7].MessageID); Assert.AreEqual(7, helper.Errors[7].LineNumber); Assert.AreEqual("errInvalidParameter", helper.Errors[8].MessageID); Assert.AreEqual(8, helper.Errors[8].LineNumber); Assert.AreEqual("errMalFormedCvs", helper.Errors[9].MessageID); Assert.AreEqual(9, helper.Errors[9].LineNumber); Assert.IsTrue(helper.RowsAffected <= 3); result = helper.Import(PathToTestFolder.Get(TestFolders.Db) + "Data\\StatisticData_BadHeader.csv", false); Assert.AreEqual(-1, result); Assert.AreEqual(1, helper.Errors.Count); Assert.AreEqual("errStatisticImportFieldsQty", helper.Errors[0].MessageID); Assert.AreEqual(-1, helper.Errors[0].LineNumber); result = helper.Import(PathToTestFolder.Get(TestFolders.Db) + "Data\\StatisticData_BadHeader1.csv", false); Assert.AreEqual(-1, result); Assert.AreEqual(1, helper.Errors.Count); Assert.AreEqual("errStatisticImportFieldsQty", helper.Errors[0].MessageID); Assert.AreEqual(-1, helper.Errors[0].LineNumber); result = helper.Import(PathToTestFolder.Get(TestFolders.Db) + "Data\\StatisticData_Good.csv", false); Assert.AreEqual(0, result); Assert.AreEqual(9, helper.Errors.Count); Assert.AreEqual("errMissingField", helper.Errors[0].MessageID); Assert.AreEqual(0, helper.Errors[0].LineNumber); Assert.AreEqual("errInvalidStatisticType", helper.Errors[1].MessageID); Assert.AreEqual(1, helper.Errors[1].LineNumber); Assert.AreEqual("errInvalidStatisticValue", helper.Errors[2].MessageID); Assert.AreEqual(2, helper.Errors[2].LineNumber); Assert.AreEqual("errInvalidDateFormat", helper.Errors[3].MessageID); Assert.AreEqual(3, helper.Errors[3].LineNumber); Assert.AreEqual("errInvalidYearStartDate", helper.Errors[4].MessageID); Assert.AreEqual(4, helper.Errors[4].LineNumber); Assert.AreEqual("errInvalidCountry", helper.Errors[5].MessageID); Assert.AreEqual(5, helper.Errors[5].LineNumber); Assert.AreEqual("errInvalidRegion", helper.Errors[6].MessageID); Assert.AreEqual(6, helper.Errors[6].LineNumber); Assert.AreEqual("errInvalidRayon", helper.Errors[7].MessageID); Assert.AreEqual(7, helper.Errors[7].LineNumber); Assert.AreEqual("errInvalidParameter", helper.Errors[8].MessageID); Assert.AreEqual(8, helper.Errors[8].LineNumber); Assert.IsTrue(helper.RowsAffected <= 3); } }
public override void MyTestInitialize() { EidssUserContext.Init(); context = ModelUserContext.Instance as EidssUserContext; base.MyTestInitialize(); }
public void TestInit() { EidssUserContext.Init(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", "")); }