public static void LoadGameFiles() { var gameFiles = new List <Tuple <string, string, int> >(); gameFiles.Add(new Tuple <string, string, int>("Achievements", @"gamefiles/logic/achievements.csv", 22)); gameFiles.Add(new Tuple <string, string, int>("Buildings", @"gamefiles/logic/buildings.csv", 0)); gameFiles.Add(new Tuple <string, string, int>("Characters", @"gamefiles/logic/characters.csv", 3)); gameFiles.Add(new Tuple <string, string, int>("Decos", @"gamefiles/logic/decos.csv", 17)); gameFiles.Add(new Tuple <string, string, int>("Experience Levels", @"gamefiles/logic/experience_levels.csv", 10)); gameFiles.Add(new Tuple <string, string, int>("Globals", @"gamefiles/logic/globals.csv", 13)); gameFiles.Add(new Tuple <string, string, int>("Heroes", @"gamefiles/logic/heroes.csv", 27)); gameFiles.Add(new Tuple <string, string, int>("Leagues", @"gamefiles/logic/leagues.csv", 12)); gameFiles.Add(new Tuple <string, string, int>("NPCs", @"gamefiles/logic/npcs.csv", 16)); gameFiles.Add(new Tuple <string, string, int>("Obstacles", @"gamefiles/logic/obstacles.csv", 7)); gameFiles.Add(new Tuple <string, string, int>("Shields", @"gamefiles/logic/shields.csv", 19)); gameFiles.Add(new Tuple <string, string, int>("Spells", @"gamefiles/logic/spells.csv", 25)); gameFiles.Add(new Tuple <string, string, int>("Townhall Levels", @"gamefiles/logic/townhall_levels.csv", 14)); gameFiles.Add(new Tuple <string, string, int>("Traps", @"gamefiles/logic/traps.csv", 11)); gameFiles.Add(new Tuple <string, string, int>("Resources", @"gamefiles/logic/resources.csv", 2)); gameFiles.Add(new Tuple <string, string, int>("Wars", @"gamefiles/logic/war.csv", 1)); var dataCount = 0; Console.WriteLine("ObjectManager: Loading gamefiles..."); foreach (var data in gameFiles) { Console.Write("\t" + data.Item1); dataCount++; DataTables.InitDataTable(new CSVTable(data.Item2), data.Item3); Console.WriteLine(" done"); } Console.WriteLine("ObjectManager: " + dataCount + " objects successfully loaded on " + ConfigurationManager.AppSettings["programThreadCount"] + " thread!"); }
//private static ConcurrentDictionary<long, Level> m_vInMemoryPlayers { get; set; } public ObjectManager() { m_vTimerCanceled = false; m_vDatabase = new DatabaseManager(); NpcLevels = new Dictionary <int, string>(); DataTables = new DataTables(); m_vAlliances = new Dictionary <long, Alliance>(); if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { LoadFingerPrint(); } using (StreamReader sr = new StreamReader(@"gamefiles/default/home.json")) { m_vHomeDefault = sr.ReadToEnd(); } m_vAvatarSeed = m_vDatabase.GetMaxPlayerId() + 1; m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1; LoadGameFiles(); LoadNpcLevels(); System.Threading.TimerCallback TimerDelegate = new System.Threading.TimerCallback(Save); System.Threading.Timer TimerItem = new System.Threading.Timer(TimerDelegate, null, 60000, 60000); TimerReference = TimerItem; Console.WriteLine("Database Sync started"); m_vRandomSeed = new Random(); }
/// <summary> /// Loader of the ObjectManager class, which is neccessary for all UCS functionality. /// </summary> public ObjectManager() { m_vTimerCanceled = false; m_vDatabase = new DatabaseManager(); NpcLevels = new Dictionary <int, string>(); DataTables = new DataTables(); m_vAlliances = new Dictionary <long, Alliance>(); if (!File.Exists("banned-ip.txt")) { File.Create("banned-ip.txt"); } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { LoadFingerPrint(); } using (var sr = new StreamReader(@"gamefiles/starting_home.json")) m_vHomeDefault = sr.ReadToEnd(); m_vAvatarSeed = m_vDatabase.GetMaxPlayerId() + 1; m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1; GetAllAlliancesFromDB(); LoadGameFiles(); LoadBannedIPs(); TimerCallback TimerDelegate = Save; var TimerItem = new Timer(TimerDelegate, null, 30000, 15000); TimerReference = TimerItem; Console.WriteLine("[UCR] Database Sync started successfully"); m_vRandomSeed = new Random(); }
public static void LoadGameFiles() { List <Tuple <string, string, int> > gameFiles = new List <Tuple <string, string, int> >(); gameFiles.Add(new Tuple <string, string, int>("Achievements", @"gamefiles/logic/achievements.csv", 22)); gameFiles.Add(new Tuple <string, string, int>("Buildings", @"gamefiles/logic/buildings.csv", 0)); gameFiles.Add(new Tuple <string, string, int>("Characters", @"gamefiles/logic/characters.csv", 3)); gameFiles.Add(new Tuple <string, string, int>("Decos", @"gamefiles/logic/decos.csv", 17)); gameFiles.Add(new Tuple <string, string, int>("Experience Levels", @"gamefiles/logic/experience_levels.csv", 10)); gameFiles.Add(new Tuple <string, string, int>("Globals", @"gamefiles/logic/globals.csv", 13)); gameFiles.Add(new Tuple <string, string, int>("Heroes", @"gamefiles/logic/heroes.csv", 27)); gameFiles.Add(new Tuple <string, string, int>("Leagues", @"gamefiles/logic/leagues.csv", 12)); gameFiles.Add(new Tuple <string, string, int>("NPCs", @"gamefiles/logic/npcs.csv", 16)); gameFiles.Add(new Tuple <string, string, int>("Obstacles", @"gamefiles/logic/obstacles.csv", 7)); gameFiles.Add(new Tuple <string, string, int>("Shields", @"gamefiles/logic/shields.csv", 19)); gameFiles.Add(new Tuple <string, string, int>("Spells", @"gamefiles/logic/spells.csv", 25)); gameFiles.Add(new Tuple <string, string, int>("Townhall Levels", @"gamefiles/logic/townhall_levels.csv", 14)); gameFiles.Add(new Tuple <string, string, int>("Traps", @"gamefiles/logic/traps.csv", 11)); gameFiles.Add(new Tuple <string, string, int>("Resources", @"gamefiles/logic/resources.csv", 2)); Console.WriteLine("Loading server data..."); foreach (var data in gameFiles) { Console.Write("\t" + data.Item1); DataTables.InitDataTable(new CSVTable(data.Item2), data.Item3); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" done"); Console.ResetColor(); } }
public void Append(ScriptOutput x) { DataTables.AddRange(x.DataTables); x.DataTables.Clear(); TextOutput.AddRange(x.TextOutput); x.TextOutput.Clear(); }
private void BindFeeEarner() { _ddlFeeEarner.DataSource = DataTables.GetFeeEarners(); _ddlFeeEarner.DataTextField = "Name"; _ddlFeeEarner.DataBind(); AddDefaultToDropDownList(_ddlFeeEarner); }
public ActionResult AjaxList(int?categoryId) { ViewBag.Title = "新闻列表"; var draw = Request["draw"]; var drawInt = ConvertUtils.To(draw, 1); var length = Request["length"]; var lengthInt = ConvertUtils.To(length, 0); var start = Request["start"]; var startInt = ConvertUtils.To(start, 0); int count; var list = _service.NewsList(categoryId, startInt, lengthInt, out count); var data = new DataTables <BasicInformation>() { Draw = drawInt, RecordsTotal = count, RecordsFiltered = count, Data = list }; var jsetting = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; string jsonStr = JsonConvert.SerializeObject(data, Formatting.Indented, jsetting); Thread.Sleep(2000); return(Content(jsonStr)); }
// private static ConcurrentDictionary<long, Level> m_vInMemoryPlayers { get; set; } public ObjectManager() { this.m_vTimerCanceled = false; m_vDatabase = new DatabaseManager(); // NpcLevels = new Dictionary<int, string>(); DataTables = new DataTables(); m_vAlliances = new Dictionary <long, Clan>(); if (Convert.ToBoolean(Constants.Patching)) { LoadFingerPrint(); } using (StreamReader sr = new StreamReader(@"gamefiles/level/starting_home_backup.json")) { m_vHomeDefault = sr.ReadToEnd(); } m_vAvatarSeed = m_vDatabase.GetMaxPlayerId() + 1; m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1; LoadGameFiles(); // LoadNpcLevels(); TimerCallback TimerDelegate = new TimerCallback(this.Save); Timer TimerItem = new Timer(TimerDelegate, null, 60000, 60000); this.TimerReference = TimerItem; Console.WriteLine("Database Sync started"); m_vRandomSeed = new Random(); }
/// <summary> /// Loader of the ObjectManager class, which is neccessary for all UCS functionality. /// </summary> public ObjectManager() { m_vTimerCanceled = false; m_vDatabase = new DatabaseManager(); NpcLevels = new Dictionary <int, string>(); DataTables = new DataTables(); m_vAlliances = new Dictionary <long, Alliance>(); LoadFingerPrint(); using (var sr = new StreamReader(@"Gamefiles/starting_home.json")) m_vHomeDefault = sr.ReadToEnd(); m_vDatabase.CheckConnection(); m_vAvatarSeed = m_vDatabase.GetMaxPlayerId() + 1; m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1; LoadGameFiles(); LoadNpcLevels(); var TimerItem = new Timer(Save, null, 30000, 15000); TimerReference = TimerItem; Console.WriteLine("[UCS] Database Sync started successfully"); m_vRandomSeed = new Random(); GetAllAlliancesFromDB(); }
[InlineData("456", "Cost", false)] //query, isnt match public void SearchQueryTests(string searchString, string columnName, bool returnsResult) { var testData = new TestData(columnName, searchString); var result = new DataTables().GetResponse(testData.Queryable, testData.DataTablesRequest); var data = result; Assert.Equal(returnsResult, data.recordsFiltered > 0); }
public DataTables <UserAddress> GetByAccountId(int accountId) { var model = new DataTables <UserAddress>(); string sql = "select * from fz_UserAddress where userId=@accountId"; model.ModelList = new QueryObject <UserAddress>(_databaseInstance, sql, new { accountId = accountId }).ToList(); return(model); }
// public static void LoadNpcLevels() // { // Console.WriteLine(""); // Console.Write("Loading Npc levels... "); // for(int i=0;i<50;i++) // { // using(StreamReader sr = new StreamReader(@"gamefiles/pve/level" + ( i + 1) + ".json")) // { // NpcLevels.Add(i, sr.ReadToEnd()); // } // } // Console.WriteLine("done"); // } public static void LoadGameFiles() { // List<Tuple<string, string, int>> gameFiles = new List<Tuple<string, string, int>>(); GameFiles.Add(new Tuple <string, string, int>("Achievements", @"Gamefiles/csv_logic/achievements.csv", 1)); GameFiles.Add(new Tuple <string, string, int>("Alliance Badges", @"Gamefiles/csv_logic/alliance_badges.csv", 2)); GameFiles.Add(new Tuple <string, string, int>("Alliance Roles", @"Gamefiles/csv_logic/alliance_roles.csv", 3)); GameFiles.Add(new Tuple <string, string, int>("Area Effect Objects", @"Gamefiles/csv_logic/area_effect_objects.csv", 4)); GameFiles.Add(new Tuple <string, string, int>("Arenas", @"Gamefiles/csv_logic/arenas.csv", 5)); GameFiles.Add(new Tuple <string, string, int>("Buildings", @"Gamefiles/csv_logic/buildings.csv", 6)); GameFiles.Add(new Tuple <string, string, int>("Character Buffs", @"Gamefiles/csv_logic/character_buffs.csv", 7)); GameFiles.Add(new Tuple <string, string, int>("Characters", @"Gamefiles/csv_logic/characters.csv", 8)); GameFiles.Add(new Tuple <string, string, int>("Chest Order", @"Gamefiles/csv_logic/chest_order.csv", 9)); GameFiles.Add(new Tuple <string, string, int>("Content Tests", @"Gamefiles/csv_logic/content_tests.csv", 10)); GameFiles.Add(new Tuple <string, string, int>("Damage Types", @"Gamefiles/csv_logic/damage_types.csv", 11)); GameFiles.Add(new Tuple <string, string, int>("Decos", @"Gamefiles/csv_logic/decos.csv", 12)); GameFiles.Add(new Tuple <string, string, int>("Exp Levels", @"Gamefiles/csv_logic/exp_levels.csv", 13)); GameFiles.Add(new Tuple <string, string, int>("Gamble Chests", @"Gamefiles/csv_logic/gamble_chests.csv", 14)); GameFiles.Add(new Tuple <string, string, int>("Globals", @"Gamefiles/csv_logic/globals.csv", 15)); GameFiles.Add(new Tuple <string, string, int>("Locales", @"Gamefiles/csv_logic/locales.csv", 16)); GameFiles.Add(new Tuple <string, string, int>("Locations", @"Gamefiles/csv_logic/locations.csv", 17)); GameFiles.Add(new Tuple <string, string, int>("NPCs", @"Gamefiles/csv_logic/npcs.csv", 18)); GameFiles.Add(new Tuple <string, string, int>("Predefined Decks", @"Gamefiles/csv_logic/predefined_decks.csv", 19)); GameFiles.Add(new Tuple <string, string, int>("Projectiles", @"Gamefiles/csv_logic/projectiles.csv", 20)); GameFiles.Add(new Tuple <string, string, int>("Rarities", @"Gamefiles/csv_logic/rarities.csv", 21)); GameFiles.Add(new Tuple <string, string, int>("Regions", @"Gamefiles/csv_logic/regions.csv", 22)); GameFiles.Add(new Tuple <string, string, int>("Resource Packs", @"Gamefiles/csv_logic/resource_packs.csv", 23)); GameFiles.Add(new Tuple <string, string, int>("Resources", @"Gamefiles/csv_logic/resources.csv", 24)); GameFiles.Add(new Tuple <string, string, int>("Shop", @"Gamefiles/csv_logic/shop.csv", 25)); GameFiles.Add(new Tuple <string, string, int>("Spawn Points", @"Gamefiles/csv_logic/spawn_points.csv", 26)); GameFiles.Add(new Tuple <string, string, int>("Spells Sets", @"Gamefiles/csv_logic/spell_sets.csv", 27)); GameFiles.Add(new Tuple <string, string, int>("Spells Buildings", @"Gamefiles/csv_logic/spells_buildings.csv", 28)); GameFiles.Add(new Tuple <string, string, int>("Spells Characters", @"Gamefiles/csv_logic/spells_characters.csv", 29)); GameFiles.Add(new Tuple <string, string, int>("Spells Other", @"Gamefiles/csv_logic/spells_other.csv", 30)); GameFiles.Add(new Tuple <string, string, int>("Survival Modes", @"Gamefiles/csv_logic/survival_modes.csv", 31)); GameFiles.Add(new Tuple <string, string, int>("Taunts", @"Gamefiles/csv_logic/taunts.csv", 32)); GameFiles.Add(new Tuple <string, string, int>("Tournament Tiers", @"Gamefiles/csv_logic/tournament_tiers.csv", 33)); GameFiles.Add(new Tuple <string, string, int>("Treasure Chests", @"Gamefiles/csv_logic/treasure_chests.csv", 34)); GameFiles.Add(new Tuple <string, string, int>("Tutorials Home", @"Gamefiles/csv_logic/tutorials_home.csv", 35)); GameFiles.Add(new Tuple <string, string, int>("Tutorials Npc", @"Gamefiles/csv_logic/tutorials_npc.csv", 36)); DataTables = new DataTables(); Console.WriteLine("Loading server data..."); foreach (var data in GameFiles) { Console.Write("\t" + data.Item1); DataTables.InitDataTable(new CSVTable(data.Item2), data.Item3); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" done"); Console.ResetColor(); } }
public static DataTable GetBankBinTable() { Table t = new Table("BankBin"); t.Add("bbid", "autolong", 1); t.Add("bankbin", "long", 0); //银行bin号 t.Add("bankname", "string", 0); //银行名称 return(DataTables.GetDataTable(t)); }
public CSVManager() { //DownloadLatestCSVFiles(); try { _gameFiles.Add(new Tuple <string, string, int>("Buildings", @"Gamefiles/logic/buildings.csv", 0)); _gameFiles.Add(new Tuple <string, string, int>("Resources", @"Gamefiles/logic/resources.csv", 2)); _gameFiles.Add(new Tuple <string, string, int>("Characters", @"Gamefiles/logic/characters.csv", 3)); _gameFiles.Add(new Tuple <string, string, int>("Obstacles", @"Gamefiles/logic/obstacles.csv", 7)); _gameFiles.Add(new Tuple <string, string, int>("Experience Levels", @"Gamefiles/logic/experience_levels.csv", 10)); _gameFiles.Add(new Tuple <string, string, int>("Traps", @"Gamefiles/logic/traps.csv", 11)); _gameFiles.Add(new Tuple <string, string, int>("Leagues", @"Gamefiles/logic/leagues.csv", 12)); _gameFiles.Add(new Tuple <string, string, int>("Globals", @"Gamefiles/logic/globals.csv", 13)); _gameFiles.Add(new Tuple <string, string, int>("Townhall Levels", @"Gamefiles/logic/townhall_levels.csv", 14)); _gameFiles.Add(new Tuple <string, string, int>("NPCs", @"Gamefiles/logic/npcs.csv", 16)); _gameFiles.Add(new Tuple <string, string, int>("Decos", @"Gamefiles/logic/decos.csv", 17)); _gameFiles.Add(new Tuple <string, string, int>("Shields", @"Gamefiles/logic/shields.csv", 19)); _gameFiles.Add(new Tuple <string, string, int>("Achievements", @"Gamefiles/logic/achievements.csv", 22)); _gameFiles.Add(new Tuple <string, string, int>("Spells", @"Gamefiles/logic/spells.csv", 25)); _gameFiles.Add(new Tuple <string, string, int>("Heroes", @"Gamefiles/logic/heroes.csv", 27)); /* * gameFiles.Add(new Tuple<string, string, int>("Alliance Badge Layers", @"Gamefiles/logic/alliance_badge_layers.csv", 30)); * gameFiles.Add(new Tuple<string, string, int>("Alliance Badges", @"Gamefiles/logic/alliance_badges.csv", 31)); * gameFiles.Add(new Tuple<string, string, int>("Alliance Levels", @"Gamefiles/logic/alliance_levels.csv", 32)); * gameFiles.Add(new Tuple<string, string, int>("Alliance Portal", @"Gamefiles/logic/alliance_portal.csv", 33)); * gameFiles.Add(new Tuple<string, string, int>("Buildings Classes", @"Gamefiles/logic/building_classes.csv", 34)); * gameFiles.Add(new Tuple<string, string, int>("Effects", @"Gamefiles/logic/effects.csv", 35)); * gameFiles.Add(new Tuple<string, string, int>("Locales", @"Gamefiles/logic/locales.csv", 36)); * gameFiles.Add(new Tuple<string, string, int>("Missions", @"Gamefiles/logic/missions.csv", 37)); * gameFiles.Add(new Tuple<string, string, int>("Projectiles", @"Gamefiles/logic/projectiles.csv", 38)); * gameFiles.Add(new Tuple<string, string, int>("Regions", @"Gamefiles/logic/regions.csv", 39)); * gameFiles.Add(new Tuple<string, string, int>("Variables", @"Gamefiles/logic/variables.csv", 40)); * gameFiles.Add(new Tuple<string, string, int>("War", @"Gamefiles/logic/war.csv", 28)); */ _DataTables = new DataTables(); int Count = 0; foreach (Tuple <string, string, int> _File in _gameFiles) { _DataTables.InitDataTable(new CSVTable(_File.Item2), _File.Item3); Count++; } Say("CSV Tables have been succesfully loaded. (" + Count + ")"); } catch (Exception) { Say(); Error("Error loading Gamefiles. Looks like you have :"); Error(" -> Edited the Files Wrong"); Error(" -> Made mistakes by deleting values"); Error(" -> Entered too High or Low value"); Error(" -> Please check to these errors"); Console.ReadKey(); Environment.Exit(0); } }
public void ContextualObjectMemberAccess() { Document doc = new Document(MyDir + "ReportingEngine.ContextualObjectMemberAccess.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds, "ds"); doc.Save(MyDir + @"\Artifacts\ReportingEngine.ContextualObjectMemberAccess Out.docx"); Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.ContextualObjectMemberAccess Out.docx", MyDir + @"\Golds\ReportingEngine.ContextualObjectMemberAccess Gold.docx")); }
public void ExtensionMethods() { Document doc = new Document(MyDir + "ReportingEngine.ExtensionMethods.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds, "ds"); doc.Save(MyDir + @"\Artifacts\ReportingEngine.ExtensionMethods Out.docx"); Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.ExtensionMethods Out.docx", MyDir + @"\Golds\ReportingEngine.ExtensionMethods Gold.docx")); }
public void BubbleChartTest() { Document doc = new Document(MyDir + "ReportingEngine.TestBubbleChart.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds.Managers, "managers"); doc.Save(MyDir + @"\Artifacts\ReportingEngine.TestBubbleChart Out.docx"); Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.TestBubbleChart Out.docx", MyDir + @"\Golds\ReportingEngine.TestBubbleChart Gold.docx")); }
/// <summary> /// 获取指定数据对象对应的DataTable /// </summary> /// <param name="dataObjectId">数据对象标识</param> /// <returns>数据对象对应的DataTable</returns> public DataTable GetDataTable(string dataObjectId) { if (!ShardingInfo.ContainsKey(dataObjectId)) { throw new Exception($"Cannot find {dataObjectId}'s sharding info."); } var tableName = ShardingInfo[dataObjectId].TableName; return(DataTables.FirstOrDefault(i => i.TableName.ToLower() == tableName.ToLower())); }
private static void DataTable() { try { DataTables.GetSetData(); } catch (Exception e) { Console.WriteLine(e.Message); } }
public static object GetData() { // Initialization. DataTables result = new DataTables(); try { // Initialization. string search = HttpContext.Current.Request.Params["search[value]"]; string draw = HttpContext.Current.Request.Params["draw"]; string order = HttpContext.Current.Request.Params["order[0][column]"]; string orderDir = HttpContext.Current.Request.Params["order[0][dir]"]; int startRec = Convert.ToInt32(HttpContext.Current.Request.Params["start"]); int pageSize = Convert.ToInt32(HttpContext.Current.Request.Params["length"]); // Loading. List <Country> data = LoadData(); // Total record count. int totalRecords = data.Count; // Verification. if (!string.IsNullOrEmpty(search) && !string.IsNullOrWhiteSpace(search)) { // Apply search data = data.Where(p => p.CountryName.ToString().ToLower().Contains(search.ToLower()) ).ToList(); } // Sorting. data = SortByColumnWithOrder(order, orderDir, data); // Filter record count. int recFilter = data.Count; // Apply pagination. data = data.Skip(startRec).Take(pageSize).ToList(); // Loading drop down lists. result.draw = Convert.ToInt32(draw); result.recordsTotal = totalRecords; result.recordsFiltered = recFilter; result.data = data; } catch (Exception ex) { // Info Console.Write(ex); } // Return info. return(result); }
public void NestedDataTableTest() { Document doc = new Document(MyDir + "ReportingEngine.TestNestedDataTable.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds, "ds"); doc.Save(MyDir + @"\Artifacts\ReportingEngine.TestNestedDataTable Out.docx"); Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.TestNestedDataTable Out.docx", MyDir + @"\Golds\ReportingEngine.TestNestedDataTable Gold.docx")); }
public static bool Contains(this DataTables dataTables, string tableUid) { for (int i = 0; dataTables != null && i < dataTables.Count; i++) { if (dataTables.Item(i).UniqueID.Equals(tableUid)) { return(true); } } return(false); }
public static int level = 1; // The Current Level to Load void Start() { if (canvas != null) { if (canvas.activeInHierarchy) { canvas.SetActive(false); } } if (GameOverCanvas != null) { if (GameOverCanvas.activeInHierarchy) { GameOverCanvas.SetActive(false); } } var questionList = new List <MediumQuestions>(); if (questions.Count == 0) { questions = DataTables.LoadQuestions(); } if (level <= 10) { questionList = questions.FindAll(x => x.difficulty == "e"); time = 60; //Time Limit } else if (level >= 11 && level <= 20) { questionList = questions.FindAll(x => x.difficulty == "m"); time = 40;//Time Limit } else if (level >= 21 && level <= 30) { questionList = questions.FindAll(x => x.difficulty == "h"); time = 30;//Time Limit } totalTime = time; int i = rng.Next(0, questionList.Count - 1); var tempquestion = questionList[i]; questions.Remove(tempquestion); currentQuestion = tempquestion; answerBank.Clear(); selectCharacters.Clear(); foreach (char c in currentQuestion.randomword) { answerBank.Add(c.ToString()); } GlobalFunctions.isLoading = false; }
public void IndexOf() { Document doc = new Document(MyDir + "ReportingEngine.TestIndexOf.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds, "ds"); MemoryStream dstStream = new MemoryStream(); doc.Save(dstStream, SaveFormat.Docx); Assert.AreEqual("The names are: Name 1, Name 2, Name 3\f", doc.GetText()); }
public void IfElse() { Document doc = new Document(MyDir + "ReportingEngine.IfElse.docx"); DataSet ds = DataTables.AddClientsTestData(); BuildReport(doc, ds.Managers, "m"); MemoryStream dstStream = new MemoryStream(); doc.Save(dstStream, SaveFormat.Docx); Assert.AreEqual("You have chosen 3 item(s).\f", doc.GetText()); }
/// <summary> /// 获取泛型集合 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="conn"></param> /// <param name="sp"></param> /// <returns></returns> public DataTables <T> GetTables <T>(StoreProcedure sp) { string str = ConfigurationManager.ConnectionStrings["ecard"].ConnectionString; SqlConnection conn = new SqlConnection(str); try { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = sp.ProcedureName; if (sp.param != null) { cmd.Parameters.AddRange(sp.param); } using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataSet ds = new DataSet(); sda.Fill(ds); if (ds == null || ds.Tables.Count <= 0) { return(null); } DataTable dt = ds.Tables[0]; DataTables <T> tables = new DataTables <T>(); tables.ModelList = new List <T>(); if (dt.Rows.Count == 1 && dt.Columns.Count == 1 && dt.Columns["Total"] != null) { tables.TotalCount = Convert.ToInt32(dt.Rows[0]["Total"]); } tables.ModelList = (List <T>)DataSetToList <T>(ds, 1); return(tables); } } } catch (Exception ex) { // Log.Error(ex.Message, ex); return(null); } finally { conn.Close(); } }
/// <summary> /// This function load all gamefiles in the csv/logic/ folder. /// </summary> public static void LoadGameFiles() { var gameFiles = new List <Tuple <string, string, int> >(); Console.WriteLine("[UCR] Loading server gamefiles & data..."); foreach (var data in gameFiles) { Console.Write(" -> " + data.Item1); DataTables.InitDataTable(new CSVTable(data.Item2), data.Item3); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" done"); Console.ResetColor(); } }
private void BindTaskStatus() { try { _ddlStatus.DataSource = DataTables.GetTaskStatus(); _ddlStatus.DataTextField = "statusText"; _ddlStatus.DataValueField = "statusValue"; _ddlStatus.DataBind(); } catch (Exception ex) { throw ex; } }
public static void Stop() { foreach (Level op in ResourcesManager.GetOnlinePlayers()) { ResourcesManager.DropClient(op.GetClient().GetSocketHandle()); } m_vDatabase = new DatabaseManager(); NpcLevels = new Dictionary <int, string>(); DataTables = new DataTables(); m_vAlliances = new Dictionary <long, Alliance>(); m_vHomeDefault = ""; m_vAvatarSeed = 0; m_vAllianceSeed = 0; _Logger.Print(" Object Manager unloaded successfully", Types.INFO); }
public object ExecuteDataTablesQuery() { var sqlQueryAndParms = this.GetSqlQueryAndParms(SelectClauseBuildMode.StringWithAlias); var sqlQuery = sqlQueryAndParms.Item1; var sqlWhere = sqlQueryAndParms.Item2; var start = DataTablesOption.Start + 1; // 分页中 start 为起始行,不是要跳过的行值 var length = DataTablesOption.Length; var connectionOpt = this.GetConnectionOption(); var itemCount = this.dataDao.QueryCount(connectionOpt.Item1, connectionOpt.Item2, sqlQuery, sqlWhere); var items = this.dataDao.Query<ReportData>(connectionOpt.Item1, connectionOpt.Item2, sqlQuery, sqlWhere, start, length); var datatable = new DataTables<ReportData>(items, itemCount); return datatable.WrapDataTablesObject(); }
public BLLOperacion() { dataTable = new DataTables(); _proveedor = new TProveedore(); _marca = new TMarca(); _departamento = new TDepartamento(); _categoria = new TCategoria(); _articulo = new TArticulo(); _cantidadesArt = new TCantidadesArticulo(); _precioArticulo = new TPreciosArticulo(); _pasillo = new TPasillo(); _mueble = new TMueble(); _caracteristicas = new TCaracteristicasArticulo(); _ventaEncabezado = new TVentasEncabezado(); _ventaDetalle = new TVentasDetalle(); }
public static JsonResult Index(DataTables.AspNet.Core.IDataTablesRequest request, DbConnection connection, string from_sql, Field[] fields, bool ignore_first_column_search = true) { Cliver.Bot.DbConnection dbc = Cliver.Bot.DbConnection.CreateFromNativeConnection(connection); return Index(request, dbc, from_sql, fields, ignore_first_column_search); }
partial void ListDataOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, DataTables.Mvc.IDataTablesRequest request, Jarboo.Admin.BL.Filters.ReportFilter reportFilter);
public override System.Web.Mvc.ActionResult ListData(DataTables.Mvc.IDataTablesRequest request, Jarboo.Admin.BL.Filters.ReportFilter reportFilter) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ListData); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "request", request); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "reportFilter", reportFilter); ListDataOverride(callInfo, request, reportFilter); return callInfo; }
public static DataTable SelectInCompletesAudits(string connectionString, DataTables.ClassAuditEntriesDataTable entriesTable) { DataTable _resultTable = new DataTable(); SqlConnection sqlConnection = new SqlConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlConnection.ConnectionString = connectionString; sqlCommand.Connection = sqlConnection; sqlCommand.CommandText = BuildSelectInCompleteAuditsQuery(entriesTable); sqlConnection.Open(); using (SqlDataAdapter sqlAdaptor = new SqlDataAdapter(sqlCommand.CommandText, sqlConnection)) { sqlAdaptor.Fill(_resultTable); } sqlConnection.Close(); return _resultTable; }
private static string BuildSelectInCompleteAuditsQuery(DataTables.ClassAuditEntriesDataTable entriesTable) { StringBuilder sqlQuery = new StringBuilder(); int entriesCount = 1; sqlQuery.AppendLine("USE [APN_DATA]"); sqlQuery.AppendLine("SELECT "); sqlQuery.AppendLine(" [ID],"); sqlQuery.AppendLine(" [File_Name],"); sqlQuery.AppendLine(" [Date_Uploaded],"); sqlQuery.AppendLine(" [Date_Completed],"); sqlQuery.AppendLine(" [Actual_CDR_Amount],"); sqlQuery.AppendLine(" [Self_Check_CDR_Amount]"); sqlQuery.AppendLine("FROM"); sqlQuery.AppendLine(" [dbo].[MTN_APN_Data_File]"); sqlQuery.AppendLine("WHERE"); sqlQuery.AppendLine(" Audit_File_CDR_Amount IS NULL"); sqlQuery.AppendLine(" AND [File_Name] IN"); sqlQuery.AppendLine(" ("); foreach (DataRow dr in entriesTable.entriesTable.Rows) { sqlQuery.AppendLine(" '" + dr["FileName"] + "' + '.dat',"); if (entriesCount == entriesTable.entriesTable.Rows.Count) { sqlQuery = sqlQuery.Remove(sqlQuery.Length - 3, 1); } else entriesCount++; } sqlQuery.AppendLine(" )"); return sqlQuery.ToString(); }
public static JsonResult Index(DataTables.AspNet.Core.IDataTablesRequest request, Cliver.Bot.DbConnection dbc, string from_sql, Field[] fields, bool ignore_first_column_search = true) { try { from_sql = " " + from_sql; //turn around as it is unclear how to pass additional parameters if (!string.IsNullOrWhiteSpace(request.Columns.First().Search.Value)) { List<string> wheres = new List<string>(); foreach (string f2c in Regex.Split(request.Columns.First().Search.Value, @"\|", RegexOptions.Singleline)) { Match m = Regex.Match(f2c, @"(?'DbField'.*?)\=(?'SearchValue'.*)", RegexOptions.Singleline); if (m.Success) { string search_value = m.Groups["SearchValue"].Value; decimal sv; if (!decimal.TryParse(search_value, out sv)) search_value = "'" + search_value + "'"; wheres.Add(m.Groups["DbField"].Value + "=" + search_value); } m = Regex.Match(f2c, @"(?'DbField'.*?)\s*LIKE\s*(?'SearchValue'.*)", RegexOptions.Singleline); if (m.Success) { string search_value = m.Groups["SearchValue"].Value; decimal sv; if (!decimal.TryParse(search_value, out sv)) search_value = "'" + search_value + "'"; wheres.Add(m.Groups["DbField"].Value + " LIKE " + search_value); } } if (wheres.Count > 0) { string select_sql = " WHERE " + string.Join(" AND ", wheres); from_sql += select_sql; } } int total_count = (int)dbc.Get("SELECT COUNT(ISNULL(" + fields[0].Entity + ", 0))" + from_sql).GetSingleValue(); int filtered_count = total_count; string where_sql = null; if (!string.IsNullOrEmpty(request.Search.Value)) { string search = Regex.Replace(request.Search.Value.ToLower(), @"\'|\%|\\|_", @"\$0", RegexOptions.Compiled | RegexOptions.Singleline); List<string> conditions = new List<string>(); foreach (Field f in fields.Where(r => r.Searchable)) conditions.Add("" + f.Entity + " LIKE '%" + search + "%'"); if (conditions.Count > 0) { if (from_sql.Contains(" WHERE ")) where_sql += " AND "; else where_sql += " WHERE "; where_sql += "(" + string.Join(" OR ", conditions) + @" ESCAPE '\')"; } } if (!string.IsNullOrWhiteSpace(where_sql)) filtered_count = (int)dbc.Get("SELECT COUNT(ISNULL(" + fields[0].Entity + ", 0))" + from_sql + where_sql).GetSingleValue(); Dictionary<string, int> of2nothing = new Dictionary<string,int>(); List<string> ofs = new List<string>(); foreach (var column in request.Columns) { if (ignore_first_column_search) { ignore_first_column_search = false; continue; } if (column.Sort == null) continue; string f = column.Field; int n; if (int.TryParse(f, out n)) f = fields[n].Entity; if (column.Sort.Direction == DataTables.AspNet.Core.SortDirection.Ascending) ofs.Add(f); else ofs.Add(f + " DESC"); of2nothing[f] = 0; } foreach (Field field in fields) { if (field.Order == Field.OrderMode.NONE) continue; if(of2nothing.ContainsKey(field.Name)) continue; if (field.Order == Field.OrderMode.ASC) ofs.Add(field.Entity); else ofs.Add(field.Entity + " DESC"); of2nothing[field.Name] = 0; } string order_sql = " ORDER BY "; if (ofs.Count > 0) order_sql += string.Join(", ", ofs); else order_sql += fields[0].Entity; string fields_sql = string.Join(",", (from r in fields select r.Expression != null ? r.Expression + " AS " + r.Name : r.Name)); string sql = "SELECT " + fields_sql + from_sql + where_sql + order_sql + " OFFSET " + request.Start + " ROWS FETCH NEXT " + request.Length + " ROWS ONLY"; List<object[]> array = new List<object[]>(); using (DbDataReader r = (DbDataReader)dbc.Get(sql).GetReader()) { string search = null; if (!string.IsNullOrEmpty(request.Search.Value)) search = Regex.Escape(request.Search.Value); while (r.Read()) { object[] vs = new object[fields.Length]; r.GetValues(vs); if (search != null) { for (int i = 0; i < fields.Length; i++) if (fields[i].Searchable) if(!(vs[i] is System.DBNull)) vs[i] = Regex.Replace((string)vs[i], search, @"<span class='match'>$0</span>", RegexOptions.Compiled | RegexOptions.IgnoreCase); } array.Add(vs); } } DataTables.AspNet.Mvc5.DataTablesResponse response = DataTables.AspNet.Mvc5.DataTablesResponse.Create(request, total_count, filtered_count, array); return new DataTables.AspNet.Mvc5.DataTablesJsonResult(response, JsonRequestBehavior.AllowGet); } catch (Exception e) { DataTables.AspNet.Mvc5.DataTablesResponse response = DataTables.AspNet.Mvc5.DataTablesResponse.Create(request, e.Message); return new DataTables.AspNet.Mvc5.DataTablesJsonResult(response, JsonRequestBehavior.AllowGet); } }