Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,GeoServerWorkspace,GeoServerName,NameKK,NameRU,NameEN,PollutionEnvironmentId,MeasuredParameterId,KATOId,Season,Hour")] Layer layer,
                                               string SortOrder,
                                               string GeoServerNameFilter,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               string NameENFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder           = SortOrder;
            ViewBag.PageSize            = PageSize;
            ViewBag.PageNumber          = PageNumber;
            ViewBag.GeoServerNameFilter = GeoServerNameFilter;
            ViewBag.NameKKFilter        = NameKKFilter;
            ViewBag.NameRUFilter        = NameRUFilter;
            ViewBag.NameENFilter        = NameENFilter;
            if (id != layer.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/Layers/{layer.Id}", layer);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(layer));
                }

                layer = await response.Content.ReadAsAsync <Layer>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    GeoServerNameFilter = ViewBag.GeoServerNameFilter,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    NameENFilter = ViewBag.NameENFilter
                }));
            }
            return(View(layer));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Level,AreaType,EgovId,ParentEgovId,NameKK,NameRU")] KATO KATO,
                                               string SortOrder,
                                               string CodeFilter,
                                               int?LevelFilter,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.CodeFilter   = CodeFilter;
            ViewBag.LevelFilter  = LevelFilter;
            ViewBag.NameKKFilter = NameKKFilter;
            ViewBag.NameRUFilter = NameRUFilter;
            if (id != KATO.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/KATOes/{KATO.Id}", KATO);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(KATO));
                }

                KATO = await response.Content.ReadAsAsync <KATO>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    CodeFilter = ViewBag.CodeFilter,
                    LevelFilter = ViewBag.LevelFilter,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter
                }));
            }
            return(View(KATO));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Number,NorthLatitude,EastLongitude,MonitoringPostId")] LEDScreen ledScreen,
                                               string SortOrder,
                                               string NameFilter,
                                               int?MonitoringPostIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder              = SortOrder;
            ViewBag.PageSize               = PageSize;
            ViewBag.PageNumber             = PageNumber;
            ViewBag.NameFilter             = NameFilter;
            ViewBag.MonitoringPostIdFilter = MonitoringPostIdFilter;
            if (id != ledScreen.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/LEDScreens/{ledScreen.Id}", ledScreen);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(ledScreen));
                }

                ledScreen = await response.Content.ReadAsAsync <LEDScreen>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameFilter = ViewBag.NameFilter,
                    MonitoringPostIdFilter = ViewBag.MonitoringPostIdFilter
                }));
            }
            return(View(ledScreen));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] AuthorizedAuthority authorizedAuthority,
                                               string SortOrder,
                                               string NameFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder  = SortOrder;
            ViewBag.PageSize   = PageSize;
            ViewBag.PageNumber = PageNumber;
            ViewBag.NameFilter = NameFilter;
            if (id != authorizedAuthority.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/AuthorizedAuthorities/{authorizedAuthority.Id}", authorizedAuthority);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(authorizedAuthority));
                }

                authorizedAuthority = await response.Content.ReadAsAsync <AuthorizedAuthority>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameFilter = ViewBag.NameFilter,
                }));
            }
            return(View(authorizedAuthority));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,MeasuredParameterUnitId,NameKK,NameRU,NameEN,NameShortKK,NameShortRU,NameShortEN,MPCDailyAverage,MPCMaxSingle,EcomonCode,OceanusCode,KazhydrometCode")] MeasuredParameter measuredParameter,
                                               string SortOrder,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               string NameENFilter,
                                               int?EcomonCodeFilter,
                                               string OceanusCodeFilter,
                                               string KazhydrometCodeFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder             = SortOrder;
            ViewBag.PageSize              = PageSize;
            ViewBag.PageNumber            = PageNumber;
            ViewBag.NameKKFilter          = NameKKFilter;
            ViewBag.NameRUFilter          = NameRUFilter;
            ViewBag.NameENFilter          = NameENFilter;
            ViewBag.EcomonCodeFilter      = EcomonCodeFilter;
            ViewBag.OceanusCodeFilter     = OceanusCodeFilter;
            ViewBag.KazhydrometCodeFilter = KazhydrometCodeFilter;
            if (id != measuredParameter.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/MeasuredParameters/{measuredParameter.Id}", measuredParameter);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(measuredParameter));
                }

                measuredParameter = await response.Content.ReadAsAsync <MeasuredParameter>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    NameENFilter = ViewBag.NameENFilter,
                    EcomonCodeFilter = ViewBag.EcomonCodeFilter,
                    OceanusCodeFilter = ViewBag.OceanusCodeFilter,
                    KazhydrometCodeFilter = ViewBag.KazhydrometCodeFilter
                }));
            }
            List <MeasuredParameterUnit> measuredParameterUnits = new List <MeasuredParameterUnit>();
            string urlMeasuredParameterUnits   = "api/MeasuredParameterUnits",
                   routeMeasuredParameterUnits = "";
            HttpResponseMessage responseMeasuredParameterUnits = await _HttpApiClient.GetAsync(urlMeasuredParameterUnits + routeMeasuredParameterUnits);

            if (responseMeasuredParameterUnits.IsSuccessStatusCode)
            {
                measuredParameterUnits = await responseMeasuredParameterUnits.Content.ReadAsAsync <List <MeasuredParameterUnit> >();
            }
            ViewBag.MeasuredParameterUnits = new SelectList(measuredParameterUnits.OrderBy(m => m.Name), "Id", "Name", measuredParameter.MeasuredParameterUnitId);
            return(View(measuredParameter));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,KATOId,PlantationsTypeId,TreesNumber")] SpeciesDiversity speciesDiversity,
                                               string SortOrder,
                                               int?KATOIdFilter,
                                               int?PlantationsTypeIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder               = SortOrder;
            ViewBag.PageSize                = PageSize;
            ViewBag.PageNumber              = PageNumber;
            ViewBag.KATOIdFilter            = KATOIdFilter;
            ViewBag.PlantationsTypeIdFilter = PlantationsTypeIdFilter;
            if (id != speciesDiversity.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/SpeciesDiversities/{speciesDiversity.Id}", speciesDiversity);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(speciesDiversity));
                }

                speciesDiversity = await response.Content.ReadAsAsync <SpeciesDiversity>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    KATOIdFilter = ViewBag.KATOIdFilter,
                    PlantationsTypeIdFilter = ViewBag.PlantationsTypeIdFilter
                }));
            }

            List <KATO> KATOes      = new List <KATO>();
            string      urlKATOes   = "api/KATOes",
                        routeKATOes = "";
            HttpResponseMessage responseKATOes = await _HttpApiClient.GetAsync(urlKATOes + routeKATOes);

            if (responseKATOes.IsSuccessStatusCode)
            {
                KATOes = await responseKATOes.Content.ReadAsAsync <List <KATO> >();
            }
            ViewBag.KATOes = new SelectList(KATOes.Where(k => k.ParentEgovId == 17112).OrderBy(m => m.Name), "Id", "Name", speciesDiversity.KATOId);

            List <PlantationsType> plantationsTypes = new List <PlantationsType>();
            string urlPlantationsTypes   = "api/PlantationsTypes",
                   routePlantationsTypes = "";
            HttpResponseMessage responsePlantationsTypes = await _HttpApiClient.GetAsync(urlPlantationsTypes + routePlantationsTypes);

            if (responsePlantationsTypes.IsSuccessStatusCode)
            {
                plantationsTypes = await responsePlantationsTypes.Content.ReadAsAsync <List <PlantationsType> >();
            }
            ViewBag.PlantationsTypes = new SelectList(plantationsTypes.OrderBy(m => m.Name), "Id", "Name", speciesDiversity.PlantationsTypeId);

            return(View(speciesDiversity));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,GreemPlantsPassportId,PlantationsTypeId,StateOfCSR15PlantationsTypeId,StateOfCSR15_1,StateOfCSR15_2,StateOfCSR15_3,StateOfCSR15_4,StateOfCSR15_5,Quantity,StateOfCSR15Type")] TreesByObjectTableOfTheBreedStateList treesByObjectTableOfTheBreedStateList,
                                               string SortOrder,
                                               int?GreemPlantsPassportIdFilter,
                                               int?PlantationsTypeIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder  = SortOrder;
            ViewBag.PageSize   = PageSize;
            ViewBag.PageNumber = PageNumber;
            ViewBag.GreemPlantsPassportIdFilter = GreemPlantsPassportIdFilter;
            ViewBag.PlantationsTypeIdFilter     = PlantationsTypeIdFilter;
            if (id != treesByObjectTableOfTheBreedStateList.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                if (treesByObjectTableOfTheBreedStateList.StateOfCSR15Type)
                {
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15PlantationsTypeId = null;
                }
                else
                {
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15_1 = null;
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15_2 = null;
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15_3 = null;
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15_4 = null;
                    treesByObjectTableOfTheBreedStateList.StateOfCSR15_5 = null;
                }

                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/TreesByObjectTableOfTheBreedStateLists/{treesByObjectTableOfTheBreedStateList.Id}", treesByObjectTableOfTheBreedStateList);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(treesByObjectTableOfTheBreedStateList));
                }

                treesByObjectTableOfTheBreedStateList = await response.Content.ReadAsAsync <TreesByObjectTableOfTheBreedStateList>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    GreemPlantsPassportIdFilter = ViewBag.GreemPlantsPassportIdFilter,
                    PlantationsTypeIdFilter = ViewBag.PlantationsTypeIdFilter
                }));
            }

            List <PlantationsType> plantationsTypes = new List <PlantationsType>();
            string urlPlantationsTypes   = "api/PlantationsTypes",
                   routePlantationsTypes = "";
            HttpResponseMessage responsePlantationsTypes = await _HttpApiClient.GetAsync(urlPlantationsTypes + routePlantationsTypes);

            if (responsePlantationsTypes.IsSuccessStatusCode)
            {
                plantationsTypes = await responsePlantationsTypes.Content.ReadAsAsync <List <PlantationsType> >();
            }
            ViewBag.PlantationsTypes = new SelectList(plantationsTypes.OrderBy(m => m.Name), "Id", "Name", treesByObjectTableOfTheBreedStateList.PlantationsTypeId);

            List <GreemPlantsPassport> greemPlantsPassports = new List <GreemPlantsPassport>();
            string urlGreemPlantsPassports   = "api/GreemPlantsPassports",
                   routeGreemPlantsPassports = "";
            HttpResponseMessage responseGreemPlantsPassports = await _HttpApiClient.GetAsync(urlGreemPlantsPassports + routeGreemPlantsPassports);

            if (responseGreemPlantsPassports.IsSuccessStatusCode)
            {
                greemPlantsPassports = await responseGreemPlantsPassports.Content.ReadAsAsync <List <GreemPlantsPassport> >();
            }
            ViewBag.GreemPlantsPassports = new SelectList(greemPlantsPassports.OrderBy(m => m.GreenObject), "Id", "GreenObject", treesByObjectTableOfTheBreedStateList.GreemPlantsPassportId);

            return(View(treesByObjectTableOfTheBreedStateList));
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Name,AdditionalInformation,NorthLatitude,EastLongitude")] KazHydrometSoilPost kazHydrometSoilPost,
                                               string SortOrder,
                                               int?NumberFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.NumberFilter = NumberFilter;
            if (id != kazHydrometSoilPost.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                int      logNumber        = kazHydrometSoilPost.Number;
                decimal  logNorthLatitude = kazHydrometSoilPost.NorthLatitude;
                decimal  logEastLongitude = kazHydrometSoilPost.EastLongitude;
                DateTime logDateTimeStart = DateTime.Now;

                string url   = "api/Logs/EditNote",
                       route = "";

                route += string.IsNullOrEmpty(route) ? "?" : "&";
                route += $"Number={logNumber.ToString()}";

                route += string.IsNullOrEmpty(route) ? "?" : "&";
                route += $"NorthLatitude={logNorthLatitude.ToString()}".Replace(',', '.');

                route += string.IsNullOrEmpty(route) ? "?" : "&";
                route += $"EastLongitude={logEastLongitude.ToString()}".Replace(',', '.');

                route += string.IsNullOrEmpty(route) ? "?" : "&";
                route += $"DateTimeStart={logDateTimeStart.ToString()}";

                HttpResponseMessage responseLog = await _HttpApiClient.PostAsync(url + route, null);

                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/KazHydrometSoilPosts/{kazHydrometSoilPost.Id}", kazHydrometSoilPost);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(kazHydrometSoilPost));
                }

                kazHydrometSoilPost = await response.Content.ReadAsAsync <KazHydrometSoilPost>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NumberFilter = ViewBag.NumberFilter
                }));
            }
            return(View(kazHydrometSoilPost));
        }
Esempio n. 9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PollutionEnvironmentId,NameKK,NameRU,NameEN,TypeOfAchievement,MeasuredParameterUnitId,ProjectId")] Target target,
                                               string SortOrder,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               string NameENFilter,
                                               int?PollutionEnvironmentIdFilter,
                                               int?ProjectIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.NameKKFilter = NameKKFilter;
            ViewBag.NameRUFilter = NameRUFilter;
            ViewBag.NameENFilter = NameENFilter;
            ViewBag.PollutionEnvironmentIdFilter = PollutionEnvironmentIdFilter;
            ViewBag.ProjectIdFilter = ProjectIdFilter;
            if (id != target.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/Targets/{target.Id}", target);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(target));
                }

                target = await response.Content.ReadAsAsync <Target>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    NameENFilter = ViewBag.NameENFilter,
                    PollutionEnvironmentIdFilter = ViewBag.PollutionEnvironmentIdFilter,
                    ProjectIdFilter = ViewBag.ProjectIdFilter
                }));
            }

            List <PollutionEnvironment> pollutionEnvironments = new List <PollutionEnvironment>();
            string urlPollutionEnvironments   = "api/PollutionEnvironments",
                   routePollutionEnvironments = "";
            HttpResponseMessage responsePollutionEnvironments = await _HttpApiClient.GetAsync(urlPollutionEnvironments + routePollutionEnvironments);

            if (responsePollutionEnvironments.IsSuccessStatusCode)
            {
                pollutionEnvironments = await responsePollutionEnvironments.Content.ReadAsAsync <List <PollutionEnvironment> >();
            }
            ViewBag.PollutionEnvironments = new SelectList(pollutionEnvironments.OrderBy(m => m.Name), "Id", "Name", target.PollutionEnvironmentId);

            List <MeasuredParameterUnit> measuredParameterUnits = new List <MeasuredParameterUnit>();
            string urlMeasuredParameterUnits   = "api/MeasuredParameterUnits",
                   routeMeasuredParameterUnits = "";
            HttpResponseMessage responseMeasuredParameterUnits = await _HttpApiClient.GetAsync(urlMeasuredParameterUnits + routeMeasuredParameterUnits);

            if (responseMeasuredParameterUnits.IsSuccessStatusCode)
            {
                measuredParameterUnits = await responseMeasuredParameterUnits.Content.ReadAsAsync <List <MeasuredParameterUnit> >();
            }
            ViewBag.MeasuredParameterUnits = new SelectList(measuredParameterUnits.OrderBy(m => m.Name), "Id", "Name", target.MeasuredParameterUnitId);

            List <Project> projects              = new List <Project>();
            string         urlProjects           = "api/Projects",
                           routeProjects         = "";
            HttpResponseMessage responseProjects = await _HttpApiClient.GetAsync(urlProjects + routeProjects);

            if (responseProjects.IsSuccessStatusCode)
            {
                projects = await responseProjects.Content.ReadAsAsync <List <Project> >();
            }
            ViewBag.Projects = new SelectList(projects.OrderBy(m => m.Name), "Id", "Name", target.ProjectId);

            return(View(target));
        }
        public async Task<IActionResult> Edit(int id, [Bind("Id,GreenObject,KATOId,NameOfPowersAttributed,NameOfRegistrationObject,LegalEntityUse,AccountNumber,NameAndLocation,PresenceOfHistoricalObject,GreenTotalAreaGa,Lawns,Flowerbeds,TracksAndPlatforms,Tree,Shrubs,SofasAndBenches,Urns,EquippedPlaygrounds,EquippedSportsgrounds,Monument,Toilets,OutdoorLighting,Billboards,OtherCapitalStructures,GreenTotalArea,AreaUnderGreenery,AreaUnderLawn,AreaUnderGroundlawn,AreaUnderOrdinarylawn,AreaUnderMeadowlawn,AreaUnderTrees,AreaUnderShrubs,AreaUndeFlowerbeds,AreaUndeTracksAndPlatforms,Asphalted,PavingBlocks,LengthOfTrays,AmountConiferousTrees,ListOfTreesConiferous,Upto10yearsConiferous,Betwen10_20yearsConiferous,Over10yearsConiferous,AmountDeciduousTrees,ListOfTreesDeciduous,Upto10yearsDeciduous,Betwen10_20yearsDeciduous,Over10yearsDeciduous,AmountFormedTrees,TotallAmountShrubs,AmountShrubs,LengthOfHedges,AmountEquippedPlaygrounds,AmountEquippedSportsgrounds,AmountSofasAndBenches,AmountBenches,AmountSofas,AmountArbours,AmountOutdoorLighting,AmountToilets,AmountMonument,AmountBillboards,ListOfTreesByObjectBreedsCondition,ListOfTreesByObjectEconomicMeasures,PassportGeneralInformation,NorthLatitude,EastLongitude")] GreemPlantsPassport greemPlantsPassport,
            string SortOrder,
            string GreenObjectFilter,
            int? KATOIdFilter,
            int? PageSize,
            int? PageNumber)
        {
            ViewBag.SortOrder = SortOrder;
            ViewBag.PageSize = PageSize;
            ViewBag.PageNumber = PageNumber;
            ViewBag.GreenObjectFilter = GreenObjectFilter;
            ViewBag.KATOIdFilter = KATOIdFilter;
            if (id != greemPlantsPassport.Id)
            {
                return NotFound();
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/GreemPlantsPassports/{greemPlantsPassport.Id}", greemPlantsPassport);

                string OutputViewText = await response.Content.ReadAsStringAsync();
                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject<dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return View(greemPlantsPassport);
                }

                greemPlantsPassport = await response.Content.ReadAsAsync<GreemPlantsPassport>();
                return RedirectToAction(nameof(Index),
                    new
                    {
                        SortOrder = ViewBag.SortOrder,
                        PageSize = ViewBag.PageSize,
                        PageNumber = ViewBag.PageNumber,
                        GreenObjectFilter = ViewBag.GreenObjectFilter,
                        KATOIdFilter = ViewBag.KATOIdFilter
                    });
            }

            List<KATO> KATOes = new List<KATO>();
            string urlKATOes = "api/KATOes",
                routeKATOes = "";
            HttpResponseMessage responseKATOes = await _HttpApiClient.GetAsync(urlKATOes + routeKATOes);
            if (responseKATOes.IsSuccessStatusCode)
            {
                KATOes = await responseKATOes.Content.ReadAsAsync<List<KATO>>();
            }
            ViewBag.KATOes = new SelectList(KATOes.Where(k => k.ParentEgovId == 17112).OrderBy(m => m.Name), "Id", "Name", greemPlantsPassport.KATOId);

            return View(greemPlantsPassport);
        }
Esempio n. 11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TerritoryTypeId,KATOId,NameKK,NameRU,GISConnectionCode,AdditionalInformationKK,AdditionalInformationRU,MonitoringPostId,KazHydrometSoilPostId,ProjectId")] TargetTerritory targetTerritory,
                                               string SortOrder,
                                               string NameKKFilter,
                                               string NameRUFilter,
                                               string GISConnectionCodeFilter,
                                               int?TerritoryTypeIdFilter,
                                               int?ProjectIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder               = SortOrder;
            ViewBag.PageSize                = PageSize;
            ViewBag.PageNumber              = PageNumber;
            ViewBag.NameKKFilter            = NameKKFilter;
            ViewBag.NameRUFilter            = NameRUFilter;
            ViewBag.GISConnectionCodeFilter = GISConnectionCodeFilter;
            ViewBag.TerritoryTypeIdFilter   = TerritoryTypeIdFilter;
            ViewBag.ProjectIdFilter         = ProjectIdFilter;
            if (id != targetTerritory.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/TargetTerritories/{targetTerritory.Id}", targetTerritory);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(targetTerritory));
                }

                targetTerritory = await response.Content.ReadAsAsync <TargetTerritory>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameKKFilter = ViewBag.NameKKFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    GISConnectionCodeFilter = ViewBag.GISConnectionCodeFilter,
                    TerritoryTypeIdFilter = ViewBag.TerritoryTypeIdFilter,
                    ProjectIdFilter = ViewBag.ProjectIdFilter
                }));
            }

            List <MonitoringPost> monitoringPosts       = new List <MonitoringPost>();
            string urlMonitoringPosts                   = "api/MonitoringPosts",
                   routeMonitoringPosts                 = "";
            HttpResponseMessage responseMonitoringPosts = await _HttpApiClient.GetAsync(urlMonitoringPosts + routeMonitoringPosts);

            if (responseMonitoringPosts.IsSuccessStatusCode)
            {
                monitoringPosts = await responseMonitoringPosts.Content.ReadAsAsync <List <MonitoringPost> >();
            }
            ViewBag.TransportPosts        = new SelectList(monitoringPosts.Where(m => m.PollutionEnvironmentId == 7).OrderBy(m => m.Name), "Id", "Name");
            ViewBag.KazHydrometWaterPosts = new SelectList(monitoringPosts.Where(m => m.PollutionEnvironmentId == 3 && m.DataProviderId == 1).OrderBy(m => m.Name), "Id", "Name");
            ViewBag.KazHydrometAirPosts   = new SelectList(monitoringPosts.Where(m => m.PollutionEnvironmentId == 2 && m.DataProviderId == 1).OrderBy(m => m.Name), "Id", "Name");

            List <KazHydrometSoilPost> kazHydrometSoilPosts = new List <KazHydrometSoilPost>();
            string urlKazHydrometSoilPosts   = "api/KazHydrometSoilPosts",
                   routeKazHydrometSoilPosts = "";
            HttpResponseMessage responseKazHydrometSoilPosts = await _HttpApiClient.GetAsync(urlKazHydrometSoilPosts + routeKazHydrometSoilPosts);

            if (responseKazHydrometSoilPosts.IsSuccessStatusCode)
            {
                kazHydrometSoilPosts = await responseKazHydrometSoilPosts.Content.ReadAsAsync <List <KazHydrometSoilPost> >();
            }
            ViewBag.KazHydrometSoilPosts = new SelectList(kazHydrometSoilPosts.OrderBy(m => m.Name), "Id", "Name", targetTerritory.KazHydrometSoilPostId);

            List <TerritoryType> territoryTypes        = new List <TerritoryType>();
            string urlTerritoryTypes                   = "api/TerritoryTypes",
                   routeTerritoryTypes                 = "";
            HttpResponseMessage responseTerritoryTypes = await _HttpApiClient.GetAsync(urlTerritoryTypes + routeTerritoryTypes);

            if (responseTerritoryTypes.IsSuccessStatusCode)
            {
                territoryTypes = await responseTerritoryTypes.Content.ReadAsAsync <List <TerritoryType> >();
            }
            ViewBag.TerritoryTypes = new SelectList(territoryTypes.OrderBy(m => m.Name), "Id", "Name", targetTerritory.TerritoryTypeId);

            List <KATO> KATOes      = new List <KATO>();
            string      urlKATOes   = "api/KATOes",
                        routeKATOes = "";
            HttpResponseMessage responseKATOes = await _HttpApiClient.GetAsync(urlKATOes + routeKATOes);

            if (responseKATOes.IsSuccessStatusCode)
            {
                KATOes = await responseKATOes.Content.ReadAsAsync <List <KATO> >();
            }
            ViewBag.KATOes = new SelectList(KATOes.Where(k => k.ParentEgovId == 17112).OrderBy(m => m.Name), "Id", "Name", targetTerritory.KATOId);

            List <Project> projects              = new List <Project>();
            string         urlProjects           = "api/Projects",
                           routeProjects         = "";
            HttpResponseMessage responseProjects = await _HttpApiClient.GetAsync(urlProjects + routeProjects);

            if (responseProjects.IsSuccessStatusCode)
            {
                projects = await responseProjects.Content.ReadAsAsync <List <Project> >();
            }
            ViewBag.Projects = new SelectList(projects.OrderBy(m => m.Name), "Id", "Name", targetTerritory.ProjectId);

            return(View(targetTerritory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,NameKK,NameRU,NameEN,AuthorizedAuthorityId,Areahectares")] SpeciallyProtectedNaturalTerritory speciallyProtectedNaturalTerritory,
                                               string SortOrder,
                                               string NameENFilter,
                                               string NameRUFilter,
                                               string NameKKFilter,
                                               int?AuthorizedAuthorityIdFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder    = SortOrder;
            ViewBag.PageSize     = PageSize;
            ViewBag.PageNumber   = PageNumber;
            ViewBag.NameENFilter = NameENFilter;
            ViewBag.NameRUFilter = NameRUFilter;
            ViewBag.NameKKFilter = NameKKFilter;
            ViewBag.AuthorizedAuthorityIdFilter = AuthorizedAuthorityIdFilter;
            if (id != speciallyProtectedNaturalTerritory.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/SpeciallyProtectedNaturalTerritories/{speciallyProtectedNaturalTerritory.Id}", speciallyProtectedNaturalTerritory);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(speciallyProtectedNaturalTerritory));
                }

                speciallyProtectedNaturalTerritory = await response.Content.ReadAsAsync <SpeciallyProtectedNaturalTerritory>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    NameENFilter = ViewBag.NameENFilter,
                    NameRUFilter = ViewBag.NameRUFilter,
                    NameKKFilter = ViewBag.NameKKFilter,
                    AuthorizedAuthorityIdFilter = ViewBag.AuthorizedAuthorityIdFilter
                }));
            }

            List <AuthorizedAuthority> authorizedAuthorities = new List <AuthorizedAuthority>();
            string urlAuthorizedAuthorities   = "api/AuthorizedAuthorities",
                   routeAuthorizedAuthorities = "";
            HttpResponseMessage responseAuthorizedAuthorities = await _HttpApiClient.GetAsync(urlAuthorizedAuthorities + routeAuthorizedAuthorities);

            if (responseAuthorizedAuthorities.IsSuccessStatusCode)
            {
                authorizedAuthorities = await responseAuthorizedAuthorities.Content.ReadAsAsync <List <AuthorizedAuthority> >();
            }
            ViewBag.AuthorizedAuthorities = new SelectList(authorizedAuthorities.OrderBy(m => m.Name), "Id", "Name", speciallyProtectedNaturalTerritory.AuthorizedAuthorityId);

            return(View(speciallyProtectedNaturalTerritory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Organization,Address,TypesRaw,NorthLatitude,EastLongitude,ProjectId")] ReceptionRecyclingPoint receptionRecyclingPoint,
                                               string SortOrder,
                                               string OrganizationFilter,
                                               string TypesRawFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder          = SortOrder;
            ViewBag.PageSize           = PageSize;
            ViewBag.PageNumber         = PageNumber;
            ViewBag.OrganizationFilter = OrganizationFilter;
            ViewBag.TypesRawFilter     = TypesRawFilter;
            if (id != receptionRecyclingPoint.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/ReceptionRecyclingPoints/{receptionRecyclingPoint.Id}", receptionRecyclingPoint);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(receptionRecyclingPoint));
                }

                receptionRecyclingPoint = await response.Content.ReadAsAsync <ReceptionRecyclingPoint>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    OrganizationFilter = ViewBag.OrganizationFilter,
                    TypesRawFilter = ViewBag.TypesRawFilter
                }));
            }

            List <Project> projects              = new List <Project>();
            string         urlProjects           = "api/Projects",
                           routeProjects         = "";
            HttpResponseMessage responseProjects = await _HttpApiClient.GetAsync(urlProjects + routeProjects);

            if (responseProjects.IsSuccessStatusCode)
            {
                projects = await responseProjects.Content.ReadAsAsync <List <Project> >();
            }
            ViewBag.Projects = new SelectList(projects.OrderBy(m => m.Name), "Id", "Name", receptionRecyclingPoint.ProjectId);

            return(View(receptionRecyclingPoint));
        }
Esempio n. 14
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,Position")] Executor executor,
                                               string SortOrder,
                                               string FullNameFilter,
                                               string PositionFilter,
                                               int?PageSize,
                                               int?PageNumber)
        {
            ViewBag.SortOrder      = SortOrder;
            ViewBag.PageSize       = PageSize;
            ViewBag.PageNumber     = PageNumber;
            ViewBag.FullNameFilter = FullNameFilter;
            ViewBag.PositionFilter = PositionFilter;
            if (id != executor.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                HttpResponseMessage response = await _HttpApiClient.PutAsJsonAsync(
                    $"api/Executors/{executor.Id}", executor);

                string OutputViewText = await response.Content.ReadAsStringAsync();

                OutputViewText = OutputViewText.Replace("<br>", Environment.NewLine);
                try
                {
                    response.EnsureSuccessStatusCode();
                }
                catch
                {
                    dynamic errors = JsonConvert.DeserializeObject <dynamic>(OutputViewText);
                    foreach (Newtonsoft.Json.Linq.JProperty property in errors.Children())
                    {
                        ModelState.AddModelError(property.Name, property.Value[0].ToString());
                    }
                    return(View(executor));
                }

                executor = await response.Content.ReadAsAsync <Executor>();

                return(RedirectToAction(nameof(Index),
                                        new
                {
                    SortOrder = ViewBag.SortOrder,
                    PageSize = ViewBag.PageSize,
                    PageNumber = ViewBag.PageNumber,
                    FullNameFilter = ViewBag.FullNameFilter,
                    PositionFilter = ViewBag.PositionFilter
                }));
            }

            decimal efficiency     = 0m;
            string  urlExecutors   = "api/Executors/CalcEfficiency",
                    routeExecutors = "";

            routeExecutors += string.IsNullOrEmpty(routeExecutors) ? "?" : "&";
            routeExecutors += $"ExecutorId={id.ToString()}";

            HttpResponseMessage responseExecutors = await _HttpApiClient.GetAsync(urlExecutors + routeExecutors);

            if (responseExecutors.IsSuccessStatusCode)
            {
                efficiency = await responseExecutors.Content.ReadAsAsync <decimal>();
            }

            ViewBag.Efficiency = efficiency;

            return(View(executor));
        }