variables for RO Reports and for UseOnFirstPageOnly logic

This commit is contained in:
John Jenko 2012-09-13 19:55:06 +00:00
parent 8ffe532d44
commit 80e72fbbb0

View File

@ -1245,6 +1245,13 @@ namespace VEPROMS.CSLA.Library
get { return _SearchAnnotationType; }
}
#endregion
#region Reports
internal string _FoundROID;
public string FoundROID
{
get { return _FoundROID; }
}
#endregion
#region ProcedureConfig
[NonSerialized]
private ProcedureConfig _ProcedureConfig = null;
@ -1884,42 +1891,55 @@ namespace VEPROMS.CSLA.Library
_ActiveSection = value;
}
}
//private int _PageNumForDocStyle = 0;
//public int PageNumForDocStyle
//{
// get { return _PageNumForDocStyle; }
// set { _PageNumForDocStyle = value; }
//}
private bool _DidFirstPageDocStyle = false;
public bool DidFirstPageDocStyle
{
get { return _DidFirstPageDocStyle; }
set
{
if (!_DidFirstPageDocStyle)
{
_DidFirstPageDocStyle = value;
_MyDocStyle = null;
}
}
}
private DocStyle _MyDocStyle;
//private DocStyle _MyDocStyleOtherThanFirstPage;
private DocStyle _MyDocStyleOtherThanFirstPage;
public DocStyle MyDocStyle
{
get
{
ItemInfo prevSection = (ActiveSection != null) ? ActiveSection.MyPrevious : null;
if (_MyDocStyle == null && ActiveSection != null)
//if ((_MyDocStyle == null && ActiveSection != null) ||
// (!_DidFirstPageDocStyle &&
// _MyDocStyle.IsStepSection &&
// prevSection != null &&
// ((SectionConfig)ActiveSection.MyConfig).Section_Pagination == SectionConfig.SectionPagination.Continuous))
{
int typ = (int)ActiveSection.MyContent.Type;
int subtyp = typ % 10000;
_MyDocStyle = ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp];
// if (((MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) != 0) && PageNumForDocStyle > 1)
// {
// if (_MyDocStyleOtherThanFirstPage == null)
// {
// foreach (DocStyle ds in ActiveFormat.PlantFormat.DocStyles.DocStyleList)
// {
// if ((ds.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) != 0)
// {
// _MyDocStyleOtherThanFirstPage = ds;
// break;
// }
// }
// }
// }
if (((_MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) != 0) && _DidFirstPageDocStyle)
{
if (_MyDocStyleOtherThanFirstPage == null)
{
foreach (DocStyle ds in ActiveFormat.PlantFormat.DocStyles.DocStyleList)
{
if ((ds.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) != 0)
{
_MyDocStyleOtherThanFirstPage = ds;
break;
}
}
}
}
}
//if (PageNumForDocStyle <= 1)
if (_MyDocStyleOtherThanFirstPage == null)
return _MyDocStyle;
//else
// return _MyDocStyleOtherThanFirstPage;
else
return _MyDocStyleOtherThanFirstPage;
}
}
private FormatInfo _ActiveFormat = null;
@ -3137,6 +3157,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
string FoundROs = "";
while (dr.Read())
{
ItemInfo itemInfo = null;
@ -3294,6 +3315,110 @@ namespace VEPROMS.CSLA.Library
this.RaiseListChangedEvents = true;
}
#endregion
#region RO Reports
public static ItemInfoList GetListFromROReport(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
{
try
{
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROReportCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix));
ItemInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
}
}
[Serializable()]
private class ItemListROReportCriteria
{
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
private string _StepTypeList;
public string StepTypeList
{
get { return _StepTypeList; }
set { _StepTypeList = value; }
}
private string _ROSearchString;
public string ROSearchString
{
get { return _ROSearchString; }
set { _ROSearchString = value; }
}
private string _UnitPrefix;
public string UnitPrefix
{
get { return _UnitPrefix; }
set { _UnitPrefix = value; }
}
public ItemListROReportCriteria(string docVersionList, string stepTypeList, string roSearchString, string unitPrefix)
{
_DocVersionList = docVersionList;
_StepTypeList = stepTypeList;
_ROSearchString = roSearchString;
_UnitPrefix = unitPrefix;
}
}
private void DataPortal_Fetch(ItemListROReportCriteria criteria)
{
this.RaiseListChangedEvents = false;
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_GetROUsagesByProcedure";
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList);
cm.Parameters.AddWithValue("@ROSearchString", criteria.ROSearchString);
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
string FoundROs = "";
while (dr.Read())
{
ItemInfo itemInfo = null;
int itemType = dr.GetInt32("Type") / 10000;
switch (itemType)
{
case 0:
itemInfo = new ProcedureInfo(dr);
break;
case 1:
itemInfo = new SectionInfo(dr);
break;
default:
itemInfo = new StepInfo(dr);
break;
}
itemInfo.AddContent(dr);
itemInfo._SearchDVPath = dr.GetString("DVPath");
itemInfo._SearchPath = dr.GetString("Path");
itemInfo._FoundROID = dr.GetString("FoundROID");
IsReadOnly = false;
this.Add(itemInfo);
IsReadOnly = true;
}
}
}
}
}
catch (Exception ex)
{
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
}
#endregion
#region ProcedureInfo