public void OpenCreateSubrouteWindow(Procescell procescell)
        {
            CreateSubrouteWindow window = new CreateSubrouteWindow();

            ((CreateSubrouteViewModel)window.DataContext).Procescell = procescell;
            window.ShowDialog();
        }
Esempio n. 2
0
        public Route GenerateNewRoute(Procescell cell)
        {
            List <int> RouteIds = new List <int>();

            foreach (Route r in cell.Routes)
            {
                string routeid = new String(r.rot_RouteId.Where(Char.IsDigit).ToArray());
                RouteIds.Add(Convert.ToInt32(routeid));
            }
            int?firstAvailable = Enumerable.Range(1, int.MaxValue).Except(RouteIds).FirstOrDefault();

            string routeId = "R" + firstAvailable;
            Route  route   = new Route
            {
                rot_RouteId        = routeId,
                rot_RouteNm        = cell.prc_ProcescellId + ":" + routeId + ":",
                rot_ShortRouteNm   = routeId,
                rot_Available      = 1,
                rot_SelectPriority = 1,
                //rot_ProcedureId = cell.prc_ProcescellId + routeId,
                rot_ProcesCellId = cell.prc_ProcescellId,
            };

            return(route);
        }
        private void OpenCreateProcescellWindow(ProcescellType celltype)
        {
            ProcessCellService service    = new ProcessCellService();
            Procescell         procescell = service.GenerateNextProcescell(celltype, Procescells);

            _MainView.OpenCreateProcescellView(procescell);
        }
        public void OpenCreateRouteWindow(Procescell cell)
        {
            CreateRouteWindow window = new CreateRouteWindow();

            ((CreateRouteViewModel)window.DataContext).Procescell = cell;
            ((CreateRouteViewModel)window.DataContext).GenerateRoute();
            window.ShowDialog();
        }
 public void DeleteProcescell(Procescell procescell)
 {
     using (ConfigurationToolContext context = new ConfigurationToolContext())
     {
         var repository = new ProcessCellRepository(context);
         repository.Delete(procescell);
         context.SaveChanges();
     }
 }
 private void DeleteObject(TreeViewObject treeViewObject)
 {
     if (_MainView.ConfirmMessage("delete " + treeViewObject.GetName(), "Are you sure you want to delete " + treeViewObject.GetName() + "?"))
     {
         treeViewObject.DeleteTreeViewObject();
         if (treeViewObject is Procescell)
         {
             Procescell cell = treeViewObject as Procescell;
             Procescells.Remove(cell);
         }
     }
 }
        public ProcessCellParameter(Procescell cell, ParameterDefinition param)
        {
            pca_ProcCellId    = cell.prc_ProcescellId;
            pca_ParNm         = param.paf_ParNm;
            pca_ParDesc       = param.paf_ParDesc;
            Value             = param.paf_DefValue;
            pca_ParValueUOM   = param.paf_ParValueUOM;
            pca_DisplayToUser = param.paf_DisplayToUser;

            ProcessCell         = cell;
            ParameterDefinition = param;
        }
        public RouteParameter(Route route, ParameterDefinition paramdef, Procescell procescell)
        {
            rop_ProcCellId    = procescell.prc_ProcescellId;
            rop_RouteId       = route.rot_RouteId;
            rop_ParNm         = paramdef.paf_ParNm;
            rop_ParDesc       = paramdef.paf_ParDesc;
            Value             = paramdef.paf_DefValue;
            rop_ParValueUOM   = paramdef.paf_ParValueUOM;
            rop_DisplayToUser = paramdef.paf_DisplayToUser;

            Route = route;
            ParameterDefinition = paramdef;
        }
        public Procescell GenerateNextProcescell(ProcescellType celltype, ICollection <Procescell> Procescells)
        {
            List <int> procIds = new List <int>();

            foreach (Procescell r in Procescells)
            {
                if (celltype.ToString() == r.prc_ProcescellTypeId)
                {
                    string routeid = new string(r.prc_ProcescellId.Where(char.IsDigit).ToArray());
                    procIds.Add(Convert.ToInt32(routeid));
                }
            }
            int firstAvailable = Enumerable.Range(1, int.MaxValue).Except(procIds).FirstOrDefault();

            Procescell procescell = new Procescell(celltype, firstAvailable);

            return(procescell);
        }
        public void RemoveRelationShips(Procescell procescell, Subroute subroute)
        {
            //remove procescell relationship
            procescell.Subroutes.Remove(subroute);
            subroute.Procescell = null;

            //remove route relationship
            foreach (SubroutesInRoute S in subroute.SubroutesInRoutes)
            {
                S.Route.SubroutesInRoutes.Remove(S);
            }

            //remove bin relationship
            foreach (BinsInSubRoute bir in subroute.BinsInSubRoutes)
            {
                //bir.Subroute.BinsInSubRoutes.Remove(bir);
                bir.Bin.BinsInSubRoutes.Remove(bir);
            }
        }
        public List <Subroute> GetSubroutesNotInRoute(Route route)
        {
            List <Subroute> subroutesInRoute    = new List <Subroute>();
            List <Subroute> subroutesNotInRoute = new List <Subroute>();
            Procescell      procescell          = route.ProcesCell;

            foreach (SubroutesInRoute sri in route.SubroutesInRoutes)
            {
                subroutesInRoute.Add(sri.Subroute);
            }

            foreach (Subroute S in procescell.Subroutes)
            {
                if (!subroutesInRoute.Contains(S))
                {
                    OrderObservableList.AddSorted(subroutesNotInRoute, S);
                }
            }
            return(subroutesNotInRoute);
        }
        public Subroute GenerateNewSubroute(Procescell procescell, string name)
        {
            List <int> SubrouteIds = new List <int>();

            foreach (Subroute r in procescell.Subroutes)
            {
                string routeid = new String(r.sur_SubRouteId.Where(Char.IsDigit).ToArray());
                SubrouteIds.Add(Convert.ToInt32(routeid));
            }
            int?firstAvailable = Enumerable.Range(1, int.MaxValue).Except(SubrouteIds).FirstOrDefault();

            string   SubrouteId = "SR" + firstAvailable;
            Subroute subroute   = new Subroute
            {
                sur_ProcCellId = procescell.prc_ProcescellId,
                sur_SubRouteId = SubrouteId,
                sur_SubRouteNm = name
            };

            return(subroute);
        }
Esempio n. 13
0
        public void CreateNewRoute(Route route, Procescell procescell)
        {
            using (ConfigurationToolContext context = new ConfigurationToolContext())
            {
                var repository = new RouteRepository(context);
                var parameterDefinitionRepository = new ParameterDefinitionRepository(context);

                //Gets required parameters for a new procescell
                IEnumerable <ParameterDefinition> requiredParameters;
                requiredParameters = parameterDefinitionRepository.GetRequiredParameters("rop_RoutePars", procescell.prc_ProcescellTypeId);

                //convert parDef to proccellPars and add them to the procescell
                foreach (ParameterDefinition paf in requiredParameters)
                {
                    RouteParameter rop = new RouteParameter(route, paf, procescell);
                    route.RouteParameters.Add(rop);
                }

                repository.Add(route);
                context.SaveChanges();
            }
        }
        public void CreateNewProcescell(Procescell procescell)
        {
            using (ConfigurationToolContext context = new ConfigurationToolContext())
            {
                var repository = new ProcessCellRepository(context);
                var parameterDefinitionRepository = new ParameterDefinitionRepository(context);

                //Gets required parameters for a new procescell
                IEnumerable <ParameterDefinition> requiredParameters;
                requiredParameters = parameterDefinitionRepository.GetRequiredParameters("pca_ProcCellPars", procescell.prc_ProcescellTypeId);

                //convert parDef to proccellPars and add them to the procescell
                foreach (ParameterDefinition paf in requiredParameters)
                {
                    ProcessCellParameter pca = new ProcessCellParameter(procescell, paf);
                    procescell.ProcessCellParameters.Add(pca);
                }

                //this always happens at the end of the method
                repository.Add(procescell);
                context.SaveChanges();
            }
        }
 public void AddSubrouteToCell(Procescell procescell, Subroute subroute)
 {
     OrderObservableList.AddSorted(procescell.Subroutes, subroute);
     subroute.Procescell = procescell;
 }
 public bool ValidateProcesCell(Procescell procescell)
 {
     return(true);
 }
Esempio n. 17
0
 public void ConnectRouteToCell(Procescell cell, Route route)
 {
     OrderObservableList.AddSorted(cell.Routes, route);
     route.ProcesCell = cell;
 }
Esempio n. 18
0
 public void RemoveRouteFromCell(Procescell cell, Route route)
 {
     cell.Routes.Remove(route);
     route.ProcesCell = null;
 }
 private void OpenCreateSubrouteWindow(Procescell procescell)
 {
     _MainView.OpenCreateSubrouteWindow(procescell);
 }