Added GetByName method to AnnotationTypeInfo class

Added code to manage checking out a folder to allow for exporting or importing docversions
Added new commands TurnChangeManagerOff and TurnChangeManagerOn.
This commit is contained in:
Rich
2014-06-14 01:15:45 +00:00
parent ad7307ab87
commit adf9d6d19c
2 changed files with 151 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ namespace VEPROMS.CSLA.Library
{
return _Name;
}
}
}
public partial class AnnotationTypeInfo
{
public static List<AnnotationTypeInfo> AllList()
@@ -65,7 +65,69 @@ namespace VEPROMS.CSLA.Library
{
return _Name;
}
}
public static AnnotationTypeInfo GetByName(string name)
{
try
{
AnnotationTypeInfo tmp = DataPortal.Fetch<AnnotationTypeInfo>(new GetByNameCriteria(name));
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up AnnotationTypeInfo
tmp = null;
}
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on AnnotationTypeInfo.GetByName", ex);
}
}
[Serializable()]
protected class GetByNameCriteria
{
private string _Name;
public string Name { get { return _Name; } }
public GetByNameCriteria(string name)
{
_Name = name;
}
}
private void DataPortal_Fetch(GetByNameCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
ApplicationContext.LocalContext["cn"] = cn;
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getAnnotationTypeByName";
cm.Parameters.AddWithValue("@Name", criteria.Name);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
if (!dr.Read())
{
_ErrorMessage = "No Record Found";
return;
}
ReadData(dr);
}
}
// removing of item only needed for local data portal
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
ApplicationContext.LocalContext.Remove("cn");
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.DataPortal_Fetch", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("AnnotationTypeInfo.DataPortal_Fetch", ex);
}
}
}
public partial class AnnotationTypeInfoList
{
public static void Refresh()