Exemple #1
0
    public COMPONENT[] GetComponentsInChildrenOnly <COMPONENT>() where COMPONENT : UnityEngine.Component
    {
        COMPONENT[] arrCompoAll = GetComponentsInChildren <COMPONENT>(true);

        int iCount = 0;

        for (int i = 0; i < arrCompoAll.Length; i++)
        {
            if (arrCompoAll[i].transform != transform)
            {
                iCount++;
            }
        }

        // Array는 동적으로 Item 추가가 안되기 때문에 카운트를 센 후 Init후 사용
        int iIndex = 0;

        COMPONENT[] arrCompoChildren = new COMPONENT[iCount];
        for (int i = 0; i < arrCompoAll.Length; i++)
        {
            if (arrCompoAll[i].transform != transform)
            {
                arrCompoChildren[iIndex++] = arrCompoAll[i];
            }
        }

        return(arrCompoChildren);
    }
        public static COMPONENT Get <COMPONENT>() where COMPONENT : Component
        {
            COMPONENT returnObject = null;
            Type      retrieveType = typeof(COMPONENT);

            if (Instance != null)
            {
                // Check if the component is in the cache
                if (Instance.mCacheRetrievedComponent.ContainsKey(retrieveType) == true)
                {
                    // If so, return that
                    returnObject = Instance.mCacheRetrievedComponent[retrieveType] as COMPONENT;
                }
                else
                {
                    // Attempt to grab a component from children
                    returnObject = Instance.GetComponentInChildren <COMPONENT>();
                    if (returnObject != null)
                    {
                        // If return object is not null, cache it
                        Instance.mCacheRetrievedComponent.Add(retrieveType, returnObject);
                    }
                }
            }
            return(returnObject);
        }
Exemple #3
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }


            Entities db = new Entities();
            //COMPONENT comp = componentRepository.GetAllList().First(x => x.ID.Equals(id));
            COMPONENT comp = db.COMPONENT.Find(Convert.ToDecimal(id));


            var n = new ComponentViewModel()
            {
                ID_MODEL       = comp.ID_MODEL,
                ID_TYPE        = comp.ID_TYPE,
                ID_SERIES      = comp.ID_SERIES,
                DATE_ADD       = comp.DATE_ADD,
                PARTNUMBER     = comp.PARTNUMBER,
                CURRENT_STATUS = comp.CURRENT_STATUS,
                MODEL          = comp.MODEL,
                TYPE           = comp.TYPE,
                currentStatus  = comp.CURRENT_STATUS.Where(x => x.ID_COMPLECT.Equals(Convert.ToDecimal(id)))
                                 .OrderByDescending(x => x.DATE_STATUS).FirstOrDefault().STATUS.NAME,
                currentCoast = comp.MODEL.PRICE.Where(x => x.ID_MODEL.Equals(Convert.ToDecimal(comp.ID_MODEL)))
                               .OrderByDescending(x => x.DATE_ADD).FirstOrDefault().COAST
            };

            return(View(n));
        }
Exemple #4
0
        public ActionResult StatusChange(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            COMPONENT component = componentRepository.GetAllList().
                                  FirstOrDefault(x => x.ID.Equals(Convert.ToDecimal(id)));

            if (component == null)
            {
                return(HttpNotFound());
            }

            decimal status = component.CURRENT_STATUS.Where(x => x.ID_COMPLECT.Equals(component.ID))
                             .OrderByDescending(x => x.DATE_STATUS).FirstOrDefault().ID_STATUS;
            string statusName = component.CURRENT_STATUS.Where(x => x.ID_COMPLECT.Equals(component.ID))
                                .OrderByDescending(x => x.DATE_STATUS).FirstOrDefault().STATUS.NAME;

            CurrentStatusViewModel modelData = new CurrentStatusViewModel()
            {
                ID          = component.ID,
                ID_COMPLECT = component.ID,
                ID_STATUS   = status,
                statusList  = getList.getStatusSelectList()
            };

            return(View(modelData));
        }
Exemple #5
0
 public ActionResult Edit(COMPONENT component)
 {
     if (ModelState.IsValid)
     {
         componentRepository.Update(component);
         componentRepository.Save();
         return(RedirectToAction("Index"));
     }
     return(View(component));
 }
Exemple #6
0
        // Get: Edit
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            COMPONENT component = componentRepository.GetAllList().FirstOrDefault(x => x.ID.Equals(id));

            if (component == null)
            {
                return(HttpNotFound());
            }
            return(View(component));
        }
Exemple #7
0
        private static void LogCOMPONENT(COMPONENT comp, string logHeader)
        {
            string componentHeader = logHeader + "COMPONENT ";

            Log.Trace(componentHeader + "sn=" + comp.sn);
            Log.Trace(componentHeader + "uid=" + comp.uid);
            Log.Trace(componentHeader + "componentType=" + comp.componentType);
            Log.Trace(componentHeader + "componentCode=" + comp.componentCode);
            Log.Trace(componentHeader + "partNumber=" + comp.partNumber);
            Log.Trace(componentHeader + "manufacturerCode=" + comp.manufacturerCode);
            LogSpecifiedDate(comp.manufacturedDate, comp.manufacturedDateSpecified, componentHeader, "manufacturedDate");
            LogSpecifiedDate(comp.setupDate, comp.setupDateSpecified, componentHeader, "setupDate");

            // indent properties and cylinders
            logHeader = componentHeader + "    ";

            LogPROPERTIES(comp.property, logHeader);
        }
    public static COMPONENT Get <COMPONENT>() where COMPONENT : Component
    {
        COMPONENT returnObject = null;
        Type      retrieveType = typeof(COMPONENT);

        if (msInstance != null)
        {
            if (msInstance.mCacheRetrievedComponent.ContainsKey(retrieveType) == true)
            {
                returnObject = msInstance.mCacheRetrievedComponent [retrieveType] as COMPONENT;
            }
            else
            {
                returnObject = msInstance.GetComponentInChildren <COMPONENT> ();
                msInstance.mCacheRetrievedComponent.Add(retrieveType, returnObject);
            }
        }
        return(returnObject);
    }
Exemple #9
0
        // Get: Edit
        public ActionResult Edit(int?id)
        {
            Entities  db   = new Entities();
            COMPONENT comp = db.COMPONENT.Find(id);

            var n = new ComponentViewModel()
            {
                listType   = new SelectList(db.TYPE, "ID", "NAME"),
                listModel  = new SelectList(db.MODEL, "ID", "NAME"),
                listStatus = new SelectList(db.STATUS, "ID", "NAME"),
                ID_MODEL   = comp.ID_MODEL,
                ID_TYPE    = comp.ID_TYPE,
                ID_SERIES  = comp.ID_SERIES,
                DATE_ADD   = comp.DATE_ADD,
                PARTNUMBER = comp.PARTNUMBER,
            };

            return(View(n));
        }