public static void findSumExDepth(BinaryTreeNode root, double threshold, int level = 0, System.Collections.Generic.List<BinaryTreeNode> list = null) { if (list == null) { list = new System.Collections.Generic.List<BinaryTreeNode>(); list.Add(root); if (root.Data == threshold) { printPath(list); } } else { list.Add(root); double tmp = threshold; for (int i = level; i >= 0; i--) { tmp -= list[i].Data; if (tmp == 0) { printPath(list, i); } } } if (root.LeftNode != null) { findSumExDepth(root.LeftNode, threshold, level + 1, clone(list)); } if (root.RightNode != null) { findSumExDepth(root.RightNode, threshold, level + 1, clone(list)); } }
public void Can_Remove_Product_From_Cart() { // Arrange: Set up a mock repository with two products var mockProductsRepos = new Moq.Mock<IProductsRepository>(); var products = new System.Collections.Generic.List<Product> { new Product { ProductID = 14, Name = "Much Ado About Nothing" }, new Product { ProductID = 27, Name = "The Comedy of Errors" }, }; mockProductsRepos.Setup(x => x.Products) .Returns(products.AsQueryable()); var cart = new Cart(); cart.AddItem(products[1], 2); // 2x Comedy of Errors cart.AddItem(products[0], 3); // 3x Much Ado var controller = new CartController(mockProductsRepos.Object, null); // Act: Try removing Much Ado RedirectToRouteResult result = controller.RemoveFromCart(cart, 14, "someReturnUrl"); // Assert Assert.AreEqual(1, cart.Lines.Count); Assert.AreEqual("The Comedy of Errors", cart.Lines[0].Product.Name); Assert.AreEqual(2, cart.Lines[0].Quantity); // Check that the visitor was redirected to the cart display screen Assert.AreEqual("Index", result.RouteValues["action"]); Assert.AreEqual("someReturnUrl", result.RouteValues["returnUrl"]); }
static MItem unit(string Format, params string[] units) { var lUnits = new System.Collections.Generic.List<string>(units.Length); foreach (var unit in units) lUnits.Add(SMath.Manager.UnitsManager.GetCurrentUnitName(unit)); return Converter.ToMItem(string.Format(Format, lUnits.ToArray())); }
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies() { System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>(); assemblyList.Add(Load("HRApplicationServices.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken" + "=null")); assemblyList.Add(Load("HRApplicationServices.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" + "")); assemblyList.Add(Load("Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a" + "3a")); assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" + "e35")); assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934" + "e089")); assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b7" + "7a5c561934e089")); assemblyList.Add(Load("System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a")); assemblyList.Add(Load("System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" + "31bf3856ad364e35")); assemblyList.Add(Load("System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193" + "4e089")); assemblyList.Add(Load("System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")); assemblyList.Add(Load("System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" + "9")); assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly()); return assemblyList; }
private static int run(string[] args, Ice.Communicator communicator) { System.Collections.Generic.List<int> ports = new System.Collections.Generic.List<int>(); for(int i = 0; i < args.Length; i++) { int port = 0; try { port = System.Int32.Parse(args[i]); } catch(System.FormatException ex) { System.Console.Error.WriteLine(ex); return 1; } ports.Add(port); } if(ports.Count == 0) { System.Console.Error.WriteLine("Client: no ports specified"); usage(); return 1; } AllTests.allTests(communicator, ports); return 0; }
void Initialize(SerializedProperty property) { if (listedScenes != null && listedScenes.Length > 0) return; var scenes = EditorBuildSettings.scenes; var selectableScenes = new System.Collections.Generic.List<EditorBuildSettingsScene>(); SceneSelectionAttribute attr = (SceneSelectionAttribute)attribute; for (int i = 0; i < scenes.Length; i++) { if (scenes[i].enabled || attr.allowDisabledScenes) selectableScenes.Add(scenes[i]); } listedScenes = new GUIContent[selectableScenes.Count]; for (int i = 0; i < listedScenes.Length; i++) { var path = selectableScenes[i].path; int lastSeparator = path.LastIndexOf("/") + 1; var sceneName = path.Substring(lastSeparator, path.LastIndexOf(".") - lastSeparator); listedScenes[i] = new GUIContent(sceneName, selectableScenes[i].enabled ? "Enabled" : "Disabled"); if (listedScenes[i].text.Equals(property.stringValue)) selectedIndex = i; } }
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies() { System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>(); assemblyList.Add(Load("Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a" + "3a")); assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b" + "77a5c561934e089")); assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50" + "a3a")); assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "")); assemblyList.Add(Load("System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a")); assemblyList.Add(Load("System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5619" + "34e089")); assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" + "9")); assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly()); return assemblyList; }
private System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier> CreateActionList() { System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier> actionList = new System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier>(); actionList.Add(new RuleEngine.Evidence.EvidenceSpecifier(true, "a1")); actionList.Add(new RuleEngine.Evidence.EvidenceSpecifier(true, "a2")); return actionList; }
//public GameObject loadingImage; public void LoadScene(string level) { Data.noMissions = false; System.Collections.Generic.List<Mission> tempList = new System.Collections.Generic.List<Mission>(); for (int i = 0; i < Data.diplomacyList.Count; i++) { if (Data.diplomacyList[i].difficulty == Data.currentDifficulty && !Data.diplomacyList[i].isDone) { tempList.Add(Data.diplomacyList[i]); } } System.Random r = new System.Random(); int randomIndex = r.Next(0, tempList.Count); if (tempList.Count == 0) { //hotdogs } else if (!Data.preserveDipMission || !Data.lastDipMission.isListed) { Debug.Log("Random mission: " + randomIndex + " out of: " + tempList.Count); Data.pickedMission = tempList[randomIndex]; Data.lastDipMission = Data.pickedMission; Data.lastDipMission.isListed = true; } else { Data.pickedMission = Data.lastDipMission; } tempList.Clear(); Data.hitBack = false; //loadingImage.SetActive(true); Application.LoadLevel(level); }
internal static string ToJson(ThemeLabelText labelText) { string json = ""; System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); list.Add(string.Format("\"minTextHeight\":{0}", labelText.MinTextHeight.ToString())); list.Add(string.Format("\"maxTextWidth\":{0}", labelText.MaxTextWidth.ToString())); list.Add(string.Format("\"minTextWidth\":{0}", labelText.MinTextWidth.ToString())); list.Add(string.Format("\"maxTextHeight\":{0}", labelText.MaxTextHeight.ToString())); if (labelText.UniformStyle != null) { list.Add(string.Format("\"uniformStyle\":{0}", ServerTextStyle.ToJson(labelText.UniformStyle))); } else { list.Add(string.Format("\"uniformStyle\":{0}", ServerTextStyle.ToJson(new ServerTextStyle()))); } if (labelText.UniformMixedStyle != null) { list.Add(string.Format("\"uniformMixedStyle\":{0}", LabelMixedTextStyle.ToJson(labelText.UniformMixedStyle))); } else { list.Add("\"uniformMixedStyle\":null"); } json = string.Join(",", list.ToArray()); return json; }
internal override string BuildUri(string baseUri, string accesskey) { // assume no batch id nor events string usingBatch = String.Empty; string usingEvents = String.Empty; // if the user has passed a batch id, build that portion of the query string request if (!String.IsNullOrEmpty(BatchId)) { usingBatch = String.Format("&batchid={0}", HttpUtility.UrlEncode(BatchId)); } // if the user has passed event ids, build that portion of the query string request if (EventIds != null) { if (EventIds.Count() != 0) { // URLEncode each event id System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); foreach (var ev in EventIds) { list.Add(HttpUtility.UrlEncode(ev)); } // Build the event ids string string idString = String.Join("_", list.ToArray()); usingEvents = String.Format("&eventids={0}", idString); } } // build the uri return String.Concat(baseUri, String.Format(c_removeeventscommand, accesskey, usingBatch, usingEvents)); }
private void InnitCBCat() { int newsid = Request["newsid"] == null ? -1 : int.Parse(Request["newsid"]); int catid = -1; if (newsid != -1) { var news = (from n in Data.CV_News where n.NewsID == newsid select n).FirstOrDefault(); if (news != null) { catid = news.CatNewsID.Value; } } System.Collections.Generic.List<ListItem> cats = new System.Collections.Generic.List<ListItem>(); var catnews = from cn in Data.CV_CatNews where cn.PortalID==PortalId select new ListItem { Value = cn.CatID.ToString(), Selected = cn.CatID == catid, Text = cn.CatName }; foreach (var c in catnews) { cats.Add(c); } this.ddlCatNews.Items.Clear(); this.ddlCatNews.Items.AddRange(cats.ToArray()); }
public virtual void Test1() { int size = 100000; int[] arrayOfInts = new int[size]; System.Collections.Generic.IList<int> listOfInts = new System.Collections.Generic.List <int>(size); long startArray = OdbTime.GetCurrentTimeInMs(); for (int i = 0; i < size; i++) { arrayOfInts[i] = i; } for (int i = 0; i < size; i++) { int ii = arrayOfInts[i]; } long endArray = OdbTime.GetCurrentTimeInMs(); long startList = OdbTime.GetCurrentTimeInMs(); for (int i = 0; i < size; i++) { listOfInts.Add(i); } for (int i = 0; i < size; i++) { int ii = listOfInts[i]; } long endList = OdbTime.GetCurrentTimeInMs(); Println("Time for array = " + (endArray - startArray)); Println("Time for list = " + (endList - startList)); }
public static System.Collections.Generic.List<string> getPermutation(string str, int index = 0, System.Collections.Generic.List<string> sets = null) { if (index == str.Length) { return sets; } System.Collections.Generic.List<string> current_result = new System.Collections.Generic.List<string>(); string c = str.Substring(index, 1); if (sets == null) { current_result.Add(c); }else if (sets != null) { foreach (string item in sets) { for (int i = 0; i <= item.Length; i++) { current_result.Add(insertStr(item, i, c)); } } } return getPermutation(str, index + 1, current_result); }
//Idea of Recursive public static System.Collections.Generic.List<string> getPermutationV5(string str) { if (str == null) { return null; } System.Collections.Generic.List<string> solutions = new System.Collections.Generic.List<string>(); if (str.Length == 0) { solutions.Add(""); return solutions; } //solutions.Add(str[0].ToString()); string remaining = str.Substring(1); System.Collections.Generic.List<string> current_solutions = getPermutationV5(remaining); foreach (string item in current_solutions) { for (int i = 0; i <= item.Length; i++) { string new_item = insertStr(item, i, str[0].ToString()); solutions.Add(new_item); } } return solutions; }
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies() { System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>(); assemblyList.Add(Load("Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a" + "3a")); assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" + "e35")); assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b" + "77a5c561934e089")); assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a")); assemblyList.Add(Load("System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" + "31bf3856ad364e35")); assemblyList.Add(Load("System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193" + "4e089")); assemblyList.Add(Load("System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" + "9")); assemblyList.Add(Load("Discord.Net.Commands, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null")); assemblyList.Add(Load("Discord.Net, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null")); assemblyList.Add(Load("Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aee" + "d")); assemblyList.Add(Load("RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null")); assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly()); return assemblyList; }
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies() { System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>(); assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856a" + "d364e35")); assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" + "e35")); assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "")); assemblyList.Add(Load("System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b7" + "7a5c561934e089")); assemblyList.Add(Load("System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" + "31bf3856ad364e35")); assemblyList.Add(Load("System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" + "9")); assemblyList.Add(Load("Microsoft.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad" + "364e35")); assemblyList.Add(Load("Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, Pub" + "licKeyToken=71e9bce111e9429c")); assemblyList.Add(Load("Microsoft.SharePoint.DesignTime.Activities, Version=14.0.0.0, Culture=neutral, Pu" + "blicKeyToken=b03f5f7f11d50a3a")); assemblyList.Add(Load("Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce11" + "1e9429c")); assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly()); return assemblyList; }
public static System.Collections.Generic.List<_Star_Double_Double> static_call(float a, float b, float c) { var _ret = new System.Collections.Generic.List<_Star_Double_Double>(); { var tmp_0 = a * c; var tmp_1 = 4 * tmp_0; var tmp_2 = b * b; var d = tmp_2 - tmp_1; var tmp_3 = d > 0; if (tmp_3) { var tmp_4 = 0 - b; var tmp_5 = System.Math.Sqrt(d); var x = tmp_4 - tmp_5; var tmp_6 = b * x; var tmp_7 = x * x; var tmp_8 = a * tmp_7; var tmp_9 = tmp_6 + c; var y = tmp_8 + tmp_9; var tmp_10 = new _Star_Double_Double(x,y); _ret.Add(tmp_10); } } { var tmp_0 = a * c; var tmp_1 = 4 * tmp_0; var tmp_2 = b * b; var d = tmp_2 - tmp_1; var tmp_3 = d > 0; if (tmp_3) { var tmp_4 = 0 - b; var tmp_5 = System.Math.Sqrt(d); var x = tmp_4 + tmp_5; var tmp_6 = b * x; var tmp_7 = x * x; var tmp_8 = a * tmp_7; var tmp_9 = tmp_6 + c; var y = tmp_8 + tmp_9; var tmp_10 = new _Star_Double_Double(x, y); _ret.Add(tmp_10); } } { var tmp_0 = a * c; var tmp_1 = 4 * tmp_0; var tmp_2 = b * b; var d = tmp_2 - tmp_1; var tmp_3 = d == 0; if (tmp_3) { var x = 0 - b; var tmp_4 = b * x; var tmp_5 = x * x; var tmp_6 = a * tmp_5; var tmp_7 = tmp_4 + c; var y = tmp_6 + tmp_7; var tmp_8 = new _Star_Double_Double(x,y); _ret.Add(tmp_8); } } return _ret; }
public static IEnumerable<TerrainService.shPoint> getPolygonPoints(string polygon_guid) { List<TerrainService.shPoint> pntsList = new System.Collections.Generic.List<TerrainService.shPoint>(); string sql = "select * from polygon_points where polygon_guid='" + polygon_guid + "' order by point_num"; using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection)) using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection)) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Reset(); da.Fill(ds); dt = ds.Tables[0]; if (dt == null || dt.Rows == null || dt.Rows.Count == 0) { return null; } foreach (DataRow row in dt.Rows) { TerrainService.shPoint mp = new TerrainService.shPoint(); mp.x = System.Convert.ToDouble(row["pointx"]); mp.y = System.Convert.ToDouble(row["pointy"]); pntsList.Add(mp); } } return pntsList; }
/// <exception cref="System.Exception"></exception> public virtual void Test1() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = Open(baseName); System.Collections.Generic.IList<NeoDatis.Odb.Test.VO.Login.Profile> profiles = new System.Collections.Generic.List<NeoDatis.Odb.Test.VO.Login.Profile>(); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p1", new NeoDatis.Odb.Test.VO.Login.Function ("f1"))); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p2", new NeoDatis.Odb.Test.VO.Login.Function ("f2"))); NeoDatis.Odb.Test.Query.Criteria.ClassB cb = new NeoDatis.Odb.Test.Query.Criteria.ClassB ("name", profiles); odb.Store(cb); odb.Close(); odb = Open(baseName); // this object is not known y NeoDatis so the query will not return anything NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile("p1" , (System.Collections.IList)null); NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query = odb.CriteriaQuery(typeof( NeoDatis.Odb.Test.Query.Criteria.ClassB), NeoDatis.Odb.Core.Query.Criteria.Where .Contain("profiles", p)); NeoDatis.Odb.Objects<NeoDatis.Odb.Test.Query.Criteria.ClassB> l = odb.GetObjects( query); odb.Close(); AssertEquals(0, l.Count); }
/// <exception cref="System.Exception"></exception> public virtual void TestReuse() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = Open(baseName); System.Collections.Generic.IList<NeoDatis.Odb.Test.VO.Login.Profile> profiles = new System.Collections.Generic.List<NeoDatis.Odb.Test.VO.Login.Profile>(); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p1", new NeoDatis.Odb.Test.VO.Login.Function ("f1"))); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p2", new NeoDatis.Odb.Test.VO.Login.Function ("f2"))); NeoDatis.Odb.Test.Query.Criteria.ClassB cb = new NeoDatis.Odb.Test.Query.Criteria.ClassB ("name", profiles); odb.Store(cb); odb.Close(); odb = Open(baseName); NeoDatis.Odb.Test.VO.Login.Profile p = (NeoDatis.Odb.Test.VO.Login.Profile)odb.GetObjects (typeof(NeoDatis.Odb.Test.VO.Login.Profile)).GetFirst(); NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query = odb.CriteriaQuery(typeof( NeoDatis.Odb.Test.Query.Criteria.ClassB), NeoDatis.Odb.Core.Query.Criteria.Where .Equal("profiles", p)); NeoDatis.Odb.Impl.Core.Query.Criteria.EqualCriterion ec = (NeoDatis.Odb.Impl.Core.Query.Criteria.EqualCriterion )query.GetCriteria(); try { NeoDatis.Odb.Objects<NeoDatis.Odb.Test.Query.Criteria.ClassB> l = odb.GetObjects( query); } catch (System.Exception e) { AssertTrue(NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, true).IndexOf("1063" ) != -1); } odb.Close(); }
public void FirefoxProfile_add_five_extensions() { string[] expected = { "SePSX.dll", "SePSX.dll", "SePSX.dll", "SePSX.dll", "SePSX.dll" }; AddSeFirefoxExtensionCommand cmdlet = WebDriverFactory.Container.Resolve<AddSeFirefoxExtensionCommand>(); //AddSeFirefoxExtensionCommand.UnitTestMode = true; cmdlet.InputObject = //WebDriverFactory.GetFirefoxProfile(); // resolve FirefoxProfile WebDriverFactory.Container.Resolve<FirefoxProfile>(); cmdlet.ExtensionList = expected; SeAddFirefoxExtensionCommand command = new SeAddFirefoxExtensionCommand(cmdlet); command.Execute(); System.Collections.Generic.List<string> listOfArguments = new System.Collections.Generic.List<string>(); listOfArguments.Add(expected[0]); listOfArguments.Add(expected[1]); listOfArguments.Add(expected[2]); listOfArguments.Add(expected[3]); listOfArguments.Add(expected[4]); ReadOnlyCollection<string> expectedList = new ReadOnlyCollection<string>(listOfArguments); //Assert.AreEqual(expectedList, (SePSX.CommonCmdletBase.UnitTestOutput[0] as FirefoxProfile)); // ?? }
public void OverlappingIdentifierFails() { // Assert var start = new DateTime(1999, 1, 1); var finish = new DateTime(2020, 12, 31); var validity = new DateRange(start, finish); var system = new SourceSystem { Name = "Test" }; var expected = new SourceSystemMapping { System = system, MappingValue = "1", Validity = validity }; var list = new System.Collections.Generic.List<SourceSystemMapping> { expected }; var repository = new Mock<IRepository>(); repository.Setup(x => x.Queryable<SourceSystemMapping>()).Returns(list.AsQueryable()); var identifier = new EnergyTrading.Mdm.Contracts.MdmId { SystemName = "Test", Identifier = "1", StartDate = start.AddHours(5), EndDate = start.AddHours(10) }; var request = new AmendMappingRequest() { EntityId = 1, Mapping = identifier, MappingId = 1 }; var rule = new AmendMappingNoOverlappingRule<SourceSystemMapping>(repository.Object); // Act var result = rule.IsValid(request); // Assert repository.Verify(x => x.Queryable<SourceSystemMapping>()); Assert.IsFalse(result, "Rule failed"); }
public void GetTLProject_broken_connection() { System.Collections.Generic.List<TestProject> list = new System.Collections.Generic.List<TestProject>(); list.Add( FakeTestLinkFactory.GetTestProject( "project1", "prj1", string.Empty)); list.Add( FakeTestLinkFactory.GetTestProject( "project2", "prj2", string.Empty)); list.Add( FakeTestLinkFactory.GetTestProject( "project3", "prj3", string.Empty)); //cmdlet.WriteTrace(cmdlet, "GetTLProject_broken_connection: 001"); System.Collections.Generic.List<TestProject> resultList = getProjectCollection(list, true); //cmdlet.WriteTrace(cmdlet, "GetTLProject_broken_connection: 002"); Assert.AreEqual<System.Collections.Generic.List<TestProject>>( (new System.Collections.Generic.List<TestProject>()), resultList); }
public static Rhino.Commands.Result ExtractRenderMesh(Rhino.RhinoDoc doc) { Rhino.DocObjects.ObjRef objRef = null; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", false, Rhino.DocObjects.ObjectType.Brep, out objRef); if (rc != Rhino.Commands.Result.Success) return rc; Rhino.DocObjects.RhinoObject obj = objRef.Object(); if (null == obj) return Rhino.Commands.Result.Failure; System.Collections.Generic.List<Rhino.DocObjects.RhinoObject> objList = new System.Collections.Generic.List<Rhino.DocObjects.RhinoObject>(1); objList.Add(obj); Rhino.DocObjects.ObjRef[] meshObjRefs = Rhino.DocObjects.RhinoObject.GetRenderMeshes(objList, true, false); if (null != meshObjRefs) { for (int i = 0; i < meshObjRefs.Length; i++) { Rhino.DocObjects.ObjRef meshObjRef = meshObjRefs[i]; if (null != meshObjRef) { Rhino.Geometry.Mesh mesh = meshObjRef.Mesh(); if (null != mesh) doc.Objects.AddMesh(mesh); } } doc.Views.Redraw(); } return Rhino.Commands.Result.Success; }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // ****** Program ****** // Initialize WorkbookDesigner object WorkbookDesigner designer = new WorkbookDesigner(); // Load the template file designer.Workbook = new Workbook(dataDir + "SM_NestedObjects.xlsx"); // Instantiate the List based on the class System.Collections.Generic.ICollection<Individual> list = new System.Collections.Generic.List<Individual>(); // Create an object for the Individual class Individual p1 = new Individual("Damian", 30); // Create the relevant Wife class for the Individual p1.Wife = new Wife("Dalya", 28); // Create another object for the Individual class Individual p2 = new Individual("Mack", 31); // Create the relevant Wife class for the Individual p2.Wife = new Wife("Maaria", 29); // Add the objects to the list list.Add(p1); list.Add(p2); // Specify the DataSource designer.SetDataSource("Individual", list); // Process the markers designer.Process(false); // Save the Excel file. designer.Workbook.Save(dataDir+ "output.xlsx"); }
private System.Collections.Generic.List<TestProject> getProjectCollection( System.Collections.Generic.List<TestProject> listOfProjects, bool makeFail) { TLProjectCmdletBase cmdlet = new TLProjectCmdletBase(); cmdlet.Name = null; TLAddinData.CurrentTestLinkConnection = FakeTestLinkFactory.GetTestLinkWithProjects(listOfProjects); if (makeFail) { TLAddinData.CurrentTestLinkConnection = null; } //cmdlet.WriteTrace(cmdlet, "getProjectCollection: 003"); TLSrvGetProjectCommand command = new TLSrvGetProjectCommand(cmdlet); command.Execute(); //cmdlet.WriteTrace(cmdlet, "getProjectCollection: 004"); System.Collections.Generic.List<TestProject> resultList = new System.Collections.Generic.List<TestProject>(); //cmdlet.WriteTrace(cmdlet, "getProjectCollection: 005"); //cmdlet.WriteTrace(cmdlet, "IsInitialized: " + PSTestLib.UnitTestOutput.IsInitialized.ToString()); foreach (object tpr in PSTestLib.UnitTestOutput.LastOutput) { //cmdlet.WriteTrace(cmdlet, "getProjectCollection: 006"); resultList.Add((TestProject)tpr); //cmdlet.WriteTrace(cmdlet, "getProjectCollection: 007"); } return resultList; }
private static System.String[] buildPhoneNumbers(System.String number1, System.String number2, System.String number3) { // System.Collections.ArrayList numbers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(3)); // commented by .net follower (http://dotnetfollower.com) System.Collections.Generic.List<Object> numbers = new System.Collections.Generic.List<Object>(3); // added by .net follower (http://dotnetfollower.com) if (number1 != null) { numbers.Add(number1); } if (number2 != null) { numbers.Add(number2); } if (number3 != null) { numbers.Add(number3); } int size = numbers.Count; if (size == 0) { return null; } System.String[] result = new System.String[size]; for (int i = 0; i < size; i++) { result[i] = ((System.String) numbers[i]); } return result; }
protected void btnBus_Click(object sender, EventArgs e) { int intAnio = 0; int intMes = 0; if (!int.TryParse(cmbAnio.SelectedValue, out intAnio) || !int.TryParse(cmbMes.SelectedValue, out intMes)) { lblErr.Text = "El año y mes seleccionado es incorrecto"; return; } System.Collections.Generic.List<ReportParameter> _parameters = new System.Collections.Generic.List<ReportParameter>(); _parameters.Add(new ReportParameter("Tipo", this.cmbTip.SelectedIndex == 0 ? " " : this.cmbTip.Text)); _parameters.Add(new ReportParameter("Grupo", this.cmbGru.SelectedIndex == 0 ? " " : this.cmbGru.Text)); _parameters.Add(new ReportParameter("Area", this.cmbAre.SelectedIndex == 0 ? " " : this.cmbAre.Text)); _parameters.Add(new ReportParameter("fechaIni", UtilFechas.getFechaIni(intAnio,intMes).ToString("yyyyMMdd"))); _parameters.Add(new ReportParameter("fechaFin", UtilFechas.getFechaFin(intAnio, intMes).ToString("yyyyMMdd"))); try { this.rpvData.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; this.rpvData.ShowParameterPrompts = false; this.rpvData.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerUrl"]); this.rpvData.ServerReport.ReportPath = "/rptTablero/rptAnalisisSLA"; this.rpvData.ServerReport.SetParameters(_parameters); this.rpvData.ServerReport.Refresh(); this.rpvData.Visible = true; } catch (Exception ex) { this.rpvData.Visible = false; this.lblErr.Text = ex.Message + "<br/>" + ex.StackTrace; } }
/// <exception cref="System.Exception"></exception> public virtual void Test2() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = Open(baseName); System.Collections.Generic.IList<NeoDatis.Odb.Test.VO.Login.Profile> profiles = new System.Collections.Generic.List<NeoDatis.Odb.Test.VO.Login.Profile>(); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p1", new NeoDatis.Odb.Test.VO.Login.Function ("f1"))); profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p2", new NeoDatis.Odb.Test.VO.Login.Function ("f2"))); NeoDatis.Odb.Test.Query.Criteria.ClassB cb = new NeoDatis.Odb.Test.Query.Criteria.ClassB ("name", profiles); odb.Store(cb); odb.Close(); odb = Open(baseName); NeoDatis.Odb.Test.VO.Login.Profile p = (NeoDatis.Odb.Test.VO.Login.Profile)odb.GetObjects (typeof(NeoDatis.Odb.Test.VO.Login.Profile)).GetFirst(); NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query = odb.CriteriaQuery(typeof( NeoDatis.Odb.Test.Query.Criteria.ClassB), NeoDatis.Odb.Core.Query.Criteria.Where .Contain("profiles", p)); NeoDatis.Odb.Objects<NeoDatis.Odb.Test.Query.Criteria.ClassB> l = odb.GetObjects( query); odb.Close(); AssertEquals(1, l.Count); }
/// <summary> /// Constructor /// </summary> public CombiInput() { Items = new System.Collections.Generic.List <CombiItem>(); }
public MultiDOFJointTrajectoryPoint(System.Collections.Generic.List <geometry_msgs.Transform> transforms, System.Collections.Generic.List <geometry_msgs.Twist> velocities, System.Collections.Generic.List <geometry_msgs.Twist> accelerations, SIGVerse.RosBridge.msg_helpers.Duration time_from_start) { this.transforms = transforms; this.velocities = velocities; this.accelerations = accelerations; this.time_from_start = time_from_start; }
public MatchReplayListItemEventSystem(Contexts contexts) : base(contexts.game) { _listenerBuffer = new System.Collections.Generic.List <IMatchReplayListItemListener>(); }
public FlagEntityEventEventSystem(Contexts contexts) : base(contexts.test) { _listenerBuffer = new System.Collections.Generic.List <IFlagEntityEventListener>(); }
static StackObject *get_Item_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @index = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method[index]; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *Clear_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); instance_of_this_method.Clear(); return(__ret); }
} // Many to many mapping public Employee() { Orders = new System.Collections.Generic.List <Order>(); Territories = new System.Collections.Generic.List <Territory>(); }
static StackObject *TryGetValue_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.List <System.Object> @value = (System.Collections.Generic.List <System.Object>) typeof(System.Collections.Generic.List <System.Object>).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack)); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.String @key = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Collections.Generic.Dictionary <System.String, System.Collections.Generic.List <System.Object> > instance_of_this_method = (System.Collections.Generic.Dictionary <System.String, System.Collections.Generic.List <System.Object> >) typeof(System.Collections.Generic.Dictionary <System.String, System.Collections.Generic.List <System.Object> >).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.TryGetValue(@key, out @value); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.StackObjectReference: { var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method); object ___obj = @value; if (___dst->ObjectType >= ObjectTypes.Object) { if (___obj is CrossBindingAdaptorType) { ___obj = ((CrossBindingAdaptorType)___obj).ILInstance; } __mStack[___dst->Value] = ___obj; } else { ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain); } } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @value; } else { var ___type = __domain.GetType(___obj.GetType()) as CLRType; ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @value); } } break; case ObjectTypes.StaticFieldReference: { var ___type = __domain.GetType(ptr_of_this_method->Value); if (___type is ILType) { ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @value; } else { ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @value); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Collections.Generic.List <System.Object>[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = @value; } break; } __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); __intp.Free(ptr_of_this_method); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }
private void ControlButton_Click(object sender, EventArgs e) { Global.Settings.ExitWhenClosed = ExitWhenClosedCheckBox.Checked; Global.Settings.StopWhenExited = StopWhenExitedCheckBox.Checked; Global.Settings.StartWhenOpened = StartWhenOpenedCheckBox.Checked; Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked; Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked; Global.Settings.RunAtStartup = RunAtStartup.Checked; // 开机自启判断 TaskSchedulerClass scheduler = new TaskSchedulerClass(); scheduler.Connect(null, null, null, null); ITaskFolder folder = scheduler.GetFolder("\\"); bool taskIsExists = false; try { folder.GetTask("Netch Startup"); taskIsExists = true; } catch (Exception) { } if (RunAtStartup.Checked) { if (taskIsExists) { folder.DeleteTask("Netch Startup", 0); } ITaskDefinition task = scheduler.NewTask(0); task.RegistrationInfo.Author = "Netch"; task.RegistrationInfo.Description = "Netch run at startup."; task.Principal.RunLevel = _TASK_RUNLEVEL.TASK_RUNLEVEL_HIGHEST; task.Triggers.Create(_TASK_TRIGGER_TYPE2.TASK_TRIGGER_LOGON); IExecAction action = (IExecAction)task.Actions.Create(_TASK_ACTION_TYPE.TASK_ACTION_EXEC); action.Path = System.Windows.Forms.Application.ExecutablePath; task.Settings.ExecutionTimeLimit = "PT0S"; task.Settings.DisallowStartIfOnBatteries = false; task.Settings.RunOnlyIfIdle = false; folder.RegisterTaskDefinition("Netch Startup", task, (int)_TASK_CREATION.TASK_CREATE, null, null, _TASK_LOGON_TYPE.TASK_LOGON_INTERACTIVE_TOKEN, ""); } else { if (taskIsExists) { folder.DeleteTask("Netch Startup", 0); } } try { var Socks5Port = int.Parse(Socks5PortTextBox.Text); if (Socks5Port > 0 && Socks5Port < 65536) { Global.Settings.Socks5LocalPort = Socks5Port; } else { throw new FormatException(); } } catch (FormatException) { Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString(); MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { var HTTPPort = int.Parse(HTTPPortTextBox.Text); if (HTTPPort > 0 && HTTPPort < 65536) { Global.Settings.HTTPLocalPort = HTTPPort; } else { throw new FormatException(); } } catch (FormatException) { HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString(); MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (AllowDevicesCheckBox.Checked) { Global.Settings.LocalAddress = "0.0.0.0"; } else { Global.Settings.LocalAddress = "127.0.0.1"; } try { var Address = IPAddress.Parse(TUNTAPAddressTextBox.Text); var Netmask = IPAddress.Parse(TUNTAPNetmaskTextBox.Text); var Gateway = IPAddress.Parse(TUNTAPGatewayTextBox.Text); var DNS = new System.Collections.Generic.List <IPAddress>(); foreach (var ip in TUNTAPDNSTextBox.Text.Split(',')) { DNS.Add(IPAddress.Parse(ip)); } } catch (FormatException) { MessageBox.Show(Utils.i18N.Translate("IP address format illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address; TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask; TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway; var DNS = ""; foreach (var ip in Global.Settings.TUNTAP.DNS) { DNS += ip; DNS += ','; } DNS = DNS.Trim(); TUNTAPDNSTextBox.Text = DNS.Substring(0, DNS.Length - 1); TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS; return; } try { var ProfileCount = int.Parse(ProfileCount_TextBox.Text); if (ProfileCount > 0) { Global.Settings.ProfileCount = ProfileCount; } else { throw new FormatException(); } } catch (FormatException) { ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString(); MessageBox.Show(Utils.i18N.Translate("ProfileCount value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { var STUN_Server = STUN_ServerTextBox.Text; Global.Settings.STUN_Server = STUN_Server; var STUN_ServerPort = int.Parse(STUN_ServerPortTextBox.Text); if (STUN_ServerPort > 0) { Global.Settings.STUN_Server_Port = STUN_ServerPort; } else { throw new FormatException(); } } catch (FormatException) { ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString(); MessageBox.Show(Utils.i18N.Translate("STUN_ServerPort value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text; Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text; Global.Settings.TUNTAP.Gateway = TUNTAPGatewayTextBox.Text; Global.Settings.TUNTAP.DNS.Clear(); foreach (var ip in TUNTAPDNSTextBox.Text.Split(',')) { Global.Settings.TUNTAP.DNS.Add(ip); } Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked; Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked; Utils.Configuration.Save(); MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); }
public StReadonlyKeywordToken(ForgedOnce.TsLanguageServices.FullSyntaxTree.TransportModel.NodeFlags flags, System.Collections.Generic.List<ForgedOnce.TsLanguageServices.FullSyntaxTree.AstModel.StDecorator> decorators, System.Collections.Generic.List<ForgedOnce.TsLanguageServices.FullSyntaxTree.AstModel.IStModifier> modifiers): base(flags, decorators, modifiers) { this.kind = ForgedOnce.TsLanguageServices.FullSyntaxTree.TransportModel.SyntaxKind.ReadonlyKeyword; }
public System.Threading.Tasks.Task <bool> removeJedisAsync(System.Collections.Generic.List <int> removeList) { return(base.Channel.removeJedisAsync(removeList)); }
public static void Main(string[] args) { /*int[] array; * int[] copy; * //Console.WriteLine(ArrayHelper.GetString(array)); * * //Selection sort * array = ArrayHelper.GetRandomArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Selection(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * * array = ArrayHelper.GetNullArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Selection(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetSortedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Selection(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetReversedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Selection(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetWithDuplicatesArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Selection(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * //Bubble sort * * array = ArrayHelper.GetRandomArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * * array = ArrayHelper.GetNullArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetSortedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetReversedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetWithDuplicatesArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * //insertion * * array = ArrayHelper.GetRandomArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * * array = ArrayHelper.GetNullArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetSortedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetReversedArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * array = ArrayHelper.GetWithDuplicatesArray(24); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Bubble(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * if (!ArrayHelper.CheckIfGood(array, copy)) { * Console.WriteLine("Sort ne radi"); * return; * } * * Console.WriteLine("Sva sortiranja rade na zadatim testovima"); * * for (int i = 0; i < 100; i++) { * array = ArrayHelper.GetRandomArray(); * if (array[ArrayHelper.Find.MaxIndex(array)] != ArrayHelper.Find.MaxElement(array)) { * Console.WriteLine("Vrednost elementa na osnovu indeksa nije jednaka maksimalnom"); * return; * } * ArrayHelper.Sort.Selection(array); * if (array[ArrayHelper.Find.MaxIndex(array)] != array[array.Length - 1]) { * Console.WriteLine("Vrednost elementa na prvom mestu u sortiranom nizu nije maksimum"); * return; * } * } * * for (int i = 0; i < 100; i++) { * array = ArrayHelper.GetRandomArray(); * if (array[ArrayHelper.Find.MinIndex(array)] != ArrayHelper.Find.MinElement(array)) { * Console.WriteLine("Vrednost elementa na osnovu indeksa nije jednaka minimalnom"); * return; * } * ArrayHelper.Sort.Selection(array); * if (ArrayHelper.Find.MinIndex(array) != 0) { * Console.WriteLine("Vrednost elementa na prvom mestu u sortiranom nizu nije minimum"); * return; * } * } * * Console.WriteLine("Vrednosti minalnih i maksimalnih na osnovu indeksa jesu dobri"); * * Console.WriteLine("Lista"); * * LinkedList<int> list; * LinkedList<int> copyList; * //Console.WriteLine(ListHelper.GetString(list)); * * //Selection sort * list = ListHelper.GetRandomList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Selection(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList) ){ * Console.WriteLine("Sort ne radi"); * return; * } * * * list = ListHelper.GetNullList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Selection(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetSortedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Selection(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetReversedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Selection(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetWithDuplicatesList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Selection(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * //Bubble sort * * list = ListHelper.GetRandomList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * * list = ListHelper.GetNullList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetSortedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetReversedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetWithDuplicatesList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * //insertion * * list = ListHelper.GetRandomList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * * list = ListHelper.GetNullList(); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetSortedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetReversedList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * list = ListHelper.GetWithDuplicatesList(24); * copyList = ListHelper.GetCopyOfList(list); * ListHelper.Sort.Bubble(list); * //Console.WriteLine(ListHelper.GetString(list)); * if (!ListHelper.CheckIfGood(list, copyList)) { * Console.WriteLine("Sort ne radi"); * return; * } * * Console.WriteLine("Sva sortiranja rade na zadatim testovima"); * * for (int i = 0; i < 100; i++) { * list = ListHelper.GetRandomList(); * if (list.Read((uint)ListHelper.Find.MaxIndex(list)) != ListHelper.Find.MaxElement(list)) { * Console.WriteLine("Vrednost elementa na osnovu indeksa nije jednaka maksimalnom"); * return; * } * ListHelper.Sort.Selection(list); * if (list.Read((uint)ListHelper.Find.MaxIndex(list)) != list.Read((uint)list.Length - 1)) { * Console.WriteLine("Vrednost elementa na prvom mestu u sortiranom nizu nije maksimum"); * return; * } * } * * for (int i = 0; i < 100; i++) { * list = ListHelper.GetRandomList(); * if (list.Read((uint)ListHelper.Find.MinIndex(list)) != ListHelper.Find.MinElement(list)) { * Console.WriteLine("Vrednost elementa na osnovu indeksa nije jednaka minimalnom"); * return; * } * ListHelper.Sort.Selection(list); * if (ListHelper.Find.MinIndex(list) != 0) { * Console.WriteLine("Vrednost elementa na prvom mestu u sortiranom nizu nije minimum"); * return; * } * } * * Console.WriteLine("Vrednosti minalnih i maksimalnih na osnovu indeksa jesu dobri"); * * array = ArrayHelper.GetRandomArray(); * copy = ArrayHelper.GetCopyOfArray(array); * ArrayHelper.Sort.Insertion(array); * //Console.WriteLine(ArrayHelper.GetString(array)); * //Console.WriteLine(ArrayHelper.CheckIfGood(array, copy)); */ Ucenik uc1 = new Ucenik(tezina: 12); Console.WriteLine(uc1); Ucenik[] ucenici = new Ucenik[] { new Ucenik(ime: "Petar", prezime: "Spasic"), new Ucenik() }; //foreach (Ucenik ucenik in ucenici) { // Console.WriteLine(ucenik); //} Ucenik[] ucenici1 = new Ucenik[5]; ucenici1[0] = ucenici[1]; ucenici1[1] = uc1; Console.WriteLine(ucenici1[3]); //ispisace isto sto i Console.WriteLine(); (samo novi red) ucenici = new Ucenik[40]; Random rand = new Random(); for (int i = 0; i < ucenici.Length; ++i) { ucenici[i] = new Ucenik(visina: Math.Round(rand.NextDouble() * 50 + 150, 2), tezina: Math.Round(rand.NextDouble() * 50 + 50, 2), prosek: Math.Round(rand.NextDouble() * 4 + 1, 2)); } ucenici[0] = new Ucenik(visina: 140, tezina: 50); //uzeo sam ekstremnu visine, da bi lako nasao ucenici[34] = new Ucenik(visina: 140, tezina: 49); ucenici[20] = new Ucenik(visina: 201, tezina: Math.Round(rand.NextDouble() * 50 + 50, 2)); ucenici[21] = new Ucenik(visina: 201, tezina: Math.Round(rand.NextDouble() * 50 + 50, 2)); //foreach(Ucenik ucenik in ucenici) { // Console.WriteLine(ucenik); //} System.Collections.Generic.List <Ucenik> listaUcenika = new System.Collections.Generic.List <Ucenik>(ucenici); listaUcenika.Sort((x, y) => x.Prosek.CompareTo(y.Prosek)); //sortiranje po proseku // gore mozemo po bilo cemu drugom sortirati foreach (Ucenik ucenik in listaUcenika) { Console.WriteLine(ucenik); } Ucenik[] kopija = ArrayHelper <Ucenik> .GetCopyOfArray(ucenici); ArrayHelper <Ucenik> .Sort.Selection(ucenici); Console.WriteLine("Moj sort"); Console.WriteLine(ArrayHelper <Ucenik> .GetString(ucenici)); if (!ArrayHelper <Ucenik> .CheckIfGood(ucenici, kopija)) { Console.WriteLine("Sort ne radi"); } }
public System.Threading.Tasks.Task <bool> updateJedisAsync(System.Collections.Generic.List <JediTournamentWCFTest.ServiceJediTournamentEntities.JediWCF> jediList) { return(base.Channel.updateJedisAsync(jediList)); }
public BifaPerson() { BifaEmailAddresses = new System.Collections.Generic.List <BifaEmailAddress>(); BifaTelephones = new System.Collections.Generic.List <BifaTelephone>(); }
private void Search() { Models.DatabaseContext databaseContext = null; try { databaseContext = new Models.DatabaseContext(); string fullName = fullNameTextBox.Text; fullName = Infrastructure.Utility.FixText(fullName); //var users; // Note: Compile Error! //var users = null; // Note: Compile Error! System.Collections.Generic.List <Models.User> users = null; // دستور ذیل خیلی جالب نیست //var users = new System.Collections.Generic.List<Models.User>(); if (fullName == null) { //var users = // databaseContext.Users // .OrderBy(current => current.FullName) // .ToList() // ; users = databaseContext.Users .OrderBy(current => current.FullName) .ToList() ; } else { //users = // databaseContext.Users // .Where(current => current.FullName == fullName) // .OrderBy(current => current.FullName) // .ToList() // ; //users = // databaseContext.Users // .Where(current => string.Compare(current.FullName, fullName, true) == 0) // .OrderBy(current => current.FullName) // .ToList() // ; //users = // databaseContext.Users // .Where(current => current.FullName.ToLower() == fullName.ToLower()) // .OrderBy(current => current.FullName) // .ToList() // ; //users = // databaseContext.Users // .Where(current => current.FullName.ToLower().StartsWith(fullName.ToLower())) // .OrderBy(current => current.FullName) // .ToList() // ; //users = // databaseContext.Users // .Where(current => current.FullName.ToLower().EndsWith(fullName.ToLower())) // .OrderBy(current => current.FullName) // .ToList() // ; users = databaseContext.Users .Where(current => current.FullName.ToLower().Contains(fullName.ToLower())) .OrderBy(current => current.FullName) .ToList() ; } // ************************************************** // Unbinding // ************************************************** //usersListBox.Items.Clear(); //foreach (var item in users) //{ // usersListBox.Items.Add(item.Username); //} // ************************************************** // ************************************************** // ************************************************** // ************************************************** // Binding // ************************************************** usersListBox.DataSource = null; // ************************************************** // ************************************************** //usersListBox.ValueMember = "Id"; //usersListBox.DisplayMember = "Username"; //usersListBox.ValueMember = "Id1"; //usersListBox.DisplayMember = "Username1"; //usersListBox.ValueMember = nameof(Models.User.Id); // "Id" //usersListBox.DisplayMember = nameof(Models.User.Username); // "Username" //usersListBox.ValueMember = nameof(Models.User.Id1); //usersListBox.DisplayMember = nameof(Models.User.Username1); //usersListBox.ValueMember = nameof(Models.User.Id); //usersListBox.DisplayMember = nameof(Models.User.FullName); usersListBox.ValueMember = nameof(Models.User.Id); usersListBox.DisplayMember = nameof(Models.User.DisplayName); usersListBox.DataSource = users; // ************************************************** // ************************************************** // ************************************************** //if (users.Count == 0) //{ // System.Windows.Forms.MessageBox // .Show("There is not any user for displaying!"); //} } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show($"Error: { ex.Message }"); } finally { if (databaseContext != null) { databaseContext.Dispose(); databaseContext = null; } } }
public bool removeJedis(System.Collections.Generic.List <int> removeList) { return(base.Channel.removeJedis(removeList)); }
static int _m_GetClosestReflectionProbes(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Renderer __cl_gen_to_be_invoked = (UnityEngine.Renderer)translator.FastGetCSObj(L, 1); try { { System.Collections.Generic.List <UnityEngine.Rendering.ReflectionProbeBlendInfo> result = (System.Collections.Generic.List <UnityEngine.Rendering.ReflectionProbeBlendInfo>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List <UnityEngine.Rendering.ReflectionProbeBlendInfo>)); __cl_gen_to_be_invoked.GetClosestReflectionProbes(result); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public bool updateJedis(System.Collections.Generic.List <JediTournamentWCFTest.ServiceJediTournamentEntities.JediWCF> jediList) { return(base.Channel.updateJedis(jediList)); }
public bool GuardarSolicitudDetalle(Entidades.TBL_SOLICITUDVIATICOS Obj_Solicitud, System.Collections.Generic.List <Entidades.TBL_DETALLESOLICITUDVIATICOS> Obj_SolicitudDetalle) { return(base.Channel.GuardarSolicitudDetalle(Obj_Solicitud, Obj_SolicitudDetalle)); }
static StackObject *Add_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.EventSystems.EventTrigger.Entry @item = (UnityEngine.EventSystems.EventTrigger.Entry) typeof(UnityEngine.EventSystems.EventTrigger.Entry).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry> instance_of_this_method = (System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry>) typeof(System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Add(@item); return(__ret); }
private void ChangeBoostTemplates(System.Collections.Generic.List <BoostMove> availableMoves) { availableMoves.Add(new BoostMove(Actions.BoostTemplates.LeftTurn1, true)); availableMoves.Add(new BoostMove(Actions.BoostTemplates.RightTurn1, true)); }
public System.Threading.Tasks.Task <bool> GuardarSolicitudDetalleAsync(Entidades.TBL_SOLICITUDVIATICOS Obj_Solicitud, System.Collections.Generic.List <Entidades.TBL_DETALLESOLICITUDVIATICOS> Obj_SolicitudDetalle) { return(base.Channel.GuardarSolicitudDetalleAsync(Obj_Solicitud, Obj_SolicitudDetalle)); }
public System.Collections.Generic.List <byte> __encode() { var data = new System.Collections.Generic.List <byte>(); return(data); }
private static string ReadConfigToString() { string buffer = string.Empty; string zipBuffer = string.Empty; Catalog catalog = new Catalog(); catalog.Rows = 2; using (AvtoritetEntities ae = new AvtoritetEntities()) { System.Collections.Generic.List <Group> groups = (from r in ae.Group where r.Enable select r into t orderby t.Order select t).ToList <Group>(); catalog.Groups = new System.Collections.Generic.List <RelayServer.Models.Group>(); using (System.Collections.Generic.List <Group> .Enumerator enumerator = groups.GetEnumerator()) { while (enumerator.MoveNext()) { Group group = enumerator.Current; RelayServer.Models.Group catalogGroup = new RelayServer.Models.Group(); System.Collections.Generic.List <GroupBox> groupboxs = (from t in ae.GroupBox where t.GroupId == @group.GroupId && t.Enable select t into r orderby r.Title select r).ToList <GroupBox>(); catalogGroup.GroupBoxs = new System.Collections.Generic.List <RelayServer.Models.GroupBox>(); using (System.Collections.Generic.List <GroupBox> .Enumerator enumerator2 = groupboxs.GetEnumerator()) { while (enumerator2.MoveNext()) { GroupBox groupBox = enumerator2.Current; RelayServer.Models.GroupBox catalogGroupBox = new RelayServer.Models.GroupBox(); System.Collections.Generic.List <Brand> brands = (from t in ae.Brand where t.GroupBoxId == groupBox.GroupBoxId && t.Enable select t into r orderby r.NameAndFolder select r).ToList <Brand>(); catalogGroupBox.Brands = new System.Collections.Generic.List <RelayServer.Models.Brand>(); using (System.Collections.Generic.List <Brand> .Enumerator enumerator3 = brands.GetEnumerator()) { while (enumerator3.MoveNext()) { Brand brand = enumerator3.Current; RelayServer.Models.Brand catalogBrand = new RelayServer.Models.Brand(); System.Collections.Generic.List <Provider> providers = (from t in ae.Provider where t.BrandId == brand.BrandId && t.Enable select t into r orderby r.Order select r).ToList <Provider>(); catalogBrand.Providers = new System.Collections.Generic.List <RelayServer.Models.Provider>(); using (System.Collections.Generic.List <Provider> .Enumerator enumerator4 = providers.GetEnumerator()) { while (enumerator4.MoveNext()) { Provider provider = enumerator4.Current; ProviderAccount provAcc = ae.ProviderAccount.FirstOrDefault(t => t.ProviderId == provider.ProviderId && t.Enable); System.Collections.Generic.List <RelayServer.Models.CommandFile> commandFiles = (from t in ae.CommandFile where t.ProviderId == (int?)provider.ProviderId select t into r select new RelayServer.Models.CommandFile { FileName = r.FileName, FileContent = r.FileContent }).ToList <RelayServer.Models.CommandFile>(); System.Collections.Generic.List <RelayServer.Models.ProviderFile> providerFiles = (from t in ae.ProviderFile where t.ProviderId == (int?)provider.ProviderId select t into r select new RelayServer.Models.ProviderFile { FileName = r.FileName, FileExt = r.FileExt, FileSize = (long)r.FileSize, FileContent = r.FileContent }).ToList <RelayServer.Models.ProviderFile>(); catalogBrand.Providers.Add(new RelayServer.Models.Provider { Uri = provider.Uri.Trim(), IconPath = provider.IconPath, Title = provider.Title, Order = (provider.Order ?? 0), Commands = provider.commandcontent, Login = ((provAcc != null) ? provAcc.Login.Trim() : string.Empty), Password = ((provAcc != null) ? provAcc.Password.Trim() : string.Empty), CommandFiles = commandFiles, ProviderFiles = providerFiles }); } } catalogBrand.NameAndFolder = brand.NameAndFolder; catalogBrand.IconPath = brand.IconPath; catalogBrand.IconPath2 = brand.IconPath2; catalogBrand.IconPathImg = brand.IconPathImg; catalogBrand.IconPath2Img = brand.IconPath2Img; catalogBrand.Top = (brand.Top ?? 0); catalogBrand.Left = (brand.Left ?? 0); catalogBrand.Width = (brand.Width ?? 0); catalogBrand.Height = (brand.Height ?? 0); catalogBrand.BrandId = brand.BrandId; catalogBrand.ButtonStyle = brand.ButtonStyle; catalogBrand.MenuWindow = brand.MenuWindow.Value; catalogGroupBox.Brands.Add(catalogBrand); } } catalogGroupBox.Left = groupBox.Left.Value; catalogGroupBox.Top = groupBox.Top.Value; catalogGroupBox.Width = groupBox.Width.Value; catalogGroupBox.Height = groupBox.Height.Value; catalogGroupBox.Title = groupBox.Title; catalogGroupBox.VisibleBorder = groupBox.VisibleBorder.Value; catalogGroup.GroupBoxs.Add(catalogGroupBox); } } catalogGroup.Name = group.Name; catalogGroup.Width = group.Width.Value; catalogGroup.Height = group.Height.Value; catalogGroup.Order = (group.Order ?? 0); catalog.Groups.Add(catalogGroup); } } buffer = StringZip.Zip(new JavaScriptSerializer { MaxJsonLength = 2147483647 }.Serialize(catalog)); } return(buffer); }
public void GenerarReporte() { try { var encabezado = new System.Collections.Generic.List <cEncabezado>(); var listaIngresosActivos = new System.Collections.Generic.List <cReporteReingresos>(); var ListaDelitosPreliminar = new System.Collections.Generic.List <cReporteReingresos>(); var listaIngresosDefinitivos = new System.Collections.Generic.List <cReporteReingresos>(); //COMUNES var listaIngresosDefinitivos2 = new System.Collections.Generic.List <cReporteReingresos>(); //FEDERALES var listaIngresosDefinitivos3 = new System.Collections.Generic.List <cReporteReincidentes>(); //OTROS var centro = new SSP.Controlador.Catalogo.Justicia.cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault(); encabezado.Add(new cEncabezado() { ImagenIzquierda = Parametro.REPORTE_LOGO1, ImagenDerecha = Parametro.REPORTE_LOGO2, TituloUno = Parametro.ENCABEZADO1, TituloDos = Parametro.ENCABEZADO2, NombreReporte = centro != null ? !string.IsNullOrEmpty(centro.DESCR) ? centro.DESCR.Trim() : string.Empty : string.Empty, PieUno = string.Format("Reporte de Reingresos por Fuero y Delito \n Del {0} Al {1}", SelectedFechaInicial.HasValue ? SelectedFechaInicial.Value.ToString("dd/MM/yyyy") : string.Empty, SelectedFechaFinal.HasValue ? SelectedFechaFinal.Value.ToString("dd/MM/yyyy") : string.Empty) }); var _IngresosActivos = new SSP.Controlador.Catalogo.Justicia.cIngreso().ObtenerIngresosActivosPorFecha(GlobalVar.gCentro, SelectedFechaInicial, SelectedFechaFinal); if (_IngresosActivos != null && _IngresosActivos.Any()) { foreach (var item in _IngresosActivos) { if (item.CAUSA_PENAL != null && item.CAUSA_PENAL.Any()) { var _detallesCausaPenal = item.CAUSA_PENAL.FirstOrDefault(x => x.ID_ESTATUS_CP == (short)eEstatusCausaPenal.ACTIVO); if (_detallesCausaPenal != null) { if (_detallesCausaPenal.SENTENCIA != null) { if (_detallesCausaPenal.SENTENCIA.Any(x => x.FEC_EJECUTORIA == null))//NO CAUSO EJECUTORIA { var _fuero = _detallesCausaPenal.CP_FUERO; if (!string.IsNullOrEmpty(_fuero)) { var _Delitos = _detallesCausaPenal.CAUSA_PENAL_DELITO; if (_Delitos != null && _Delitos.Any()) { if (_fuero == "C") { foreach (var item2 in _Delitos) { ListaDelitosPreliminar.Add(new cReporteReingresos { Delito = item2.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(item2.MODALIDAD_DELITO.DESCR) ? item2.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty, Femenino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "F" ? +1 : +0 : +0, Masculino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "M" ? +1 : +0 : +0, Fuero = _fuero, Total = +1 }); } } ; if (_fuero == "F") { foreach (var item2 in _Delitos) { ListaDelitosPreliminar.Add(new cReporteReingresos { Delito = item2.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(item2.MODALIDAD_DELITO.DESCR) ? item2.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty, Femenino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "F" ? +1 : +0 : +0, Masculino = item.IMPUTADO != null ? item.IMPUTADO.SEXO == "M" ? +1 : +0 : +0, Fuero = _fuero, Total = +1 }); } } ; } ; } else { var _Delitos = _detallesCausaPenal.CAUSA_PENAL_DELITO;//ESTOS DELITOS NO TIENEN FUERO PERO SI CAUSARON EJECUTORIA EN UNA CAUSA PENAL ACTIVA if (_Delitos != null && _Delitos.Any()) { foreach (var itemX in _Delitos) { ListaDelitosPreliminar.Add(new cReporteReingresos { Delito = itemX.MODALIDAD_DELITO != null ? !string.IsNullOrEmpty(itemX.MODALIDAD_DELITO.DESCR) ? itemX.MODALIDAD_DELITO.DESCR.Trim() : string.Empty : string.Empty, Femenino = _detallesCausaPenal != null ? _detallesCausaPenal.INGRESO != null ? _detallesCausaPenal.INGRESO.IMPUTADO != null ? _detallesCausaPenal.INGRESO.IMPUTADO.SEXO == "F" ? +1 : +0 : +0 : +0 : +0, Masculino = _detallesCausaPenal != null ? _detallesCausaPenal.INGRESO != null ? _detallesCausaPenal.INGRESO.IMPUTADO != null ? _detallesCausaPenal.INGRESO.IMPUTADO.SEXO == "M" ? +1 : +0 : +0 : +0 : +0, Fuero = "X", Total = +1 }); } } } }//EJECUTORIA } ; //SENTENCIA } ; } } } ; if (ListaDelitosPreliminar != null && ListaDelitosPreliminar.Any()) { var _Comunes = ListaDelitosPreliminar.Where(x => x.Fuero == "C"); var _Federales = ListaDelitosPreliminar.Where(x => x.Fuero == "F"); var _SinFuero = ListaDelitosPreliminar.Where(x => x.Fuero == "X"); if (_Comunes != null && _Comunes.Any()) { var _DetalleComunes = _Comunes.GroupBy(x => x.Delito); if (_DetalleComunes != null && _DetalleComunes.Any()) { foreach (var item in _DetalleComunes) { if (!string.IsNullOrEmpty(item.Key)) { listaIngresosDefinitivos.Add(new cReporteReingresos { Delito = item.Key, Femenino = item.Sum(x => x.Femenino), Masculino = item.Sum(x => x.Masculino), Fuero = "COMÚN", Total = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0) }); } } } } ; if (_Federales != null && _Federales.Any()) { var _DetalleFederales = _Federales.GroupBy(x => x.Delito); if (_DetalleFederales != null && _DetalleFederales.Any()) { foreach (var item in _DetalleFederales) { if (!string.IsNullOrEmpty(item.Key)) { listaIngresosDefinitivos2.Add(new cReporteReingresos { Delito = item.Key, Femenino = item.Sum(x => x.Femenino), Masculino = item.Sum(x => x.Masculino), Fuero = "FEDERAL", Total = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0) }); } } } } ; if (_SinFuero != null && _SinFuero.Any()) { var _DetalleSinFuero = _Federales.GroupBy(x => x.Delito); if (_DetalleSinFuero != null && _DetalleSinFuero.Any()) { foreach (var item in _DetalleSinFuero) { if (!string.IsNullOrEmpty(item.Key)) { listaIngresosDefinitivos3.Add(new cReporteReincidentes { Delito = item.Key, Femenino = item.Sum(x => x.Femenino), Masculino = item.Sum(x => x.Masculino), Fuero = "SIN FUERO", Total = (item.Any() ? item.Sum(x => x.Femenino) : 0) + (item.Any() ? item.Sum(x => x.Masculino) : 0) }); } } } } ; } ; Reporte.LocalReport.ReportPath = "Reportes/rReporteReingresos.rdlc"; Reporte.LocalReport.DataSources.Clear(); Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Encabezado = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource_Encabezado.Name = "DataSet1"; ReportDataSource_Encabezado.Value = encabezado; Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource_Motivos.Name = "DataSet2"; ReportDataSource_Motivos.Value = listaIngresosDefinitivos != null?listaIngresosDefinitivos.Any() ? listaIngresosDefinitivos.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReporteReingresos>() : new System.Collections.Generic.List <cReporteReingresos>(); Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos2 = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource_Motivos2.Name = "DataSet3"; ReportDataSource_Motivos2.Value = listaIngresosDefinitivos2 != null?listaIngresosDefinitivos2.Any() ? listaIngresosDefinitivos2.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReporteReingresos>() : new System.Collections.Generic.List <cReporteReingresos>(); Microsoft.Reporting.WinForms.ReportDataSource ReportDataSource_Motivos3 = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource_Motivos3.Name = "DataSet4"; ReportDataSource_Motivos3.Value = listaIngresosDefinitivos3 != null?listaIngresosDefinitivos3.Any() ? listaIngresosDefinitivos3.OrderBy(x => x.Delito).ToList() : new System.Collections.Generic.List <cReporteReincidentes>() : new System.Collections.Generic.List <cReporteReincidentes>(); Reporte.LocalReport.DataSources.Add(ReportDataSource_Encabezado); Reporte.LocalReport.DataSources.Add(ReportDataSource_Motivos); Reporte.LocalReport.DataSources.Add(ReportDataSource_Motivos2); Reporte.LocalReport.DataSources.Add(ReportDataSource_Motivos3); System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate { Reporte.Refresh(); Reporte.RefreshReport(); })); } catch (System.Exception exc) { System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(delegate { ReportViewerVisible = System.Windows.Visibility.Collapsed; })); StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar el reporte", exc); } }
public CaseState() { CaseStateHistories = new System.Collections.Generic.List <CaseStateHistory>(); TaskConfigGroups = new System.Collections.Generic.List <TaskConfigGroup>(); TaskConfigurations = new System.Collections.Generic.List <TaskConfiguration>(); }
public JobPrefer() { JobCategories = new System.Collections.Generic.List <JobCategory>(); Industries = new System.Collections.Generic.List <Industry>(); }
static internal System.Collections.Generic.List <HuffmanListNode> BuildPrefixedLinkedList(int[] values, int[] lengthList, int[] codeList, out int tableBits, out HuffmanListNode firstOverflowNode) { HuffmanListNode[] list = new HuffmanListNode[lengthList.Length]; var maxLen = 0; for (int i = 0; i < list.Length; i++) { list[i] = new HuffmanListNode { Value = values[i], Length = lengthList[i] <= 0 ? 99999 : lengthList[i], Bits = codeList[i], Mask = (1 << lengthList[i]) - 1, }; if (lengthList[i] > 0 && maxLen < lengthList[i]) { maxLen = lengthList[i]; } } Array.Sort(list, SortCallback); tableBits = maxLen > MAX_TABLE_BITS ? MAX_TABLE_BITS : maxLen; var prefixList = new System.Collections.Generic.List <HuffmanListNode>(1 << tableBits); firstOverflowNode = null; for (int i = 0; i < list.Length && list[i].Length < 99999; i++) { if (firstOverflowNode == null) { var itemBits = list[i].Length; if (itemBits > tableBits) { firstOverflowNode = list[i]; } else { var maxVal = 1 << (tableBits - itemBits); var item = list[i]; for (int j = 0; j < maxVal; j++) { var idx = (j << itemBits) | item.Bits; while (prefixList.Count <= idx) { prefixList.Add(null); } prefixList[idx] = item; } } } else { list[i - 1].Next = list[i]; } } while (prefixList.Count < 1 << tableBits) { prefixList.Add(null); } return(prefixList); }
public StTemplateMiddle(ForgedOnce.TsLanguageServices.FullSyntaxTree.TransportModel.NodeFlags flags, System.Collections.Generic.List <ForgedOnce.TsLanguageServices.FullSyntaxTree.AstModel.StDecorator> decorators, System.Collections.Generic.List <ForgedOnce.TsLanguageServices.FullSyntaxTree.AstModel.IStModifier> modifiers, System.String text, System.Nullable <System.Boolean> isUnterminated, System.Nullable <System.Boolean> hasExtendedUnicodeEscape, System.String rawText) : base(flags, decorators, modifiers) { this.kind = ForgedOnce.TsLanguageServices.FullSyntaxTree.TransportModel.SyntaxKind.TemplateMiddle; this.text = text; this.isUnterminated = isUnterminated; this.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; this.rawText = rawText; }
private void setDefaults() { //Default values assignedClientIdentifier = ""; assignedClientSecret = ""; PersonalClientIdentifier = ""; PersonalClientSecret = ""; OutlookService = OutlookOgcs.Calendar.Service.DefaultMailbox; MailboxName = ""; SharedCalendar = ""; UseOutlookCalendar = new OutlookCalendarListEntry(); CategoriesRestrictBy = RestrictBy.Exclude; Categories = new System.Collections.Generic.List <String>(); OnlyRespondedInvites = false; OutlookDateFormat = "g"; outlookGalBlocked = false; UseGoogleCalendar = new GoogleCalendarListEntry(); apiLimit_inEffect = false; apiLimit_lastHit = DateTime.Parse("01-Jan-2000"); GaccountEmail = ""; CloakEmail = true; SyncDirection = Sync.Direction.OutlookToGoogle; DaysInThePast = 1; DaysInTheFuture = 60; SyncInterval = 0; SyncIntervalUnit = "Hours"; OutlookPush = false; AddLocation = true; AddDescription = true; AddDescription_OnlyToGoogle = true; AddReminders = false; UseGoogleDefaultReminder = false; UseOutlookDefaultReminder = false; ReminderDND = false; ReminderDNDstart = DateTime.Now.Date.AddHours(22); ReminderDNDend = DateTime.Now.Date.AddDays(1).AddHours(6); AddAttendees = false; AddColours = false; MergeItems = true; DisableDelete = true; ConfirmOnDelete = true; TargetCalendar = Sync.Direction.OutlookToGoogle; CreatedItemsOnly = true; SetEntriesPrivate = false; SetEntriesAvailable = false; SetEntriesColour = false; SetEntriesColourValue = Microsoft.Office.Interop.Outlook.OlCategoryColor.olCategoryColorNone.ToString(); SetEntriesColourName = "None"; Obfuscation = new Obfuscate(); MuteClickSounds = false; ShowBubbleTooltipWhenSyncing = true; StartOnStartup = false; StartupDelay = 0; StartInTray = false; MinimiseToTray = false; MinimiseNotClose = false; ShowBubbleWhenMinimising = true; CreateCSVFiles = false; LoggingLevel = "DEBUG"; portable = false; Proxy = new SettingsProxy(); alphaReleases = !System.Windows.Forms.Application.ProductVersion.EndsWith("0.0"); SkipVersion = null; Subscribed = DateTime.Parse("01-Jan-2000"); donor = false; hideSplashScreen = false; lastSyncDate = new DateTime(0); completedSyncs = 0; VerboseOutput = true; }