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")); } }
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); }
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); }
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; }
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")); } }
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")); } }
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")); } }
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; }
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")); } }
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")); } }
public void AddCosemObject(ViewCOSEMObject viewCosemObject, Guid userId) { CosemObjectRowAffected++; }
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); }
public void UpdateCosemObject(ViewCOSEMObject viewCosemObjecttype, Guid userId) { }