Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
 }
 /// <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;
 }
Exemplo n.º 6
0
        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);
        }
 //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;
 }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            AgencyType agencytype = db.AgencyTypes.Find(id);

            db.AgencyTypes.Remove(agencytype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 public ActionResult Edit(AgencyType agencytype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agencytype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(agencytype));
 }
Exemplo n.º 11
0
        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);

        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 13
0
        public bool SaveAgencyType(AgencyTypeVM model)
        {
            var agencyType = new AgencyType()
            {
                Description = model.Description
            };

            _context.AgencyTypes.Add(agencyType);
            _context.SaveChanges();
            return(true);
        }
Exemplo n.º 14
0
        /// <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);
            }
        }
Exemplo n.º 15
0
        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));
        }
Exemplo n.º 16
0
        /// <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;
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
		///////////////////////////////////////////////////////////////////////////////////////////////////
		////////////BUILD FROM V1 SCHEMA				 //////////////////////////////////////////////////
		///////////////////////////////////////////////////////////////////////////////////////////////////
		public AgencyCore(AgencyType bean, IAgencyScheme parent) {
		}
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 20
0
        // GET: /AgencyType/Details/5

        public ViewResult Details(int id)
        {
            AgencyType agencytype = db.AgencyTypes.Find(id);

            return(View(agencytype));
        }
Exemplo n.º 21
0
 public int UpdateAgencyType(AgencyType agencyModel)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 22
0
        public ActionResult Delete(int id)
        {
            AgencyType agencytype = db.AgencyTypes.Find(id);

            return(View(agencytype));
        }
Exemplo n.º 23
0
 /// <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);
 }
Exemplo n.º 24
0
 public AgencyTypeModel(AgencyType model) : base(model)
 {
 }
Exemplo n.º 25
0
 public static bool IsAgencyBeingTracked(AgencyType type)
 {
     return _trackedLaunches.TrackedAgencies.Any(x => x.AgencyType == type);
 }
Exemplo n.º 26
0
 public static void RemoveTrackedAgency(AgencyType agencyType)
 {
      _trackedLaunches.TrackedAgencies.RemoveAt(_trackedLaunches.TrackedAgencies.FindIndex(x => x.AgencyType == agencyType));
 }
Exemplo n.º 27
0
        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;
        }