Created a GetAllFormats Stored Procedure for Update Formats
Use new Stored Procedure to get all formats including those designation unused
This commit is contained in:
@@ -22,6 +22,21 @@ using System.Collections.Generic;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// B2018-078 Update Formats needs to include unused formats
|
||||
[Serializable()]
|
||||
public class CriteriaAllFormats
|
||||
{
|
||||
bool _AllFormats;
|
||||
public bool AllFormats
|
||||
{
|
||||
get { return _AllFormats; }
|
||||
set { _AllFormats = value; }
|
||||
}
|
||||
public CriteriaAllFormats(bool allFormats)
|
||||
{
|
||||
_AllFormats = allFormats;
|
||||
}
|
||||
}
|
||||
public partial class Format
|
||||
{
|
||||
public static Format GetJustFormat(int formatID)
|
||||
@@ -219,7 +234,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_LookupFormats == null)
|
||||
{
|
||||
_LookupFormats = new Dictionary<string, int>();
|
||||
FormatInfoList allFormats = FormatInfoList.Get();
|
||||
FormatInfoList allFormats = FormatInfoList.GetAll(); // B2018-078 Update Formats needs to include unused formats
|
||||
foreach (FormatInfo myFormat in allFormats)
|
||||
{
|
||||
_LookupFormats.Add(myFormat.Name.ToUpper(), myFormat.FormatID);
|
||||
@@ -303,8 +318,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!LookupFormats.ContainsKey(fname.ToUpper()))
|
||||
{
|
||||
rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, fmtfi.LastWriteTimeUtc, Userid);
|
||||
}
|
||||
rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, fmtfi.LastWriteTimeUtc, Userid);
|
||||
}
|
||||
else
|
||||
{
|
||||
rec = Format.Get(LookupFormats[fname.ToUpper()]);
|
||||
@@ -535,6 +550,51 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public partial class FormatInfoList
|
||||
{
|
||||
/// <summary>
|
||||
/// B2018-078 Return a list of all FormatInfo Including Unused.
|
||||
/// </summary>
|
||||
public static FormatInfoList GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
FormatInfoList tmp = DataPortal.Fetch<FormatInfoList>(new CriteriaAllFormats(true));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on FormatInfoList.GetAll", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(CriteriaAllFormats myCrit)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getAllFormats";
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new FormatInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("FormatInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
|
||||
private static Csla.SortedBindingList<FormatInfo> _SortedFormatInfoList;
|
||||
public static Csla.SortedBindingList<FormatInfo> SortedFormatInfoList
|
||||
{
|
||||
|
Reference in New Issue
Block a user