Example #1
0
		public void UpdateValidationResource(ValidationResource update)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				T_ValidationResource tvr = dc.T_ValidationResources.SingleOrDefault(vr => vr.vrName == update.Name);
				if (tvr == null)
				{
					throw new ApplicationException("Invalid validation resource name");
				}
				tvr.vrDownloadDate = update.DownloadDate;
				tvr.vrContent = update.Content;
				dc.SubmitChanges();
			}
		}
Example #2
0
		public ValidationResource GetValidationResourceByName(string name)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var tResource = dc.T_ValidationResources.SingleOrDefault(r => r.vrName == name);
				if (tResource == null)
				{
					throw new ApplicationException("Invalid validation resource ID");
				}
				ValidationResource resource = new ValidationResource();
				resource.Name = tResource.vrName;
				resource.DownloadDate = (DateTime)tResource.vrDownloadDate;
				resource.Content = tResource.vrContent;
				return resource;
			}
		}
Example #3
0
		private static ValidationResource GetValidationResource(string name)
		{
			ValidationResource resource = new ValidationResource();
			resource.Name = name;
			switch (name)
			{
				case _nameSDN:
					resource.Content = DownloadOFACBase(Properties.Settings.Default.sourceSDN);
					break;
				case _namePLC:
					resource.Content = DownloadOFACBase(Properties.Settings.Default.sourcePLC);
					break;
				default:
					throw new ApplicationException("Invalid validation resource name");
			}
			resource.DownloadDate = DateTime.Now;
			return resource;
		}
Example #4
0
		public nsplcNspEntry[] GetPLCEntityByXML(int validationID)
		{
			ValidationResource validationResource = new ValidationResource();
			MemoryStream memoryStream = new MemoryStream();
			var vFail = _provider.GetValidationsResultsByValidationID(validationID);
			if (vFail == null)
				return null;
			if (vFail.PLC == null)
			{
				return null;
			}
			validationResource.Content = vFail.PLC;
			validationResource.Content.Save(memoryStream);
			memoryStream.Position = 0;
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(nsplcNspEntry[]));
			nsplcNspEntry[] plc = (nsplcNspEntry[])xmlSerializer.Deserialize(memoryStream);
			return plc;
		}
Example #5
0
		public List<ExclusionaryListEntry> GetExcListEntryByXML(int validationID)
		{
			ValidationResource validationResource = new ValidationResource();
			MemoryStream memoryStream = new MemoryStream();
			var excList = _provider.GetExcListResultsByValidationID(validationID);
			if (excList != null)
			{
				validationResource.Content = excList.Result;
				validationResource.Content.Save(memoryStream);
				memoryStream.Position = 0;
				XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<ExclusionaryListEntry>));
				List<ExclusionaryListEntry> list = (List<ExclusionaryListEntry>)xmlSerializer.Deserialize(memoryStream);
				return list;
			}
			else
				return null;
		}
Example #6
0
		//private static XElement GetValidationAddressResource(StringBuilder queryString)
		//{
		//  XElement xAddress;
		//  xAddress = XElement.Load(_vawf);
		//  return xAddress;
		//}

		private static FragmentAddress GetAddressValidation(XElement xmlAddrVal)
		{
			ValidationResource validationResource = new ValidationResource();
			MemoryStream memoryStream = new MemoryStream();
			validationResource.Content = xmlAddrVal;
			validationResource.Content.Save(memoryStream);
			memoryStream.Position = 0;
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(FragmentAddress));
			FragmentAddress addr = (FragmentAddress)xmlSerializer.Deserialize(memoryStream);
			return addr;
		}
Example #7
0
		public sdnListSdnEntry[] GetSDNEntityByXML(int validationID)
		{
			ValidationResource validationResource = new ValidationResource();
			MemoryStream memoryStream = new MemoryStream();
			var vFail = _provider.GetValidationsResultsByValidationID(validationID);
			if (vFail == null)
				return null;
			if (vFail.SDN == null)
			{
				return null;
			}
			validationResource.Content = vFail.SDN;
			validationResource.Content.Save(memoryStream);
			memoryStream.Position = 0;
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(sdnListSdnEntry[]));
			sdnListSdnEntry[] sdn = (sdnListSdnEntry[])xmlSerializer.Deserialize(memoryStream);
			return sdn;
		}