示例#1
0
        /// <summary>
        /// The index.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Index()
        {
            if (Properties.Settings.Default.SetBackDays != 0)
            {
                startDate = DateTime.Now.Date.AddDays(-1 * SetBackDays);
            }

            this.logger.Trace($"Index Calling Interface.GetEventsByProgram using {EventRegistrationId}");
            var events = Interface.GetEventsByProgram(EventRegistrationId, startDate);

            if (!events.Any())
            {
                return(this.RedirectToAction("Closed"));
            }

            // create states drop down list
            IEnumerable <SelectListItem> states     = StatesRepository.GetStates();
            IEnumerable <SelectListItem> selectList = GetSelectList(events);

            Form form = new Form()
            {
                States  = states,
                Events  = selectList,
                Message = Properties.Settings.Default.AlertMessage
            };

            return(this.View(form));
        }
示例#2
0
        public static StatesRepository GetStatesRepository(IUnitOfWork unitOfWork)
        {
            var repository = new StatesRepository();

            repository.UnitOfWork = unitOfWork;
            return(repository);
        }
示例#3
0
 /// <summary>
 /// This constructor
 /// </summary>
 /// <param name="_unitOfWork"></param>
 public SetupBL(IUnitOfWork _unitOfWork, IMapper _mapper)
 {
     unitOfWork        = _unitOfWork;
     countryRepository = new CountryRepository(_unitOfWork);
     StateRepository   = new StatesRepository(_unitOfWork);
     mapper            = _mapper;
 }
        public ActionResult FillStates(int Country)
        {
            IRepositoryBase <State> statesRepo = new StatesRepository(new DataContext());
            var states = statesRepo.GetAll().ToList().Where(s => s.CountryID == Country);

            return(Json(states, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public static StatesRepository GetStatesRepository()
        {
            var repository = new StatesRepository();

            repository.UnitOfWork = GetUnitOfWork();
            return(repository);
        }
示例#6
0
 public HttpResponseMessage GetStates()
 {
     try
     {
         var listaStates = StatesRepository.ConsultarStates();
         return(Request.CreateResponse(HttpStatusCode.OK, listaStates));
     }
     catch (Exception e)
     {
         Console.WriteLine($"An Exception has been caught: {e.Message}");
         return(Request.CreateResponse(HttpStatusCode.InternalServerError));
     }
 }
示例#7
0
        public override void LoadContent()
        {
            _renderRasterId = StatesRepository.AddRasterStates(new RasterizerStateDescription()
            {
                CullMode = SharpDX.Direct3D11.CullMode.None, FillMode = FillMode.Solid
            });

            _wrappedEffect = new HLSLVertexPositionColor(_d3dEngine, @"D3D\Effects\Basics\VertexPositionColor.hlsl", VertexPositionColor.VertexDeclaration);
            //_wrappedEffect.CurrentTechnique = _wrappedEffect.Effect.GetTechniqueByIndex(0); ==> Optional, defaulted to 0 !

            CreateVertexBuffer();

            base.LoadContent();
        }
示例#8
0
        public UnitOfWork(ITrafficMgtDbContext context)
        {
            this.context = context;

            Users            = new UserRepository(context);
            Menus            = new MenuRepository(context);
            RoleMenus        = new RoleMenuRepository(context);
            MenuGroups       = new MenuGroupRepository(context);
            UserRoles        = new UserRoleRepository(context);
            Ind              = new IncidentTypeRepository(context);
            ReportIncidents  = new ReportIncidentRepository(context);
            States           = new StatesRepository(context);
            LocalGovernments = new LocalGovtRepository(context);
        }
示例#9
0
        public Task <ExecuteResultEntity <ICollection <States> > > GetStateListAsync()
        {
            try
            {
                StatesRepository repo = RepositoryHelper.GetStatesRepository();
                return(Task.FromResult(ExecuteResultEntity <ICollection <States> > .CreateResultEntity(new Collection <States>(repo.All().ToList()))));
            }
            catch (Exception ex)
            {
                return(Task.FromResult(ExecuteResultEntity <ICollection <States> > .CreateErrorResultEntity(ex)));

                throw;
            }
        }
        public UnitOfWork(ITrafficMgtDbContext context)
        {
            this.context = context;

            Users            = new UserRepository(context);
            Menus            = new MenuRepository(context);
            RoleMenus        = new RoleMenuRepository(context);
            MenuGroups       = new MenuGroupRepository(context);
            UserRoles        = new UserRoleRepository(context);
            Ind              = new DepartmentRepository(context);
            Students         = new StudentRepository(context);
            Courses          = new CourseRepository(context);
            States           = new StatesRepository(context);
            LocalGovernments = new LocalGovtRepository(context);
        }
示例#11
0
        public void fillDDL()
        {
            StatesRepository r = new StatesRepository();

            ddlState.DataSource     = r.getStatesInfo();
            ddlState.DataTextField  = "StateName";
            ddlState.DataValueField = "StateID";
            ddlState.DataBind();

            CityRepository cr = new CityRepository();

            ddlCity.DataSource     = cr.getCitiesInfoByStateID(ddlState.SelectedIndex + 1);
            ddlCity.DataTextField  = "CityName";
            ddlCity.DataValueField = "CityID";
            ddlCity.DataBind();
        }
示例#12
0
 public HttpResponseMessage GetStateByID(int id)
 {
     try
     {
         var state = StatesRepository.ConsultarStateByID(id);
         if (state == null)
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, state));
     }
     catch (Exception e)
     {
         Console.WriteLine($"An Exception has been caught: {e.Message}");
         return(Request.CreateResponse(HttpStatusCode.InternalServerError));
     }
 }
示例#13
0
        public ActionResult States(int x, int y, int z)
        {
            var key        = string.Format(@"states\{0}\{1}\{1}", x, y, z);
            var cachedJson = this.HttpContext.Cache[key] as string;

            if (cachedJson != null)
            {
                return(new ContentResult()
                {
                    Content = cachedJson, ContentType = "application/json"
                });
            }

            const int utfgridResolution = 2;

            using (var utf8Grid = new Utf8Grid(utfgridResolution, x, y, z))
            {
                var bbox = GetBoundingBoxInLatLngWithMargin(x, y, z);
                if (bbox.Bottom > 0)
                {
                    var states = new StatesRepository().Query(bbox.ToSqlGeography());
                    int i      = 1;
                    foreach (var state in states)
                    {
                        var geography = (SqlGeography)state["geom"];
                        var projected = ((SqlGeography)state["geom"]).FromLonLat().MakeValid();
                        var wkt       = projected.STAsText().ToSqlString().Value;
                        utf8Grid.FillPolygon(geography, i,
                                             new { NAME = state["STATE_NAME"], POP2005 = state["POP2000"], Wkt = wkt });
                        i = i + 1;
                    }
                }
                cachedJson = utf8Grid.CreateUtfGridJson();
                this.HttpContext.Cache.Insert(key, cachedJson);
                return(new ContentResult()
                {
                    Content = cachedJson, ContentType = "application/json"
                });
            }
        }
示例#14
0
        public override void Draw(int index)
        {
            if (_gameStates.DebugDisplay == 1)
            {
                //Set States.
                StatesRepository.ApplyRaster(_renderRasterId);

                //Set Effect variables
                _wrappedEffect.Begin();
                _wrappedEffect.CBPerDraw.Values.World       = Matrix.Transpose(Matrix.Identity);
                _wrappedEffect.CBPerDraw.IsDirty            = true;
                _wrappedEffect.CBPerFrame.Values.View       = Matrix.Transpose(_camManager.ActiveCamera.View_focused);
                _wrappedEffect.CBPerFrame.Values.Projection = Matrix.Transpose(_camManager.ActiveCamera.Projection3D);
                _wrappedEffect.CBPerFrame.IsDirty           = true;
                _wrappedEffect.Apply();

                //Set the vertex buffer to the Graphical Card.
                _vertexBuffer.SetToDevice(0);

                _d3dEngine.Context.Draw(6, 0); //2 Vertex by line ! ==> 6 vertex to draw
            }
        }
示例#15
0
 public void Insert(States state)
 {
     StatesRepository repo = new StatesRepository();
     //repo.Insert(state);
 }
示例#16
0
        public IEnumerable <States> GetAll()
        {
            StatesRepository repo = new StatesRepository();

            return(null); // repo.GetAll();
        }
示例#17
0
        public ActionResult Index(Form data)
        {
            this.logger.Trace($"Index Post Calling Interface.GetEventsByProgram to get drop down list of events for Program {EventRegistrationId}");
            if (Properties.Settings.Default.SetBackDays != 0)
            {
                startDate = DateTime.Now.Date.AddDays(-1 * SetBackDays);
            }

            List <EventData> events = Interface.GetEventsByProgram(EventRegistrationId, startDate);

            data.Events = GetSelectList(events);

            if (!events.Any())
            {
                return(this.RedirectToAction("Closed"));
            }

            // create states drop down list - note - move to default constructor
            IEnumerable <SelectListItem> states = StatesRepository.GetStates();

            data.States = states;
            if (!Properties.Settings.Default.devMode && this.ModelState.IsValid)
            {
                this.VerifyCaptcha("CaptchaError");
            }

            this.ViewBag.PublicKey = WebConfigurationManager.AppSettings["recaptchaPublicKey"];

            if (!this.ModelState.IsValid)
            {
                return(this.View(data));
            }

            EventData item = Interface.GetEvent(EventRegistrationId, data.SelectedEvent);

            if (item == null)
            {
                return(this.RedirectToAction("Error"));
            }

            // todo: consider moving dup check to AddRegistration
            if (!Properties.Settings.Default.AllowDuplicates)
            {
                if (this.CheckDuplicate(data))
                {
                    string ccpEmail = this.GetCampusEmail(item.CampusName);
                    return(this.View("Duplicate", null, ccpEmail));
                }
            }

            RegistrationData reg = this.AddRegistration(data);

            // todo : need a status and/or message to be returned to check for ok or dup.
            if (reg == null)
            {
                // API returned an error
                return(this.RedirectToAction("Error"));
            }

            bool isSentEmail = this.SendEmail(reg.EmailAddress, item);

            return(this.RedirectToAction(isSentEmail ? "Thanks" : "Error"));
        }
示例#18
0
        public States GetByName(string name)
        {
            StatesRepository repo = new StatesRepository();

            return(null); // repo.GetByName(name);
        }