Delete Empty CPS Annotation

This commit is contained in:
Rich 2016-04-21 20:21:18 +00:00
parent ca12e39a6b
commit 09331fa227

View File

@ -496,21 +496,34 @@ namespace Volian.Controls.Library
if(ai != null) // Update existing Annotation if(ai != null) // Update existing Annotation
using(Annotation aa = Annotation.Get(ai.AnnotationID)) using(Annotation aa = Annotation.Get(ai.AnnotationID))
{ {
aa.Config=config; if (config == "")
aa.DTS=DateTime.Now; {
aa.UserID = Volian.Base.Library.VlnSettings.UserID; Annotation.DeleteAnnotation(ai);
aa.Save(); UpdateAnnotationGrid();
AnnotationInfo.Refresh(aa); }
else
{
aa.Config = config;
aa.DTS = DateTime.Now;
aa.UserID = Volian.Base.Library.VlnSettings.UserID;
aa.Save();
AnnotationInfo.Refresh(aa);
UpdateAnnotationGrid();
}
} }
else // Add a new Annotation else // Add a new Annotation
{ {
using(Item myItem = Item.Get(itemID )) if (config != "")
{ {
using (AnnotationType myType = AnnotationType.Get(ExeType)) using (Item myItem = Item.Get(itemID))
{ {
using (Annotation annotation = Annotation.MakeAnnotation(myItem, myType,null, "New",config)) using (AnnotationType myType = AnnotationType.Get(ExeType))
{ {
annotation.Save(); using (Annotation annotation = Annotation.MakeAnnotation(myItem, myType, null, "New", config))
{
annotation.Save();
UpdateAnnotationGrid();
}
} }
} }
} }