/// <summary> /// Implementacja interfejsu IComparable w celu /// prawidłowego poążdkowania elemetów w listach sortowania /// </summary> /// <param name="obj">obiekt z którym porównuje aktulany obiekt (this)</param> /// <returns> /// [ < 0] - bieżące wystąpienie poprzedza obiekt /// [ 0] - bieżące wystąpienie występuje w tym samym pożądku sortowania /// [ > 0] - bieżące wystąpienie występuje po obiekcie określonym przez CompareTo /// </returns> public int CompareTo(object obj) { Contact otherContact = obj as Contact; // na początku kontakty są sortowane alfabetycznie po miejscowości if (otherContact.City != null) { return(City.CompareTo(otherContact.City)); } if (otherContact.Street != null) { return(Street.CompareTo(otherContact.Street)); } if (otherContact.PostOffice != null) { return(PostOffice.CompareTo(otherContact.PostOffice)); } if (otherContact.Email != null) { return(Email.CompareTo(otherContact.Email)); } if (otherContact.Phone != null) { return(Phone.CompareTo(otherContact.Phone)); } return(HomeNumber.CompareTo(otherContact.HomeNumber)); }
protected void btnSave_Click(object sender, EventArgs e) { try { labelMessagePostOffice.Text = string.Empty; int PoliceStationID = int.Parse(txtPoliceStationID.Text); using (PostOfficeRT receiverTransfer = new PostOfficeRT()) { if (receiverTransfer.IsPostOfficeCodeExists(txtPostOfficeCode.Text, PoliceStationID) && receiverTransfer.IsPostOfficeNameExists(txtPostOfficeName.Text, PoliceStationID)) { labelMessagePostOffice.Text = "Post Office Code " + txtPostOfficeCode.Text + "& Name " + txtPostOfficeName.Text + " Already Exists!"; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; return; } else if (receiverTransfer.IsPostOfficeCodeExists(txtPostOfficeCode.Text)) { labelMessagePostOffice.Text = "Post Office Code " + txtPostOfficeCode.Text + " Already Exists!"; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; return; } else if (receiverTransfer.IsPostOfficeCodeExists(txtPostOfficeCode.Text, PoliceStationID)) { labelMessagePostOffice.Text = "Post Office Code " + txtPostOfficeCode.Text + " Already Exists!"; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; return; } else if (receiverTransfer.IsPostOfficeNameExists(txtPostOfficeName.Text, PoliceStationID)) { labelMessagePostOffice.Text = "Post Office Name " + txtPostOfficeName.Text + " Already Exists!"; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; return; } hdSave.Value = "true"; PostOffice postOffice = CreatePostOffice(); receiverTransfer.AddPostOffice(postOffice); if (postOffice.IID > 0) { labelMessagePostOffice.Text = "Data successfully saved..."; labelMessagePostOffice.ForeColor = System.Drawing.Color.Green; } else { labelMessagePostOffice.Text = "Data not saved..."; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; } } ClearField(); LoadPostOfficeListView(); SetButton(); // hdSave.Value = string.Empty; } catch (Exception ex) { labelMessagePostOffice.Text = "Error : " + ex.Message; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; } }
protected void lvPostOffice_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "EditPostOffice") { try { labelMessagePostOffice.Text = string.Empty; btnSave.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = false; btnCancel.Visible = true; chkPoliceStationActv.Visible = true; int PostoffcID = Convert.ToInt32(e.CommandArgument); hdPostOfficeID.Value = PostoffcID.ToString(); using (PostOfficeRT receiverTransfer = new PostOfficeRT()) { PostOffice postOffice = receiverTransfer.GetPostOfficeByID(PostoffcID); FillPostOfficeForEdit(postOffice); } } catch (Exception ex) { labelMessagePostOffice.Text = "Error : " + ex.Message; labelMessagePostOffice.ForeColor = System.Drawing.Color.Red; } } }
public void GetsCompanyNameTest_PostOffice() { PostOffice target = new PostOffice(); string expected = "PostOffice"; Assert.AreEqual(expected, target.GetsCompanyName()); }
public void Apply() { try { Setting.Instance.TweetExperienceProperty.UrlResolveMode = (UrlResolve)this._resolveStrategyIndex; Setting.Instance.TweetExperienceProperty.UrlTooltipShowLength = int.Parse(this._tipHelpShowLength); Setting.Instance.TweetExperienceProperty.UserNameViewMode = (NameView)this._userNameViewModeIndex; Setting.Instance.TweetExperienceProperty.NotificationNameViewMode = (NameView)this._notificationNameViewModeIndex; Setting.Instance.TweetExperienceProperty.NameAreaWidth = this.UserNameAreaWidthInt; Setting.Instance.TweetExperienceProperty.UseP3StyleIcon = this._p3StyleIcon; Setting.Instance.TweetExperienceProperty.ShowUnofficialRetweetButton = this._showUnofficialRTButton; Setting.Instance.TweetExperienceProperty.ShowQuoteButton = this._showQuoteTweetButton; Setting.Instance.TweetExperienceProperty.TweetViewMode = (TweetViewingMode)this._viewModeIndex; Setting.Instance.TweetExperienceProperty.CanFavoriteMyTweet = this._canFavMyTweet; Setting.Instance.TweetExperienceProperty.ShowTweetTooltip = this._showTweetTooltip; Setting.Instance.TweetExperienceProperty.RightButtonKind = (QuickActionButtonKind)this._rightButtonKind; Setting.Instance.TweetExperienceProperty.ShowImageInlineThumbnail = this._showImageInlineThumbnail; if (Setting.Instance.TweetExperienceProperty.ShowStealButton != this._showStealButton && this._showStealButton) { var acc = AccountStorage.Accounts.FirstOrDefault(); if (acc != null) { string sts = "人としてクズに育ちました!お父さんお母さんありがとう!(◞≼●≽◟◞౪◟◞≼●≽◟) #クズ"; Task.Factory.StartNew(() => { try { PostOffice.UpdateTweet(acc, sts); } catch { } }); } } Setting.Instance.TweetExperienceProperty.ShowStealButton = this._showStealButton; } catch (Exception ex) { ExceptionStorage.Register(ex, ExceptionCategory.UserError, "Setting error."); } }
public void CalculateTest_PostOffice() { PostOffice target = new PostOffice() { ShipProduct = new Product { IsNeedCool = true, Name = "test1", Size = new getSize { Height = 10, Length = 30, Width = 20 }, Weight = 10 } }; target.Calculate(); var expectedName = "PostOffice"; var expectedFee = 180; var actualName = target.GetsCompanyName(); var actualFee = target.GetsFee(); Assert.AreEqual(expectedName, actualName); Assert.AreEqual(expectedFee, actualFee); }
public void GetsFeeTest_PostOffice() { PostOffice target = new PostOffice(); double expected = 0F; Assert.AreEqual(expected, target.GetsFee()); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PostCode,ThanaOrUpazilaId,CreatedBy,CreatedAt,UpdatedBy,UpdatedAt")] PostOffice postOffice) { if (id != postOffice.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(postOffice); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostOfficeExists(postOffice.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ThanaOrUpazilaId"] = new SelectList(_context.ThanaOrUpazila, "Id", "Id", postOffice.ThanaOrUpazilaId); return(View(postOffice)); }
public void CalculateTest() { // 從整合測試的test case,來當做單元測試的test case // arrange PostOffice target = new PostOffice() { ShipProduct = new Product { IsNeedCool = true, Name = "商品測試1", Size = new Size { Height = 10, Length = 30, Width = 20 }, Weight = 10 } }; // act target.Calculate(); var expectedName = "郵局"; var expectedFee = 180; var actualName = target.GetsComapanyName(); var actualFee = target.GetsFee(); // assert Assert.AreEqual(expectedName, actualName); Assert.AreEqual(expectedFee, actualFee); }
public void RetweetThisTabAll() { Task.Factory.StartNew(() => { IEnumerable <TabDependentTweetViewModel> tweets; using (NotifyStorage.NotifyManually("タイムラインの内容を取得しています...")) { tweets = this.CurrentForegroundTimeline.CoreViewModel.TweetsSource.ToArrayVolatile(); } var msg = new ConfirmationMessage( "このタブに含まれるすべてのツイートをRetweetします。" + Environment.NewLine + "(対象ツイート: " + tweets.Count() + "件)" + Environment.NewLine + "よろしいですか?", "全てRetweet", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Parent.Messenger.Raise(msg); if (msg.Response.GetValueOrDefault()) { var lai = this.TabProperty.LinkAccountInfos.ToArray(); tweets.OrderBy(t => t.Tweet.CreatedAt) .ForEach(t => PostOffice.Retweet(lai, t.Tweet)); } }); }
/// <summary> /// Send the provided parcel. /// </summary> /// <param name="messageBusConnectionConfiguration">Persistence configuration.</param> /// <param name="parcel">Parcel to send.</param> /// <param name="schedule">Optional recurring schedule.</param> public static void Send( MessageBusConnectionConfiguration messageBusConnectionConfiguration, Parcel parcel, ScheduleBase schedule = null) { new { messageBusConnectionConfiguration }.AsArg().Must().NotBeNull(); new { parcel }.AsArg().Must().NotBeNull(); var serializerFactory = SerializerFactory.Instance; var envelopeMachine = new EnvelopeMachine( PostOffice.MessageSerializerRepresentation, serializerFactory); var courier = new HangfireCourier(messageBusConnectionConfiguration.CourierPersistenceConnectionConfiguration, envelopeMachine); using (var parcelTrackingSystem = new ParcelTrackingSystem( courier, envelopeMachine, messageBusConnectionConfiguration.EventPersistenceConnectionConfiguration, messageBusConnectionConfiguration.ReadModelPersistenceConnectionConfiguration)) { var postOffice = new PostOffice(parcelTrackingSystem, HangfireCourier.DefaultChannelRouter, envelopeMachine); if (schedule == null) { postOffice.Send(parcel); } else { postOffice.SendRecurring(parcel, schedule); } } }
public NuxleusCoreHandler () { _receiver = new ReceiverHandler(); _dispatcher = new DispatchHandler(); PostOffice m_postOffice = new PostOffice(); _receiver.PostOffice = m_postOffice; _dispatcher.PostOffice = m_postOffice; }
public void TestNotifySellerNoBidders() { PostOffice.GetInstance().Clear(); (Users users, User scott, User bob, Auction auction) = AuctionTests.CreateAuctionWorld(); auction.StartAuction(); auction.EndAuction(); Approvals.Verify(PostOffice.GetInstance().FindEmail(scott.Email, auction.ItemDescription)); }
/// <summary> /// Returns the static singleton PostOffice. /// </summary> /// <param name="user">The David SMTP username.</param> /// <param name="password">That user's password.</param> /// <returns></returns> public static PostOffice PostOffice(string user, string password) { if (myPostOffice == null) { myPostOffice = new PostOffice(user, password, Model.ModelManager.UserService.CurrentUser.EmailWork); } return(myPostOffice); }
private void NotifyOnGameStateChange(GameState.GameStateEnum newGameState) { var data = DataPool.GetInstance().RequestInstance(); data.SetValue(GameMasterEvent.GameStateChangeEvent.New_Game_State, newGameState); PostOffice.SendData(data, GameMasterEvent.ON_GAMESTATE_CHANGED); DataPool.GetInstance().ReturnInstance(data); }
public void AddPostOffice(PostOffice postOffice) { try { DatabaseHelper.Insert <PostOffice>(postOffice); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public ActionResult DeleteConfirmed(string id) { PostOffice postOffice = GM.FindBy(x => x.postOffice == id).FirstOrDefault(); db.PostOffice.Remove(postOffice); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Loaded() { KeyAssignCore.RegisterOperation("SookIkemen", () => KeyAssignHelper.ExecuteTabAction(tab => { try { tab.TabProperty.LinkAccountInfos.ForEach(a => PostOffice.UpdateTweet(a, "スークイケメンナーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー #sook_ikemen")); } catch (Exception e) { ExceptionStorage.Register(e, ExceptionCategory.PluginError, "スークイケメンナーーーーーーーーーーーーーーに失敗しました: " + e.Message); } })); KeyAssignCore.RegisterOperation("SenselessRetweet", () => KeyAssignHelper.ExecuteTVMAction(tvm => { var ts = tvm.Tweet.Status as TwitterStatus; if (ts == null) { return; } KernelService.MainWindowViewModel.InputBlockViewModel.SetOpenText(true, true); KernelService.MainWindowViewModel.InputBlockViewModel.SetText(BuildSenseless(ts)); })); KeyAssignCore.RegisterOperation("SenselessRetweetFast", () => KeyAssignHelper.ExecuteTVMAction(tvm => { try { var ts = tvm.Tweet.Status as TwitterStatus; if (ts == null) { return; } tvm.Parent.TabProperty.LinkAccountInfos.ForEach( ai => PostOffice.UpdateTweet(ai, BuildSenseless(ts))); } catch (Exception e) { ExceptionStorage.Register(e, ExceptionCategory.PluginError, "非常識RTに失敗しました: " + e.Message); } })); KernelService.AddMenu("スークイケメンナー", () => KeyAssignHelper.ExecuteTabAction(tab => { try { tab.TabProperty.LinkAccountInfos.ForEach(a => PostOffice.UpdateTweet(a, "スークイケメンナーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー #sook_ikemen")); } catch (Exception e) { ExceptionStorage.Register(e, ExceptionCategory.PluginError, "スークイケメンナーーーーーーーーーーーーーーに失敗しました: " + e.Message); } })); }
public void GetsComapanyNameTest() { PostOffice target = new PostOffice(); string expected = "郵局"; string actual; actual = target.GetsComapanyName(); Assert.AreEqual(expected, actual); }
public void GetsFeeTest() { PostOffice target = new PostOffice(); double expected = 0F; double actual; actual = target.GetsFee(); Assert.AreEqual(expected, actual); }
static public void Run() { Console.WriteLine("------------ChainOfResponsibility------------"); PostOffice postOffice = new PostOffice(); int packageFirst = 5, packageSecond = 20; postOffice.Delivery(packageFirst); postOffice.Delivery(packageSecond); }
public void AssertGenerateRoutes() { PostOffice poBox = new PostOffice(); poBox.initializeDestinations(); poBox.generateRoutes(); Assert.IsTrue(File.Exists(poBox.FilePath)); Assert.IsTrue(File.ReadAllText(poBox.FilePath).Length > 0); }
public void FinishedLoadingProtocol() { SceneManager.UnloadSceneAsync(profile.loadScene); var data = DataPool.GetInstance().RequestInstance(); data.SetValue("Instance", currentInstance); PostOffice.SendData(data, GameMasterEvent.GAME_LOAD_EVENT); DataPool.GetInstance().ReturnInstance(data); }
public void SaturdayHasExtraTwoDays() { PostOffice postOffice = new PostOffice(); var date = postOffice.CalculateDespatchDate(new Order(new List <int>() { 1 }, new DateTime(2018, 1, 26))); date.Date.ShouldBe(new DateTime(2018, 1, 26).Date.AddDays(3)); }
public void OneProductWithLeadTimeOfThreeDay() { PostOffice postOffice = new PostOffice(); var date = postOffice.CalculateDespatchDate(new Order(new List <int>() { 3 }, DateTime.Now)); date.Date.ShouldBe(DateTime.Now.Date.AddDays(3)); }
public void SundayHasExtraDay() { PostOffice postOffice = new PostOffice(); var date = postOffice.CalculateDespatchDate(new Order(new List <int>() { 3 }, new DateTime(2018, 1, 25))); date.Date.ShouldBe(new DateTime(2018, 1, 25).Date.AddDays(4)); }
LoadBalancer (int processors) { _postOfficeArrayList = new ArrayList(); _loadBalancePostOfficeIndex = 0; for (int p = 0; p < processors; p++) { PostOffice m_postOffice = new PostOffice(); _postOfficeArrayList.Add(m_postOffice); } }
public void Delete(int id) { var PostOffice = new PostOffice { PostOfficeId = id }; unitOfWork.PostOfficeRepository.Delete(PostOffice); unitOfWork.Save(); }
public ComputationState(InternalComputation manager, Scheduler scheduler) { this.InternalComputation = manager; this.PostOffice = new PostOffice(scheduler); this.WorkItems = new List <WorkItem>(); this.index = scheduler.Index; this.Vertices = new List <Dataflow.Vertex>(); this.producer = null; }
public void Create(PostOfficeViewModel PostOfficeViewModel) { var PostOffice = new PostOffice { PostOfficeName = PostOfficeViewModel.PostOfficeName, DistrictId = PostOfficeViewModel.DistrictId }; unitOfWork.PostOfficeRepository.Insert(PostOffice); unitOfWork.Save(); }
static void Main(string[] args) { PostOffice po = new PostOffice(); for (int i = 1; i < 6; i++) { Console.WriteLine("第" + i + "组数据邮局选址位置为:" + po.getPosition("data/input_assign01_0" + i + ".txt")); po.clear(); } Console.ReadKey(); }
public async void PostOfficeOnlineSubscription() { PostOffice p = new PostOffice(Guid.NewGuid()); var task=new Task(()=>{}); }
public async Task <IActionResult> Create([Bind("Id,Name,PostCode,ThanaOrUpazilaId,CreatedBy,CreatedAt,UpdatedBy,UpdatedAt")] PostOffice postOffice) { if (ModelState.IsValid) { _context.Add(postOffice); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ThanaOrUpazilaId"] = new SelectList(_context.ThanaOrUpazila, "Id", "Id", postOffice.ThanaOrUpazilaId); return(View(postOffice)); }
public void Test_Post() { var node = new Node ("Node1"); var po = new PostOffice (); po.Post (node, "Node2", null); Assert.AreEqual (1, po.MailCount); Assert.AreEqual (1, po.Mails.Count ()); }
public void Test_New() { var po = new PostOffice (); Assert.AreEqual (100, PostOffice.MaxRecordCount); Assert.AreEqual (0, po.MailCount); Assert.AreEqual (0, po.Mails.Count ()); Assert.AreEqual (0, po.DeliveryRecordCount); Assert.AreEqual (0, po.DeliveryRecords.Count ()); }
public void HandleData(string line) { if (ignoreinput) return; line = line.Replace("\t", " "); string scode = (line.IndexOf(" ") > 0) ? line.Substring(0, line.IndexOf(" ")) : line; int icode = 411; if (scode.IndexOf("-") != 3) icode = Int32.Parse(scode); switch (icode) { case 100: if (!loggedin) { Send("user " + username + "\r\n"); Send("pass " + password + "\r\n"); Send("postoffices\r\n"); loggedin = true; } break; case 200: if (watchforeof && line.StartsWith("200 EOF:")) { if (listpostoffices) { PostOfficesReceived.BeginInvoke(null, null, null, null); listpostoffices = false; } else if (listmailboxes) { MailBoxesReceived.BeginInvoke(this, null, null, null); listmailboxes = false; } else if (listdomains) { DomainsReceived.BeginInvoke(this, null, null, null); listdomains = false; } else if (listaddresses) { AddressesReceived.BeginInvoke(this, null, null, null); listaddresses = false; } watchforeof = false; } break; case 500: //if (listpostoffices) // Send("list detailed\r\n"); break; case 411: break; #region Mode 510 case 510: if (listpostoffices) { watchforeof = true; PostOffice po = new PostOffice(); line = line.Substring(line.IndexOf(" ") + 1).Trim(); string[] pa = line.Split(";".ToCharArray(), 5); for (int i = 0; i < pa.Length; i++) { line = pa[i]; switch (pa[i].Substring(0, ((pa[i].IndexOf(":") > 0)) ? pa[i].IndexOf(":") : pa[i].Length).Trim()) { case "ID": po.ID = line.Substring(line.IndexOf(":") + 1).Trim(); break; case "Default": po.IsDefault = (Int32.Parse(pa[i].Substring(pa[i].IndexOf(":") + 1).Trim()) == 1) ? true : false; break; case "Status": po.Status = Int32.Parse(pa[i].Substring(pa[i].IndexOf(":") + 1).Trim()); break; case "Description": po.Description = pa[i].Substring(pa[i].IndexOf(":") + 1).Trim(); break; default: if (i == 1) { po.Name = line.Substring(line.IndexOf("\\\\") + 2).Trim(); } break; } } if (postoffices.findByID(po.ID) == null) { postoffices.Add(po); } } break; #endregion #region Mode 610 case 610: if (listdomains) { string domainpostoffice = null; Domain d = new Domain(); line = line.Substring(line.IndexOf(" ") + 1).Trim(); string[] da = line.Split(";".ToCharArray(), 5); for (int i = 0; i < da.Length; i++) { switch (da[i].Substring(0, ((da[i].IndexOf(":") > 0)) ? da[i].IndexOf(":") : da[i].Length).Trim()) { case "ID": d.ID = da[i].Substring(da[i].IndexOf(":") + 1).Trim(); break; case "Status": d.Status = Int32.Parse(da[i].Substring(da[i].IndexOf(":") + 1).Trim()); break; case "Misc": d.Misc = da[i].Substring(da[i].IndexOf(":") + 1).Trim(); break; case "Description": d.Description = da[i].Substring(da[i].IndexOf(":") + 1).Trim(); break; default: if (i == 1) { line = da[i]; line = line.Substring(line.IndexOf("\\\\") + 2); domainpostoffice = line.Substring(0, line.LastIndexOf("\\")); d.Name = line.Substring(line.LastIndexOf("@") + 1).Trim(); } break; } } if (postoffices.findByName(domainpostoffice).Domains.findByID(d.ID) == null) { postoffices.findByName(domainpostoffice).Domains.Add(d); } } break; #endregion #region Mode 710 case 710: if (listmailboxes) { string mailboxpostoffice = ""; MailBox mb = new MailBox(); line = line.Substring(line.IndexOf(" ") + 1).Trim(); string[] mba = line.Split(";".ToCharArray(), 6); for (int i = 0; i < mba.Length; i++) { line = mba[i]; switch (mba[i].Substring(0, ((mba[i].IndexOf(":") > 0)) ? mba[i].IndexOf(":") : mba[i].Length).Trim()) { case "ID": mb.ID = mba[i].Substring(mba[i].IndexOf(":") + 1).Trim(); break; case "Quota": mb.Quota = Int32.Parse(mba[i].Substring(mba[i].IndexOf(":") + 1).Trim()); break; case "Status": mb.Status = Int32.Parse(mba[i].Substring(mba[i].IndexOf(":") + 1).Trim()); break; case "Misc": mb.Misc = mba[i].Substring(mba[i].IndexOf(":") + 1).Trim(); break; case "Description": mb.Description = mba[i].Substring(mba[i].IndexOf(":") + 1).Trim(); break; default: if (i == 1) { line = line.Substring(line.IndexOf("\\\\") + 2); mailboxpostoffice = line.Substring(0, line.IndexOf("\\")); mb.Name = line.Substring(line.LastIndexOf("\\") + 1).Trim(); } break; } } if (postoffices.findByName(mailboxpostoffice).MailBoxes.findByID(mb.ID) == null) { postoffices.findByName(mailboxpostoffice).MailBoxes.Add(mb); } } break; #endregion #region Mode 810 case 810: if (listaddresses) { Address a = new Address(); string addresspostofficename= String.Empty; string addressmailboxname = String.Empty; line = line.Substring(line.IndexOf(" ") + 1).Trim(); string[] aa = line.Split(";".ToCharArray(), 5); for (int i = 0; i < aa.Length; i++) { switch (aa[i].Substring(0, ((aa[i].IndexOf(":") > 0)) ? aa[i].IndexOf(":") : aa[i].Length).Trim()) { case "ID": a.ID = aa[i].Substring(aa[i].IndexOf(":") + 1).Trim(); break; case "Status": a.Status = Int32.Parse(aa[i].Substring(aa[i].IndexOf(":") + 1).Trim()); break; case "Misc": a.Misc = aa[i].Substring(aa[i].IndexOf(":") + 1).Trim(); break; case "SMS ID": a.SMSID = aa[i].Substring(aa[i].IndexOf(":") + 1).Trim(); break; default: if (i == 1) { line = aa[i].Trim(); a.Name = line.Substring(line.LastIndexOf("\\") + 1); line = line.Substring(0, line.LastIndexOf("\\")); addressmailboxname = line.Substring(line.LastIndexOf("\\") + 1); line = line.Substring(0, line.LastIndexOf("\\")); //line = line.Substring(line.IndexOf("\\")); addresspostofficename = line.Substring(2); } break; } } postoffices.findByName(addresspostofficename).MailBoxes.findByName(addressmailboxname).Addresses.Add(a); } break; #endregion case 900: break; default: break; } }
private static Boolean KawigiEdit_RunTest(int testNum, string p0, string p1, Boolean hasAnswer, int p2) { Console.Write("Test " + testNum + ": [" + "\"" + p0 + "\"" + "," + "\"" + p1 + "\""); Console.WriteLine("]"); PostOffice obj; int answer; obj = new PostOffice(); DateTime startTime = DateTime.Now; answer = obj.matchAddress(p0, p1); DateTime endTime = DateTime.Now; Boolean res; res = true; Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds"); if (hasAnswer) { Console.WriteLine("Desired answer:"); Console.WriteLine("\t" + p2); } Console.WriteLine("Your answer:"); Console.WriteLine("\t" + answer); if (hasAnswer) { res = answer == p2; } if (!res) { Console.WriteLine("DOESN'T MATCH!!!!"); } else if ((endTime - startTime).TotalSeconds >= 2) { Console.WriteLine("FAIL the timeout"); res = false; } else if (hasAnswer) { Console.WriteLine("Match :-)"); } else { Console.WriteLine("OK, but is it right?"); } Console.WriteLine(""); return res; }
// public PostOffice Add() // { // PostOffice postoffice = new PostOffice(); // adminconnection // postoffice.adminconnection = adminconnection; // return Add(postoffice); // } public PostOffice Add(PostOffice postoffice) { postoffice.adminconnection = adminconnection; List.Add(postoffice); return postoffice; }
public int IndexOf(PostOffice postoffice) { return List.IndexOf(postoffice); }