Beispiel #1
0
        /// <summary>
        /// Производит удаление всех коллекций прогноза
        /// </summary>
        public void Dispose()
        {
            // Создаем все коллекции
            ForecastDatas.Clear();
            ForecastDatas = null;
            BaseComponents.Clear();
            BaseComponents = null;
            BaseComponentDirectives.Clear();
            BaseComponentDirectives = null;
            Components.Clear();
            Components = null;
            ComponentDirectives.Clear();
            ComponentDirectives = null;
            AdStatus.Clear();
            AdStatus = null;
            Damages.Clear();
            Damages = null;
            DefferedItems.Clear();
            DefferedItems = null;
            EngineeringOrders.Clear();
            EngineeringOrders = null;
            OutOfPhaseItems.Clear();
            OutOfPhaseItems = null;
            ServiceBulletins.Clear();
            ServiceBulletins = null;
            MaintenanceChecks.Clear();
            MaintenanceChecks = null;
            Kits.Clear();
            Kits = null;

            DirectiveCollections.Clear();
            DirectiveCollections = null;
        }
Beispiel #2
0
        public PartialViewResult createNewCheck([FromBody] MaintenanceChecks Model)
        {
            int finalIndex = (maintenanceCheckViewModel.Checks.Count) - 1;

            try
            {
                Model.MaintenanceCheckID = maintenanceCheckViewModel.Checks[finalIndex].MaintenanceCheckID + 1;
            }
            catch (ArgumentOutOfRangeException)
            {
                Model.MaintenanceCheckID = 1;
            }
            //maintenanceCheckViewModel.Checks.Add(Model);
            maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;

            try
            {
                string maintenanceCheckData = JsonConvert.SerializeObject(Model);

                this.PostAsync("http://localhost:8961/api/MaintenanceCheck/", maintenanceCheckData);
                maintenanceCheckViewModel.Checks.Add(Model);
            }
            catch (AggregateException e)
            {
            }
            return(PartialView("_CheckItems", maintenanceCheckViewModel));
        }
Beispiel #3
0
        public PartialViewResult deleteCheck()
        {
            //for (int x = maintenanceCheckViewModel.currentIndex; x <= maintenanceCheckViewModel.Checks.Count - 2; x++)
            //{
            //    int nextIndex = x + 1;
            //    maintenanceCheckViewModel.Checks[x] = maintenanceCheckViewModel.Checks[nextIndex];
            //}

            //int finalIndex = maintenanceCheckViewModel.Checks.Count - 1;
            //maintenanceCheckViewModel.Checks.RemoveAt(finalIndex);


            int index = maintenanceCheckViewModel.MaintenanceCheckID - 1;
            MaintenanceChecks item = maintenanceCheckViewModel.Checks.Single(r => r.MaintenanceCheckID == maintenanceCheckViewModel.MaintenanceCheckID);

            maintenanceCheckViewModel.Checks.Remove(item);



            ClearSession();

            try
            {
                string crewData = JsonConvert.SerializeObject(item);
                this.DeleteAsync("http://localhost:8961/api/MaintenanceCheck/", crewData);
            }
            catch (AggregateException e)
            {
            }


            maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;
            return(PartialView("_CheckItems", maintenanceCheckViewModel));
        }
Beispiel #4
0
        public PartialViewResult LoadCheck([FromBody] MaintenanceChecks ID)
        {
            MaintenanceChecks item = maintenanceCheckViewModel.Checks.Single(r => r.MaintenanceCheckID == ID.MaintenanceCheckID);

            maintenanceCheckViewModel.currentIndex       = maintenanceCheckViewModel.Checks.FindIndex(r => r.MaintenanceCheckID == ID.MaintenanceCheckID);
            maintenanceCheckViewModel.MaintenanceCheckID = item.MaintenanceCheckID;
            maintenanceCheckViewModel.Description        = item.Description;
            maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;

            try
            {
                var uri = "api/MaintenanceCheck/Get ";

                List <MaintenanceChecks> maintenanceCheckItems;

                using (HttpClient httpClient = new HttpClient())
                {
                    httpClient.BaseAddress = new Uri("http://localhost:8961");
                    Task <String> response = httpClient.GetStringAsync(uri);
                    maintenanceCheckItems = JsonConvert.DeserializeObject <List <MaintenanceChecks> >(response.Result);
                }
                maintenanceCheckViewModel.Checks = maintenanceCheckItems;
            }
            catch (AggregateException e)
            {
            }

            return(PartialView("_CheckItems", maintenanceCheckViewModel));
        }
Beispiel #5
0
        public PartialViewResult DeleteCheckItem([FromBody] MaintenanceChecks CheckDiscription)
        {
            var itemToRemove = maintenanceViewModel.CheckItems.Single(r => r.Description == CheckDiscription.Description);

            maintenanceViewModel.CheckItems.Remove(itemToRemove);
            maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;
            return(PartialView("_NewMaintenanceOrder", maintenanceViewModel));
        }
Beispiel #6
0
 public PartialViewResult AddCheckItem([FromBody] MaintenanceChecks CheckDiscription)
 {
     maintenanceViewModel.CheckItems.Add(new MaintenanceChecks()
     {
         Description = CheckDiscription.Description
     });
     maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;
     return(PartialView("_NewMaintenanceOrder", maintenanceViewModel));
 }
        public IHttpActionResult Post(MaintenanceChecks maintenanceChecks)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            maintenanceChecksLogic.Insert(maintenanceChecks);

            return(CreatedAtRoute("DefaultApi", new { id = maintenanceChecks.MaintenanceCheckID }, maintenanceChecks));
        }
 public IHttpActionResult Put([FromBody] MaintenanceChecks maintenanceCheck)
 {
     if (maintenanceCheck.Equals(0))
     {
         return(BadRequest());
     }
     else if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     maintenanceChecksLogic.UpdateOne(maintenanceCheck);
     return(StatusCode(HttpStatusCode.NoContent));
 }
Beispiel #9
0
        public PartialViewResult saveEditedCheck([FromBody] MaintenanceChecks Model)
        {
            Model.MaintenanceCheckID = maintenanceCheckViewModel.MaintenanceCheckID;
            maintenanceCheckViewModel.Checks[maintenanceCheckViewModel.currentIndex] = Model;
            ClearSession();

            maintenanceViewModel.ActiveTab = SessionUtility.Frame_2;


            try
            {
                string maintenanceData = JsonConvert.SerializeObject(Model);
                this.PutAsync("http://localhost:8961/api/MaintenanceCheck/", maintenanceData);
            }
            catch (AggregateException e)
            {
            }

            return(PartialView("_CheckItems", maintenanceCheckViewModel));
        }
 public void Delete([FromBody] MaintenanceChecks id)
 {
     maintenanceChecksLogic.DeleteOne(id);
 }