check for duplicate procedure entries in set file (there should not be any)
This commit is contained in:
		@@ -155,7 +155,7 @@ namespace DataLoader
 | 
			
		||||
			Item itm =null;
 | 
			
		||||
			string number = TextConvert.ConvertText(dr["Number"].ToString());
 | 
			
		||||
      frmMain.UpdateLabels(1, 0, 0);
 | 
			
		||||
		if (!convertProcedures || docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft)
 | 
			
		||||
	  if (!convertProcedures || (docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft && docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.Approved))
 | 
			
		||||
						{
 | 
			
		||||
			cont = Content.New(number, TextConvert.ConvertText(dr["Title"].ToString(),do_cvt), 0, null, ci == null ? null : ci.ToString(), dts, userid);
 | 
			
		||||
			itm = Item.MakeItem(FromItem, cont, dts, userid);
 | 
			
		||||
@@ -172,7 +172,7 @@ namespace DataLoader
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
		}
 | 
			
		||||
		if (convertProcedures  /*&& number == "0POP05\\u8209?EO\\u8209?ES32"*/)  //0POP05\u8209?EO\u8209?ES32
 | 
			
		||||
		if (convertProcedures /* && number == "001\\u8209?007"/* && number == "0POP05-EO-EC00"*/)
 | 
			
		||||
			{
 | 
			
		||||
					OleDbDataAdapter da = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where sequence like ' %'", cn);
 | 
			
		||||
					try
 | 
			
		||||
@@ -217,8 +217,12 @@ namespace DataLoader
 | 
			
		||||
					int level = 0;
 | 
			
		||||
					bool addpart = true;
 | 
			
		||||
					Item parentitem = itm;
 | 
			
		||||
					//if (ProcNumber == "001-002")
 | 
			
		||||
					//    Console.WriteLine("proc 001-002");
 | 
			
		||||
					foreach (DataRowView drw in dv)
 | 
			
		||||
					{
 | 
			
		||||
						//if (ProcNumber == "016-001") //"017-001") //"082-002AB")
 | 
			
		||||
						//    Console.WriteLine("016-001"); //("017-001"); //"082-002AB");
 | 
			
		||||
						SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver);
 | 
			
		||||
						// if no children, add first child (cont)
 | 
			
		||||
						if (addpart)
 | 
			
		||||
@@ -271,6 +275,20 @@ namespace DataLoader
 | 
			
		||||
			key.Close();
 | 
			
		||||
			return retval;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// check for duplicate SET file data  - jsj 2/11/10
 | 
			
		||||
		private bool OKtoProcessDBF(DataRow dr)
 | 
			
		||||
		{
 | 
			
		||||
			string pfn = dr["Entry"].ToString();
 | 
			
		||||
			string pn = dr["Number"].ToString();
 | 
			
		||||
			if (!dicSetfileEntries.ContainsValue(pfn) && !dicSetfileEntries.ContainsKey(pn))
 | 
			
		||||
			{
 | 
			
		||||
				dicSetfileEntries.Add(pn, pfn);
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
 | 
			
		||||
		{
 | 
			
		||||
				Item FirstItm = null;
 | 
			
		||||
@@ -283,11 +301,15 @@ namespace DataLoader
 | 
			
		||||
					Item FrItm = null;
 | 
			
		||||
					frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
 | 
			
		||||
					frmMain.UpdateLabels(0, 0, 0);
 | 
			
		||||
					dicSetfileEntries = new Dictionary<string, string>(); // used to check for duplicate SET file info - jsj 2/11/10
 | 
			
		||||
 | 
			
		||||
					foreach (DataRow dr in ds.Tables[0].Rows)
 | 
			
		||||
					{
 | 
			
		||||
						FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);
 | 
			
		||||
						if (FirstItm == null) FirstItm = FrItm;
 | 
			
		||||
						if (OKtoProcessDBF(dr)) // look for duplicate SET file info - jsj 2/11/10
 | 
			
		||||
						{
 | 
			
		||||
							FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);
 | 
			
		||||
							if (FirstItm == null) FirstItm = FrItm;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					da.Dispose();
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user