private BaseMaterial BuildBaseMaterial()
        {
            var material = new BaseMaterial();
            material.CreateBasicListOfElements();

            material.Name = _view.NameTextbox;
            material.Number = _view.NumberTextbox;

            material.GetElement(Category.OfElement.C).Min = _view.CMintextbox;
            material.GetElement(Category.OfElement.C).Max = _view.CMaxtextbox;
            material.GetElement(Category.OfElement.C).RealValue = _view.CRealtextbox;

            material.GetElement(Category.OfElement.Si).Min = _view.SiMintextbox;
            material.GetElement(Category.OfElement.Si).Max = _view.SiMaxtextbox;
            material.GetElement(Category.OfElement.Si).RealValue = _view.SiRealtextbox;

            material.GetElement(Category.OfElement.Mn).Min = _view.MnMintextbox;
            material.GetElement(Category.OfElement.Mn).Max = _view.MnMaxtextbox;
            material.GetElement(Category.OfElement.Mn).RealValue = _view.MnRealtextbox;

            material.GetElement(Category.OfElement.P).Min = _view.PMintextbox;
            material.GetElement(Category.OfElement.P).Max = _view.PMaxtextbox;
            material.GetElement(Category.OfElement.P).RealValue = _view.PRealtextbox;

            material.GetElement(Category.OfElement.S).Min = _view.SMintextbox;
            material.GetElement(Category.OfElement.S).Max = _view.SMaxtextbox;
            material.GetElement(Category.OfElement.S).RealValue = _view.SRealtextbox;

            material.GetElement(Category.OfElement.N).Min = _view.NMintextbox;
            material.GetElement(Category.OfElement.N).Max = _view.NMaxtextbox;
            material.GetElement(Category.OfElement.N).RealValue = _view.NRealtextbox;

            material.GetElement(Category.OfElement.Cr).Min = _view.CrMintextbox;
            material.GetElement(Category.OfElement.Cr).Max = _view.CrMaxtextbox;
            material.GetElement(Category.OfElement.Cr).RealValue = _view.CrRealtextbox;

            material.GetElement(Category.OfElement.Mo).Min = _view.MoMintextbox;
            material.GetElement(Category.OfElement.Mo).Max = _view.MoMaxtextbox;
            material.GetElement(Category.OfElement.Mo).RealValue = _view.MoRealtextbox;

            material.GetElement(Category.OfElement.Nb).Min = _view.NbMintextbox;
            material.GetElement(Category.OfElement.Nb).Max = _view.NbMaxtextbox;
            material.GetElement(Category.OfElement.Nb).RealValue = _view.NbRealtextbox;

            material.GetElement(Category.OfElement.Ni).Min = _view.NiMintextbox;
            material.GetElement(Category.OfElement.Ni).Max = _view.NiMaxtextbox;
            material.GetElement(Category.OfElement.Ni).RealValue = _view.NiRealtextbox;

            material.GetElement(Category.OfElement.Ti).Min = _view.TiMintextbox;
            material.GetElement(Category.OfElement.Ti).Max = _view.TiMaxtextbox;
            material.GetElement(Category.OfElement.Ti).RealValue = _view.TiRealtextbox;

            material.GetElement(Category.OfElement.Al).Min = _view.AlMintextbox;
            material.GetElement(Category.OfElement.Al).Max = _view.AlMaxtextbox;
            material.GetElement(Category.OfElement.Al).RealValue = _view.AlRealtextbox;

            material.GetElement(Category.OfElement.V).Min = _view.VMintextbox;
            material.GetElement(Category.OfElement.V).Max = _view.VMaxtextbox;
            material.GetElement(Category.OfElement.V).RealValue = _view.VRealtextbox;

            material.GetElement(Category.OfElement.Cu).Min = _view.CuMintextbox;
            material.GetElement(Category.OfElement.Cu).Max = _view.CuMaxtextbox;
            material.GetElement(Category.OfElement.Cu).RealValue = _view.CuRealtextbox;

            switch (_workingMode)
            {
                case WindowMode.Mode.AddNew:
                    material.GuidNumber = Guid.NewGuid();
                    break;
                case WindowMode.Mode.ModifyCurrent:
                    material.GuidNumber = Guid.Parse(_view.GuidTextbox);
                    break;
            }

            return material;
        }
 public void SaveSecondBasisMarerialForSchaeffler(BaseMaterial baseMateiral)
 {
     _normRepo.SerializeSecondBaseMaterialForSchaeffler(baseMateiral);
 }
 public void SaveFirstBasisMarerialForSchaeffler(BaseMaterial baseMaterial)
 {
     _normRepo.SerializeFirstBaseMaterialForSchaeffler(baseMaterial);
 }
 public void Init()
 {
     _baseMaterial1 = _dataCreator.GetSampleMaterial();
     _baseMaterial2 = _dataCreator.GetSampleMaterial();
     _addMaterial = _dataCreator.GetAdditiveMaterial();
 }
        public PDFGenerator(PdfFor pdfFor, 
            BaseMaterial baseMaterial, 
            BaseMaterial baseMaterial2, 
            AdditiveMaterial addMaterial, 
            double addMaterialQuantity, 
            string schaefferFerriteQuantity,
            string schaefflerPhase,
            string deLongPhase,
            string deLongFerriteContent,
            string deLongFerriticNumber,
            string wrcPhase,
            string wrcFerriticNumber)
        {
            _pdfFor = pdfFor;
            _baseMaterial1 = baseMaterial;
            _baseMaterial2 = baseMaterial2;
            _addMaterial = addMaterial;
            _schaefflerPhase = schaefflerPhase;
            _schaefflerFerriteQuantity = schaefferFerriteQuantity;
            _deLongPhase = deLongPhase;
            _deLongFerriteContent = deLongFerriteContent;
            _deLongFerriticeNumber = deLongFerriticNumber;
            _wrcPhase = wrcPhase;
            _wrcFerriticNumber = wrcFerriticNumber;

            _document = new Document();
            Section section = _document.AddSection();

            AddHeader(section);

            AddInputDataSection(section, "Dane wejsciowe");
            AddEmptySpace(section, 0.1);

            AddElementsTable(section);
            AddEmptySpace(section, 0.1);

            AddEquivalentsTable(section, addMaterialQuantity);
            AddEmptySpace(section, 0.5);

            AddInputDataSection(section, "Dane wyjściowe");
            AddEmptySpace(section, 0.5);

            AddMainChartImage(section);
            if (pdfFor == PdfFor.Schaeffler)
            {
                AddSchaefflerLegendImage(section);
                AddEmptySpace(section, 0.5);

                addSchaefflerOutputData(section);
            }
            else if (pdfFor == PdfFor.DeLong)
            {
                AddDeLongLegendImage(section);
                AddEmptySpace(section, 0.5);
                addDeLongOutputData(section);
                AddMinimapChartImage(section);
            }
            else if (pdfFor == PdfFor.WRC1992)
            {
                AddWrcLegendImage(section);
                AddEmptySpace(section, 0.5);
                AddWrcOutputData(section);
                AddMinimapChartImage(section);
            }

            // AddFinalMaterialData
            _document.UseCmykColor = true;
            const bool unicode = false;
            const PdfFontEmbedding embedding = PdfFontEmbedding.Always;
            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding);
            pdfRenderer.Document = _document;
            pdfRenderer.RenderDocument();
            string filename = RandomString() + ".pdf";
            pdfRenderer.PdfDocument.Save(filename);
            Process.Start(filename);
        }
        private void FillElementColumns(DataRow row, string min, string max, string real, Category.OfElement element, BaseMaterial material)
        {
            var materialElement = material.GetElement(element);

            if (material.GetElement(element).Min == null)
                row[min] = DBNull.Value;
            else
                row[min] = materialElement.Min;

            if (material.GetElement(element).Max == null)
                row[max] = DBNull.Value;
            else
                row[max] = materialElement.Max;

            if (material.GetElement(element).RealValue == null)
                row[real] = DBNull.Value;
            else
                row[real] = materialElement.RealValue;
        }