Added code to prevent user from importing a procedure set more than once.

This commit is contained in:
Rich 2014-06-24 02:02:41 +00:00
parent d194f751d9
commit bb6d3827c4
2 changed files with 14 additions and 0 deletions

View File

@ -180,6 +180,11 @@ namespace DataLoader
xd.Load(fn);
LoadFormats(xd);
Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd);
if (ff == null)
{
MessageBox.Show("You can not import the same procedure set more than once", "Duplicate Import Error");
return;
}
_MyNewFolder = FolderInfo.Get(ff.FolderID);
AddAnnotationTypes(xd);
DocVersionInfo dvi = AddDocVersion(ff, xd);
@ -1825,6 +1830,8 @@ namespace DataLoader
DateTime dts = DateTime.Parse(xd.DocumentElement.Attributes.GetNamedItem("dts").InnerText);
string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText;
Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid));
if (Folder.GetByParentID_Name(p.FolderID, name) != null)
return null;
Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, format, null, dts, usrid);
return f;
}

View File

@ -180,6 +180,11 @@ namespace VEPROMS
xd.Load(fn);
LoadFormats(xd);
Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd);
if (ff == null)
{
MessageBox.Show("You can not import the same procedure set more than once", "Duplicate Import Error");
return;
}
_MyNewFolder = FolderInfo.Get(ff.FolderID);
AddAnnotationTypes(xd);
DocVersionInfo dvi = AddDocVersion(ff, xd);
@ -1825,6 +1830,8 @@ namespace VEPROMS
DateTime dts = DateTime.Parse(xd.DocumentElement.Attributes.GetNamedItem("dts").InnerText);
string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText;
Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid));
if (Folder.GetByParentID_Name(p.FolderID, name) != null)
return null;
Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, format, null, dts, usrid);
return f;
}