SourceCode/PROMS/DataLoader/DocVersions.cs
2007-12-05 13:12:16 +00:00

73 lines
2.8 KiB
C#

// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
using VEPROMS.CSLA.Library;
namespace DataLoader
{
public partial class Loader
{
public Item MigrateDocVersion(DocVersion docver)
{
string pth = docver.Title;
// Open connection
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pth + ";Extended Properties=dBase III;Persist Security Info=False");
// load rofst (use it later)....
rofst = new ROFST(pth + "\\ro.fst");
// Migrate library documents
MigrateLibDocs(cn, pth);
// Initialize Dictionaries
dicTrans_ItemDone = new Dictionary<string, Item>();
dicTrans_ItemIds = new Dictionary<string, Item>();
// Create a 'dummy' content record. This will be used for any transitions 'to'
// that don't exist when dbf is processed. At end, use this to see if there
// are missing transitions.
TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null);
// Process Procedures
Item itm = MigrateProcedures(cn,pth,docver);
// Show any Missing Transtitons (i.e. Transitions which have not been processed)
ShowMissingTransitions();
log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth);
rofst.Close();
cn.Close();
dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null;
if (itm != null)
{
docver.MyItem = itm;
docver.Title = "";
if (!docver.IsSavable) ErrorRpt.ErrorReport(docver);
docver.Save();
}
return itm;
}
private VEPROMS.CSLA.Library.VersionTypeEnum DocVersionType(string s)
{
if (s.EndsWith("approved")) return VEPROMS.CSLA.Library.VersionTypeEnum.Approved;
if (s.EndsWith("chgsht")) return VEPROMS.CSLA.Library.VersionTypeEnum.Revision;
if (s.EndsWith("tmpchg")) return VEPROMS.CSLA.Library.VersionTypeEnum.Temporary;
return VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft;
}
}
}