/// <summary> /// Loads the source modules. /// </summary> private void LoadSourceModules() { if (ModuleTypes.SelectedIndex > -1) { int ModuleTypeID = Int32.Parse(ModuleTypes.SelectedItem.Value); ContentManagerDB contentDB = new ContentManagerDB(); SourceInstance.DataValueField = "ModuleID"; SourceInstance.DataTextField = "TabModule"; SourceInstance.DataSource = contentDB.GetModuleInstances(ModuleTypeID, Int32.Parse(SourcePortal.SelectedItem.Value)); SourceInstance.DataBind(); //if items exist in the sourceinstance, select the first item if (SourceInstance.Items.Count > 0) { SourceInstance.SelectedIndex = 0; LoadSourceModuleData(); } else { //if there are no instances, there can be no data!! SourceListBox.Items.Clear(); } } }
internal override IEnumerable <ITestParameter> GetParameters(TestContext ctx) { var parameters = SourceInstance.GetParameters(ctx, Filter); foreach (var value in parameters) { yield return(Serialize(value)); } }
public override void Initialize(TestContext ctx) { base.Initialize(ctx); if (Path.Parameter != null) { current = Clone(Host.Deserialize(Path.Parameter)); hasNext = true; return; } parameters = new List <T> (SourceInstance.GetParameters(ctx, Filter)); index = 0; }
// We must not modify the files in the repository. // Therefore we create a copy of the file in the cache folder. private static Page rd_createPage(SourceInstance si) { string cacheFolder = DataPool.CacheFolder; string cacheFile = Path.Combine(cacheFolder, "su_" + Path.GetFileName(si.Url)); File.Copy(si.Url, cacheFile); si.Url = cacheFile; si.IsArchived = false; return(new Page() { Filename = cacheFile, Bitmap = new OCCSinglePage(cacheFile, (si as ImageVariantInstance).Orientation) }); }
public static string Imprint( DataPool pool, string spec, bool allPages, int nofDigits, bool refImage, bool ocrImage, int orientation, int position, int offsetX, int offsetY) { NameSpecParser nsp = new NameSpecParser(); nsp.BatchId = "BatchId"; // Replace so it as "no operation" nsp.DocumentNumber = "DocumentNumber"; // Replace so it as "no operation" nsp.ValueList = new List <KeyValuePair <string, string> >(); List <NameSpecParser.SubstituteItem> lsi = nsp.Parse(spec); string result = string.Empty; foreach (Document doc in pool.RootNode.Documents) { // Initialize field values for ValueList spec parser foreach (Field f in doc.Fields) { nsp.ValueList.Add(new KeyValuePair <string, string>(f.Name, f.Value)); } int pagenumber = 0; foreach (ImageSource ims in doc.Sources) { nsp.PageNumber = pagenumber++.ToString().PadLeft(nofDigits, '0'); nsp.SetValues(lsi); string imprint = nsp.ComposeResultString(lsi); if (pagenumber == 1) { result = imprint; } if (refImage) { SourceInstance si = ims.SelectInstance("ref"); int refRotation = (si as ImageVariantInstance).Orientation; im_doImprint(si, refRotation, imprint, orientation, position, offsetX, offsetX); } if (ocrImage) { SourceInstance si = ims.SelectInstance("ocr"); im_doImprint(si, 0, imprint, orientation, position, offsetX, offsetX); } } } return(result); }
private static void im_doImprint( SourceInstance si, int imageOrientation, string text, int orientation, int position, int offsetX, int offsetY) { string cacheFolder = DataPool.CacheFolder; string cacheFile = Path.Combine(cacheFolder, "su_" + Path.GetFileName(si.Url)); File.Copy(si.Url, cacheFile); si.Url = cacheFile; si.IsArchived = false; OCCSinglePage sp = new OCCSinglePage(si.Url, imageOrientation); sp.AddTextToImage(text, 0, orientation, position, offsetX, offsetX); sp.Save(si.Url); }
public static Common.Data.Models.SourceInstanceDto GetDtoSourceInstanceFromEntSourceInstance(SourceInstance entSourceInstance) { return(new Common.Data.Models.SourceInstanceDto { Id = entSourceInstance.Id, SourceId = entSourceInstance.SourceId, WallId = entSourceInstance.WallId, X = entSourceInstance.X, Y = entSourceInstance.Y, Width = entSourceInstance.Width, Height = entSourceInstance.Height }); }