public static List <Folder> GetFolders() { List <Folder> lstFolders = new List <Folder>(); string StoredProcedureName = "usp_FileManagerGetFolders"; SqlDataReader SQLReader; SQLHandler sagesql = new SQLHandler(); try { SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName); while (SQLReader.Read()) { Folder obj = new Folder(); obj.FolderId = int.Parse(SQLReader["FolderId"].ToString()); obj.FolderPath = SQLReader["FolderPath"].ToString(); obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString()); lstFolders.Add(obj); } SQLReader.Dispose(); } catch (Exception e) { throw e; } return(lstFolders); }
public static List <string> GetModulePermission(int UserModuleID, string UserName) { List <string> lstPermissions = new List <string>(); string StoredProcedureName = "usp_FileManagerGetModulePermission"; SQLHandler sagesql = new SQLHandler(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName)); SqlDataReader SQLReader; try { SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); while (SQLReader.Read()) { lstPermissions.Add(SQLReader["permissionkey"].ToString()); } SQLReader.Dispose(); } catch (Exception e) { throw e; } return(lstPermissions); }
public static List <LanguageSwitchKeyValue> GetLanguageSwitchSettings(int portalId, int UserModuleID) { List <LanguageSwitchKeyValue> lstSettings = new List <LanguageSwitchKeyValue>(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalId)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID)); string StoredProcedureName = "usp_loc_GetLanguageSwitchSettings"; SqlDataReader SQLReader; try { SQLHandler sagesql = new SQLHandler(); SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); } catch (Exception e) { throw e; } while (SQLReader.Read()) { lstSettings.Add(new LanguageSwitchKeyValue(SQLReader["SettingKey"].ToString(), SQLReader["SettingValue"].ToString())); } SQLReader.Close(); return(lstSettings); }
public static List <ATTFile> SearchFiles(string SearchQuery) { List <ATTFile> lstFiles = new List <ATTFile>(); string StoredProcedureName = "usp_FileManagerSearchFiles"; SQLHandler sagesql = new SQLHandler(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@SearchQuery", SearchQuery)); SqlDataReader SQLReader; try { SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); while (SQLReader.Read()) { ATTFile obj = new ATTFile(); obj.FileId = int.Parse(SQLReader["FileId"].ToString()); obj.FileName = SQLReader["FileName"].ToString(); obj.Folder = SQLReader["Folder"].ToString(); obj.Extension = SQLReader["Extension"].ToString(); obj.Size = int.Parse(SQLReader["Size"].ToString()); obj.AddedOn = SQLReader["AddedOn"].ToString(); obj.Content = SQLReader["Content"] == DBNull.Value ? null : (byte[])SQLReader["Content"]; obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString()); lstFiles.Add(obj); } SQLReader.Dispose(); } catch (Exception e) { throw e; } return(lstFiles); }
public static List <FolderPermission> GetUserListForFolder(int FolderID) { List <FolderPermission> lstFolderPer = new List <FolderPermission>(); string StoredProcedureName = "usp_FileManagerGetUsersWithPermissions"; SQLHandler sagesql = new SQLHandler(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@FolderID", FolderID)); SqlDataReader SQLReader; try { SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); while (SQLReader.Read()) { FolderPermission obj = new FolderPermission(); obj.UserID = int.Parse(SQLReader["UserID"].ToString()); obj.UserName = SQLReader["UserName"].ToString() ?? SQLReader["UserName"].ToString(); lstFolderPer.Add(obj); } SQLReader.Dispose(); } catch (Exception e) { throw e; } return(lstFolderPer); }
public static List <MenuInfo> GetMenuFront(int PortalID, string UserName, string CultureCode) { List <MenuInfo> lstPages = new List <MenuInfo>(); string StoredProcedureName = "[dbo].[usp_SageMenuGetClientView]"; List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@prefix", "---")); ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsDeleted", 0)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@CultureCode", CultureCode)); SqlDataReader SQLReader; try { SQLHandler sagesql = new SQLHandler(); SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); } catch (Exception e) { throw e; } while (SQLReader.Read()) { lstPages.Add(new MenuInfo(int.Parse(SQLReader["PageID"].ToString()), int.Parse(SQLReader["PageOrder"].ToString()), SQLReader["PageName"].ToString(), int.Parse(SQLReader["ParentID"].ToString()), int.Parse(SQLReader["Level"].ToString()), SQLReader["LevelPageName"].ToString(), SQLReader["SEOName"].ToString(), SQLReader["TabPath"].ToString(), bool.Parse(SQLReader["IsVisible"].ToString()), bool.Parse(SQLReader["ShowInMenu"].ToString()))); } return(lstPages); }
public static List <ModuleInfo> GetCoreModules() { List <ModuleInfo> lstCoreModules = new List <ModuleInfo>(); string StoredProcedureName = "usp_loc_CoreModulesGet"; SqlDataReader SQLReader; try { SqlConnection SQLConn = new SqlConnection(SystemSetting.SageFrameConnectionString); SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StoredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(); } catch (Exception e) { throw e; } while (SQLReader.Read()) { ModuleInfo obj = new ModuleInfo(); obj.ModuleID = int.Parse(SQLReader["ModuleID"].ToString()); obj.ModuleName = SQLReader["ModuleName"].ToString(); lstCoreModules.Add(obj); } SQLReader.Close(); return(lstCoreModules); }
/// <summary> /// Execute As list /// </summary> /// <typeparam name="T"></typeparam> /// <param name="StroredProcedureName">StoreProcedure Name</param> /// <param name="ParaMeterCollection"></param> /// <returns></returns> public IList <T> ExecuteAsList <T>(string StroredProcedureName, List <SQLParam> ParaMeterCollection) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SqlParameter[] sqlParameters = new SQLParamCollection(ParaMeterCollection).ParamCollection; SQLCmd.Parameters.AddRange(sqlParameters); SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection IList <T> mList = DataSourceHelper.FillCollection <T>(SQLReader); if (SQLReader != null) { SQLReader.Close(); } SQLConn.Close(); return(mList); } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
public static List <Language> GetPortalLanguages(int portalId) { List <Language> lstPortalLanguages = new List <Language>(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalId)); string StoredProcedureName = "usp_loc_PortalLanguagesGet"; SqlDataReader SQLReader; try { SQLHandler sagesql = new SQLHandler(); SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); } catch (Exception e) { throw e; } while (SQLReader.Read()) { Language obj = new Language(int.Parse(SQLReader["LanguageID"].ToString()), SQLReader["CultureName"].ToString(), SQLReader["CultureCode"].ToString()); obj.LanguageN = SQLReader["CultureName"].ToString(); obj.Country = SQLReader["CultureName"].ToString(); lstPortalLanguages.Add(obj); } SQLReader.Close(); return(lstPortalLanguages); }
public static List <Roles> GetAllRoles(int portalID, bool isAll, string userName) { List <Roles> lstRoles = new List <Roles>(); string StoredProcedureName = "sp_PortalRoleList"; SQLHandler sagesql = new SQLHandler(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalID)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsAll", isAll)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", userName)); SqlDataReader SQLReader; try { SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); while (SQLReader.Read()) { Roles obj = new Roles(); obj.RoleID = new Guid(SQLReader["RoleID"].ToString()); obj.RoleName = SQLReader["RoleName"].ToString(); lstRoles.Add(obj); } } catch (Exception) { } return(lstRoles); }
/// <summary> /// Execute As enumerable /// </summary> /// <typeparam name="T"><T></typeparam> /// <param name="StroredProcedureName">Storedprocedure Name</param> /// <returns></returns> public IEnumerable <T> ExecuteAsEnumerable <T>(string StroredProcedureName) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection IEnumerable <T> mList = DataSourceHelper.FillCollection <T>(SQLReader); if (SQLReader != null) { SQLReader.Close(); } SQLConn.Close(); return(mList); } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
public static List <MenuInfo> GetSideMenu(int PortalID, string UserName, string PageName, string CultureCode) { List <MenuInfo> lstPages = new List <MenuInfo>(); string StoredProcedureName = "[dbo].[usp_SageMenuGetSideMenu]"; List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", UserName)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PageName", PageName)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@CultureCode", CultureCode)); SqlDataReader SQLReader; try { SQLHandler sagesql = new SQLHandler(); SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName, ParaMeterCollection); } catch (Exception e) { throw e; } while (SQLReader.Read()) { MenuInfo objMenu = new MenuInfo(); objMenu.PageID = int.Parse(SQLReader["PageID"].ToString()); objMenu.PageOrder = int.Parse(SQLReader["PageOrder"].ToString()); objMenu.PageName = SQLReader["PageName"].ToString(); objMenu.ParentID = int.Parse(SQLReader["ParentID"].ToString()); objMenu.Level = int.Parse(SQLReader["Level"].ToString()); objMenu.TabPath = SQLReader["TabPath"].ToString(); lstPages.Add(objMenu); } return(lstPages); }
/// <summary> /// Execute As List /// </summary> /// <typeparam name="T"><T></typeparam> /// <param name="StroredProcedureName">Storedprocedure Name</param> /// <returns></returns> public async Task <IList <T> > ExecuteAsListAsync <T>(string StroredProcedureName) { using (SqlConnection SQLConn = new SqlConnection(this._connectionString)) { using (SqlCommand SQLCmd = new SqlCommand()) { SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; try { SqlDataReader SQLReader; await SQLConn.OpenAsync(); SQLReader = await SQLCmd.ExecuteReaderAsync(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection IList <T> mList = DataSourceHelper.FillCollection <T>(SQLReader); if (SQLReader != null) { SQLReader.Close(); } SQLConn.Close(); return(mList); } catch (Exception e) { throw e; } finally { SQLConn.Close(); } } } }
public List <T> ExecuteAsListText <T>(string sqlCommand) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = sqlCommand; SQLCmd.CommandType = CommandType.Text; SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection List <T> mList = new List <T>(); mList = DataSourceHelper.FillCollection <T>(SQLReader); if (SQLReader != null) { SQLReader.Close(); } SQLConn.Close(); return(mList); } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
public static List <Language> GetAvailableLocales() { List <Language> lstAvailableLocales = new List <Language>(); string StoredProcedureName = "sp_LanguageGet"; SqlDataReader SQLReader; try { SqlConnection SQLConn = new SqlConnection(SystemSetting.SageFrameConnectionString); SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StoredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(); } catch (Exception e) { throw e; } while (SQLReader.Read()) { Language obj = new Language(int.Parse(SQLReader["LanguageID"].ToString()), SQLReader["CultureName"].ToString(), SQLReader["CultureCode"].ToString()); obj.LanguageN = SQLReader["CultureName"].ToString(); obj.Country = SQLReader["CultureName"].ToString(); lstAvailableLocales.Add(obj); } SQLReader.Close(); return(lstAvailableLocales); }
public void VerifyTableData() { var actual = SQLReader.LoadCreatureTemplates(); Assert.AreEqual(actual.Count(), 231); Assert.AreEqual(actual.Count(x => x.Value.VehicleId == 0), 0); Assert.AreEqual(actual.Max(x => x.Value.Id), 40725u); }
private static void ComposeObjects() { var wrappedReader = new SQLReader(); var reader = new CachingReader(wrappedReader); //dekorator var viewModel = new PeopleViewModel(reader); Application.Current.MainWindow = new PeopleViewerWindow(viewModel); }
public Loader() { Contract.Requires(DBC.DBCPath != null); DBC.Vehicle = DBCReader.ReadDBC <VehicleEntry>(DBC.VehicleStrings); DBC.VehicleSeat = DBCReader.ReadDBC <VehicleSeatEntry>(null); DBC.VehicleUIIndicator = DBCReader.ReadDBC <VehicleUIIndicatorEntry>(null); DBC.VehicleUIIndSeat = DBCReader.ReadDBC <VehicleUIIndSeatEntry>(null); SQL.CreatureTemplate = SQLReader.LoadCreatureTemplates(); SQL.SpellClick = SQLReader.LoadSpellClick(); SQL.Accessories = SQLReader.LoadVehicleAccessories(); }
static void Main(string[] args) { using (SQLReader reader = new SQLReader("Server=<machine name>\\<instance>;Database=<database name>;Trusted_Connection=yes;")) { reader.GetNodes(); reader.GetEdges(); using (ArrangoDbWriter writer = new ArrangoDbWriter("http://localhost:8529", "<database name>", "<user>", "<password>")) { writer.ImportNodes(reader.Nodes); writer.ImportEdges(reader.Edges); } } }
private static void ComposeObjectsForViewer() { // var reader = new ServiceReader(); //First Data Reader //var reader = new CSVReader(); //Second Data Reader var sqlReader = new SQLReader(); var serviceReader = new ServiceReader(); var reader = new CachingReader(sqlReader); var mainviewModel = new PeopleViewModel(reader); Application.Current.MainWindow = new PeopleViewerWindow(mainviewModel); Application.Current.MainWindow.Title = "Saja Makes the Dependency Injection Happen in WPFPlusASPNetCore 2020"; Application.Current.MainWindow.Show(); }
public void VerifyRecordData() { var actual = SQLReader.LoadCreatureTemplates(); var record = actual[23693]; Assert.AreEqual(record.Name, "Duskwing Eagle"); Assert.AreEqual(record.NPCFlag, 0u); Assert.AreEqual(record.UnitFlags, 0u); Assert.AreEqual(record.DynamicFlags, 8u); Assert.AreEqual(record.VehicleId, 23u); Assert.AreEqual(record.AIName, String.Empty); Assert.AreEqual(record.InhabitType, 7u); Assert.AreEqual(record.ScriptName, String.Empty); Assert.AreEqual(record.VerifiedBuild, 12340u); }
/// <summary> /// Execute as object. /// </summary> /// <typeparam name="T">Given type of object.</typeparam> /// <param name="StroredProcedureName">Store procedure name.</param> /// <param name="ParaMeterCollection">Accept key value collection for parameters.</param> /// <returns></returns> public T ExecuteAsObject <T>(string StroredProcedureName, List <KeyValuePair <string, object> > ParaMeterCollection) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; //Loop for Parameters for (int i = 0; i < ParaMeterCollection.Count; i++) { SqlParameter sqlParaMeter = new SqlParameter(); sqlParaMeter.IsNullable = true; sqlParaMeter.ParameterName = ParaMeterCollection[i].Key; sqlParaMeter.Value = ParaMeterCollection[i].Value; SQLCmd.Parameters.Add(sqlParaMeter); } //End of for loop SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); ArrayList arrColl = DataSourceHelper.FillCollection(SQLReader, typeof(T)); SQLConn.Close(); if (SQLReader != null) { SQLReader.Close(); } if (arrColl != null && arrColl.Count > 0) { return((T)arrColl[0]); } else { return(default(T)); } } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
/// <summary> /// Execute As Object /// </summary> /// <typeparam name="T"><T></typeparam> /// <param name="StroredProcedureName">StoreProcedure Name</param> /// <param name="ParaMeterCollection">Accept Key Value Collection For Parameters</param> /// <returns></returns> public async Task <T> ExecuteAsObjectAsync <T>(string StroredProcedureName, List <SQLParam> ParaMeterCollection) { using (SqlConnection SQLConn = new SqlConnection(this._connectionString)) { using (SqlCommand SQLCmd = new SqlCommand()) { SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SqlParameter[] sqlParameters = new SQLParamCollection(ParaMeterCollection).ParamCollection; SQLCmd.Parameters.AddRange(sqlParameters); try { SqlDataReader SQLReader; await SQLConn.OpenAsync(); SQLReader = await SQLCmd.ExecuteReaderAsync(CommandBehavior.CloseConnection); ArrayList arrColl = DataSourceHelper.FillCollection(SQLReader, typeof(T)); SQLConn.Close(); if (SQLReader != null) { SQLReader.Close(); } if (arrColl != null && arrColl.Count > 0) { return((T)arrColl[0]); } else { return(default(T)); } } catch (Exception e) { throw e; } finally { SQLConn.Close(); } } } }
public static void sql2es(FileInfo sqlFile) { var sqlLines = File.ReadAllLines(sqlFile.FullName); var sqlReader = new SQLReader(); var emoteTable = sqlReader.ReadEmoteTable(sqlLines); emoteTable.BuildLinks(); //ShowScript(emoteTable.EmoteSets); var esFilename = Path.ChangeExtension(sqlFile.FullName, ".es"); // check if file already exists? var esFile = new FileInfo(esFilename); OutputScript(emoteTable.EmoteSets, esFile); }
/// <summary> /// Execute as list. /// </summary> /// <typeparam name="T">Given type of object</typeparam> /// <param name="StroredProcedureName">Store procedure name.</param> /// <param name="ParaMeterCollection">Accept Key Value collection for parameters.</param> /// <returns>Type of list of object implementing.</returns> public List <T> ExecuteAsList <T>(string StroredProcedureName, List <KeyValuePair <string, string> > ParaMeterCollection) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; //Loop for Paramets for (int i = 0; i < ParaMeterCollection.Count; i++) { SqlParameter sqlParaMeter = new SqlParameter(); sqlParaMeter.IsNullable = true; sqlParaMeter.ParameterName = ParaMeterCollection[i].Key; sqlParaMeter.Value = ParaMeterCollection[i].Value; SQLCmd.Parameters.Add(sqlParaMeter); } //End of for loop SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection List <T> mList = new List <T>(); mList = DataSourceHelper.FillCollection <T>(SQLReader); if (SQLReader != null) { SQLReader.Close(); } SQLConn.Close(); return(mList); } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
public static IPersonReader GetReader(string readerType) { IPersonReader reader; switch (readerType) { case "Service": reader = new ServiceReader(); break; case "CSV": reader = new CSVReader(); break; case "SQL": reader = new SQLReader(); break; default: throw new ArgumentException("Invalid reader type"); } return(reader); }
public static List <MenuInfo> GetAdminMenu() { List <MenuInfo> lstPages = new List <MenuInfo>(); string StoredProcedureName = "[dbo].[usp_sagemenugetadminmenu]"; SqlDataReader SQLReader; try { SQLHandler sagesql = new SQLHandler(); SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName); } catch (Exception e) { throw e; } while (SQLReader.Read()) { lstPages.Add(new MenuInfo(int.Parse(SQLReader["PageID"].ToString()), int.Parse(SQLReader["PageOrder"].ToString()), SQLReader["PageName"].ToString(), int.Parse(SQLReader["ParentID"].ToString()), int.Parse(SQLReader["Level"].ToString()), SQLReader["LevelPageName"].ToString(), SQLReader["SEOName"].ToString(), SQLReader["TabPath"].ToString(), bool.Parse(SQLReader["IsVisible"].ToString()), bool.Parse(SQLReader["ShowInMenu"].ToString()))); } return(lstPages); }
/// <summary> /// Execute As Object /// </summary> /// <typeparam name="T">Given type of object.</typeparam> /// <param name="StroredProcedureName">Accept Key Value Collection For Parameters</param> /// <returns> Type of the object implementing</returns> public T ExecuteAsObject <T>(string StroredProcedureName) { SqlConnection SQLConn = new SqlConnection(this._connectionString); try { SqlDataReader SQLReader; SqlCommand SQLCmd = new SqlCommand(); SQLCmd.Connection = SQLConn; SQLCmd.CommandText = StroredProcedureName; SQLCmd.CommandType = CommandType.StoredProcedure; SQLConn.Open(); SQLReader = SQLCmd.ExecuteReader(); ArrayList arrColl = DataSourceHelper.FillCollection(SQLReader, typeof(T)); SQLConn.Close(); if (SQLReader != null) { SQLReader.Close(); } if (arrColl != null && arrColl.Count > 0) { return((T)arrColl[0]); } else { return(default(T)); } } catch (Exception e) { throw e; } finally { SQLConn.Close(); } }
public void LoadVehicleAccessoriesTest() { var actual = SQLReader.LoadVehicleAccessories(); List <VehicleTemplateAccessory> accessories; if (actual.TryGetValue(36678, out accessories)) { foreach (var accessory in accessories) { switch (accessory.AccessoryEntry) { case 38309: Assert.AreEqual(0u, accessory.SeatId); break; case 38308: Assert.AreEqual(1u, accessory.SeatId); break; } } } }
static void Main(string[] args) { using (SQLReader reader = new SQLReader("Server=DESKTOP-KCL006K\\DATASERVER;Database=GraphPL;Trusted_Connection=yes;")) { reader.GetNodes(); reader.GetEdges(); reader.GetIndexes(); reader.GetFullTextIndexes(); reader.GetUniqueConstraints(); //reader.GetExistenceConstraints(); -- available only in enterprise edition //reader.GetNodeKeyConstraints(); -- available only in enterprise edition using (Neo4jWriter importer = new Neo4jWriter(new Uri("http://*****:*****@localhost:7474"))) { importer.ImportNodes(reader.Nodes); importer.ImportEdges(reader.Edges); importer.ImportIndexes(reader.Indexes); importer.ImportFullTextIndexes(reader.FullTextIndexes); importer.ImportConstraints(reader.UniqueConstraints); //importer.ImportConstraints(reader.ExistenceConstraints); -- available only in enterprise edition //importer.ImportConstraints(reader.NodeKeyConstraints); -- available only in enterprise edition } } }