Ejemplo n.º 1
0
        public void SetOrder()
        {
            SettingsFactory factory  = new SettingsFactory();
            Settings        settings = factory.GetSettings();

            isOrderSet = false;

            Excel.Range titleRange  = (Excel.Range)bomSheet.Rows[1];
            Excel.Range cells       = (Excel.Range)titleRange.Cells;
            Excel.Range testCell    = (Excel.Range)cells.Cells[1, 1];
            int         usedColumns = bomSheet.UsedRange.Columns.Count;

            if (!(bool)testCell.MergeCells)
            {
                for (int i = 1; i <= usedColumns; i++)
                {
                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Designator))
                    {
                        DESIGNATOR   = i;
                        isDesignator = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Type))
                    {
                        TYPE   = i;
                        isType = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.ManufacturerPartNumber))
                    {
                        MANUFACTURER_PARTNUMBER  = i;
                        isManufacturerPartNumber = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Description))
                    {
                        DESCRIPTION   = i;
                        isDescription = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Manufacturer))
                    {
                        MANUFACTURER   = i;
                        isManufacturer = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Note))
                    {
                        NOTE   = i;
                        isNote = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Note1))
                    {
                        NOTE1   = i;
                        isNote1 = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.Quantity))
                    {
                        QUANTITY   = i;
                        isQuantity = true;
                        continue;
                    }
                }
            }

            if (isDesignator && isManufacturerPartNumber)
            {
                isOrderSet = true;
            }
        }
Ejemplo n.º 2
0
        public void SetOrder()
        {
            SettingsFactory factory  = new SettingsFactory();
            Settings        settings = factory.GetSettings();

            isOrderSet = false;

            Excel.Range titleRange  = (Excel.Range)bomSheet.Rows[1];
            Excel.Range cells       = (Excel.Range)titleRange.Cells;
            Excel.Range testCell    = (Excel.Range)cells.Cells[1, 1];
            int         usedColumns = bomSheet.UsedRange.Columns.Count;

            if (!(bool)testCell.MergeCells)
            {
                for (int i = 1; i <= usedColumns; i++)
                {
                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWFormat))
                    {
                        FORMAT   = i;
                        isFormat = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWPosition))
                    {
                        POSITION   = i;
                        isPosition = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWDesignation))
                    {
                        DESIGNATION   = i;
                        isDesignation = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWName))
                    {
                        NAME   = i;
                        isName = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWQuantity))
                    {
                        QUANTITY   = i;
                        isQuantity = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWNote))
                    {
                        NOTE   = i;
                        isNote = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWDocumentSection))
                    {
                        DOCUMENT_SECTION  = i;
                        isDocumentSection = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWClass))
                    {
                        CLASS   = i;
                        isClass = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWGost))
                    {
                        GOST   = i;
                        isGost = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWSizesParametres))
                    {
                        SIZES_PARAMETRES  = i;
                        isSizesParametres = true;
                        continue;
                    }

                    if ((cells[1, i] as Excel.Range).Value2.Equals(settings.SWReplacement))
                    {
                        REPLACEMENT   = i;
                        isReplacement = true;
                        continue;
                    }
                }
            }

            if (isDocumentSection && (isName || isSizesParametres))
            {
                isOrderSet = true;
            }
        }