public async Task <IActionResult> Edit(int id, [Bind("Id,Current,Destination,ApplicationMemberId")] Visa visa) { if (id != visa.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(visa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VisaExists(visa.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationMemberId"] = new SelectList(_context.Users, "Id", "Id", visa.ApplicationMemberId); return(View(visa)); }
public void TestCase2() { Person testPerson = new Person() { FirstName = "Test", LastName = "Person1" }; Wallet wallet1 = new Wallet(); testPerson.Wallets.Add(wallet1); Visa VisaCC = new Visa(); VisaCC.Balance = 100; wallet1.CreditCards.Add(VisaCC); Discover DiscoverCC = new Discover(); DiscoverCC.Balance = 100; wallet1.CreditCards.Add(DiscoverCC); Wallet wallet2 = new Wallet(); testPerson.Wallets.Add(wallet2); MasterCard MasterCC = new MasterCard(); MasterCC.Balance = 100; wallet2.CreditCards.Add(MasterCC); Assert.AreEqual(16, testPerson.TotalInterest()); Assert.AreEqual(11, wallet1.TotalInterest()); Assert.AreEqual(5, wallet2.TotalInterest()); }
public static MvcHtmlString CustomDisplayVisaForEMP(this HtmlHelper helper, Visa visa) { StringBuilder builder = new StringBuilder(""); if (visa == null) { builder.Append("<tr><td><b>Visa</b></td><td>No Visa</td></tr> <br />"); } else { int? usedDays = visa.DaysUsedInPrivateTrips.Value + visa.DaysUsedInBT.Value + visa.CorrectionForVisaDays.Value; string daysToDisplay = String.Format("{0}({1})", visa.Days, usedDays); int? usedEntries; string entriesToDisplay; if (visa.Entries == 0) { entriesToDisplay = "MULT"; } else { usedEntries = visa.EntriesUsedInPrivateTrips.Value + visa.EntriesUsedInBT.Value + visa.CorrectionForVisaEntries.Value; entriesToDisplay = String.Format("{0}({1})", visa.Entries, usedEntries); } builder.AppendFormat("<tr><td rowspan=\"3\"><b>Visa</b></td> <td><customBlueItalic>Type:</customBlueItalic> {0}</td></tr>", visa.VisaType); builder.AppendFormat("<tr><td><customBlueItalic>Dates:</customBlueItalic> {0} - {1}</td></tr>", visa.StartDate.Date.ToShortDateString(), visa.DueDate.Date.ToShortDateString()); builder.AppendFormat("<tr><td><customBlueItalic>Entries: </customBlueItalic> {0}, <customBlueItalic>Days:</customBlueItalic> {1}</td></tr> <br />", entriesToDisplay, daysToDisplay); } builder.Append(" <tr> <td><br/></td> </tr>"); return(new MvcHtmlString(builder.ToString())); }
/// <summary> /// get report from a file by input file name /// </summary> /// <param name="inputFile"> file name </param> /// <returns>report feeReport</returns> public Visa GetReport(string inputFile) { visaReport = new Visa(); var watch = Stopwatch.StartNew(); visaReport.LoadFile(inputFile); const Int32 BufferSize = 128; var fileStream = File.OpenRead(inputFile); streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize); String line; List <string> ltsString = new List <string>(); int rowNumber = 0; while ((line = streamReader.ReadLine()) != null) { rowNumber++; if (streamReader.EndOfStream) { visaReport.FileRow = rowNumber; } ReadLine(line, rowNumber); } // the code that you want to measure comes here fileStream.Close(); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; visaReport.TimeProcess = elapsedMs.ToString(); return(visaReport); }
public ActionResult Edit(Visa visa, string searchString = "") { ViewBag.JSDatePattern = MvcApplication.JSDatePattern; ViewBag.SearchString = searchString; if (ModelState.IsValid) { try { repository.SaveVisa(visa, visa.EmployeeID); } catch (DbUpdateConcurrencyException) { return(Json(new { error = ModelError })); } List <Employee> empList = SearchVisaData(repository.Employees.ToList(), searchString); return(View("TableViewVisasAndPermitsBTM", empList)); } VisaViewModel visaModel = new VisaViewModel(visa); ViewBag.SearchString = searchString; return(View(visaModel)); }
public Visa UpdateVisa(Visa entity, Visa toUpd) { var visa = _visaDbAccess.Update(entity, toUpd); _context.Commit(); return(visa); }
public void TestCaseThree() { MasterCard person1MasterCard1 = new MasterCard(100m); MasterCard person1MasterCard2 = new MasterCard(100m); WalletType person1Wallet = new WalletType(); person1Wallet.AddCard(person1MasterCard1) .AddCard(person1MasterCard2); WalletPerson person1 = new WalletPerson(); person1.AddWallet(person1Wallet); MasterCard person2MasterCard = new MasterCard(100m); Visa person2Visa = new Visa(100m); WalletType person2Wallet = new WalletType(); person2Wallet.AddCard(person2MasterCard) .AddCard(person2Visa); WalletPerson person2 = new WalletPerson(); person2.AddWallet(person2Wallet); Assert.Equal(10m, person1.CalculateTotalInterest()); Assert.Equal(10m, person1Wallet.CalculateTotalInterest()); Assert.Equal(15m, person2.CalculateTotalInterest()); Assert.Equal(15m, person2Wallet.CalculateTotalInterest()); }
public String Add(TradeExamineViewPage1 VisaAdd) { Visa VisaInfo = new Visa(); var CompanyInfo = db.UsersInfo.Where(a => a.CompanyID == VisaAdd.CompanyID).FirstOrDefault(); var VisaInfo1 = db.Visa.ToList(); var VisaInfo2 = VisaInfo1.Where(s => s.CompanyName == (CompanyInfo.CompanyName)).ToList(); if (VisaInfo2.Count > 0) { return("该签证已受理"); } else { var TradeExamine = db.TradeExamine.Where(a => a.TradeExamineID == VisaAdd.TradeExamineID).ToList(); TradeExamine TradeExamineInfo = db.TradeExamine.Find(VisaAdd.TradeExamineID);//寻找当前id的数据 TradeExamineInfo.TradeExamineState = TradeExamineState1.Finish; VisaInfo.VisaID = DateTime.Now.ToString("yyyyMMddHHmmss"); VisaInfo.CompanyID = VisaAdd.CompanyID; VisaInfo.CompanyName = CompanyInfo.CompanyName; VisaInfo.VisaName = "高职校"; VisaInfo.VisaType = "中国 "; VisaInfo.VisaState = VisaState1.Reviewing; VisaInfo.VisaTime = DateTime.Now; db.Visa.Add(VisaInfo); db.SaveChanges(); } return("签证受理成功"); }
protected void SaveContactsVisa() { OMMDataContext context = new OMMDataContext(); Visa entity = null; if (_IsEditMode) { entity = context.Visas.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID); } else { entity = new Visa(); entity.ContactID = _ContactID; context.Visas.InsertOnSubmit(entity); } //ddlContactID.SelectedValue.ToInt(); if (!ddlCountry.SelectedValue.IsNullOrEmpty()) { entity.CountryID = ddlCountry.SelectedValue.ToInt(); //Convert.ToInt32(ddlCountry.SelectedValue); } //entity.CountryID = Convert.ToInt32(tbxCountry.Text); entity.VisaType = tbxVisaType.Text; if (!tbxVisaExpDate.Text.IsNullOrEmpty()) //if (tbxExpiryDate.Text.Trim() != "") { entity.ExpiryDate = tbxVisaExpDate.Text.ToDateTime(ConfigReader.CSharpCalendarDateFormat); //Convert.ToDateTime(tbxExpiryDate.Text.Trim()); } entity.ChangedByUserID = SessionCache.CurrentUser.ID; entity.ChangedOn = DateTime.Now; //entity = entity.ChangedByUsername = SessionCache.CurrentUser.UserName; context.SubmitChanges(); RedirectToShowSuccessMessage(); }
public void TestCase1() { var visa = new Visa(100); var mc = new MasterCard(100); var discover = new Discover(100); _wallet.Cards.Add(visa); _wallet.Cards.Add(mc); _wallet.Cards.Add(discover); _person.Wallets.Add(_wallet); var correctVisaInterest = _visaInterest * 100; var correctMcInterest = _masterCardInterest * 100; var correctDiscoverInterest = _discoverInterest * 100; var correctTotalInterest = correctVisaInterest + correctMcInterest + correctDiscoverInterest; var actualVisaInterest = _calculator.CalculateInterestForCard(visa); var actualMcInterest = _calculator.CalculateInterestForCard(mc); var actualDiscoverInterest = _calculator.CalculateInterestForCard(discover); var actualTotalInterest = _calculator.CalculateInterestForPerson(_person); Assert.AreEqual(correctVisaInterest, actualVisaInterest); Assert.AreEqual(correctMcInterest, actualMcInterest); Assert.AreEqual(correctDiscoverInterest, actualDiscoverInterest); Assert.AreEqual(correctTotalInterest, actualTotalInterest); }
public ScpiIOResult Open(string visaAddress, bool exclusiveLock) { if (instrument != Visa.VI_NULL) { throw new Exception("IO is already open"); } var res2 = Visa.viOpenDefaultRM(out rm); if (res2 < 0) { return(MakeError(res2)); } var res = Visa.viOpen(ScpiInstrument.GetResourceManager(), visaAddress, exclusiveLock ? Visa.VI_EXCLUSIVE_LOCK : Visa.VI_NO_LOCK, IOTimeoutMS, out instrument); // Use sensible defaults sendEnd = true; useTermChar = false; if (res >= 0) { SyncSettings(); } else { instrument = Visa.VI_NULL; } return(MakeError(res)); }
public void LoadVisas() { Worksheet sheet = workBook.Worksheets[1]; int rowIndex = 19; int colIndex = 1; visas.Clear(); while (sheet.Cells.GetRow(rowIndex).GetCell(colIndex).StringValue != "") { if (sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 25).StringValue.Trim() != "" && sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 26).StringValue != "" && sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 27).StringValue != "") { Visa visa = new Visa(); visa.VisaType = sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 25).StringValue.Trim(); visa.StartDate = DateTime.FromOADate(Int32.Parse(sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 26).StringValue)); visa.DueDate = DateTime.FromOADate(Int32.Parse(sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 27).StringValue)); if (sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 28).StringValue.Trim() != "") { visa.Days = Int32.Parse(sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 28).StringValue.Trim()); } visa.Entries = 0; visa.VisaOf = new Employee { EID = sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 1).StringValue.Trim(), LastName = sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 2).StringValue.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Trim(), FirstName = sheet.Cells.GetRow(rowIndex).GetCell(colIndex + 2).StringValue.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1].Trim() }; visas.Add(visa); } rowIndex++; } }
private void SyncSettings() { Visa.viSetAttribute(instrument, Visa.VI_ATTR_SEND_END_EN, (byte)(sendEnd ? 1 : 0)); Visa.viSetAttribute(instrument, Visa.VI_ATTR_TMO_VALUE, ioTimeout); Visa.viSetAttribute(instrument, Visa.VI_ATTR_TERMCHAR, termChar); Visa.viSetAttribute(instrument, Visa.VI_ATTR_TERMCHAR_EN, (byte)(useTermChar ? 1 : 0)); }
public ActionResult Create(PrivateTrip PTrip, string searchString = "") { ViewBag.JSDatePattern = MvcApplication.JSDatePattern; ViewBag.SearchString = searchString; PrivateTrip privateTrip = PTrip; if (ModelState.IsValid) { Visa visa = repository.Visas.Where(v => v.EmployeeID == privateTrip.EmployeeID).FirstOrDefault(); if (visa != null) { visa.DaysUsedInPrivateTrips += CountingDaysUsedInPT(privateTrip); visa.EntriesUsedInPrivateTrips++; repository.SaveVisa(visa, visa.EmployeeID); } repository.SavePrivateTrip(privateTrip); //return RedirectToAction("BTMView", "Home", new { tab = 2, searchString = searchString }); List <Employee> emplist = SearchPrivateTripData(repository.Employees.ToList(), searchString); return(View("TableViewPTBTM", emplist)); } PrivateTripViewModel pTripModel = new PrivateTripViewModel(privateTrip); return(View(pTripModel)); }
public void CheckInterestOnePersonThreeCards(double balance) { // 1 person has 1 wallet and 3 cards(1 Visa, 1 MC 1 Discover) – Each Card has a balance of $100 – // calculate the total interest(simple interest) for this person and per card. var InterestCalcService = CreateDefaultInterestCalcService(); Visa cardVisa = new Visa(balance); MC cardMC = new MC(balance); Discover cardDiscover = new Discover(balance); List <CreditCard> Cards = new List <CreditCard> { cardVisa, cardMC, cardDiscover }; Wallet wallet = new Wallet(Cards); List <Wallet> Wallets = new List <Wallet> { wallet }; Person person = new Person(Wallets); double interestVisa = InterestCalcService.CalcInterestByCard(cardVisa); double interestMC = InterestCalcService.CalcInterestByCard(cardMC); double interestDiscover = InterestCalcService.CalcInterestByCard(cardDiscover); double totalInterestPerson = InterestCalcService.CalcInterestByPerson(person); Assert.True(interestVisa == 10, $"{interestVisa} should be 10"); Assert.True(interestMC == 5, $"{interestMC} should be 5"); Assert.True(interestDiscover == 1, $"{interestDiscover} should be 1"); Assert.True(totalInterestPerson == 16, $"{totalInterestPerson} should be 16"); }
public void TestCase1() { //Arrange decimal bal = 100m; var visa = new Visa(bal); var mc = new MasterCard(bal); var disc = new Discover(bal); Wallet homersWallet = new Wallet(); homersWallet.AddCard(visa); homersWallet.AddCard(mc); homersWallet.AddCard(disc); Person homer = new Person("Homer J Simpson", new List <Wallet>() { homersWallet }); //Act decimal interestHomer = InterestCalculator.CalculatePersonSimpleInterest(homer); decimal interestVisa = InterestCalculator.CalculateSimpleInterest(visa.CurrentBalance, visa.InterestRate); decimal interestMasterCard = InterestCalculator.CalculateSimpleInterest(mc.CurrentBalance, mc.InterestRate); decimal interestDiscover = InterestCalculator.CalculateSimpleInterest(disc.CurrentBalance, disc.InterestRate); //Assert Assert.Equal(16m, interestHomer); //Total simple interest for the person Assert.Equal(10m, interestVisa); //Simple interest per card Assert.Equal(5m, interestMasterCard); Assert.Equal(1m, interestDiscover); Assert.Equal(interestHomer, interestVisa + interestMasterCard + interestDiscover); //Total should equal the sum of all cards }
// DELETE: api/Visa/5 public IHttpActionResult Delete(int id) { Visa result = visaList.Where(p => p.ID == id).FirstOrDefault(); var resultflag = visaList.Remove(result); return(Ok(resultflag)); }
public ActionResult Details(string urlParam) { if (urlParam == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Regex isGuid = new Regex(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled); if (isGuid.IsMatch(urlParam)) { return(RedirectPermanent("/visa")); } Visa visa = db.Visas.FirstOrDefault(current => current.UrlParam == urlParam); List <VisaTour> visaTours = db.VisaTours.Where(current => current.VisaId == visa.Id).Include(c => c.Tour).Include(c => c.Tour.TourCategory).ToList(); List <Tour> tours = new List <Tour>(); foreach (VisaTour visaTour in visaTours) { tours.Add(visaTour.Tour); } VisaDetailViewModel visaDetail = new VisaDetailViewModel() { Visa = visa, VisaDetails = db.VisaDetails.Where(current => current.VisaId == visa.Id && current.IsDelete == false) .OrderBy(current => current.Order).ToList(), Menu = menu.ReturnMenuTours(), MenuBlogGroups = menu.ReturnBlogGroups(), Footer = menu.ReturnFooter(), SuggestedTours = tours }; if (!string.IsNullOrEmpty(visa.PageTitle)) { ViewBag.Title = visa.PageTitle; } else { ViewBag.Title = visa.Title + " | اخذ ویزا تضمینی توسط بکتاش سیر"; } if (!string.IsNullOrEmpty(visa.PageDescription)) { ViewBag.Description = visa.PageDescription; } else { ViewBag.Description = "راهنمای جامع اخذ " + visa.Title + " به صورت تضمینی. اطلاعات جامع اخذ ویزا تمامی کشورها و ویزا شینگن را در وب سایت بکتاش سیر گشت مطالعه نمایید."; } ViewBag.Canonical = "https://www.bektashtravel.com/visa/" + visa.UrlParam; return(View(visaDetail)); }
static void Main(string[] args) { Welcome.WelcomeToAirport(); string name = Console.ReadLine(); string firstNames, lastName; SplitFullName.SplitName(name, out firstNames, out lastName); Console.WriteLine($"{firstNames}, welcome to check-in desk. Please answer for a few questions."); Console.WriteLine($"First of all, please input your date of birthday (yyyy,mm,d): "); Passport passport = new Passport(); passport.DateOfBirth = CheckType.GetDateFromConsole(); CheckDB.CheckDateOfBirth(passport); Console.WriteLine($"Are you have a visa, {firstNames}? (yes or no)"); Visa visa = new Visa(); visa.Status = CheckVisa.CheckOfVisa(); Console.WriteLine($"{firstNames}, please input your passport number: "); passport.Number = Console.ReadLine(); Console.WriteLine($"{firstNames}, now please input passport issued (yyyy,mm,d): "); passport.Issued = CheckType.GetDateFromConsole(); Console.WriteLine($"{firstNames}, now please input passport expired (yyyy,mm,d): "); passport.Expired = CheckType.GetDateFromConsole(); CheckPassport.CheckDatesOfPassport(passport); Console.WriteLine($"Are you have a online registration, {firstNames}? (yes or no)"); Ticket ticket = new Ticket(); ticket.NumberOfTicket = CheckTicket.CheckOnlineRegistration(ticket); Console.WriteLine($"\nDo you have any luggage, {firstNames}? (yes or no)"); Bag bag = new Bag(); CheckBag.CheckWeightOfBag(bag); Console.WriteLine($"{firstNames}, allright! Please go to security check. (any key)"); Console.ReadKey(); Console.WriteLine($"{firstNames}, welcome to security check. Open your case for examination, please." + $"\nDo you have anything forbidden in your suitcase: drugs, guns, explosive materials? (yes or no)"); SecurityEmployee security = new SecurityEmployee(); security.ForbiddenItem = SecurityCheck.CheckForbiddenItem(security); Console.WriteLine($"{firstNames}, welcome to passport control. May I see your passport and ticket, please? (yes or no)"); Passanger passanger = new Passanger(name, passport, ticket, visa, bag); PassportControlEmployee passportControlEmployee = new PassportControlEmployee(); passportControlEmployee.Passanger = PassportControl.CheckPassanger(passanger); }
/// <summary> /// Binds ContactsNotes Info Requested through Query Strings /// </summary> protected void BindContactsPassportInfo() { if (_OnTable == "PASSPORT") { OMMDataContext context = new OMMDataContext(); //if (context.Passports.FirstOrDefault(P => P.ContactID == _ContactID) == null) // ShowNotFoundMessage(); //else //{ if (_IsEditMode) { Passport entity = context.Passports.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID); if (entity == null) { ShowNotFoundMessage(); } else { tbxNumber.Text = entity.Number; tbxWhereIssued.Text = entity.WhereIssued; //tbxExpiryDate.Text = (entity.ExpiryDate.IsNotNull()) ? entity.ExpiryDate.ToString() : ""; tbxExpiryDate.Text = entity.ExpiryDate.HasValue ? entity.ExpiryDate.GetValueOrDefault().ToString(ConfigReader.CSharpCalendarDateFormat) : String.Empty; tbxNationality.Text = entity.Nationality; } } //} } ///Load VISA Information if (_OnTable == "VISA") { OMMDataContext context = new OMMDataContext(); //if (context.Visas.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID) == null) // ShowNotFoundMessage(); //else //{ if (_IsEditMode) { Visa entity = context.Visas.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID); if (entity == null) { ShowNotFoundMessage(); } else { //tbxCountry.Text = entity.CountryID.ToString(); ddlCountry.SetSelectedItem(entity.CountryID.ToString()); tbxVisaType.Text = entity.VisaType; //tbxVisaExpDate.Text = (entity.ExpiryDate.IsNotNull()) ? entity.ExpiryDate.ToString() : ""; tbxVisaExpDate.Text = entity.ExpiryDate.HasValue ? entity.ExpiryDate.GetValueOrDefault().ToString(ConfigReader.CSharpCalendarDateFormat) : String.Empty; } } //} } }
public String CheckPass(string id) { var VisaInfo = db.Visa.Where(a => a.VisaID == id).ToList(); Visa VisaInfo1 = db.Visa.Find(id);//寻找当前id的数据 VisaInfo1.VisaState = VisaState1.Reviewed; db.SaveChanges(); return("已审核"); }
public void TestAddFunction() { Visa newVisa = new Visa(); this.visaRepoMock.Setup(repo => repo.Create(newVisa)).Callback(() => this.visaList.Add(newVisa)); this.visaLogic.AddVisa(newVisa); Assert.That(this.visaLogic.GetAllVisas().Count, Is.EqualTo(5)); this.visaRepoMock.Verify(r => r.Create(newVisa), Times.Once); }
protected override void Initialize() { // Instantiate constituents _amazon = new Amazon(this); _customer = new Customer(this); _dell = new BarnesAndNoble(this); _ups = new UPS(this); _upsDriver = new UPSDriver(this); _visa = new Visa(this); }
public ActionResult DeleteConfirmed(Guid id) { Visa visa = db.Visas.Find(id); visa.IsDelete = true; visa.DeleteDate = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); }
// PUT: api/Visa/5 public IHttpActionResult Put(int id, Visa value) { Visa result = visaList.Where(p => p.ID == id).FirstOrDefault(); result.Number = value.Number; result.ExpDate = new DateTime(2020, 12, 12); result.Comments = value.Comments; result.Type = value.Type; return(Ok(result)); }
public static bool CheckVisaToBeValid(this HtmlHelper helper, Visa visa) { if (visa != null && visa.StartDate <= DateTime.Now.ToLocalTimeAzure().Date && visa.DueDate >= DateTime.Now.ToLocalTimeAzure().Date) { return(true); } return(false); }
public VisaManageViewPage VisaDetail(string id) { Visa VisaInfo = db.Visa.Find(id);//寻找当前id的数据 VisaManageViewPage VisaDetail = new VisaManageViewPage(); VisaDetail.CompanyName = VisaInfo.CompanyName; VisaDetail.VisaName = VisaInfo.VisaName; VisaDetail.VisaState = VisaInfo.VisaState; VisaDetail.VisaTime = VisaInfo.VisaTime; return(VisaDetail); }
public Visa DeleteVisa(int employeeID) { Visa dbEntry = Visas.Where(v => v.EmployeeID == employeeID).SingleOrDefault(); if (dbEntry != null) { dbEntry.VisaOf.Visa = null; visas.Remove(dbEntry); } return(dbEntry); }
public IActionResult Visa(Visa visa) { if (!ModelState.IsValid) { return(View()); } _db.VisaTypes.Add(visa); _db.SaveChanges(); return(View()); }
public void RetrieveInterestForWallets_OnePersonOneWalletThreeCards_ReturnsInterest() { ICreditCard masterCard = new MasterCard(100); ICreditCard discoverCard = new Discover(100); ICreditCard visaCard = new Visa(100); IWallet wallet = new Wallet(discoverCard, masterCard, visaCard); IPerson person = new Person(wallet); decimal totalInterestForPerson = person.RetrieveInterestForPerson(); Assert.Equal(16, totalInterestForPerson); }
public void OnPreLoad() { sDefaultBarTuned = false; foreach (BookComicData bookData in BookData.BookComicDataList.Values) { bookData.AllowedWorldTypes.Add(WorldType.Vacation); } foreach (Opportunity opp in OpportunityManager.sLocationBasedOpportunityList.Values) { if (opp.SharedData.mTargetWorldRequired == WorldName.SunsetValley) { opp.SharedData.mTargetWorldRequired = WorldName.Undefined; } } if (ServiceNPCSpecifications.sServiceSpecifications != null) { foreach (ServiceType type in Enum.GetValues(typeof(ServiceType))) { ServiceNPCSpecifications.ServiceSpecifications spec; if (ServiceNPCSpecifications.sServiceSpecifications.TryGetValue(type.ToString(), out spec)) { spec.InvalidWorlds.Clear(); } } } foreach (List<MotiveTuning> tempTuning in MotiveTuning.sTuning.Values) { foreach (MotiveTuning tuning in tempTuning) { tuning.WorldRestrictionType = WorldRestrictionType.None; } } Bartending.BarData defaultData; if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData)) { sDefaultBarTuned = (defaultData.mFoods.Count > 0); } // Unlock all subTypes for all worlds foreach (Lot.CommercialSubTypeData commData in Lot.sCommnunityTypeData) { commData.WorldAllowed = null; commData.WorldTypeAllowed = null; } // Unlock all subTypes for all worlds foreach (Lot.ResidentialSubTypeData residentData in Lot.sResidentialTypeData) { residentData.WorldAllowed = null; residentData.WorldTypeAllowed = null; } foreach (ActionData action in ActionData.sData.Values) { if (action.mAllowedWorldTypes != null) { List<WorldType> types = new List<WorldType>(action.mAllowedWorldTypes); if(types.Count > 0) { if ((!types.Contains(WorldType.Vacation))) { types.Add(WorldType.Vacation); } if ((!types.Contains(WorldType.Future))) { types.Add(WorldType.Future); } action.mAllowedWorldTypes = types.ToArray(); } } } STCData.SetNumSocialsDuringConversation(int.MaxValue); foreach (InsectData insect in InsectData.sData.Values) { if (insect.RequiredWorld != WorldName.Undefined) { insect.mRequiredWorld = WorldName.Undefined; BooterLogger.AddTrace(" Unlocked: " + insect.Name); } } foreach (RockGemMetalData rock in RockGemMetalBase.sData.Values) { if (rock.RequiredWorld != WorldName.Undefined) { rock.mRequiredWorld = WorldName.Undefined; BooterLogger.AddTrace(" Unlocked: " + rock.Name); } } List<KeyValuePair<WorldName, WorldNameData>> data = new List<KeyValuePair<WorldName, WorldNameData>>(); if (GameUtils.IsInstalled(ProductVersion.EP1)) { data.Add(new KeyValuePair<WorldName, WorldNameData>(WorldName.China, new WorldNameData("China.world", "China_0x0859db4c", TravelUtil.DestinationInfoImage[0], TravelUtil.DestinationInfoName[0], TravelUtil.DestinationInfoDescription[0], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[0], 0x0)), TravelUtil.DestinationInfoComfirmDescription[0]))); data.Add(new KeyValuePair<WorldName, WorldNameData>(WorldName.Egypt, new WorldNameData("Egypt.world", "Egypt_0x0859db48", TravelUtil.DestinationInfoImage[1], TravelUtil.DestinationInfoName[1], TravelUtil.DestinationInfoDescription[1], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[1], 0x0)), TravelUtil.DestinationInfoComfirmDescription[1]))); data.Add(new KeyValuePair<WorldName, WorldNameData>(WorldName.France, new WorldNameData("France.world", "France_0x0859db50", TravelUtil.DestinationInfoImage[2], TravelUtil.DestinationInfoName[2], TravelUtil.DestinationInfoDescription[2], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[2], 0x0)), TravelUtil.DestinationInfoComfirmDescription[2]))); } List<WorldFileMetadata> worlds = new List<WorldFileMetadata>(); WorldFileSearch search = new WorldFileSearch(0x0); foreach (string str in search) { WorldFileMetadata info = new WorldFileMetadata(); info.mWorldFile = str; if (GetWorldFileDetails(ref info)) { worlds.Add(info); } } worlds.Sort(OnSort); foreach(WorldFileMetadata info in worlds) { string name = info.mWorldFile.Replace(".world", ""); WorldName worldName = WorldName.Undefined; try { worldName = unchecked((WorldName)ResourceUtils.HashString32(name.Replace(" ", ""))); } catch { continue; } string saveFile = name; switch (name.ToLower()) { case "islaparadiso": if (!GameUtils.IsInstalled(ProductVersion.EP10)) continue; worldName = WorldName.IslaParadiso; saveFile += "_0x0c50c382"; break; case "sims university": if (!GameUtils.IsInstalled(ProductVersion.EP9)) continue; worldName = WorldName.University; saveFile += "_0x0e41c954"; break; case "bridgeport": if (!GameUtils.IsInstalled(ProductVersion.EP3)) continue; worldName = WorldName.NewDowntownWorld; saveFile += "_0x09ffe3d7"; break; case "twinbrook": if (!GameUtils.IsInstalled(ProductVersion.EP2)) continue; worldName = WorldName.TwinBrook; saveFile += "_0x09b610fa"; break; case "appaloosaplains": if (!GameUtils.IsInstalled(ProductVersion.EP5)) continue; worldName = WorldName.AppaloosaPlains; saveFile += "_0x0c50c56d"; break; case "riverview": worldName = WorldName.RiverView; saveFile += "_0x0859db43"; break; case "sunset valley": worldName = WorldName.SunsetValley; saveFile += "_0x0859db3c"; break; case "moonlight falls": worldName = WorldName.MoonlightFalls; saveFile += "_0x09b61110"; break; case "starlight shores": if (!GameUtils.IsInstalled(ProductVersion.EP6)) continue; worldName = WorldName.StarlightShores; saveFile += "_0x09b610ff"; break; case "hidden springs": case "barnacle bay": case "lunar lakes": case "lucky palms": saveFile += "_0x08866eb8"; break; case "roaring heights": worldName = WorldName.DOT11; saveFile += "_0x0de07e86"; break; case "midnight hollow": worldName = WorldName.DOT10; saveFile += "_0x0de07e7d"; break; case "dragon valley": worldName = WorldName.DOT09; saveFile += "_0x0de07c9c"; break; case "aurora skies": worldName = WorldName.DOT08; saveFile += "_0x0de07c8b"; break; case "monte vista": worldName = WorldName.DOT07; saveFile += "_0x0de07c83"; break; case "sunlit tides": worldName = WorldName.DOT06; saveFile += "_0x0de07c78"; break; case "oasis landing": worldName = WorldName.FutureWorld; saveFile += "_0x0f36012a"; break; case "egypt": case "china": case "france": continue; default: saveFile = FileNameBooter.GetFileName(saveFile); break; } string infoIcon = "glb_i_suburb"; switch (info.mWorldType) { case WorldType.Downtown: infoIcon = "glb_i_downtown"; break; case WorldType.Vacation: infoIcon = "glb_i_vacation"; break; default: break; } if (info.mWorldType == WorldType.Future) { if (!TimePortal.sTimeTravelerHasBeenSummoned) { continue; } } if (!VisaManager.sDictionary.ContainsKey((ulong)worldName)) { Visa defaultVisa = new Visa(); defaultVisa.mWorldName = worldName; defaultVisa.mNonPersistableData = new NonPersistableVisaData(); defaultVisa.NonPersistableData.LevelUpStrings = new string[3] { "", "", "" }; defaultVisa.NonPersistableData.PointsForNextLevel = new int[3] { 0, 0, 0 }; Visa chinaVisa = VisaManager.GetStaticVisaData(WorldName.China); if (chinaVisa != null) { defaultVisa.NonPersistableData.LevelUpStrings = new List<string>(chinaVisa.NonPersistableData.LevelUpStrings).ToArray(); defaultVisa.NonPersistableData.PointsForNextLevel = new List<int>(chinaVisa.NonPersistableData.PointsForNextLevel).ToArray(); } VisaManager.sDictionary.Add((ulong)worldName, defaultVisa); data.Add(new KeyValuePair<WorldName, WorldNameData>(worldName, new WorldNameData(info.mWorldFile, saveFile, infoIcon, info.mCaption, info.mDescription, info.mWorldThumb, Common.Localize("Itinerary:Name", false, new object[] { info.mCaption })))); } } TravelUtil.kVacationWorldNames = new WorldName[data.Count]; TravelUtil.DestinationInfoImage = new string[data.Count]; TravelUtil.DestinationInfoName = new string[data.Count]; TravelUtil.DestinationInfoDescription = new string[data.Count]; TravelUtil.DestinationInfoConfirmImage = new string[data.Count]; TravelUtil.DestinationInfoComfirmDescription = new string[data.Count]; TravelUtil.DestinationInfoIndex = new int[data.Count]; int index = 0; foreach (KeyValuePair<WorldName, WorldNameData> value in data) { TravelUtil.kVacationWorldNames[index] = value.Key; TravelUtil.DestinationInfoIndex[index] = index; TravelUtil.DestinationInfoImage[index] = value.Value.mDestinationInfoImage; TravelUtil.DestinationInfoName[index] = value.Value.mDestinationInfoName; TravelUtil.DestinationInfoDescription[index] = value.Value.mDestinationInfoDescription; TravelUtil.DestinationInfoConfirmImage[index] = ""; TravelUtil.DestinationInfoComfirmDescription[index] = value.Value.mDestinationInfoConfirmDescription; sConfirmImages.Add(value.Value.mDestinationInfoConfirmImage); BooterLogger.AddTrace(value.Value.ToString()); BooterLogger.AddTrace(" WorldName: " + (ulong)value.Key); index++; sData.Add(value.Key, value.Value); } //BooterLogger.AddError("WorldData"); sOrigWorldNameToType = GameUtils.WorldNameToType; foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values) { switch (tuning.Availability.WorldRestrictionType) { case WorldRestrictionType.Allow: if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) { tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Vacation); BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName); } else if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) { tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Downtown); BooterLogger.AddTrace("Tuning Altered: Allowed (C) " + tuning.FullInteractionName + " : " + tuning.FullObjectName); } break; case WorldRestrictionType.Disallow: if ((tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) || (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) || (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University)) || (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Future))) { tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Vacation); tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Downtown); tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.University); tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Future); BooterLogger.AddTrace("Tuning Altered: Allowed (B) " + tuning.FullInteractionName + " : " + tuning.FullObjectName); } break; } } }
public ActionResult visa(int id) { UserProfile temp = Service.Service.findUser(id); Visa v = new Visa(); v.UserProfile1 = temp; return View(v); }
public static Visa visaInfo(UserProfile temp, String Visa) { Visa v = new Visa(); v.UserProfile1 = temp; v.visainfo = Visa; DB.Visas.Add(v); DB.SaveChanges(); return v; }