partial void WriteDummyIgnore(ESPWriter writer) { if (Location2 != null) { Location2.WriteBinary(writer); } }
public void GenerateLocations() { Location1 location1 = new Location1(); Location2 location2 = new Location2(); Location3 location3 = new Location3(); Location4 location4 = new Location4(); Location5 location5 = new Location5(); Location6 location6 = new Location6(); Location7 location7 = new Location7(); Location8 location8 = new Location8(); Location9 location9 = new Location9(); Location10 location10 = new Location10(); Location11 location11 = new Location11(); mainLocationsList.Add(location1); mainLocationsList.Add(location2); mainLocationsList.Add(location3); mainLocationsList.Add(location4); mainLocationsList.Add(location5); mainLocationsList.Add(location6); mainLocationsList.Add(location7); mainLocationsList.Add(location8); mainLocationsList.Add(location9); mainLocationsList.Add(location10); mainLocationsList.Add(location11); }
public ModuleContext(DateTime time, Location2 location, ITransferManager transferManager, IMarket market, IItemStore itemStore) { Time = time; Location = location; TransferManager = transferManager; Market = market; ItemStore = itemStore; }
public Sector(int id, Location2 location, ITransferManager transferManager) { _commodityProducers = new List<ICommodityProducer>(); _shardModules = new List<IGameModule>(); _transferManager = transferManager; Id = id; Location = location; InitModuleItemStores(); }
static void Main(string[] args) { ////////////////////////// Objects ////////////////////// Location2 P1 = new Location2(); ConsoleMenu menus = new ConsoleMenu(); Order2 orderRepository = new Order2(); var repo = new OrderRepository(new PizzaPalacedbContext()); ///////////////////////////////////////////////////////// //var repo = new OrderRepository(new PizzaPalacedbContext()); bool a = true; while (a) { ///////////////// call first menu [ WELCOME ] ////////////////////// //Console.WriteLine("Enter Name: "); //string user = Console.ReadLine(); //Console.WriteLine("Enter LastName: "); //string last = Console.ReadLine(); //repo.GetUserOrder(user, last); //menus.WellcomeMenu(); //repo.GetUserOrder("Kevin", "Ramos"); //int location_id = 1; //var locations = repo.GetLocationOrders(location_id); //foreach (var item in locations) //{ // Console.WriteLine("Location: 1 " + " Order No. " + item.OrderId + " \n Order Date & time: " + item.DateTimeOrder); //} //Console.ReadLine(); repo.SugestedOrder("Angel", "Guzman"); ///////////////////////////////////////////////////////////////// Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("DONE!!"); Console.WriteLine(""); Console.WriteLine(); Console.ReadLine(); a = false; //////////////////////////////////////////////////////////////////// } }
public bool IsSatisfied(ISchedule schedule) { if (!schedule.Destination.Location.Equals(Destination)) { return(false); } var foundAt = false; var foundLocation1 = false; foreach (var location in schedule.Locations) { if (foundAt) { if (foundLocation1) { if (location.IsStopAt(Location2)) { return(true); } } else { if (location.IsStopAt(Location1)) { if (Location2.Equals(Location.NotSet)) { return(true); } foundLocation1 = true; } } } else { if (location.IsStopAt(At)) { foundAt = true; } } } return(false); }
/// <summary> /// Parses a line from disk for participant information /// </summary> /// <param name="line">The line from the participant file</param> private void ParseParticipant(string line) { var items = line.Split(" "); // participant participantId ipaddress:portNumber true/false (accepted) var ipaddressInfo = items[2].Split(":"); var ipaddress = ipaddressInfo[0]; var portNumber = ipaddressInfo[1]; var isAccepted = Convert.ToBoolean(items[3]); Guid id = Guid.Parse(items[1]); Location2 location = new Location2(ipaddress, Convert.ToInt32(portNumber)); var particpant = new Participant2(id, location); if (isAccepted) { _accepted.Add(particpant); } else { _pending.Add(particpant); } }
public void AddNewSkill() { //Populate the Excel Sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Shareskills"); GlobalDefinitions.wait(1); //Enter a Title Title.SendKeys(ExcelLib.ReadData(2, "Title")); Base.test.Log(LogStatus.Info, "Added Title successfully"); // Enter description Description.SendKeys(ExcelLib.ReadData(2, "Description")); Base.test.Log(LogStatus.Info, "Added description successfully"); //Select a category from dropdown GlobalDefinitions.wait(2); //Thread.Sleep(500); Actions action = new Actions(GlobalDefinitions.driver); action.MoveToElement(SkillCategory).Build().Perform(); Thread.Sleep(1000); IList <IWebElement> SkillCategorylist = SkillCategory.FindElements(By.TagName("option")); int count = SkillCategorylist.Count; Thread.Sleep(1500); for (int i = 1; i < count; i++) { if (SkillCategorylist[i].Text == ExcelLib.ReadData(2, "Category").Trim()) { Thread.Sleep(500); SkillCategorylist[i].Click(); Base.test.Log(LogStatus.Info, "Added category successfully"); } } //Select a subcategory from dropdown GlobalDefinitions.wait(2); action.MoveToElement(SubCategory).Build().Perform(); GlobalDefinitions.wait(2); IList <IWebElement> SubCategorylist = SubCategory.FindElements(By.TagName("option")); for (int i = 0; i < SubCategorylist.Count; i++) { if (SubCategorylist[i].Text == ExcelLib.ReadData(2, "SubCategory")) { SubCategorylist[i].Click(); Base.test.Log(LogStatus.Info, "Added Subcategory successfully"); } } //Add Tag GlobalDefinitions.wait(2); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tag")); Tags.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Info, "Added tag successfully"); //Select Service type GlobalDefinitions.wait(2); string ExpectedService = GlobalDefinitions.ExcelLib.ReadData(2, "Service"); string ActualService = ServiceType1.Text; if (ExpectedService == ActualService) { ServiceType1.Click(); } else { ServiceType2.Click(); } //Select location type Thread.Sleep(2000); GlobalDefinitions.wait(2); string ExpectedLocation = ExcelLib.ReadData(2, "Location"); string ActualLocation = Location1.Text; if (ExpectedLocation == ActualLocation) { Location1.Click(); } else { GlobalDefinitions.wait(2); Location2.Click(); } ////Select start Date GlobalDefinitions.wait(2); //StartDate.SendKeys(ExcelLib.ReadData(2, "StartDate")); //StartDate.SendKeys(Keys.Tab); Thread.Sleep(2000); string sysday = DateTime.Today.Day.ToString(); StartDate.SendKeys(sysday); string sysmonth = DateTime.Today.Month.ToString(); StartDate.SendKeys(sysmonth); // Select EndDate Thread.Sleep(2000); // EndDate.SendKeys(ExcelLib.ReadData(2, "EndDate")); EndDate.SendKeys("20/11/2020"); GlobalDefinitions.wait(2); //Select Available day Thread.Sleep(2000); AvailableDay.Click(); // Select StartTime Thread.Sleep(2000); StartTime.SendKeys(ExcelLib.ReadData(2, "StartTime")); Thread.Sleep(2000); // Select EndTime GlobalDefinitions.wait(1); EndTime.SendKeys(ExcelLib.ReadData(2, "EndTime")); Base.test.Log(LogStatus.Info, "Added avilable date and time successfully"); Thread.Sleep(2000); //Select Skill Trade GlobalDefinitions.wait(2); string ExpectedSkillTrade = ExcelLib.ReadData(2, "Skill Trade"); string ActualSkillTrade = SkillExchange.Text; if (ExpectedSkillTrade == ActualSkillTrade) { SkillExchange.Click(); //Enter skill for exchange SkillExchangeTag.SendKeys(ExcelLib.ReadData(2, "Skillexchange")); } else { Credit.Click(); //Enter rate CreditRate.Clear(); CreditRate.SendKeys(ExcelLib.ReadData(2, "Rate")); } //Upload WorkSample Images string MyWork = ExcelLib.ReadData(2, "UploadImage"); WorkSample.Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(MyWork); GlobalDefinitions.wait(1); autoit.Send("{Enter}"); Base.test.Log(LogStatus.Info, "Uploaded image successfully"); Thread.Sleep(2000); //Select active/ Hidden button GlobalDefinitions.wait(1); GlobalDefinitions.wait(2); string ExpectedAction = ExcelLib.ReadData(2, "Location"); string ActualAction = ActiveBtn.Text; if (ExpectedAction == ActualAction) { ActiveBtn.Click(); } else { GlobalDefinitions.wait(2); HiddenBtn.Click(); } //Check if save button enabled GlobalDefinitions.wait(2); if (SaveBtn.Enabled) { // Click on Save button GlobalDefinitions.wait(2); SaveBtn.Click(); Thread.Sleep(10000); try { //Check for Skill share success message Thread.Sleep(2000); GlobalDefinitions.wait(2); String ExpectedMessage = "Service Listing Added Successfully"; Thread.Sleep(10000); String ActualMessage = driver.FindElement(By.CssSelector("div.ns-box-inner")).Text; Assert.AreEqual(ExpectedMessage, ActualMessage); Base.test.Log(LogStatus.Info, "Skill saved Successfully"); } catch (Exception) { Base.test.Log(LogStatus.Info, "Skill saved Successfully"); } } else { SaveScreenShotClass.SaveScreenshot(driver, "Save button not enabled"); Base.test.Log(LogStatus.Info, "Save button not enabled"); } //Search for the Shared skill in Manage Listing page GlobalDefinitions.wait(2); //Click on manage listing driver.FindElement(By.LinkText("Manage Listings")).Click(); Thread.Sleep(1000); //Check if navigated to service listing page try { string Expected = "Manage Listings"; string Actual = driver.FindElement(By.XPath("//div[@id='listing-management-section']/div[2]/h2")).Text; Assert.AreEqual(Expected, Actual); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Navigated to manage listing page"); string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Navigated to manage listing page"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath)); } catch (Exception) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Could not navigate to Manage listing page"); string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Could not navigate to Manage listing page"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath)); } //Check if the added skill is present in the Manage listings GlobalDefinitions.wait(2); string ExpectedTitle = ExcelLib.ReadData(2, "Title"); string BeforeXPath = "//div[@id='listing-management-section']/div[2]/div/table/tbody/tr["; string AfterXpath = "]/td[3]"; for (int i = 1; i <= 5; i++) { GlobalDefinitions.wait(2); string ColElements = driver.FindElement(By.XPath(BeforeXPath + i + AfterXpath)).Text; if (ColElements.Contains(ExpectedTitle)) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Skill present in Manage Listing "); string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Skill present in Manage Listing"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath)); break; } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Skill not present in Manage Listing "); string screenshotpath = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Skill not present in Manage Listing"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Snapshot below:" + Base.test.AddBase64ScreenCapture(screenshotpath)); } } }
public override void ReadDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ele.TryPathTo("EditorID", false, out subEle)) { if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadXML(subEle, master); } if (ele.TryPathTo("Data", false, out subEle)) { if (Data == null) { Data = new PackageData(); } Data.ReadXML(subEle, master); } if (ele.TryPathTo("Location1", false, out subEle)) { if (Location1 == null) { Location1 = new PackageLocation(); } Location1.ReadXML(subEle, master); } if (ele.TryPathTo("Location2", false, out subEle)) { if (Location2 == null) { Location2 = new PackageLocation(); } Location2.ReadXML(subEle, master); } if (ele.TryPathTo("Schedule", false, out subEle)) { if (Schedule == null) { Schedule = new PackageScheduleData(); } Schedule.ReadXML(subEle, master); } if (ele.TryPathTo("Target1", false, out subEle)) { if (Target1 == null) { Target1 = new PackageTarget(); } Target1.ReadXML(subEle, master); } if (ele.TryPathTo("Conditions", false, out subEle)) { if (Conditions == null) { Conditions = new List <Condition>(); } foreach (XElement e in subEle.Elements()) { Condition tempCTDA = new Condition(); tempCTDA.ReadXML(e, master); Conditions.Add(tempCTDA); } } if (ele.TryPathTo("Idle/Flags", false, out subEle)) { if (IdleFlags == null) { IdleFlags = new SimpleSubrecord <PackageIdleFlags>(); } IdleFlags.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/Count", false, out subEle)) { if (IdleCount == null) { IdleCount = new SimpleSubrecord <Byte>(); } IdleCount.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/TimerSetting", false, out subEle)) { if (IdleTimerSetting == null) { IdleTimerSetting = new SimpleSubrecord <Single>(); } IdleTimerSetting.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/Animations", false, out subEle)) { if (IdleAnimations == null) { IdleAnimations = new FormArray(); } IdleAnimations.ReadXML(subEle, master); } if (ele.TryPathTo("Unused", false, out subEle)) { if (Unused == null) { Unused = new SimpleSubrecord <Byte[]>(); } Unused.ReadXML(subEle, master); } if (ele.TryPathTo("CombatStyle", false, out subEle)) { if (CombatStyle == null) { CombatStyle = new RecordReference(); } CombatStyle.ReadXML(subEle, master); } if (ele.TryPathTo("EatMarker", false, out subEle)) { if (EatMarker == null) { EatMarker = new SubMarker(); } EatMarker.ReadXML(subEle, master); } if (ele.TryPathTo("EscortDistance", false, out subEle)) { if (EscortDistance == null) { EscortDistance = new SimpleSubrecord <UInt32>(); } EscortDistance.ReadXML(subEle, master); } if (ele.TryPathTo("FollowDistance_StartLocation_TriggerRadius", false, out subEle)) { if (FollowDistance_StartLocation_TriggerRadius == null) { FollowDistance_StartLocation_TriggerRadius = new SimpleSubrecord <UInt32>(); } FollowDistance_StartLocation_TriggerRadius.ReadXML(subEle, master); } if (ele.TryPathTo("PatrolIsRepeatable", false, out subEle)) { if (PatrolIsRepeatable == null) { PatrolIsRepeatable = new SimpleSubrecord <NoYesByte>(); } PatrolIsRepeatable.ReadXML(subEle, master); } if (ele.TryPathTo("UseWeaponData", false, out subEle)) { if (UseWeaponData == null) { UseWeaponData = new PackageUseWeaponData(); } UseWeaponData.ReadXML(subEle, master); } if (ele.TryPathTo("Target2", false, out subEle)) { if (Target2 == null) { Target2 = new PackageTarget(); } Target2.ReadXML(subEle, master); } if (ele.TryPathTo("UseItemMarker", false, out subEle)) { if (UseItemMarker == null) { UseItemMarker = new SubMarker(); } UseItemMarker.ReadXML(subEle, master); } if (ele.TryPathTo("AmbushMarker", false, out subEle)) { if (AmbushMarker == null) { AmbushMarker = new SubMarker(); } AmbushMarker.ReadXML(subEle, master); } if (ele.TryPathTo("DialogData", false, out subEle)) { if (DialogData == null) { DialogData = new PackageDialogData(); } DialogData.ReadXML(subEle, master); } if (ele.TryPathTo("DummyIgnore", false, out subEle)) { if (DummyIgnore == null) { DummyIgnore = new PackageLocation(); } DummyIgnore.ReadXML(subEle, master); } if (ele.TryPathTo("OnBegin", false, out subEle)) { if (OnBegin == null) { OnBegin = new PackageEvent(); } OnBegin.ReadXML(subEle, master); } if (ele.TryPathTo("OnEnd", false, out subEle)) { if (OnEnd == null) { OnEnd = new PackageEvent(); } OnEnd.ReadXML(subEle, master); } if (ele.TryPathTo("OnChange", false, out subEle)) { if (OnChange == null) { OnChange = new PackageEvent(); } OnChange.ReadXML(subEle, master); } }
public override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (EditorID != null) { ele.TryPathTo("EditorID", true, out subEle); EditorID.WriteXML(subEle, master); } if (Data != null) { ele.TryPathTo("Data", true, out subEle); Data.WriteXML(subEle, master); } if (Location1 != null) { ele.TryPathTo("Location1", true, out subEle); Location1.WriteXML(subEle, master); } if (Location2 != null) { ele.TryPathTo("Location2", true, out subEle); Location2.WriteXML(subEle, master); } if (Schedule != null) { ele.TryPathTo("Schedule", true, out subEle); Schedule.WriteXML(subEle, master); } if (Target1 != null) { ele.TryPathTo("Target1", true, out subEle); Target1.WriteXML(subEle, master); } if (Conditions != null) { ele.TryPathTo("Conditions", true, out subEle); List <string> xmlNames = new List <string> { "Condition" }; int i = 0; foreach (var entry in Conditions) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (IdleFlags != null) { ele.TryPathTo("Idle/Flags", true, out subEle); IdleFlags.WriteXML(subEle, master); } if (IdleCount != null) { ele.TryPathTo("Idle/Count", true, out subEle); IdleCount.WriteXML(subEle, master); } if (IdleTimerSetting != null) { ele.TryPathTo("Idle/TimerSetting", true, out subEle); IdleTimerSetting.WriteXML(subEle, master); } if (IdleAnimations != null) { ele.TryPathTo("Idle/Animations", true, out subEle); IdleAnimations.WriteXML(subEle, master); } if (Unused != null) { ele.TryPathTo("Unused", true, out subEle); Unused.WriteXML(subEle, master); } if (CombatStyle != null) { ele.TryPathTo("CombatStyle", true, out subEle); CombatStyle.WriteXML(subEle, master); } if (EatMarker != null) { ele.TryPathTo("EatMarker", true, out subEle); EatMarker.WriteXML(subEle, master); } if (EscortDistance != null) { ele.TryPathTo("EscortDistance", true, out subEle); EscortDistance.WriteXML(subEle, master); } if (FollowDistance_StartLocation_TriggerRadius != null) { ele.TryPathTo("FollowDistance_StartLocation_TriggerRadius", true, out subEle); FollowDistance_StartLocation_TriggerRadius.WriteXML(subEle, master); } if (PatrolIsRepeatable != null) { ele.TryPathTo("PatrolIsRepeatable", true, out subEle); PatrolIsRepeatable.WriteXML(subEle, master); } if (UseWeaponData != null) { ele.TryPathTo("UseWeaponData", true, out subEle); UseWeaponData.WriteXML(subEle, master); } if (Target2 != null) { ele.TryPathTo("Target2", true, out subEle); Target2.WriteXML(subEle, master); } if (UseItemMarker != null) { ele.TryPathTo("UseItemMarker", true, out subEle); UseItemMarker.WriteXML(subEle, master); } if (AmbushMarker != null) { ele.TryPathTo("AmbushMarker", true, out subEle); AmbushMarker.WriteXML(subEle, master); } if (DialogData != null) { ele.TryPathTo("DialogData", true, out subEle); DialogData.WriteXML(subEle, master); } if (DummyIgnore != null) { ele.TryPathTo("DummyIgnore", true, out subEle); DummyIgnore.WriteXML(subEle, master); } if (OnBegin != null) { ele.TryPathTo("OnBegin", true, out subEle); OnBegin.WriteXML(subEle, master); } if (OnEnd != null) { ele.TryPathTo("OnEnd", true, out subEle); OnEnd.WriteXML(subEle, master); } if (OnChange != null) { ele.TryPathTo("OnChange", true, out subEle); OnChange.WriteXML(subEle, master); } }
public override void WriteData(ESPWriter writer) { if (EditorID != null) { EditorID.WriteBinary(writer); } if (Data != null) { Data.WriteBinary(writer); } if (Location1 != null) { Location1.WriteBinary(writer); } if (Location2 != null) { Location2.WriteBinary(writer); } if (Schedule != null) { Schedule.WriteBinary(writer); } if (Target1 != null) { Target1.WriteBinary(writer); } if (Conditions != null) { foreach (var item in Conditions) { item.WriteBinary(writer); } } if (IdleFlags != null) { IdleFlags.WriteBinary(writer); } if (IdleCount != null) { IdleCount.WriteBinary(writer); } if (IdleTimerSetting != null) { IdleTimerSetting.WriteBinary(writer); } if (IdleAnimations != null) { IdleAnimations.WriteBinary(writer); } if (Unused != null) { Unused.WriteBinary(writer); } if (CombatStyle != null) { CombatStyle.WriteBinary(writer); } if (EatMarker != null) { EatMarker.WriteBinary(writer); } if (EscortDistance != null) { EscortDistance.WriteBinary(writer); } if (FollowDistance_StartLocation_TriggerRadius != null) { FollowDistance_StartLocation_TriggerRadius.WriteBinary(writer); } if (PatrolIsRepeatable != null) { PatrolIsRepeatable.WriteBinary(writer); } if (UseWeaponData != null) { UseWeaponData.WriteBinary(writer); } if (Target2 != null) { Target2.WriteBinary(writer); } if (UseItemMarker != null) { UseItemMarker.WriteBinary(writer); } if (AmbushMarker != null) { AmbushMarker.WriteBinary(writer); } if (DialogData != null) { DialogData.WriteBinary(writer); } WriteDummyIgnore(writer); if (OnBegin != null) { OnBegin.WriteBinary(writer); } if (OnEnd != null) { OnEnd.WriteBinary(writer); } if (OnChange != null) { OnChange.WriteBinary(writer); } }
public override void ReadData(ESPReader reader, long dataEnd) { while (reader.BaseStream.Position < dataEnd) { string subTag = reader.PeekTag(); switch (subTag) { case "EDID": if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadBinary(reader); break; case "PKDT": if (Data == null) { Data = new PackageData(); } Data.ReadBinary(reader); break; case "PLDT": if (Location1 == null) { Location1 = new PackageLocation(); } Location1.ReadBinary(reader); break; case "PLD2": if (Location2 == null) { Location2 = new PackageLocation(); } Location2.ReadBinary(reader); break; case "PSDT": if (Schedule == null) { Schedule = new PackageScheduleData(); } Schedule.ReadBinary(reader); break; case "PTDT": if (Target1 == null) { Target1 = new PackageTarget(); } Target1.ReadBinary(reader); break; case "CTDA": if (Conditions == null) { Conditions = new List <Condition>(); } Condition tempCTDA = new Condition(); tempCTDA.ReadBinary(reader); Conditions.Add(tempCTDA); break; case "IDLF": if (IdleFlags == null) { IdleFlags = new SimpleSubrecord <PackageIdleFlags>(); } IdleFlags.ReadBinary(reader); break; case "IDLC": if (IdleCount == null) { IdleCount = new SimpleSubrecord <Byte>(); } IdleCount.ReadBinary(reader); break; case "IDLT": if (IdleTimerSetting == null) { IdleTimerSetting = new SimpleSubrecord <Single>(); } IdleTimerSetting.ReadBinary(reader); break; case "IDLA": if (IdleAnimations == null) { IdleAnimations = new FormArray(); } IdleAnimations.ReadBinary(reader); break; case "IDLB": if (Unused == null) { Unused = new SimpleSubrecord <Byte[]>(); } Unused.ReadBinary(reader); break; case "CNAM": if (CombatStyle == null) { CombatStyle = new RecordReference(); } CombatStyle.ReadBinary(reader); break; case "PKED": if (EatMarker == null) { EatMarker = new SubMarker(); } EatMarker.ReadBinary(reader); break; case "PKE2": if (EscortDistance == null) { EscortDistance = new SimpleSubrecord <UInt32>(); } EscortDistance.ReadBinary(reader); break; case "PKFD": if (FollowDistance_StartLocation_TriggerRadius == null) { FollowDistance_StartLocation_TriggerRadius = new SimpleSubrecord <UInt32>(); } FollowDistance_StartLocation_TriggerRadius.ReadBinary(reader); break; case "PKPT": if (PatrolIsRepeatable == null) { PatrolIsRepeatable = new SimpleSubrecord <NoYesByte>(); } PatrolIsRepeatable.ReadBinary(reader); break; case "PKW3": if (UseWeaponData == null) { UseWeaponData = new PackageUseWeaponData(); } UseWeaponData.ReadBinary(reader); break; case "PTD2": if (Target2 == null) { Target2 = new PackageTarget(); } Target2.ReadBinary(reader); break; case "PUID": if (UseItemMarker == null) { UseItemMarker = new SubMarker(); } UseItemMarker.ReadBinary(reader); break; case "PKAM": if (AmbushMarker == null) { AmbushMarker = new SubMarker(); } AmbushMarker.ReadBinary(reader); break; case "PKDD": if (DialogData == null) { DialogData = new PackageDialogData(); } DialogData.ReadBinary(reader); break; case "DUMY": if (DummyIgnore == null) { DummyIgnore = new PackageLocation(); } DummyIgnore.ReadBinary(reader); break; case "POBA": if (OnBegin == null) { OnBegin = new PackageEvent(); } OnBegin.ReadBinary(reader); break; case "POEA": if (OnEnd == null) { OnEnd = new PackageEvent(); } OnEnd.ReadBinary(reader); break; case "POCA": if (OnChange == null) { OnChange = new PackageEvent(); } OnChange.ReadBinary(reader); break; default: throw new Exception(); } } }
private async void BookNewOrder() { try { var streetaddress = txtAdress.Text; var postalcode = txtPostalCode.Text; int convertedpostalcode = int.Parse(postalcode); var city = txtCity.Text; string[] subs = streetaddress.Split(' '); foreach (var sub in subs) { Console.WriteLine($"Substring: {sub}"); } string streetname = subs[0]; string streetNumber = subs[1]; var additionalServiceCodeStandard = new List <string> { "A1" }; var itemList = new List <long> { 373500489530470000 }; List <PickupService> newist = new List <PickupService>(); newist.Add(new PickupService() { typeOfItem = "parcel", noUnits = 1 }); Service Servicebody = new Service { basicServiceCode = "19", additionalServiceCode = new List <string> { "A1" } }; Service2 service2 = new Service2 { service = Servicebody }; Shipment2 shipment2 = new Shipment2 { shipment = service2 }; var Shipmentbody = new Shipment { items = itemList }; var LocationBody = new Location { place = "Company name or information about pickup place e.g.garage", streetName = streetname, streetNumber = streetNumber, postalCode = convertedpostalcode, city = city, countryCode = "SE" }; Location2 location2 = new Location2 { location = LocationBody }; var OrderBody = new Order { customerNumber = "1234567891", orderReference = "Ref-1212122A", contactName = "Nils Andersson", contactEmail = "*****@*****.**", phoneNumber = "+4670788888", smsNumber = "+4670788888", entryCode = "8216" }; var Order2 = new Order2 { order = OrderBody }; var PickUpBody = new PickupService { typeOfItem = "parcel", noUnits = 1 }; var PickUp2 = new PickUp2 { pickups = newist }; var datesandtimesBody = new DateAndTimes { readyPickupDate = new DateTime(2021, 5, 13), latestPickupDate = new DateTime(2021, 5, 13), earliestPickupDate = new DateTime(2021, 5, 13) }; var datesandtimes2 = new DateAndTimes2 { DateAndTimes = datesandtimesBody }; var client = new RestClient("https://api2.postnord.com/rest/order/v1/pickup/SE?apikey=0ba91457361a67d1495aefa8519ba3cb"); client.Timeout = -1; var request = new RestRequest(Method.POST); // request.AddParameter("text/plain", "{\r\n \"shipment\": {\r\n \"service\": {\r\n \"basicServiceCode\": \"19\",\r\n \"additionalServiceCode\": [\r\n \"A1\"\r\n ]\r\n },\r\n \"items\": [\r\n 373500489530470000\r\n ]\r\n },\r\n \"location\": {\r\n \"place\": \"Company name or information about pickup place e.g. garage\",\r\n \"streetName\": \"streetname\",\r\n \"streetNumber\": \"streetNumber\",\r\n \"postalCode\": postalcode,\r\n \"city\": \"txtCity\",\r\n \"countryCode\": \"SE\"\r\n },\r\n \"order\": {\r\n \"customerNumber\": \"1234567891\",\r\n \"orderReference\": \"Ref-1212122A\",\r\n \"contactName\": \"Nils Andersson\",\r\n \"contactEmail\": \"[email protected]\",\r\n \"phoneNumber\": \"+4670788888\",\r\n \"smsNumber\": \"+4670788888\",\r\n \"entryCode\": \"8216\"\r\n },\r\n \"pickup\": [\r\n {\r\n \"typeOfItem\": \"parcel\",\r\n \"noUnits\": 1\r\n }\r\n ],\r\n \"dateAndTimes\": {\r\n \"readyPickupDate\": \"2020-11-17T09:52:07.929Z\",\r\n \"latestPickupDate\": \"2020-11-17T09:52:07.929Z\",\r\n \"earliestPickupDate\": \"2020-11-17T09:52:07.929Z\"\r\n }\r\n}", ParameterType.RequestBody); request.AddHeader("Accept", "application/json"); request.Parameters.Clear(); string json = JsonConvert.SerializeObject(shipment2, Formatting.Indented); string json2 = JsonConvert.SerializeObject(Shipmentbody, Formatting.Indented); string json3 = JsonConvert.SerializeObject(location2, Formatting.Indented); string json4 = JsonConvert.SerializeObject(Order2, Formatting.Indented); string json5 = JsonConvert.SerializeObject(PickUp2, Formatting.Indented); string json6 = JsonConvert.SerializeObject(datesandtimes2, Formatting.Indented); await DisplayAlert("Alert", json + json2 + json3 + json4 + json5 + json6, "OK"); Console.WriteLine(json + json2 + json3 + json4 + json5 + json6); request.RequestFormat = DataFormat.Json; request.AddJsonBody(shipment2); request.AddJsonBody(Shipmentbody); request.AddJsonBody(location2); request.AddJsonBody(Order2); request.AddJsonBody(PickUp2); request.AddJsonBody(datesandtimes2); IRestResponse response = client.Execute(request); await DisplayAlert("Alert", response.Content.ToString(), "OK"); } catch (Exception ex) { Console.WriteLine(ex); await DisplayAlert("Alert!", "Incorrect adress, try again", "OK"); } }
public Participant2(Guid?id, Location2 location) { Id = id; Location = location; }