Use FormatInfo rather than Format object
This commit is contained in:
parent
c5d2578ee9
commit
8804d367da
@ -121,7 +121,7 @@ namespace DataLoader
|
||||
}
|
||||
}
|
||||
}
|
||||
public Format GetFormat(string format)
|
||||
public FormatInfo GetFormat(string format)
|
||||
{
|
||||
Format parent = null;
|
||||
Format rec = null;
|
||||
@ -153,7 +153,8 @@ namespace DataLoader
|
||||
{
|
||||
log.ErrorFormat("Error getting xml version of format {0}", ex.Message);
|
||||
}
|
||||
return rec;
|
||||
FormatInfo recInfo = FormatInfo.Get(rec.FormatID);
|
||||
return recInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,14 +98,16 @@ namespace DataLoader
|
||||
myReader.Close();
|
||||
}
|
||||
Folder tmpfld = (Folder)parfld;
|
||||
Format format = null;
|
||||
FormatInfo format = null;
|
||||
if (defPlantFmt != null && defPlantFmt != "")
|
||||
{
|
||||
format = GetFormat(defPlantFmt);
|
||||
}
|
||||
else
|
||||
format = Format.Get(1);
|
||||
DocVersion v = DocVersion.MakeDocVersion(tmpfld, (int)DocVersionType(vb.Path.ToLower()), thetitle, vb.Path.ToLower(), null, format, fld_cfg == null ? null : fld_cfg.ToString(), DateTime.Now, "Migration");
|
||||
format = FormatInfo.Get(1);
|
||||
DocVersion v;
|
||||
using(Format fmt = format.Get())
|
||||
v = DocVersion.MakeDocVersion(tmpfld, (int)DocVersionType(vb.Path.ToLower()), thetitle, vb.Path.ToLower(), null, fmt, fld_cfg == null ? null : fld_cfg.ToString(), DateTime.Now, "Migration");
|
||||
tn.Tag = v;
|
||||
MigrateDocVersion(v, false);
|
||||
return (object)v;
|
||||
|
@ -120,7 +120,7 @@ namespace DataLoader
|
||||
EditSectId = 0;
|
||||
|
||||
// See if no caret convert...
|
||||
Format docverFormat = docver.ActiveFormat;
|
||||
FormatInfo docverFormat = docver.MyDocVersionInfo.ActiveFormat;
|
||||
bool do_cvt = docverFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;
|
||||
// pass in a 0 on MakeContent for type of procedure, i.e. procedure = 0 (on type field)
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace DataLoader
|
||||
frmMain.UpdateLabels(0, 1, 0);
|
||||
try
|
||||
{
|
||||
Format format = null;
|
||||
FormatInfo format = null;
|
||||
|
||||
// Tie the section to format used, this will add the format xml if it doesn't exist in
|
||||
// the database yet. Note that if there is no format at this level then none should
|
||||
@ -81,7 +81,9 @@ namespace DataLoader
|
||||
if (Userid == null || Userid == "") Userid = "Migration";
|
||||
|
||||
// test for performance
|
||||
Content cont = Content.New(Number, Title, 10000+docstyleindx, format, ci==null?null:ci.ToString(), Dts, Userid);
|
||||
Content cont;
|
||||
using(Format fmt2 = format == null ? null : format.Get())
|
||||
cont = Content.New(Number, Title, 10000+docstyleindx, fmt2, ci==null?null:ci.ToString(), Dts, Userid);
|
||||
Entry entry = cont.MyEntry;
|
||||
if (needEntry)
|
||||
{
|
||||
@ -186,7 +188,7 @@ namespace DataLoader
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private int GetDocStyleIndx(string dstyleindx, Format format, Item procitem, DocVersion docver)
|
||||
private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, DocVersion docver)
|
||||
{
|
||||
// get the format, if format is set, use it, otherwise walk
|
||||
if (format == null)
|
||||
@ -200,29 +202,30 @@ namespace DataLoader
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private Format GetFormat(Item procitem, DocVersion docver)
|
||||
private FormatInfo GetFormat(Item procitem, DocVersion docver)
|
||||
{
|
||||
while (procitem.MyContent.MyFormat == null)
|
||||
{
|
||||
// find the first sibling
|
||||
while (procitem.PreviousID != null)
|
||||
procitem = procitem.MyPrevious;
|
||||
if (procitem.ItemPartCount == 0) return GetFormat(docver);
|
||||
// find the parent node
|
||||
procitem = procitem.ItemParts[0].MyContent.ContentItems[0].MyItem;
|
||||
}
|
||||
return procitem.MyContent.MyFormat;
|
||||
}
|
||||
private Format GetFormat(DocVersion docver)
|
||||
{
|
||||
if (docver.MyFormat != null) return docver.MyFormat;
|
||||
return GetFormat(docver.MyFolder);
|
||||
}
|
||||
private Format GetFormat(Folder folder)
|
||||
{
|
||||
if (folder.MyFormat != null) return folder.MyFormat;
|
||||
return GetFormat(folder.MyParent);
|
||||
return procitem.MyItemInfo.ActiveFormat;
|
||||
//while (procitem.MyItemInfo.a .MyContent.MyFormat == null)
|
||||
//{
|
||||
// // find the first sibling
|
||||
// while (procitem.PreviousID != null)
|
||||
// procitem = procitem.MyPrevious;
|
||||
// if (procitem.ItemPartCount == 0) return docver.MyDocVersionInfo.ActiveFormat;
|
||||
// // find the parent node
|
||||
// procitem = procitem.ItemParts[0].MyContent.ContentItems[0].MyItem;
|
||||
//}
|
||||
//return procitem.MyContent.MyFormat;
|
||||
}
|
||||
//private FormatInfo GetFormat(DocVersion docver)
|
||||
//{
|
||||
// if (docver.MyDocVersionInfo.MyFormat != null) return docver.MyDocVersionInfo.MyFormat;
|
||||
// return GetFormat(docver.MyDocVersionInfo.MyFolder);
|
||||
//}
|
||||
//private FormatInfo GetFormat(FolderInfo folder)
|
||||
//{
|
||||
// if (folder.MyFormat != null) return folder.MyFolderInfo.MyFormat;
|
||||
// return GetFormat(folder.MyParent);
|
||||
//}
|
||||
private string SectTitle(OleDbConnection cn, DataRowView dr, bool UseMultiLineSectionTitle, bool ConvertCaret)
|
||||
{
|
||||
string tbuff = null;
|
||||
@ -310,8 +313,8 @@ namespace DataLoader
|
||||
// Note that if the format is set for this section, check it against what the inherited
|
||||
// value would be (for example, what the format is for the set), if they are the same
|
||||
// clear the format at the section level.
|
||||
Format sectFormat = null;
|
||||
Format docverFormat = docver.ActiveFormat;
|
||||
FormatInfo sectFormat = null;
|
||||
FormatInfo docverFormat = docver.MyDocVersionInfo.ActiveFormat;
|
||||
if (fmt != null&& fmt !="") // Is there a long section title (from format flag)
|
||||
sectFormat = GetFormat(fmt);
|
||||
else // either from this format, or the plant.
|
||||
|
Loading…
x
Reference in New Issue
Block a user