public IActionResult Ward(int idnt, HomeWardViewModel model, CountyService service, FacilityService fac)
        {
            model.ward   = service.GetWard(idnt);
            model.levels = fac.GetFacilityCategorizationByLevels(model.ward);

            return(View(model));
        }
Esempio n. 2
0
        // GET: County
        public ActionResult Index()
        {
            var service = new CountyService();
            var model   = service.GetCounties();

            return(View(model));
        }
Esempio n. 3
0
        public static void InitializeCountyComboBox(ComboBox countyComboBox, ComboBox cityComboBox)
        {
            List <County> listOfCounties = CountyService.GetAllCounties();

            List <ComboBoxItem> c = new List <ComboBoxItem>();

            c.Add(new ComboBoxItem("All counties", -1));

            for (int i = 0; i < listOfCounties.Count; i++)
            {
                c.Add(new ComboBoxItem(listOfCounties[i].Name.ToString(), listOfCounties[i].CountyId));

                //if (!SetComboboxVisibility(countyComboBox, cityComboBox))
                //{
                //    if (i == 0)
                //    {
                //        InitializeCityComboBox(listOfCounties[i].CountyId, cityComboBox);
                //    }
                //}
            }

            countyComboBox.DataSource    = c;
            countyComboBox.DisplayMember = "Text";
            countyComboBox.ValueMember   = "Value";
        }
        public IActionResult Constituency(int idnt, HomeConstituencyViewModel model, CountyService service, FacilityService fac)
        {
            model.constituency = service.GetConstituency(idnt);
            model.levels       = fac.GetFacilityCategorizationByLevels(model.constituency);

            return(View(model));
        }
        public async Task <List <CountyParticipationStatistic> > GetHighestCountyParticipantByYear()
        {
            var jsonContent = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "Controllers/election.json");
            var content     = new StringContent(jsonContent, Encoding.UTF8, "application/json");

            var response = await client.PostAsync("http://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104D/ME0104T4", content);

            var    countyParticipationStatistic = new List <CountyParticipationStatistic>();
            string responseBody = await response.Content.ReadAsStringAsync();

            var countyInfo = await CountyService.GetCountyInfo();

            ParticipationStatistics participationStatistic = JsonConvert.DeserializeObject <ParticipationStatistics>(responseBody);

            foreach (var stat in participationStatistic.Data)
            {
                var countyParticipation = new CountyParticipationStatistic()
                {
                    Id   = stat.Key[0],
                    Year = int.Parse(stat.Key[1])
                };

                decimal.TryParse(stat.Values[0], NumberStyles.Any, CultureInfo.InvariantCulture, out decimal value);
                countyParticipation.Value = value;
                countyParticipation.Name  = countyInfo.Where(x => x.Id == countyParticipation.Id).Select(i => i.Name).FirstOrDefault();

                countyParticipationStatistic.Add(countyParticipation);
            }

            var result = countyParticipationStatistic.GroupBy(i => i.Year)
                         .Select(x => x.OrderByDescending(y => y.Value).First()).ToList();

            return(result);
        }
 public AccountController(UserService userService, CountyService countyService,
                          CurrentUser currentUser, AppSettings settings, IMapper mapper)
     : base(settings, mapper)
 {
     this.currentUser   = currentUser;
     this.userService   = userService;
     this.countyService = countyService;
 }
Esempio n. 7
0
        public ActionResult Create()
        {
            var service = new CountyService();
            var courses = service.GetCounties();

            ViewBag.Counties = new SelectList(courses, "CountyId", "CountyName");
            return(View());
        }
 public ProfileController(UserService userService, FriendService friendService, CountyService countyService,
                          CurrentUser currentUser, AppSettings settings, IMapper mapper)
     : base(settings, mapper)
 {
     this.friendService = friendService;
     this.countyService = countyService;
     this.userService   = userService;
     this.currentUser   = currentUser;
 }
Esempio n. 9
0
        public bool CountInsert()
        {
            ConnectBettwenModelInterface();
            bool check = CountyService.CountyInsert(contryModel.ID, contryModel.CountyName);// CatgoryService.categoryInsert(catModel.ID, catModel.CatName);

            getAllData();
            AutoNumber();
            return(check);
        }
Esempio n. 10
0
        public bool contryUpdata()
        {
            ConnectBettwenModelInterface();
            bool check = CountyService.Countyupdata(contryModel.ID, contryModel.CountyName);

            getAllData();
            AutoNumber();
            return(check);
        }
Esempio n. 11
0
        public bool countryDeleteAll()
        {
            ConnectBettwenModelInterface();
            bool check = CountyService.CountryDeleteAll();

            getAllData();
            AutoNumber();
            return(check);
        }
Esempio n. 12
0
        public void getAllData()
        {
            // ConnectBettwenModelInterface();

            icontry.datagridview = CountyService.getAllData();
            //icontry.datagridview =
            //ClearFildes();
            //  return CountyService.getAllData();
        }
Esempio n. 13
0
        public IHttpActionResult Get()
        {
            var    stateId       = 49;
            string stateIdConfig = ConfigurationManager.AppSettings["StateId"];
            int    valInt;

            if (int.TryParse(stateIdConfig, out valInt))
            {
                stateId = valInt;
            }
            CountyService countyService = new CountyService();
            var           data          = countyService.GetListCounty(stateId);

            return(Ok(data));
        }
Esempio n. 14
0
        public async Task <Result <List <County> > > Handle(GetAllCountiesCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    CountyService countyService = new CountyService(_unitOfWork);
                    var           counties      = await countyService.GetCounties();

                    return(Result <List <County> > .Valid(counties));
                }
                catch (Exception e)
                {
                    return(Result <List <County> > .Invalid(e.Message));
                }
            }
        }
Esempio n. 15
0
        public async Task <Result <List <SubCountyLookup> > > Handle(GetSubCountiesCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    CountyService countyService = new CountyService(_unitOfWork);
                    var           subcounties   = await countyService.GetSubCountyList(request.CountyId);

                    return(Result <List <SubCountyLookup> > .Valid(subcounties));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message + " " + e.InnerException);
                    return(Result <List <SubCountyLookup> > .Invalid(e.Message));
                }
            }
        }
Esempio n. 16
0
        public ActionResult Create(CountyCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            bool UserIsLoggedIn = User.Identity.IsAuthenticated;

            if (!UserIsLoggedIn)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var service = new CountyService();

            service.CreateCounty(model);

            return(RedirectToAction("Index"));
        }
Esempio n. 17
0
 public void AutoNumber()
 {
     // ConnectBettwenModelInterface();
     icontry.ID         = CountyService.getAllData().Rows.Count + 1;
     icontry.CountyName = "";
 }
        public JsonResult GetConstituency(int idnt, CountyService service)
        {
            List <SelectListItem> constituency = new List <SelectListItem>(service.GetConstituencyIEnumarable(new County(idnt)));

            return(Json(constituency));
        }
        public IActionResult Index(AdminViewModel model, FacilityService service, UserServices user, CountyService dashboard)
        {
            model.Types      = service.GetNormsTypesIEnumerable();
            model.Categories = service.GetNormsCategoryIEnumerable();
            model.Role       = user.GetRolesIEnumarable();
            model.Counties   = dashboard.GetCountyIEnumarable();

            return(View(model));
        }
Esempio n. 20
0
 public AdminController(CurrentUser currentUser, CountyService countyService, IMapper mapper)
     : base(mapper)
 {
     this.countyService = countyService;
     this.currentUser   = currentUser;
 }
Esempio n. 21
0
 public CountyController(CurrentUser currentUser, CountyService countyService)
 {
     this.currentUser   = currentUser;
     this.countyService = countyService;
 }
        public ActionResult FacilitySearch(FacilitySearchViewModel model, FacilityService service, CountyService dashboard, string facility = "", int county = 0, int level = 0)
        {
            string SearchString = "WHERE fc_level<>99";

            if (!string.IsNullOrWhiteSpace(facility))
            {
                SearchString += " AND fc_name LIKE '%" + facility.Replace("'", "`") + "%'";
            }

            if (county != 0)
            {
                SearchString += " AND fc_county=" + county;
            }

            if (level != 0)
            {
                SearchString += " AND fc_level=" + level;
            }

            //Don't Pull if Nothing Passed
            if (SearchString.Equals("WHERE fc_level<>99"))
            {
                SearchString += " AND fc_idnt=0";
            }

            model.facility   = facility.Trim();
            model.county     = county;
            model.level      = level;
            model.counties   = dashboard.GetCounties();
            model.facilities = service.GetFacilities(SearchString);

            return(View(model));
        }
 public IActionResult Index(HomeIndexViewModel model, CountyService service)
 {
     model.Markers = service.GetMarkers();
     return(View(model));
 }