public JsonResult Share(int id) { Note note = _notebookBLL.ShareNot(id); ModelNote model = new ModelNote() { ID = note.ID, Name = note.Name, Description = note.Description, Share = note.Share }; return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetNote(int id) { Note note = _notebookBLL.GetNote(id, true); ModelNote model = new ModelNote() { ID = note.ID, Name = note.Name, Description = note.Description, DateOfCration = note.DateOfCration.ToShortDateString(), Hit = note.Hit }; return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult Favorite(int id) { Note note = _notebookBLL.Favorite(id); ModelNote model = new ModelNote() { ID = note.ID, Name = note.Name, Description = note.Description, Flag = note.Flag }; return(Json(model, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Called as the pointer is moved over potential targets after a source is selected /// So should be pretty quick /// </summary> /// <remarks> /// The cursor can change dependant on CanCreateConnection when this returns true /// </remarks> /// <param name="sourceShapeElement">ShapeElement</param> /// <param name="targetShapeElement">ShapeElement</param> /// <returns></returns> public override bool IsValidSourceAndTarget(ShapeElement sourceShapeElement, ShapeElement targetShapeElement) { ModelNoteConnectAction action = (sourceShapeElement.Diagram as ORMDiagram).ModelNoteConnectAction; ORMModelElement sourceElement; ORMModelElement targetElement; if (null != (sourceElement = action.mySourceElement) && null != (targetElement = ElementFromShape <ORMModelElement>(targetShapeElement))) { ModelNote note = null; if (null == (note = sourceElement as ModelNote)) { if (null != (note = targetElement as ModelNote)) { // Switch the source and target targetElement = sourceElement; } } if (note != null) { FactType factType; ObjectType objectType; SetConstraint setConstraint; SetComparisonConstraint setComparisonConstraint; if (null != (factType = targetElement as FactType)) { return(!note.FactTypeCollection.Contains(factType)); } else if (null != (objectType = targetElement as ObjectType)) { return(!note.ObjectTypeCollection.Contains(objectType)); } else if (null != (setConstraint = targetElement as SetConstraint)) { return(!setConstraint.Constraint.ConstraintIsInternal && !note.SetConstraintCollection.Contains(setConstraint)); } else if (null != (setComparisonConstraint = targetElement as SetComparisonConstraint)) { return(!note.SetComparisonConstraintCollection.Contains(setComparisonConstraint)); } } } return(false); }
/// <summary> /// Create a connection between an ModelNoteShape and a FactType or ObjectType. /// </summary> /// <param name="sourceShapeElement">The source of the requested connection</param> /// <param name="targetShapeElement">The target of the requested connection</param> /// <param name="paintFeedbackArgs">PaintFeedbackArgs</param> public override void CreateConnection(ShapeElement sourceShapeElement, ShapeElement targetShapeElement, PaintFeedbackArgs paintFeedbackArgs) { ModelNoteConnectAction action = (sourceShapeElement.Diagram as ORMDiagram).ModelNoteConnectAction; ORMModelElement sourceElement; ORMModelElement targetElement; if (null != (sourceElement = action.mySourceElement) && null != (targetElement = ElementFromShape <ORMModelElement>(targetShapeElement))) { ModelNote note = null; if (null == (note = sourceElement as ModelNote)) { if (null != (note = targetElement as ModelNote)) { // Switch the source and target targetElement = sourceElement; } } if (note != null) { FactType factType; ObjectType objectType; SetConstraint setConstraint; SetComparisonConstraint setComparisonConstraint; if (null != (factType = targetElement as FactType)) { new ModelNoteReferencesFactType(note, factType); } else if (null != (objectType = targetElement as ObjectType)) { new ModelNoteReferencesObjectType(note, objectType); } else if (null != (setConstraint = targetElement as SetConstraint)) { new ModelNoteReferencesSetConstraint(note, setConstraint); } else if (null != (setComparisonConstraint = targetElement as SetComparisonConstraint)) { new ModelNoteReferencesSetComparisonConstraint(note, setComparisonConstraint); } } } }