private static void FillTable(ICollection <mpProductInt.Specification.SpecificationItem> sItems, bool askRow, int round)
        {
            if (sItems.Count == 0)
            {
                return;
            }
            var specificationItems = new List <InsertToAutoCad.SpecificationItemForTable>();

            foreach (var i in sItems)
            {
                var mass = string.Empty;
                if (i.Mass != null)
                {
                    mass = Math.Round(i.Mass.Value, round).ToString(CultureInfo.InvariantCulture);
                }

                // В зависимости от Наименования и стали создаем строку наименования
                var name = i.HasSteel
                    ? $"\\A1;{{\\C0;{i.BeforeName} \\H0.9x;\\S{i.TopName}/{i.SteelDoc} {i.SteelType};\\H1.1111x; {i.AfterName}"
                    : $"{i.BeforeName} {i.TopName} {i.AfterName}";

                specificationItems.Add(new InsertToAutoCad.SpecificationItemForTable(
                                           i.Position, i.Designation, name, mass, i.Count, i.Note));
            }

            InsertToAutoCad.AddSpecificationItemsToTable(specificationItems, askRow);
        }
Beispiel #2
0
        private static void FillTable(ICollection <SpecificationItem> sItems, bool askRow, int round)
        {
            if (sItems.Count == 0)
            {
                return;
            }
            var specificationItems = new List <InsertToAutoCad.SpecificationItemForTable>();

            foreach (var selectedSpecItem in sItems)
            {
                var mass = string.Empty;
                if (selectedSpecItem.Mass != null)
                {
                    mass = Math.Round(selectedSpecItem.Mass.Value, round).ToString(CultureInfo.InvariantCulture);
                }

                // В зависимости от Наименования и стали создаем строку наименования
                string name;
                if (selectedSpecItem.HasSteel)
                {
                    name = "\\A1;{\\C0;" + selectedSpecItem.BeforeName + " \\H0.9x;\\S" + selectedSpecItem.TopName + "/" +
                           selectedSpecItem.SteelDoc + " " + selectedSpecItem.SteelType + ";\\H1.1111x; " + selectedSpecItem.AfterName;
                }
                else
                {
                    name = selectedSpecItem.BeforeName + " " + selectedSpecItem.TopName + " " + selectedSpecItem.AfterName;
                }

                specificationItems.Add(new InsertToAutoCad.SpecificationItemForTable(
                                           selectedSpecItem.Position,
                                           selectedSpecItem.Designation,
                                           name,
                                           mass,
                                           selectedSpecItem.Count,
                                           selectedSpecItem.Note));
            }

            InsertToAutoCad.AddSpecificationItemsToTable(specificationItems, askRow);
        }