Example #1
0
 public void ReadContosFromFile()
 {
     var         year = ConfigTempoSinglenton.GetInstance().WorkDate.Year;
     ContoReader exportBuilderInput = new ContoReader();
     var         res = ExportBuilder.SqlScriptString(exportBuilderInput);
     //SaveTofile(res, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exportBuilderInput.FileName));
 }
Example #2
0
        public void ExportBuilderTest_ClientSqlScript()
        {
            ExportBuilderInput exportBuilderInput = new ExportBuilderInput("dost.sql", "nom_12", @"E:\inp\KLIENTI.txt");
            var res = ExportBuilder.SqlScriptString(exportBuilderInput);

            SaveTofile(res, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exportBuilderInput.FileName));
        }
Example #3
0
        public void ExportBuilderTest_SqlScriptNA1()
        {
            var exportBuilderInput = new InporterNa("NA1.sql", "na1", @"C:\Users\atakov.CLEANCODE\AppData\Roaming\Skype\My Skype Received Files\SMETKOPLAN_500.txt");
            var res = ExportBuilder.SqlScriptString(exportBuilderInput);

            SaveTofile(res, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exportBuilderInput.FileName));
        }
Example #4
0
        private static ExportMetadataAttribute GetExportMetadataAttribute(ExportBuilder builder)
        {
            var list = new List <Attribute>();

            builder.BuildAttributes(typeof(FooImpl), ref list);
            Assert.AreEqual(2, list.Count);
            return(list[1] as ExportMetadataAttribute);
        }
Example #5
0
        public void ExportBuilderTest_GenerateCsv()
        {
            ExportBuilderInput exportBuilderInput = new ExportBuilderInput("clients.sql", "nom_17", @"E:\inp\KLIENTI.txt");


            var res = ExportBuilder.GenerateExportCSV(exportBuilderInput);

            Assert.AreEqual(res, true);
        }
Example #6
0
        public void AddMetadataFuncVal_AddsExportMetadataAttribute()
        {
            var builder = new ExportBuilder();

            builder.AddMetadata("name", t => t.Name);

            ExportMetadataAttribute exportAtt = GetExportMetadataAttribute(builder);

            Assert.Equal("name", exportAtt.Name);
            Assert.Equal(typeof(FooImpl).Name, exportAtt.Value);
        }
Example #7
0
        public void AddMetadata_AddsExportMetadataAttribute()
        {
            var builder = new ExportBuilder();

            builder.AddMetadata("name", "val");

            ExportMetadataAttribute exportAtt = GetExportMetadataAttribute(builder);

            Assert.Equal("name", exportAtt.Name);
            Assert.Equal("val", exportAtt.Value);
        }
Example #8
0
        public void AsContractName_SetsContractName()
        {
            var builder = new ExportBuilder();

            builder.AsContractName("hey");

            ExportAttribute exportAtt = GetExportAttribute(builder);

            Assert.Equal("hey", exportAtt.ContractName);
            Assert.Null(exportAtt.ContractType);
        }
Example #9
0
        public void AsContractType_SetsContractType()
        {
            var builder = new ExportBuilder();

            builder.AsContractType(typeof(IFoo));

            ExportAttribute exportAtt = GetExportAttribute(builder);

            Assert.Equal(typeof(IFoo), exportAtt.ContractType);
            Assert.Null(exportAtt.ContractName);
        }
Example #10
0
        public void ExportBuilderTest_CitiesBgSqlScript()
        {
            CitiesInput exportBuilderInput = new CitiesInput();

            exportBuilderInput.FileName   = "safiqZip.sql";
            exportBuilderInput.TableName  = "cities";
            exportBuilderInput.SourceFile = @"E:\inp\safiqZip.txt";
            var res = ExportBuilder.SqlScriptString(exportBuilderInput);

            SaveTofile(res, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exportBuilderInput.FileName));
        }
Example #11
0
        public void AsContractName_AndContractType_SetsContractNameAndType()
        {
            var builder = new ExportBuilder();

            builder.AsContractName("hey");
            builder.AsContractType(typeof(IFoo));

            ExportAttribute exportAtt = GetExportAttribute(builder);

            Assert.AreEqual("hey", exportAtt.ContractName);
            Assert.AreEqual(typeof(IFoo), exportAtt.ContractType);
        }
Example #12
0
        public void Inherited_AddsInheritedExportAttribute()
        {
            var builder = new ExportBuilder();

            builder.Inherited();

            var list = new List <Attribute>();

            builder.BuildAttributes(typeof(FooImpl), ref list);
            Assert.Equal(1, list.Count);
            var att = list[0] as InheritedExportAttribute;

            Assert.NotNull(att);
        }
Example #13
0
        /// <summary>
        /// Removed all duplicate vertices by converting to ExportPolygon.
        /// </summary>
        /// <param name="p">IPolygon to convert.</param>
        /// <returns>A IPolgyon(ExportPolygon) with no duplicate vertices.</returns>
        public static ExportPolygon Convert(IPolygon p)
        {
            if (p is ExportPolygon)
            {
                return(p as ExportPolygon);
            }

            var b = new ExportBuilder();

            foreach (Triangle t in p.GetTriangles())
            {
                b.Append(t.First, t.Second, t.Third);
            }

            return(b.Build() as ExportPolygon);
        }
        protected Tuple <Log, IPolygon, string, long>[] Triangulate(ITriangulator[] triangulator, SDF[] obj)
        {
            Program.PrintTitle("TRIANGULATING...");
            var result = new Tuple <Log, IPolygon, string, long> [triangulator.Length];

            Parallel.For(0, triangulator.Length, i => {
                Stopwatch t = new Stopwatch();
                var builder = new ExportBuilder();
                t.Start();
                var mesh = triangulator[i].Run(obj[i], builder);
                t.Stop();
                var name  = $"[{obj[i].ToString()}] {triangulator[i].ToString()}";
                var time  = t.ElapsedMilliseconds;
                result[i] = Tuple.Create <Log, IPolygon, string, long>(null, mesh, name, time);
                Console.WriteLine($"\n{name} took {time}ms\nCreated {mesh.VertexCount} vertices and {mesh.TriangleCount} triangles");
            });
            Console.WriteLine();
            Console.WriteLine("PRESS ANY KEY TO CONTINUE...");
            Console.ReadKey();
            return(result);
        }
Example #15
0
        public ExcelResult Export()
        {
            const string fileName = "Reestr.xls";
            // get data
            int dm = (int)Session["Month"];

            int year = (int)Session["Year"];
            int ContractID;

            string dog = GetCookie("Dog");

            if (!String.IsNullOrWhiteSpace(dog))
            {
                ContractID = Convert.ToInt32(dog);
            }
            else
            {
                ContractID = 0;
            }
            //Установили 1е число
            DateTime begDt = new DateTime(year, dm, 01, 0, 0, 0);
            //Установили 1е число следующего месяца
            DateTime      endDt = begDt.AddMonths(1);
            TtnRepository repo  = new TtnRepository();
            List <Ttn>    ttn   = repo.GetTtn(Cust.CustId, begDt, endDt, ContractID);

            var items = repo.GetTtn(Cust.CustId, begDt, endDt, ContractID);
            var title = $"Реестр отрузки Абз-4 с {begDt.ToShortDateString()} по {endDt.ToShortDateString()}";
            var html  = ExportBuilder.Build(items, title);

            // prepare virtual file
            using (var stream = new MemoryStream())
                using (var writer = new StreamWriter(stream))
                {
                    writer.Write(html);
                    writer.Flush();
                    stream.Position = 0;
                }
            return(new ExcelResult(fileName, html));
        }
Example #16
0
 public static void BuildAttributes(this ExportBuilder builder, Type type, ref List <Attribute> attributes)
 {
     builder.GetType()
     .GetMethod(nameof(BuildAttributes), BindingFlags.NonPublic | BindingFlags.Instance)
     .Invoke(builder, new object[] { type, attributes });
 }