private Switch GenerateSwitch(AgencyType type) { var Switch = new Switch { IsToggled = TrackingManager.IsAgencyBeingTracked(type), Margin = new Thickness(0, 0, 0, 10) }; Switch.Toggled += (sender, args) => { if (sender.GetType() != typeof(Switch)) return; if (((Switch)sender).IsToggled) { TrackingManager.AddTrackedAgency(type); } else { TrackingManager.RemoveTrackedAgency(type); } }; return Switch; }
public async Task <IActionResult> Edit(int id, [Bind("AgencyTypeId,AgencyType1")] AgencyType agencyType) { if (id != agencyType.AgencyTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(agencyType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgencyTypeExists(agencyType.AgencyTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(agencyType)); }
/// <summary> /// Constructor /// </summary> /// <param name="ID">id</param> /// <param name="name">name</param> /// <param name="contactPerson">contact person</param> /// <param name="type">AgencyType</param> public Tour_Agency(uint ID, string name, string contactPerson, AgencyType type = AgencyType.national) { AgencyID = ID; Name = name; ContactPerson = contactPerson; Type = type; }
//Constructor public Tour_Agency(uint ID, string name, string contactPerson, AgencyType type = AgencyType.national) { this.agencyID = ID; this.name = name; this.contactPerson = contactPerson; this.type = type; }
public override int GetHashCode() { int hash = 1; if (ItemId.Length != 0) { hash ^= ItemId.GetHashCode(); } if (ProCode.Length != 0) { hash ^= ProCode.GetHashCode(); } if (Agency != 0) { hash ^= Agency.GetHashCode(); } if (AgencyType.Length != 0) { hash ^= AgencyType.GetHashCode(); } if (BdgYear != 0) { hash ^= BdgYear.GetHashCode(); } if (AdmdivCode.Length != 0) { hash ^= AdmdivCode.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public ActionResult DeleteConfirmed(int id) { AgencyType agencytype = db.AgencyTypes.Find(id); db.AgencyTypes.Remove(agencytype); db.SaveChanges(); return(RedirectToAction("Index")); }
private Agency BuildAgency(AgencyType agencyType, string legalName, string displayName = null) { Agency agency = new AgencyBuilder().WithAgencyProfile( new AgencyProfileBuilder().WithAgencyType(agencyType).WithAgencyName( new AgencyNameBuilder().WithLegalName(legalName).WithDisplayName(displayName))); Session.SaveOrUpdate(agency); return(agency); }
public ActionResult Edit(AgencyType agencytype) { if (ModelState.IsValid) { db.Entry(agencytype).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(agencytype)); }
public static async void AddTrackedAgency(AgencyType agencyType) { var agency = _trackedLaunches.TrackedAgencies.FirstOrDefault(x => x.AgencyType == agencyType); if (agency?.CacheTimeOut > DateTime.Now) return; var agencyToTrack = await CacheManager.TryGetAgencyByType(agencyType); _trackedLaunches.TrackedAgencies.Add(agencyToTrack); }
public async Task <IActionResult> Create([Bind("AgencyTypeId,AgencyType1")] AgencyType agencyType) { if (ModelState.IsValid) { _context.Add(agencyType); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(agencyType)); }
public bool SaveAgencyType(AgencyTypeVM model) { var agencyType = new AgencyType() { Description = model.Description }; _context.AgencyTypes.Add(agencyType); _context.SaveChanges(); return(true); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { int result = AgencyType != null?AgencyType.GetHashCode() : 0; result = (result * 397) ^ (AgencyName != null ? AgencyName.GetHashCode() : 0); result = (result * 397) ^ (EffectiveDateRange != null ? EffectiveDateRange.GetHashCode() : 0); result = (result * 397) ^ (WebsiteUrlName != null ? WebsiteUrlName.GetHashCode() : 0); result = (result * 397) ^ (GeographicalRegion != null ? GeographicalRegion.GetHashCode() : 0); result = (result * 397) ^ (Note != null ? Note.GetHashCode() : 0); return(result); } }
public ActionResult Create(AgencyType agencytype, HttpPostedFileBase file) { if (ModelState.IsValid) { if (file != null) { string pic = System.IO.Path.GetFileName(file.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/Uploads"), pic); file.SaveAs(path); agencytype.Image = file.FileName; } db.AgencyTypes.Add(agencytype); db.SaveChanges(); return(RedirectToAction("Success")); } return(View(agencytype)); }
/// <summary> /// Initializes a new instance of the <see cref="AgencyProfile"/> class. /// </summary> /// <param name="agencyType">Type of the agency.</param> /// <param name="agencyName">Name of the agency.</param> /// <param name="effectiveDateRange">The effective date range.</param> /// <param name="websiteUrlName">Name of the website URL.</param> /// <param name="geographicalRegion">The geographical region.</param> /// <param name="note">The note.</param> public AgencyProfile( AgencyType agencyType, AgencyName agencyName, DateRange effectiveDateRange, string websiteUrlName, GeographicalRegion geographicalRegion, string note) { Check.IsNotNull(agencyType, () => AgencyType); Check.IsNotNull(agencyName, () => AgencyName); AgencyType = agencyType; AgencyName = agencyName; EffectiveDateRange = effectiveDateRange; WebsiteUrlName = websiteUrlName; GeographicalRegion = geographicalRegion; Note = note; }
public async Task ShouldFindUsersByRoleNameAndAgencyCodeNotAssignedToCommitteeAssignAsyncSuccess(string roleName, string agencyCode, int committeeId, AgencyType agencyType) { _moqIdmProxy.Setup(i => i.GetMonafasatUsersByAgencyType(It.IsAny <UsersSearchCriteriaModel>())) .Returns(() => { return(Task.FromResult <QueryResult <EmployeeIntegrationModel> >(new BranchDefaults().GetEmployeeIntegrationModel())); }); _moqIDMQueries.Setup(i => i.FindUsersByRoleNameAndAgencyCodeAssignedToCommitteeIdAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>())) .Returns(() => { return(Task.FromResult <List <int> >(new List <int>() { 1 })); }); var result = await _sut.FindUsersByRoleNameAndAgencyCodeNotAssignedToCommitteeAssignAsync(roleName, agencyCode, committeeId, agencyType); Assert.NotNull(result); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// public AgencyCore(AgencyType bean, IAgencyScheme parent) { }
public static async Task<TrackedAgency> TryGetAgencyByType(AgencyType agencyType) { var trackedAgency = TrackedAgencies.FirstOrDefault(x => x.AgencyType == agencyType); if (trackedAgency?.CacheTimeOut > DateTime.Now) return trackedAgency; var agencyLaunches = await ApiManager.TryGetLaunchesBasedOnAgency(agencyType.ToAbbreviationString()); var scheduledLaunches = new List<LaunchData>(); var planedLaunches = new List<LaunchData>(); foreach (var agencyLaunch in agencyLaunches) { var launchData = new LaunchData { Launch = agencyLaunch }; switch (LaunchStatusEnum.GetLaunchStatusById(launchData.Launch.Status)) { case LaunchStatus.Go: scheduledLaunches.Add(launchData); continue; case LaunchStatus.Hold: planedLaunches.Add(launchData); continue; case LaunchStatus.Unknown: if (launchData.Launch.Net > DateTime.Now.AddDays(-7) && launchData.Launch.Net.TimeOfDay.Ticks != 0) { scheduledLaunches.Add(launchData); } else { planedLaunches.Add(launchData); } continue; default: continue; } } var newTrackedAgency = new TrackedAgency { AgencyType = agencyType, ScheduledLaunchData = scheduledLaunches.OrderBy(x => x.Launch.Net).ToList(), PlanedLaunchData = planedLaunches.OrderBy(x => x.Launch.Net).ToList(), CacheTimeOut = GetCacheTimeOutForLaunches(scheduledLaunches.OrderBy(x => x.Launch.Net).FirstOrDefault()?.Launch?.Net ?? DateTime.Now.AddDays(1)) }; TrackedAgencies.Add(newTrackedAgency); return newTrackedAgency; }
// GET: /AgencyType/Details/5 public ViewResult Details(int id) { AgencyType agencytype = db.AgencyTypes.Find(id); return(View(agencytype)); }
public int UpdateAgencyType(AgencyType agencyModel) { throw new System.NotImplementedException(); }
public ActionResult Delete(int id) { AgencyType agencytype = db.AgencyTypes.Find(id); return(View(agencytype)); }
/// <summary> /// Assigns the type of the agency. /// </summary> /// <param name="agencyType">Type of the agency.</param> /// <returns>An AgencyProfileBuilder.</returns> public AgencyProfileBuilder WithAgencyType(AgencyType agencyType) { _agencyType = agencyType; return(this); }
public AgencyTypeModel(AgencyType model) : base(model) { }
public static bool IsAgencyBeingTracked(AgencyType type) { return _trackedLaunches.TrackedAgencies.Any(x => x.AgencyType == type); }
public static void RemoveTrackedAgency(AgencyType agencyType) { _trackedLaunches.TrackedAgencies.RemoveAt(_trackedLaunches.TrackedAgencies.FindIndex(x => x.AgencyType == agencyType)); }
private Agency BuildAgency(AgencyType agencyType, string legalName, string displayName = null) { Agency agency = new AgencyBuilder().WithAgencyProfile( new AgencyProfileBuilder().WithAgencyType(agencyType).WithAgencyName( new AgencyNameBuilder().WithLegalName(legalName).WithDisplayName(displayName))); Session.SaveOrUpdate(agency); return agency; }