This commit is contained in:
Kathy Ruffing 2010-07-14 13:19:15 +00:00
parent d463f2c637
commit 2bf01da344

View File

@ -1,209 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using VEPROMS.CSLA.Library;
namespace PrintMSWord
{
[XmlRoot("Proms2010Print")]
[Serializable()]
public class Proms2010Print
{
private string _PROMS16_Folder;
[XmlAttribute("PROMS16_Folder")]
public string PROMS16_Folder
{
get { return _PROMS16_Folder; }
set { _PROMS16_Folder = value; }
}
private Proms2010Procedures _Procedures;
//[XmlElement("Procedures")]
public Proms2010Procedures Procedures
{
get { return _Procedures; }
set { _Procedures = value; }
}
public Proms2010Procedure GetProcedure(ProcedureInfo myProc)
{
return Procedures.GetProcedure(myProc);
}
}
public class Proms2010Procedures : List<Proms2010Procedure>
{
public Proms2010Procedure GetProcedure(ProcedureInfo myProc)
{
foreach (Proms2010Procedure proc in this)
if (proc.ItemID == myProc.ItemID) return proc;
return null;
}
}
public class Proms2010Procedure
{
public Proms2010Procedure()
{ ;}
public Proms2010Procedure(ProcedureInfo myProc)
{
ItemID = myProc.ItemID;
Number = myProc.DisplayNumber;
Title = myProc.DisplayText;
Sections = Proms2010Sections.GetSections(myProc);
}
private int _ItemID;
[XmlAttribute("ItemID")]
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
private string _Number;
[XmlAttribute("Number")]
public string Number
{
get { return _Number; }
set { _Number = value; }
}
private string _Title;
[XmlAttribute("Title")]
public string Title
{
get { return _Title; }
set { _Title = value; }
}
private int _PageCount;
[XmlAttribute("PageCount")]
public int PageCount
{
get { return _PageCount; }
set
{
if (Sections != null)
Sections.FixPageCount(value);
_PageCount = value;
}
}
private string _Rev;
[XmlAttribute("Rev")]
public string Rev
{
get { return _Rev; }
set { _Rev = value; }
}
private string _RevDate;
[XmlAttribute("RevDate")]
public string RevDate
{
get { return _RevDate; }
set { _RevDate = value; }
}
private Proms2010Sections _Sections;
[XmlElement("Sections")]
public Proms2010Sections Sections
{
get { return _Sections; }
set { _Sections = value; }
}
public Proms2010Section GetSection(SectionInfo mySection)
{
return Sections.GetSection(mySection);
}
}
public class Proms2010Sections : List<Proms2010Section>
{
public static Proms2010Sections GetSections(ProcedureInfo proc)
{
Proms2010Sections sections = new Proms2010Sections();
foreach (SectionInfo mySection in proc.Sections)
sections.Add(new Proms2010Section(mySection));
return sections;
}
public int TotalPages
{
get
{
int retval = 0;
foreach (Proms2010Section section in this)
retval += section.PageCount;
return retval;
}
}
public void FixPageCount(int total)
{
int stepPages = total - TotalPages;
foreach (Proms2010Section section in this)
if (section.PageCount == 0)
{
section.PageCount = stepPages;
break;
}
FixStartingPages();
}
public void FixStartingPages()
{
int pageCount = 0;
foreach (Proms2010Section section in this)
{
section.StartingPage = pageCount;
pageCount += section.PageCount;
}
}
public Proms2010Section GetSection(SectionInfo mySection)
{
foreach (Proms2010Section section in this)
if (section.ItemID == mySection.ItemID)
return section;
return null;
}
}
public class Proms2010Section
{
public Proms2010Section()
{ ;}
public Proms2010Section(SectionInfo mySection)
{
ItemID = mySection.ItemID;
Number = mySection.DisplayNumber;
Title = mySection.DisplayText;
if (mySection.MyContent.MyEntry != null) // MSWord Section
PageCount = (int)Math.Ceiling(double.Parse(mySection.SectionConfig.Section_NumPages));
else // Step Section
PageCount = 0;
}
private int _ItemID;
[XmlAttribute("ItemID")]
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
private string _Number;
[XmlAttribute("Number")]
public string Number
{
get { return _Number; }
set { _Number = value; }
}
private string _Title;
[XmlAttribute("Title")]
public string Title
{
get { return _Title; }
set { _Title = value; }
}
private int _PageCount;
[XmlAttribute("PageCount")]
public int PageCount
{
get { return _PageCount; }
set { _PageCount = value; }
}
private int _StartingPage = 0;
[XmlAttribute("StartingPage")]
public int StartingPage
{
get { return _StartingPage; }
set { _StartingPage = value; }
}
}
}