public static SpecialNamingBase GetNamingProcessor(NamingApproach approach, string namingCode) { const string ns = "RadaCode.InDoc.Data.DocumentNaming.SpecialNamings.Namings"; var dataAssembly = typeof(RadaCode.InDoc.Data.DocumentNaming.SpecialNamings.SpecialNamingBase).Assembly; var classes = SpecialNamingsFactory.GetAllClasses(ns, dataAssembly); var res = new List<string>(); foreach (var inst in classes.Select(namingClass => string.Format("{0}.{1}", ns, namingClass)).Select(toCreate => dataAssembly.GetType(toCreate)).Select(type => Activator.CreateInstance(type, approach)).Where(inst => ((SpecialNamingBase)inst).SpecialCode == namingCode)) { return inst as SpecialNamingBase; } throw new Exception(string.Format("No class found that is able to process {0} code", namingCode)); }
public static SpecialNamingBase GetNamingProcessor(NamingApproach approach, string namingCode) { const string ns = "RadaCode.InDoc.Data.DocumentNaming.SpecialNamings.Namings"; var dataAssembly = typeof(RadaCode.InDoc.Data.DocumentNaming.SpecialNamings.SpecialNamingBase).Assembly; var classes = SpecialNamingsFactory.GetAllClasses(ns, dataAssembly); var res = new List <string>(); foreach (var inst in classes.Select(namingClass => string.Format("{0}.{1}", ns, namingClass)).Select(toCreate => dataAssembly.GetType(toCreate)).Select(type => Activator.CreateInstance(type, approach)).Where(inst => ((SpecialNamingBase)inst).SpecialCode == namingCode)) { return(inst as SpecialNamingBase); } throw new Exception(string.Format("No class found that is able to process {0} code", namingCode)); }
protected override void Seed(InDocContext context) { var orderFormat = new NamingApproach() { Format = "{intInc_G}/{intInc_D}/02/-{yy}", TypeName = "Orders" }; var initParams = new List <KeyValuePair <int, string> > { new KeyValuePair <int, string>(0, "2296"), new KeyValuePair <int, string>(1, "1") }; orderFormat.SaveCurrentParams(initParams); context.NamingApproaches.Add(orderFormat); base.Seed(context); }
public void CreateGetParamBlocks() { const string format = "{intInc_G}/{intInc_D}/02-{yy}"; const string typeName = "Orders"; var initParams = new List <KeyValuePair <int, string> > { new KeyValuePair <int, string>(0, "2296"), new KeyValuePair <int, string>(1, "1") }; var orderNamingApproach = new NamingApproach { Format = format, TypeName = typeName }; orderNamingApproach.SaveCurrentParams(initParams); var breakdown = orderNamingApproach.ParamBlocks; Assert.AreEqual("1", breakdown[2]); }
public void CreateSetParamsGetNameParams() { const string format = "{intInc_G}/{intInc_D}/02-{yy}"; const string typeName = "Orders"; var initParams = new List <KeyValuePair <int, string> > { new KeyValuePair <int, string>(0, "2296"), new KeyValuePair <int, string>(1, "1") }; var orderNamingApproach = new NamingApproach { Format = format, TypeName = typeName }; orderNamingApproach.SaveCurrentParams(initParams); var newName = orderNamingApproach.GetNextName(); Assert.AreEqual("2297/2/02-12", newName); }
public void CreateSetParamsWriteOutParams() { const string format = "{intInc_G}/{intInc_D}/02/-{yy}"; const string typeName = "Orders"; var initParams = new List <KeyValuePair <int, string> > { new KeyValuePair <int, string>(0, "2296"), new KeyValuePair <int, string>(1, "1") }; var orderNamingApproach = new NamingApproach { Format = format, TypeName = typeName }; orderNamingApproach.SaveCurrentParams(initParams); Console.WriteLine(orderNamingApproach.CurrentParamsCounters); Assert.IsNotEmpty(orderNamingApproach.CurrentParamsCounters); }
public YearNaming(ref NamingApproach approach) : base(ref approach){}
public GlobalIntIncNaming(ref NamingApproach approach) : base(ref approach) { }
public DailyIntIncNaming(ref NamingApproach approach) : base(ref approach) {}
protected SpecialNamingBase(ref NamingApproach approach) { Approach = approach; }
public GlobalIntIncNaming(ref NamingApproach approach) : base(ref approach) {}
public DailyIntIncNaming(ref NamingApproach approach) : base(ref approach) { }
public YearNaming(ref NamingApproach approach) : base(ref approach) { }