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(); }
private static void Init() { Config.DefaultGlobalConfigFileName = Constants.GlobalEidssConfigName; DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init(); EIDSS_LookupCacheHelper.Init(); }
public override void MyTestInitialize() { base.MyTestInitialize(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); manager = DbManagerFactory.Factory.Create(context); manager.BeginTransaction(); }
protected void Application_Start(object sender, EventArgs e) { var connectionCredentials = new ConnectionCredentials(); DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString); EidssUserContext.Init(); }
private bool ValidateArchiveConnection() { if (TabControlMain.TabPages.IndexOf(TabPageArchive) < 0) { return(true); } if (!chkAllowArchiveConnection.Checked) { if (!string.IsNullOrEmpty(m_ArchiveConnectionCredentials.SQLDatabase) || !string.IsNullOrEmpty(m_ArchiveConnectionCredentials.SQLServer) || !string.IsNullOrEmpty(m_ArchiveConnectionCredentials.SQLUser) || !string.IsNullOrEmpty(m_ArchiveConnectionCredentials.SQLPassword)) { m_ArchiveConnectionCredentials.Clear(); } return(true); } m_ArchiveConnectionCredentials.SetCredentials(BaseSettings.ConnectionString, txtArchiveServer.Text, txtArchiveDatabase.Text, txtArchiveUser.Text, txtArchivePassword.Text, "Archive"); if (m_ArchiveConnectionCredentials.IsCorrect) { DbManagerFactory.SetSqlFactory(m_ArchiveConnectionCredentials.ConnectionString); using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { if (manager.TestConnection()) { m_ArchiveConnectionCredentials.Save(); return(true); } ErrorForm.ShowError("errArchiveConnectionError"); return(false); } } ErrorForm.ShowError("errArchiveConnectionError"); return(false); }
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); }
public void MyTestInitialize() { BaseReportTests.InitDBAndLogin(); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "AvrService").ConnectionString, DatabaseType.Avr); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "Archive").ConnectionString, DatabaseType.Archive); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); }
public static void InitSqlFactory() { if (DbManagerFactory.Factory[DatabaseType.Archive] == null) { DbManagerFactory.SetSqlFactory(GetCredentials().ConnectionString, DatabaseType.Archive); } }
public static void MyClassInitialize(TestContext testContext) { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", null)); //EidssUserContext.Init(); //EidssUserContext.ApplicationName = "test"; ////ScriptLoader.RunScript(PathToTestFolder.Get(TestFolders.Db) + "Data\\DeleteTestAccount.sql", Config.GetSetting("EidssConnectionString", null)); ////ScriptLoader.RunScript(PathToTestFolder.Get(TestFolders.Db) + "Data\\CreateTestAccount.sql", Config.GetSetting("EidssConnectionString", null)); using (DbManager manager = DbManagerFactory.Factory.Create()) { object dbVersion = manager.SetCommand("select strDatabaseVersion from tstVersionCompare where strModuleName = 'MainDatabaseVersion'").ExecuteScalar(); Version ver = Version.Parse(EidssUserContext.Version); string appVersion = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build); string cmdText = string.Format("if exists (select strModuleName from tstVersionCompare where strModuleName = 'test') " + " begin " + " update tstVersionCompare set strDatabaseVersion = '{0}', strModuleVersion = '{1}' where strModuleName = 'test' " + " end " + " else " + " begin " + " insert into tstVersionCompare (strModuleName, strDatabaseVersion, strModuleVersion) values ('test', '{0}', '{1}') " + " end " , dbVersion.ToString(), appVersion); manager.SetCommand(cmdText).ExecuteNonQuery(); object org = manager.SetCommand("select top 1 left(Inst.name, 186) from tstSite " + " inner join dbo.fnInstitution('en') Inst "+ " on Inst.idfOffice = tstSite.idfOffice "+ " and Inst.intRowStatus = 0 "+ " where tstSite.idfsSite= dbo.fnSiteID() "+ " and tstSite.intRowStatus = 0 "+ " order by tstSite.idfsSite asc").ExecuteScalar(); Organizaton = org.ToString(); } }
public void TestMethod1() { DbManagerFactory.SetSqlFactory(Config.GetSetting("TestConnectionString", "")); long?id = null; BaseFormManager.ShowNormal(typeof(TestPanelUI), ref id); }
public static void InitEidssCore() { DbManagerFactory.SetSqlFactory(new ConnectionCredentials().ConnectionString); EidssUserContext.Init(); Localizer.MenuMessages = EidssMenu.Instance; BaseFieldValidator.FieldCaptions = EidssFields.Instance; }
public void MyTestInitialize() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); WinClientContext.FieldCaptions = EidssFields.Instance; RequiredValidator.FieldCaptions = EidssFields.Instance; ErrorForm.Messages = EidssMessages.Instance; }
public static void Init(TestContext testContext) { m_Container = StructureMapContainerInit(); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); m_FieldCount = DataHelper.GetQueryFieldsCount(49539640000000); EIDSS_LookupCacheHelper.Init(); }
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); }
public void TestFarmPanel() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString", "")); using (DbManagerProxy manager = DbManagerFactory.Factory.Create()) { FarmPanel.Accessor acc = FarmPanel.Accessor.Instance(null); FarmPanel farm = acc.CreateNewT(manager); Assert.IsNotNull(farm.Location); } }
private void ConnectToStanadardDatabase() { var credentials = new ConnectionCredentials(); ConnectionManager.DefaultInstance.SetCredentials(); DbManagerFactory.SetSqlFactory(credentials.ConnectionString); BaseFormManager.ArchiveMode = false; if (m_StoredUserPermissions != null) { EidssUserContext.User.Permissions = m_StoredUserPermissions; } }
public static void InitEidssCore() { EidssServiceInitializer.InitEidssCore(); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "AvrService").ConnectionString, DatabaseType.Avr); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "Archive").ConnectionString, DatabaseType.Archive); EIDSS_LookupCacheHelper.Init(); m_LanguageProcessor = new BaseLanguageProcessor(); m_LanguageProcessor.InitLanguages(); }
private bool ConnectToArchiveDatabase() { try { if (m_StoredUserPermissions == null) { m_StoredUserPermissions = EidssUserContext.User.Permissions; } var credentials = new ConnectionCredentials(null, "Archive"); ConnectionManager.DefaultInstance.SetCredentials(null, null, null, null, null, "Archive"); DbManagerFactory.SetSqlFactory(credentials.ConnectionString); if (credentials.IsCorrect) { using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { if (!manager.TestConnection()) { ErrorForm.ShowError("errArchiveConnectionError"); return(false); } } } else { ErrorForm.ShowError("errArchiveConnectionError"); return(false); } var readOnlyPermissions = new Dictionary <string, bool>(); foreach (string key in m_StoredUserPermissions.Keys) { if (key.StartsWith(EIDSSPermissionObject.HumanCaseDeduplication.ToString()) || key.StartsWith(EIDSSPermissionObject.NotificationSubscription.ToString()) ) { continue; } readOnlyPermissions.Add(key, key.EndsWith(".Select") ? m_StoredUserPermissions[key] : false); } EidssUserContext.User.Permissions = readOnlyPermissions; BaseFormManager.ArchiveMode = true; return(true); } catch (Exception e) { if (!SqlExceptionHandler.Handle(e)) { ErrorForm.ShowError("errArchiveConnectionError", e); } return(false); } }
private void Form1_Load(object sender, EventArgs e) { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); using (DbManagerProxy manager = DbManagerFactory.Factory.Create()) { m_Address = Address.Accessor.Instance(null).CreateNewT(manager, null); m_Address.Country = m_Address.CountryLookup[0]; } lookUpEdit1.Properties.DataSource = m_Address.CountryLookup; lookUpEdit1.Properties.DisplayMember = "strCountryName"; lookUpEdit1.Properties.ValueMember = null; lookUpEdit1.DataBindings.Add("EditValue", m_Address, "Country", false, DataSourceUpdateMode.OnPropertyChanged); }
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 AsSessionSample() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); using (var context = ModelUserContext.Instance as EidssUserContext) { using (var manager = DbManagerFactory.Factory.Create(context)) { var acc = AsSession.Accessor.Instance(null); var session = (AsSession)acc.CreateNew(manager); //mandatory field session.Region = session.RegionLookup.FirstOrDefault(); var rootFarm = FarmRootPanel.Accessor.Instance(null).CreateNewT(manager); } } }
public void GetInnerExceptionDescriptionTest() { try { DbManagerFactory.SetSqlFactory("Persist Security Info=true;Initial Catalog=xxx;Data Source=xxx;"); using (DbManagerProxy manager = DbManagerFactory.Factory.Create()) { manager.SetCommand("select 1;"); manager.ExecuteNonQuery(); } } catch (Exception ex) { string description = SqlExceptionHandler.GetExceptionDescription(ex); Assert.AreNotEqual(string.Empty, description); } }
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; } } }
private void InitConnection() { if (TabControlMain.TabPages.IndexOf(TabPageSQL) > 0) { m_ConnectionCredentials.SetCredentials(BaseSettings.ConnectionString, txtSQLServer.Text, txtSQLDatabase.Text, txtSQLUser.Text, txtSQLPassword.Text); ConnectionManager.DefaultInstance.SetCredentials(BaseSettings.ConnectionString, txtSQLServer.Text, txtSQLDatabase.Text, txtSQLUser.Text, txtSQLPassword.Text); DbManagerFactory.SetSqlFactory(m_ConnectionCredentials.ConnectionString); if (m_ConnectionCredentials.IsCorrect) { using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { if (manager.TestConnection()) { m_ConnectionCredentials.Save(); } } } } }
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); }
public void RootFarmCollection() { DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); using (var context = ModelUserContext.Instance as EidssUserContext) { using (var manager = DbManagerFactory.Factory.Create(context)) { var acc = FarmRootPanel.Accessor.Instance(null); var panel = acc.Create(manager, null, HACode: null); var herdaccessor = RootFarmTree.Accessor.Instance(null); RootFarmTree farm = panel.FarmLivestockTree[0]; RootFarmTree herd = herdaccessor.CreateHerd(manager, panel, farm); RootFarmTree spec = herdaccessor.CreateSpecies(manager, panel, herd); spec.SpeciesType = spec.SpeciesTypeLookup.FirstOrDefault(c => c.idfsBaseReference == 837790000000); //spec.idfsSpeciesTypeReference = 837790000000; panel.FarmLivestockTree.Add(herd); panel.FarmLivestockTree.Add(spec); panel.Address.Region = panel.Address.RegionLookup.FirstOrDefault(); panel.Address.Rayon = panel.Address.RayonLookup.FirstOrDefault(); panel.Address.Settlement = panel.Address.SettlementLookup.FirstOrDefault(); //panel.Location.CopyAddressValues(panel.Address); //panel.Validation += new ValidationEvent(panel_Validation); //panel.blnIsLivestock = true; //acc.Post(manager, panel); //panel.Validation -= panel_Validation; //var savedpanel = acc.SelectByKey(manager, panel.idfFarm); //Assert.AreEqual(panel.FarmLivestockTree.Count, savedpanel.FarmLivestockTree.Count); //Assert.AreNotEqual(savedpanel.FarmLivestockTree.Count, savedpanel.FarmAvianTree.Count); //Assert.AreEqual(panel.FarmAvianTree.Count, 1); //Assert.AreEqual(farm._HACode, (int)HACode.Livestock); //Assert.AreEqual(herd._HACode, (int)HACode.Livestock); //Assert.AreEqual(spec._HACode, (int)HACode.Livestock); //Assert.AreNotEqual(spec.SpeciesTypeLookup.Count, 1); } } }
public string CreateTicket(long userId) { var dbType = DatabaseType.Main; var connectionCredentials = new ConnectionCredentials(null, "Avr"); if (connectionCredentials.IsCorrect) { DbManagerFactory.SetSqlFactory(connectionCredentials.ConnectionString, DatabaseType.AvrTicket); using (var avrManager = DbManagerFactory.Factory[DatabaseType.AvrTicket].Create()) { if (avrManager.TestConnection()) { dbType = DatabaseType.AvrTicket; } } } using (DbManagerProxy manager = DbManagerFactory.Factory[dbType].Create(ModelUserContext.Instance)) { try { manager.SetSpCommand("dbo.spLoginCreateTicket", manager.Parameter("@idfUserID", userId), manager.Parameter(ParameterDirection.Output, "@strTicket", ""), manager.Parameter(ParameterDirection.Output, "@Result", 0) ).ExecuteNonQuery(); int res = Convert.ToInt32(manager.Parameter("@Result").Value); if (res == 0) { return(Utils.Str(manager.Parameter("@strTicket").Value)); } return(null); } catch (DataException e) { throw DbModelException.Create(null, e); } } }
public static void MyClassInitialize(TestContext testContext) { m_Container = StructureMapContainerInit(); m_Trace = new TraceHelper(TraceHelper.AVRCategory); SetFreePortToAvrAndReport(); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "AvrService").ConnectionString, DatabaseType.Avr); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "Archive").ConnectionString, DatabaseType.Archive); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); m_HumanFieldCount = DataHelper.GetQueryFieldsCount(49539640000000); m_VetFieldCount = DataHelper.GetQueryFieldsCount(49542020000000); m_HostKeeper = new AvrHostKeeper(m_Container); m_HostKeeper.Open(); Assembly asm = Assembly.GetExecutingAssembly(); string exeLocation = Path.GetDirectoryName(Utils.ConvertFileName(asm.Location)) ?? string.Empty; if (!Directory.Exists(exeLocation)) { int index = exeLocation.IndexOf("EIDSSTrunk", StringComparison.OrdinalIgnoreCase); if (index > 0) { Directory.CreateDirectory(exeLocation); string realPath = exeLocation.Substring(0, index) + @"EIDSSTrunk\EIDSS\eidss.main\bin\Debug\eidss.avr.export.x86.exe"; File.Copy(realPath, exeLocation + @"\eidss.avr.export.x86.exe"); } } m_ExportUtilFilePath = Utils.GetFilePathNearAssembly(asm, @"eidss.avr.export.x86.exe"); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "AvrService").ConnectionString, DatabaseType.Avr); DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "Archive").ConnectionString, DatabaseType.Archive); DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString")); }