private void Search_Load(object sender, EventArgs e) { //cbtype.DataSource = TypeSearch; //cmb //TypeSearch.ForEach(x => //{ // cbtype.Items.Add(x); //}); cbtype.Items.AddRange(TypeSearch.ToArray()); this.Controls.Add(btnClick); btnClick.Location = new Point(403, 37); btnClick.Size = new Size(75, 23); btnClick.Text = "Search"; }
public IEnumerable <TypeDto> Execute(TypeSearch request) { var query = Context.UserTypes.AsQueryable(); if (request.Name != null) { query = query.Where(t => t.Type.ToLower().Contains(request.Name.ToLower())); } return(query.Select(t => new TypeDto { Id = t.Id, Name = t.Type })); }
public IActionResult Get([FromQuery] TypeSearch search) { try { var tip = _getTypesCommand.Execute(search); return(Ok(tip)); } catch (EntityNotFoundException e) { if (e.Message == "Type doesn't exist.") { return(NotFound(e.Message)); } return(UnprocessableEntity(e.Message)); } }
/// <summary> /// Retrieves the primary key for the table /// </summary> /// <param name="assemblyFilePath">The assembly file to search</param> /// <remarks>Assumes only 1 primary key defined on class</remarks> public void GetPrimaryKey(string assemblyFilePath) { Type type = AssemblySearch.GetTypeFromAssembly(assemblyFilePath, FullClassNamespace); object primaryKey = TypeSearch.GetPrimaryKeyFromType(type); //if null, there is no primary key if (primaryKey != null) { try { PropertyInfo property = (PropertyInfo)primaryKey; AddColumn(ColumnDefinition.CreateFromPropertyInfo(property, true)); } catch (InvalidCastException) { //If not a PropertyInfo type or null, it must be FieldInfo. Otherwise, allow exceptions. FieldInfo field = (FieldInfo)primaryKey; AddColumn(ColumnDefinition.CreateFromFieldInfo(field, true)); } } }
/// <summary> /// Private helper method to perform a new search or maintain a previous search through /// pagination and filter changes /// </summary> /// <param name="types">The base type query result</param> /// <param name="sortBy">The passed sort string if it exists, else null</param> /// <param name="page">The passed page param if it exists, else null</param> /// <returns>The searched types</returns> private IQueryable <type> doSearch(IQueryable <type> types, TypeSearch search, String filterString, string sortBy, int?page) { if (page != null || !String.IsNullOrEmpty(sortBy) || !String.IsNullOrEmpty(filterString)) { search = setSearchFromSession(search); } else { setSessionFromSearch(search); } if (!String.IsNullOrEmpty(search.name)) { types = types.Where(t => t.name.Contains(search.name)); } if (!String.IsNullOrEmpty(search.measure)) { types = types.Where(t => t.measure.Contains(search.measure)); } return(types); }
private static void SearchAll(TypeSearch search, Func <int, int> searchType) { List <Count1> count1s = new List <Count1>(); int min = search.Items[0] - 100; int max = search.Items.Last() + 101; for (int i = min; i < max; i++) { var z = searchType(i); var k = search.CountCompare; count1s.Add(new Count1(i, z, k)); } var co = count1s.GroupBy(x => x.CountCompare); co = co.OrderBy(x => x.Key); System.Console.WriteLine($"{search.NameTypeSearch}:"); foreach (var item in co) { System.Console.WriteLine($"CountCompare={item.Key} - CountItems{item.Count()}."); } System.Console.WriteLine(); }
/// <summary> /// Retrieves all foreigns keys for the table /// </summary> /// <param name="assemblyFilePath">The assembly file to search</param> /// <remarks><see cref="CompleteForeignKeyDefinitions"/> should be called after this function.</remarks> public void GetForeignKeys(string assemblyFilePath) { Type type = AssemblySearch.GetTypeFromAssembly(assemblyFilePath, FullClassNamespace); //Search fields foreach (var field in TypeSearch.GetFieldsWithScriptForeignKeyAttribute(type) ?? new FieldInfo[0]) { AddForeignKey(ForeignKeyDefinition.CreateFromFieldInfo(field, Name)); } //Search properties foreach (var property in TypeSearch.GetPropertiesWithScriptForeignKeyAttribute(type) ?? new PropertyInfo[0]) { AddForeignKey(ForeignKeyDefinition.CreateFromPropertyInfo(property, Name)); } #if DEBUG foreach (ForeignKeyDefinition fk in ForeignKeys) { Console.WriteLine($"Table: {Name} - Foreign Key: {fk.ColumnName}, {fk.ForeignTable}"); } #endif }
/// <summary> /// Sets the session search parameters based on the current search values /// </summary> /// <param name="search">The WorkoutSearch object containing the values to set in the session</param> private void setSessionFromSearch(TypeSearch search) { if (Session != null) { if (!String.IsNullOrEmpty(search.name)) { Session["NameSearchParam"] = search.name; } else { Session["NameSearchParam"] = ""; } if (!String.IsNullOrEmpty(search.measure)) { Session["MeasureSearchParam"] = search.measure; } else { Session["MeasureSearchParam"] = ""; } } }
public FSearch(string formName, TypeSearch typeSearch, object sender) { var conn = new RepositoryInjection().GetClass <IFactoryConnection>(); _reports = new ReportApp(conn); _consults = new ConsultApp(conn); _form = formName; TypeSearch = typeSearch; InitializeComponent(); MenuSearch.Tag = this; // Define o style do grid de pesquisa GridFilter.SMenuComponent.Visible = false; GridFilter.STextBox.Visible = false; GridFilter.SComponent.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2; // Define as colunas padrões do grid de pesquisa GridFilter.SComponent.Columns.Add("Description", "Descrição"); GridFilter.SComponent.Columns.Add("Filter", "Filtro"); GridFilter.SComponent.Columns.Add("Value", "Valor"); GridFilter.SComponent.Columns.Add("Value2", ""); GridFilter.SComponent.EditingControlShowing += dataGridView1_EditingControlShowing; Tag = sender; InicitializeTreeView(); TreeView.ExpandAll(); TreeView.AfterSelect += TreeView_AfterSelect; TreeView.SelectedNode = TreeView.Nodes[0].FirstNode; TreeView.Focus(); }
static void Main(string[] args) { System.Console.OutputEncoding = System.Text.Encoding.UTF8; int[] mass = new int[] { 8569, 8910, -8825, 8115, -3834, -7315, -7114, -5486, 6338, -2322, -3152, -1923, 398, 5902, -6749, -2745, -1265, -8541, -9921, 7504, 2223, -2119, 3338, 6626, 4432, 7490, 7407, -1753, -653, 9020, -4126, -5275, -8100, 9273, -6391, -9466, -3730, 5579, 1000, -2257, -6304, 8629, -4504, 6174, 6990, 6569, 601, 1230, 9636, 9049, 5881, -728, -697, -5985, 4299, 688, -4428, -5451, -6317, -1325, -4722, 4639, 5166, 7317, -8197, -7878, -3824, 1125, 2292, -7284, -9015, 3155, 459, 2336, 3807, 3594, -7616, 7163, 9636, 7863, -3111, -3823, -1390, 297, -6861, 6602, 5422, 7885, -5027, 2920, 4961, -8279, 1896, -7676, -7536, -943, -6538, -1821, 4370, 4867, 392, 9475, 8937, 6919, 8064, -7275, 8813, 6966, 207, -9295, -1697, -1592, -5088, -4181, -8214, 9100, -3972, -5131, 4177, -4799, -3300, -1709, -3849, 9372, -2246, 9264, -8742, -1865, -129, -5250, 132, 4205, -7207, -5232, -2530, -2587, -2761, 1691, 2232, -9586, 7789, 8455, -2322, -5732, -5383, -3447, 6808, -3924, -9462, -6636, -6971, 8592, 4001, -832, -1834, -7899, 3324, 9565, -836, 8800, -8533, 677, -2905, -4544, 573, 4097, -4385, -9856, 8349, 4372, 1861, 4337, 2636, 3763, -2588, -1755, -9387, -8117, 4755, -8799, -7545, 5181, -2404, -3493, -8279, 1539, -9796, 3624, 6601, -4632, 4089, -2326, -7474, 3432, 8946, -2889, 1359, -7779, 3695, 519, -9062, 6664, -2273, -3835, 1502, -1309, -4044, -9762, -8244, 9921, -8512, 1440, -5190, -2037, 6344, -3715, -6919, -9412, -6265, 9033, 3893, 1990, -6458, 2981, -9717, -5813, 1810, 9204, 4816, -9699, 6885, 8391, -1812, -5764, -9737, -4209, -2546, -8570, 5004, 3029, -4417, 9966, 1868, 6680, -6120, -7352, -7137, 4563, 7087, 2661, -5971, 771, 8486, 4661, 6625, -1053, 3121, 4745, -4118, -2685, 6881, -3249, -4579, -8546, -6965, -6904, -6748, -9426, -2300, 553, 8830, -8350, -4417, 706, 3450, 3927, -9878, -3138, -900, 7634, -8677, 7247, -7883, -7846, 6271, -3886, 9905, 3526, -2390, 1316, 2670, 2708, 5547, -2311, 6147, 8831, 4544, 413, 3644, -9217, 9395, -7711, -3137, -3466, 3831, -7621, -4812, -2220, -8790, -7302, -1176, -3741, -4356, -1752, -4009, 9634, -5366, -6734, -4818, 6921, -6809, -275, 2963, 6383, 7883, -3879, -3898, 7893, 4558, 4618, 9382, -292, 3217, -1683, 8238, 9033, 383, 5582, -1677, 3892, -9075, 2125, 2316, -5088, -7509, -3590, -2936, -2701, -8302, 6513, 4197, 1277, -4770, 6723, 7592, -331, -675, 479, -1349, -2291, 6276, -2706, 3221, -3409, -6685, 9115, 3041, 7327, 9, -3043, -750, -949, 4943, 1290, 5995, 1065, 7409, -1949, 3892, 1472, 9057, 8803, 6195, 8044, -9579, -1896, -5523, 6494, 725, -1432, -292, 9904, -3069, -9387, 7615, 3631, 8903, -4276, -8404, -6625, 3369, -264, 7290, 4740, -2738, -4855, 6334, 3940, -9273, -3474, 2260, -8726, 6586, 7179, -1348, 7473, 1099, 5176, -3831, 5210, 4638, 6546, -3398, -8560, 7249, -655, -7880, 4329, 3675, -7636, 2162, 1684, -3546, 516, 8102, -680, -8487, -8545, 781, 5275, 1770, 537, 5767, -5802, 6308, -1567, -6683, -249, 1960, -9859, -7469, -6274, 9554, -3614, -1263, 6823, -6866, 5849, 7490, 7917, -6976, -7996, -9736, 8363, 4364, -9425, 4820, -3930, 9077, 9331, 5960, -357, -5606, 894, -6560, -5900, -9221, -7597, -4868, -1184, -3973, 2368, -7632, 3534, 9832, -1565, 2129, -9932, -8222, -8722, -3814, -4337, -6036, 2864, 2251, -235, 273, 7404, -166, 5732, 3612, 7247, 674, 2629, -5820, 2887, 9331, -1340, -7055, -5363, 6044, -9270, 717, -1326, 1889, 656, 9635, -3270, 8530, -4072, -1554, 4752, -5709, 7798, 3144, 297, -4321, 1530, 8643, 3674, 3827, -6626, 2569, -601, 5203, -1220, -8307, -261, -647, -3056, -897, -6532, 7122, 7141, -4766, -4544, 4946, 5290, -9025, -8406, 130, -6458, 8873, -6095, -2714, 8860, 2956, 2876, 9484, 3883, -2792, -2199, 17, -729, 810, 2669, -1839, -8683, 3470, -6891, -1038, -105, 7377, 1585, 6825, -5023, 7630, -2850, 2563, -2312, 5350, 388, 554, 7048, -6456, 284, -5500, -1337, -7887, 6342, 5824, -1183, 255, 5469, 9736, -8698, 3450, -2149, -3669, 2564, 7295, 3628, -8181, 7866, 2632, -9766, -3835, -2712, -2920, -7692, -8770, -4195, -9688, 1795, 8533, 6819, 7246, 2969, -4274, -9475, -1832, 9497, 9204, 7128, -2716, -9856, 9640, -8093, 1849, 5522, 1526, -221, -9182, 9998, 393, -8278, -1431, 2688, -5585, -6691, -5881, 7212, -8417, 9804, 5112, 18, -1496, 8459, 6936, -7084, -5945, -9519, -7876, -4195, -5604, 7797, 4424, -5309, 581, 2487, -9406, -5743, 5438, 1557, 782, 1451, -5013, -9687, -8599, 6810, -1750, -5443, -1446, -7583, 6405, 956, 7913, 9399, -7984, 7266, 1640, -8820, -5029, -1067, 1467, 1045, -2346, 5012, 5602, 2595, -2703, -6123, -7893, 1927, -7285, 9862, -8227, 26, -978, -6340, -4969, -1810, 7058, -9875, 4665, 9498, 1927, 9707, -600, 3440, 9884, 5024, -7325, 3314, -9153, 9413, 9285, -3495, -9910, 9736, -6204, -26, -5289, -1195, -488, -5628, -7550, 6626, 9701, 6542, -818, -2113, 376, 8355, 2235, -6551, -5878, -5154, 4267, 1968, 9118, -2053, -4388, -7838, 2711, 2272, -8798, -1208, 1080, -6698, -9423, 5267, -64, -715, 9863, 5057, -6521, -1748, 612, 292, 7048, 5300, -9995, 2857, -5743, 1997, -5352, -5681, -8921, 7398, 5290, 4439, 2238, -1879, -9382, 5849, -5639, -7452, 6094, 7239, -6830, 3657, -4454, 6398, 5965, 3914, 7950, -8910, 8492, 7178, 9969, 5870, 4233, -6026, 4920, -6183, -2059, 2755, 7904, -9286, -2376, 6883, -2287, 3682, -1989, -3862, -6971, -8185, -1333, -5986, 695, -9069, 2157, 3372, -2878, -6610, -246, -6394, 6891, 342, 4046, -6443, -4173, -6100, 7428, 9420, -9795, -1737, 3200, 6801, -2093, 1606, -5357, 5380, -385, -3713, -4057, 1864, -1613, -173, 885, 6135, 2423, 4477, -3518, 9038, -6288, -9140, 6852, 1530, 4063, -5666, 5863, -2439, -3333, -5934, 1055, -6188, 6254, -1409, -4068, 4765, -1385, 1865, 6107, 9089, 6287, 6777, -6243, -9165, 7446, 7889, 5219, -2936, 9457, 7911, 1134, 1349, 7418, 8389, 5707, 9344, 1411, -8331, -7263, -6428, 5742, 7081, -1288, -4452, 5231, -7869, 5610, 9796, -6105, 6119, -2481, -9443, 8370, -2607, -7249, -3065, 7103, 6016, 4083, 6173, -885, -1201, -1896, -1245, 2931, 9706, -3606, 7864, 2883, -3413, -6647, -3055, -872, 2534, -6654, 9205, -1936, 8208, -4396, 5315, -7721, 5423, -6832, -6663, 391, 577, 2978, 25, 5637, -1229, -7759, 5394, -2414, -3436, 4457, -3057, -1023, 9956, 2617, 5525, 5737, 7745, -3088, 7307, 2766, -9426, 1429, -4164, -5954, -6455, 8871, 8895, 412, 8767, 3894, 3692, -4370, -5234, 8364, -7646, -3273, 6368, -7773, -5889, -5654, -2042, 9359, -7437, 8077, 6402, 228, -1893, -4409, 78, 9578, -5467, -1490, -4139, 571, -183, 9147, -2858, -4022, 2092, -100, -6654, -5018, -1182, 2670, -9235, -8687, -5790, -8408, 262, }; var search = new TypeSearch(mass); SearchAll(search, search.InterpolationSearch); SearchAll(search, search.BinarySearch); System.Console.WriteLine(); System.Console.ReadKey(); }
/// <summary> /// ForFiltring Days And Months and years /// </summary> /// <param name="Typesearch"></param> /// <returns></returns> public void FieldDataTables(TypeSearch Typesearch, DataTable data) { List <string> Name = new List <string>(); List <string> NUMF = new List <string>(); List <string> Price = new List <string>(); List <string> Price_a = new List <string>(); List <string> DOW = new List <string>(); List <string> Barcode = new List <string>(); List <string> DAT = new List <string>(); //-=-=- List <string> Name_ = new List <string>(); List <string> NUMF_ = new List <string>(); List <string> Price_ = new List <string>(); List <string> Price_a_ = new List <string>(); List <string> DOW_ = new List <string>(); List <string> Barcode_ = new List <string>(); List <string> DAT_ = new List <string>(); BindingSource Bind = new BindingSource(); if (Typesearch == TypeSearch.Day) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var DayList = new List <string>(); foreach (var item in SealsFunction.GetDays()) { DayList.Add(item);//Add Days For Compairing. } for (int i = 0; i < DayList.Count; i++) { if (SealsFunction.ExtractDaysFromDate() == DayList[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = true; PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsYear_ = false; } else if (Typesearch == TypeSearch.Month) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var Monthlist = new List <string>(); foreach (var item in SealsFunction.GetMonths()) { Monthlist.Add(item);//Add Days For Compairing. } for (int i = 0; i < Monthlist.Count; i++) { if (SealsFunction.ExtractmonthsFromDate() == Monthlist[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsMounth_ = true; PrintHelper.Print.IsYear_ = false; } else if (Typesearch == TypeSearch.SquareYear) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var MonthList = new List <string>(); foreach (var item in SealsFunction.GetMonths()) { MonthList.Add(item);//Add Days For Compairing. } for (int i = 0; i < MonthList.Count; i++) { if (DateTime.Now.Day.ToString() == MonthList[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } } else if (Typesearch == TypeSearch.Year) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var yearlist = new List <string>(); foreach (var item in SealsFunction.GetYears()) { yearlist.Add(item);//Add Days For Compairing. } for (int i = 0; i < yearlist.Count; i++) { if (SealsFunction.ExtractyearsFromDate() == yearlist[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsYear_ = true; } }
/* * * ID = item.Field<string>("ID"), * conprou = item.Field<string>("conprou"), * PRICE = item.Field<string>("PRICE"), * DAT = item.Field<string>("DAT"), * NAME = item.Field<string>("NAME"), * datrec = item.Field<string>("datrec"), * discounts = item.Field<string>("discounts"), * typeprou = item.Field<string>("typeprou"), * isdone = (item.Field<Int64>("isdone")) ? GetImage(@"/images/ionicons_2-0-1_ios-timer_23_0_27ae60_none.png") : GetImage(@"/images/material-icons_3-0-1_done_23_0_27ae60_none.png") * * */ public void Create(TypeSearch Type, ObservableCollectionCore <Models.RepairView> data) { var ID = new List <string>(); var conprou = new List <string>(); var PRICE = new List <string>(); var DAT = new List <string>(); var NAME = new List <string>(); var datrec = new List <string>(); var discounts = new List <string>(); var typeprou = new List <string>(); var isdone = new List <bool>(); var ID_ = new List <string>(); var conprou_ = new List <string>(); var PRICE_ = new List <string>(); var DAT_ = new List <string>(); var NAME_ = new List <string>(); var datrec_ = new List <string>(); var discounts_ = new List <string>(); var typeprou_ = new List <string>(); var isdone_ = new List <bool>(); BindingSource bind = new BindingSource(); if (Type == TypeSearch.Day) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetDays()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractDaysFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { //ID_.Add(ID[i]); //conprou_.Add(conprou[i]); //PRICE_.Add(PRICE[i]); //DAT_.Add(DAT[i]); //NAME_.Add(NAME[i]); //datrec_.Add(datrec[i]); //discounts_.Add(discounts[i]); //typeprou_.Add(typeprou[i]); //isdone_.Add(isdone[i]); if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii])?-1:0); } //datarow["ID"] = ID_[ii]; //datarow["NAME"] = NAME_[ii]; //datarow["DAT"] = DAT_[ii]; //datarow["datrec"] = datrec_[ii]; //datarow["typeprou"] = typeprou_[ii]; //datarow["PRICE"] = PRICE_[ii]; //datarow["discounts"] = discounts_[ii]; //datarow["conprou"] = conprou_[ii]; //datarow["isdone"] = isdone_[ii]; } } else if (Type == TypeSearch.Year) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetYears()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractyearsFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0); } } } else if (Type == TypeSearch.Month) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetMonths()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractmonthsFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0); } } } }
private System.Windows.Forms.TreeNode GetNode(string node, System.Windows.Forms.TreeNodeCollection parentCollection, TypeSearch typeSearch) { System.Windows.Forms.TreeNode ret = null; foreach (System.Windows.Forms.TreeNode child in parentCollection) { if (typeSearch == TypeSearch.searchID) { if ((string)((NodeDesign)child.Tag).Key == node) { ret = child; } else if (child.GetNodeCount(false) > 0) { ret = GetNode(node, child.Nodes, TypeSearch.searchID); } } else if (typeSearch == TypeSearch.searchText) { if (child.Text == node) { ret = child; } else if (child.GetNodeCount(false) > 0) { ret = GetNode(node, child.Nodes, TypeSearch.searchText); } } if (ret != null) { break; } } return(ret); }
public void GoSearch(TypeSearch searchtype, List <object> obj, BackgroundWorker bgk) { ObservableCollection <mLegislacaoConsulta> listdoc = new ObservableCollection <mLegislacaoConsulta>(); var dataAccess = Data.Factory.Connecting(DataBase.Base.Governo); //System.Windows.MessageBox.Show(searchtype.ToString()); string tipo = (string)obj[0]; int numero = (int)obj[1]; string classificacao = (string)obj[2]; string origem = (string)obj[3]; string situacao = (string)obj[4]; string autor = (string)obj[5]; string resumo = (string)obj[6]; string dataI = obj[7].ToString(); string dataF = obj[8].ToString(); if (tipo == "...") { tipo = "%"; } if (resumo == null || resumo == string.Empty) { resumo = "%"; } if (classificacao == "0" || classificacao == null) { classificacao = "%"; } if (situacao == "0" || situacao == null) { situacao = "%"; } if (origem == "0" || origem == null) { origem = "%"; } if (autor == null || autor == string.Empty) { autor = "%"; } try { string SqlCommand = string.Empty; switch (searchtype) { case TypeSearch.Simple: dataAccess.ClearParameters(); dataAccess.AddParameters("@Tipo", tipo); dataAccess.AddParameters("@Numero", numero); dataAccess.AddParameters("@Complemento", "%"); SqlCommand = SqlCollections.SelectSimples; break; case TypeSearch.Detailed: dataAccess.ClearParameters(); dataAccess.AddParameters("@Tipo", tipo); dataAccess.AddParameters("@Data1", dataI); dataAccess.AddParameters("@Data2", dataF); dataAccess.AddParameters("@Resumo", resumo); dataAccess.AddParameters("@Classificado", classificacao); dataAccess.AddParameters("@Situacao", situacao); dataAccess.AddParameters("@Origem", origem); dataAccess.AddParameters("@Autor", autor); SqlCommand = SqlCollections.SelectDetalhado; break; } var Acoes = dataAccess.Read(SqlCollections.AcoesSemFiltro); int vreg = dataAccess.Read(SqlCommand).Rows.Count; mTipoClassificacao TipoClass = new mTipoClassificacao(); int progresso = 0; int cont_reg = 0; foreach (DataRow leg in dataAccess.Read(SqlCommand).Rows) { cont_reg += 1; var legislacao = new mLegislacaoConsulta(); legislacao.Indice = (int)leg["Indice"]; legislacao.Tipo = leg["Tipo"].ToString(); legislacao.Numero = (int)leg["Numero"]; legislacao.Complemento = leg["Complemento"].ToString(); legislacao.Data = (DateTime)leg["Data"]; legislacao.Publicado = leg["Publicado"].ToString(); legislacao.Resumo = leg["Resumo"].ToString(); legislacao.Classificacao = TipoClass.ToName(legislacao.Tipo, (int)leg["Classificado"]).ToUpper(); legislacao.Link = mLink.Create(legislacao.Tipo, legislacao.Data.Year.ToString(), legislacao.Numero); legislacao.Situacao = new mTipoSituacao().Autal((int)leg["Situacao"]); legislacao.Origem = new mTipoOrigem().Autal((int)leg["Origem"]); legislacao.Autor = leg["Autor"].ToString(); legislacao.Cadastro = (DateTime)leg["Cadastro"]; legislacao.Atualizado = (DateTime)leg["Atualizado"]; legislacao.Excluido = (bool)leg["Excluido"]; //var listaAcoes = new Model.ViewAcoesCollections(); var listaAcoesExercidas = new List <mAcoesConsulta>(); var listaAcoesRecebidas = new List <mAcoesConsulta>(); foreach (DataRow aed in Acoes.Rows) { if ((int)aed["NumeroAlvo"] == legislacao.Numero && aed["TipoAlvo"].ToString().ToLower() == legislacao.Tipo.ToLower() && aed["ComplementoAlvo"].ToString().ToLower() == legislacao.Complemento.ToLower()) { var acoes = new mAcoesConsulta(); acoes.TipoAlvo = aed["TipoOrigem"].ToString().ToUpper(); acoes.NumeroAlvo = (int)aed["NumeroOrigem"]; acoes.ComplementoAlvo = aed["ComplementoOrigem"].ToString(); acoes.DataAlvo = (DateTime)aed["DataOrigem"]; acoes.Acao = new mAcoesRecebidas().Recebidas((int)(aed["AcaoExecutada"])); acoes.Link = mLink.Create(acoes.TipoAlvo, acoes.DataAlvo.Year.ToString(), acoes.NumeroAlvo); listaAcoesRecebidas.Add(acoes); } if ((int)aed["NumeroOrigem"] == legislacao.Numero && aed["TipoOrigem"].ToString().ToLower() == legislacao.Tipo.ToLower() && aed["ComplementoOrigem"].ToString().ToLower() == legislacao.Complemento.ToLower()) { var acoes = new mAcoesConsulta(); acoes.TipoAlvo = aed["TipoAlvo"].ToString().ToUpper(); acoes.NumeroAlvo = (int)aed["NumeroAlvo"]; acoes.ComplementoAlvo = aed["ComplementoAlvo"].ToString(); acoes.DataAlvo = (DateTime)aed["DataAlvo"]; acoes.Acao = new mAcoesExercidas().Exercidas((int)(aed["AcaoExecutada"])); acoes.Link = mLink.Create(acoes.TipoAlvo, acoes.DataAlvo.Year.ToString(), acoes.NumeroAlvo); listaAcoesExercidas.Add(acoes); } } progresso = ((cont_reg + 1) * 100) / vreg; bgk.ReportProgress(progresso); if (bgk.CancellationPending == true) { break; } legislacao.ListaAcoesExercidas = listaAcoesExercidas; legislacao.ListaAcoesRecebidas = listaAcoesRecebidas; listdoc.Add(legislacao); } Lista = listdoc; } catch (Exception ex) { throw new Exception(ex.Message); } finally { dataAccess = null; } }
/// <summary> /// Get Products. /// </summary> /// <param name="filterSearch">filter Search.</param> /// <param name="start">Start.</param> /// <param name="length">Length.</param> /// <param name="typeSearch">Type Search.</param> /// <returns>Products.</returns> public AnswerPage <Product> GetProducts(string filterSearch, int start, int length, TypeSearch typeSearch) { try { AnswerPage <Product> answerProduct = new AnswerPage <Product>(); BaseQueryPagination query = new BaseQueryPagination() { Contains = filterSearch, TotalReturn = true, Page = start / length + 1, PageSize = length }; switch (typeSearch) { case TypeSearch.Code: { int value; if (int.TryParse(filterSearch, out value)) { answerProduct = IoCFactory.Resolve <IProductsServiceAgent>().GetProductById(Convert.ToInt32(filterSearch)); } else { answerProduct = IoCFactory.Resolve <IProductsServiceAgent>().GetProductsByName(query); } break; } case TypeSearch.Name: { answerProduct = IoCFactory.Resolve <IProductsServiceAgent>().GetProductsByName(query); break; } case TypeSearch.Description: { answerProduct = IoCFactory.Resolve <IProductsServiceAgent>().GetProductsByDescription(query); break; } default: { answerProduct = IoCFactory.Resolve <IProductsServiceAgent>().GetProductsByName(query); break; } } return(answerProduct); } catch (Exception ex) { throw new Exception("Se produjo un error al consultar los productos", ex); } }
private bool isPossibleMovingInPosition(Vector3 pos, TypeSearch ts) { BoundingSphere bs = new BoundingSphere(pos, 1); if (_fov.Intersects(bs)) { if (ts == TypeSearch.DISK) agentBeliefs.hasFoundDisk = false; else { agentBeliefs.agentNearGoal = null; } return false; } return true; }
/// <summary> /// Get products. /// </summary> /// <param name="draw">Draw.</param> /// <param name="start">Start.</param> /// <param name="length">Length.</param> /// <param name="search">Search.</param> /// <param name="typeSearch">Type Search.</param> /// <returns>Products.</returns> public async Task <JsonResult> FilterProducts(int draw, int start, int length, Dictionary <string, string> search, TypeSearch typeSearch) { Response.Expires = 0; string filterSearch = string.Empty; if (search.ContainsKey("value")) { filterSearch = search["value"]; } AnswerPage <Product> answerProduct = new AnswerPage <Product>(); answerProduct = IoCFactoryBusiness.Resolve <IProductsService>().GetProducts(filterSearch, start, length, typeSearch); return(Json(new { draw = draw, recordsTotal = answerProduct.Total, recordsFiltered = answerProduct.Total, data = answerProduct.Results }, JsonRequestBehavior.AllowGet)); }
public ActionResult Get([FromQuery] TypeSearch search) { return(Ok(_gEtType.Execute(search))); }
private void TransformLog(string rLogFile, Assembly assembly) { if (!rLogFile.EndsWith(".log")) { EditorUtility.DisplayDialog("错误提示", "不是有效的日志文件,只能转换.log后缀的文件", "确定"); return; } var file = rLogFile; PacketObject.CollectAllRegisteredPackets(); Stream stream = File.OpenRead(file); if (file.EndsWith(".log")) { byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); stream = new MemoryStream(Util.DecompressData(bytes)); } StringBuilder sb = new StringBuilder(); Command command = Command.Create(); while (stream.CanRead && stream.Position < stream.Length) { command.UnSerialize(stream); EditorUtility.DisplayProgressBar("格式转换", command.cache._name, (float)stream.Position / stream.Length); var stack = command.cache as LogStack; if (stack != null) { for (var i = 0; i < stack.method.Length; i++) { var m = stack.method[i]; ArrayList arr; if (!cache.TryGetValue(m.typeHash, out arr)) { arr = TypeSearch.Search(t => t.Name.GetHashCode() == m.typeHash, assembly); cache.Add(m.typeHash, arr); } if (arr.Count > 0) { var type = (System.Type)arr[0]; if (type != null) { var methods = type.GetMethods(); if (m.methodIndex < methods.Length) { var method = methods[m.methodIndex]; sb.AppendLine($"({type.Name}) {method}"); } } } } continue; } var s = LitJson.JsonMapper.ToJson(command.cache); var index = s.IndexOf("tag"); if (index >= 0) { var endIndex = s.IndexOf(',', index); var old = s.Substring(index, endIndex > index ? endIndex - index : s.Length - index); s = s.Replace(old, $"tag\":\"{(TagType) (byte) command.cache.GetType().GetField("tag").GetValue(command.cache)}\""); } sb.AppendLine(s); } command.Destroy(); EditorUtility.ClearProgressBar(); var writer = File.CreateText(file.Replace(".log", ".txt")); writer.Write(sb.ToString()); writer.Close(); }