/// <summary> /// Pull a ticked in a office for a advice /// </summary> /// <param name="account"></param> /// <param name="advice"></param> /// <returns></returns> public Ticket PullTicketForAdvice(Account account, Advice advice) { if (account == null) { if (this.CurrentAccount != null) { if (this.CurrentAccount.MyTickets.Count >= 2) { return(null); } } Ticket ticket = advice.Office.GetTicketForAdviceIfExists(this.CurrentAccount); if (ticket == null) { ticket = new Ticket(this.CurrentAccount, advice); } return(ticket); } else { if (account.MyTickets.Count >= 2) { return(null); } Ticket ticket = advice.Office.GetTicketForAdviceIfExists(account); if (ticket == null) { ticket = new Ticket(account, advice); } return(ticket); } }
internal Ticket(Account account, Advice advice) { //Set references to other objects this.Account = account; this.Advice = advice; this.Office = advice.Office; //Set Timestamps PullDate = DateTime.Now; MaxValidUntil = this.Office.GetMaxOpeningToday(); //Line Number LineNumber = ((Office)this.Office).GetNextNumberInLine(this); if (account != null) { account.MyTickets.Add(this); } }
private void InitializeSampleAdvices() { // Create a sample Traditional User Account that only has a Username and Password // This will be used initially to demonstrate how to migrate to use Microsoft Passport Advice cat = new Advice() { AdviceId = Guid.NewGuid(), Caption = "Living & Housing" }; Advice subCat = new Advice() { AdviceId = Guid.NewGuid(), Caption = "Housing" }; Advice sampleAdvice = new Advice() { AdviceId = Guid.NewGuid(), Caption = "Registering / changing residence", Text = "sample text....", Office = GetOfficeByName("Office for Community Services and Information Processing"), Fees = "initial issue of the residence permit: EUR 100 to 250 extension of the residence permit: EUR 80 " + "For underage children the administration fees are reduced respectively by half.", }; sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "passport" }); sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "biometric photograph" }); sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "proof of adequate health insurance" }); sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "completed and signed application form", Link = "Download" }); // Add the sampleUserAccount to the _mockDatabase subCat.Advices.Add(sampleAdvice); sampleAdvice = new Advice() { AdviceId = Guid.NewGuid(), Caption = "Deregistering residenc", Text = "sample text....", Office = GetOfficeByName("Office for Community Services and Information Processing") }; // Add the sampleUserAccount to the _mockDatabase subCat.Advices.Add(sampleAdvice); cat.Advices.Add(subCat); _mockDatabaseAdviceCatList.Add(cat); //2. cat cat = new Advice() { AdviceId = Guid.NewGuid(), Caption = "Legal Advice" }; subCat = new Advice() { AdviceId = Guid.NewGuid(), Caption = "XXX" }; sampleAdvice = new Advice() { AdviceId = Guid.NewGuid(), Caption = "XXX Legal Advice", Text = "sample text....", Office = GetOfficeByName("Office for Community Services and Information Processing"), Fees = "Super expensive", }; sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "passport" }); sampleAdvice.CheckListItems.Add(new CheckListItem() { Name = "lot of papers", Link = "Download" }); // Add the sampleUserAccount to the _mockDatabase subCat.Advices.Add(sampleAdvice); cat.Advices.Add(subCat); _mockDatabaseAdviceCatList.Add(cat); //SaveAsync(); }