コード例 #1
0
        public ViewResult Index(long id /*logical object identifier*/, long deviceid /*physical device identifier*/,
                                long logicaldeviceid)
        {
            try
            {
                ViewBag.DeviceID        = deviceid;
                ViewBag.ObjectID        = id;
                ViewBag.LogicalDeviceID = logicaldeviceid;

                Guid userId = GetUserId();

                ViewDevice viewdevice = _deviceRepository.GetDevice(deviceid, userId);
                ViewBag.DeviceName = viewdevice.Name;

                ViewDeviceType viewdevicetype = _deviceTypeRepository.GetDeviceType(viewdevice.TypeID, userId);
                ViewBag.DeviceTypeName = viewdevicetype.Description.TrimEnd();

                ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(id, userId);
                ViewBag.ObjectName = viewcosemobject.COSEMLogicalName;

                List <ViewCOSEMAttributeValue> viewcosemattribute =
                    _cosemAttributeRepository.GetCosemAttributeValueList(deviceid, viewcosemobject.ID,
                                                                         viewcosemobject.COSEMClassID, userId);
                return(View(viewcosemattribute));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
コード例 #2
0
ファイル: COSEMObjectEntities.cs プロジェクト: dvmorozov/sgs
 public void UpdateCosemObject(ViewCOSEMObject viewCosemObjecttype, Guid userId)
 {
     Trace.Assert(_db != null);
     Trace.Assert(viewCosemObjecttype != null);
     _db.UpdateCOSEMObject(viewCosemObjecttype.ID, viewCosemObjecttype.COSEMLogicalDeviceID, viewCosemObjecttype.COSEMClassID, viewCosemObjecttype.DeviceTypeID, viewCosemObjecttype.COSEMLogicalName,
                           userId);
 }
コード例 #3
0
ファイル: COSEMObjectEntities.cs プロジェクト: dvmorozov/sgs
        public ViewCOSEMObject GetCosemObject(Int64 id, Guid userId)
        {
            Trace.Assert(_db != null);
            ObjectSet <ViewCOSEMObject> os     = _db.ViewCOSEMObject;
            ViewCOSEMObject             result = os.Single(t => (t.ID == id) && ((t.DataOwnerID == userId) || t.Standard));

            return(result);
        }
コード例 #4
0
        private void FillAssignIdentifierViewBag(long objectid)
        {
            Guid            userId          = GetUserId();
            ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(objectid, userId);
            ViewDeviceType  vdt             = _deviceTypeRepository.GetDeviceType(viewcosemobject.DeviceTypeID, userId);

            ViewBag.DeviceTypeName  = vdt.Description.TrimEnd();
            ViewBag.COSEMObjectName = viewcosemobject.COSEMLogicalName.TrimEnd();
            ViewBag.COSEMObjectID   = objectid;
        }
コード例 #5
0
 public ActionResult Delete(long id /*the identifier of COSEM object*/)
 {
     try
     {
         ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(id, GetUserId());
         return(View(viewcosemobject));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
コード例 #6
0
 public ActionResult Edit(long id /*the identifier of COSEM object*/)
 {
     try
     {
         ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(id, GetUserId());
         FillCreateEditViewBag(viewcosemobject.COSEMLogicalDeviceID);
         return(View(viewcosemobject));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
コード例 #7
0
 public ActionResult DeleteConfirmed(long id /*the identifier of COSEM object*/)
 {
     try
     {
         Guid            userId          = GetUserId();
         ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(id, userId);
         _cosemObjectRepository.DeleteCosemObject(id, userId);
         return(RedirectToAction("Index/" + viewcosemobject.COSEMLogicalDeviceID));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
コード例 #8
0
        private void FillCommonViewBag(long id /*the identifier of COSEM object*/)
        {
            //  some other things are filled that impossible to pass through model object.
            ViewCOSEMObject viewcosemobject = _cosemObjectRepository.GetCosemObject(id, GetUserId());

            ViewBag.LogicalDeviceID = viewcosemobject.COSEMLogicalDeviceID;
            ViewCOSEMLogicalDevice viewcosemlogicaldevice =
                _cosemLogicaDeviceRepository.GetCosemLogicalDevice(viewcosemobject.COSEMLogicalDeviceID, GetUserId());

            ViewDeviceType vdt = _deviceTypeRepository.GetDeviceType(viewcosemlogicaldevice.DeviceTypeID, GetUserId());

            ViewBag.DeviceTypeName = vdt.Description.TrimEnd();
            //  for using in the "Attributes" page.
            ViewBag.COSEMObjectID       = id;
            ViewBag.COSEMObjectName     = viewcosemobject.COSEMLogicalName.TrimEnd();
            ViewBag.COSEMObjectStandard = viewcosemobject.Standard;
        }
コード例 #9
0
 public ActionResult Edit(ViewCOSEMObject viewcosemobject)
 {
     try
     {
         if (viewcosemobject != null)
         {
             if (ModelState.IsValid)
             {
                 _cosemObjectRepository.UpdateCosemObject(viewcosemobject, GetUserId());
                 return(RedirectToAction("Index/" + viewcosemobject.COSEMLogicalDeviceID.ToString(CultureInfo.InvariantCulture)));
             }
             FillCreateEditViewBag(viewcosemobject.COSEMLogicalDeviceID);
         }
         return(View(viewcosemobject));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
コード例 #10
0
 public ActionResult Create(long id /*the identifier of COSEM logical device*/)
 {
     try
     {
         FillCreateEditViewBag(id);
         //  all necessary fields should be filled here, because this is suitable for filling hidden form fields.
         var viewcosemobject = new ViewCOSEMObject {
             COSEMLogicalDeviceID = id
         };
         Guid userId = GetUserId();
         ViewCOSEMLogicalDevice viewcosemlogicaldevice = _cosemLogicaDeviceRepository.GetCosemLogicalDevice(id,
                                                                                                            userId);
         ViewDeviceType vdt = _deviceTypeRepository.GetDeviceType(viewcosemlogicaldevice.DeviceTypeID, userId);
         viewcosemobject.DeviceTypeID = vdt.ID;
         return(View(viewcosemobject));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
コード例 #11
0
ファイル: COSEMObjectEntities.cs プロジェクト: dvmorozov/sgs
 public void AddCosemObject(ViewCOSEMObject viewCosemObject, Guid userId)
 {
     CosemObjectRowAffected++;
 }
コード例 #12
0
ファイル: COSEMObjectEntities.cs プロジェクト: dvmorozov/sgs
 public void AddCosemObject(ViewCOSEMObject viewCosemObject, Guid userId)
 {
     Trace.Assert(_db != null);
     Trace.Assert(viewCosemObject != null);
     _db.AddCOSEMObject(viewCosemObject.COSEMLogicalDeviceID, viewCosemObject.COSEMClassID, viewCosemObject.DeviceTypeID, viewCosemObject.COSEMLogicalName, userId);
 }
コード例 #13
0
ファイル: COSEMObjectEntities.cs プロジェクト: dvmorozov/sgs
 public void UpdateCosemObject(ViewCOSEMObject viewCosemObjecttype, Guid userId)
 {
 }