Ejemplo n.º 1
0
        private DesignDimensionLine GetNewLine()
        {
            DesignDimensionLine line = new DesignDimensionLine();

            line.position = Index;
            return(line);
        }
Ejemplo n.º 2
0
        private LineField AddNewLine()
        {
            DesignDimensionLine line = new DesignDimensionLine();
            int position             = Dimension.lineListChangeHandler.Items.Count + 1;

            line.position        = position;
            this.ActiveLineField = new LineField(line);
            Add(this.ActiveLineField);
            return(this.ActiveLineField);
        }
Ejemplo n.º 3
0
        private LineField RemoveLine()
        {
            DesignDimensionLine line = new DesignDimensionLine();
            int count = Dimension.lineListChangeHandler.Items.Count;

            Remove(this.ActiveLineField);
            if (count == 1)
            {
                AddNewLine();
            }
            return(this.ActiveLineField);
        }
Ejemplo n.º 4
0
        public void Display(DesignDimensionLine Line)
        {
            throwEvent = false;
            this.Clear();
            this.Line = Line;
            if (this.Line == null)
            {
                this.Line = GetNewLine();
            }
            int index = 1;

            foreach (LineItem item in Line.itemListChangeHandler.Items)
            {
                LineItemField itemField = new LineItemField(item);
                Add(itemField);
                index++;
            }
            throwEvent = true;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Construit une nouvelle instance de LineItemField
 /// </summary>
 /// <param name="index">Index du panel</param>
 /// <param name="item">LineItem à afficher</param>
 public LineField(DesignDimensionLine line)
     : this(line.position)
 {
     Display(line);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Apply design lines elements as cellproperty
        /// </summary>
        /// <param name="design">Choosen design</param>
        /// <param name="table">The InputTable on which you wish to apply design template</param>
        /// <param name="range">Contains the current selected cell and the active sheet</param>
        /// <param name="coords">the number of columns and the number of lines</param>
        public void BuildRows(Range range, System.Windows.Point coords, bool showHeader)
        {
            int  row = 1, col = 1;
            int  columnCount = (int)coords.X != 0 ? (int)coords.X : 1;
            int  rowCount    = (int)coords.Y;
            Cell cell        = range.Cells[0];
            ObservableCollection <DesignDimensionLine> Lines = new ObservableCollection <DesignDimensionLine>(design.rows.lineListChangeHandler.Items);
            int lineCount = Lines.Count;

            if (lineCount > 0)
            {
                int totalCardinality = getCartesianProductLineSize(Lines);
                col = lineCount;
                int inc = 1;
                for (int currentLineRang = lineCount; currentLineRang >= 1; currentLineRang--)
                {
                    row = design.columns.lineListChangeHandler.Items.Count > 0 ? design.columns.lineListChangeHandler.Items.Count + 1 : 2;
                    if (design.concatenateColumnHearder)
                    {
                        row = 2;
                    }
                    DesignDimensionLine currentLine = Lines[currentLineRang - 1];
                    int currentLineItemCount        = currentLine.GetItemCount();

                    ObservableCollection <DesignDimensionLine> AllLines = new ObservableCollection <DesignDimensionLine>(design.rows.lineListChangeHandler.Items);
                    AllLines.Remove(currentLine);
                    int cardinality = getCartesianProductLineSize(AllLines);
                    int addRowIndex = 0;
                    if (currentLineRang == 1 && currentLine.GetItemCount() != 0)
                    {
                        for (int j = 1; j <= totalCardinality / currentLine.GetItemCount(); j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                if (showHeader)
                                {
                                    int colone = cell.Column - inc > 0 ? cell.Column - inc : 1;
                                    this.page.getInputTableForm().SpreadSheet.SetValueAt(cell.Row + addRowIndex, colone, sheetName, item.GetValue().ToString(), Designer.DesignerForm.ROWS_COLOR);
                                    //this.page.getInputTableForm().SpreadSheet.SetColorAt(cell.Row + addRowIndex, colone, sheetName, Designer.DesignerForm.ROWS_COLOR);
                                }
                                for (int c = 0; c < columnCount; c++)
                                {
                                    CellProperty cellProperty = GetCellProperty(cell.Row + addRowIndex, cell.Column + c, false);
                                    RefreshCellProperty(cellProperty, item);
                                }
                                addRowIndex++;
                                row++;
                            }
                        }
                    }
                    else
                    {
                        int n = totalCardinality - (currentLineItemCount * cardinality) + 1;
                        int m = cardinality;

                        if (currentLineRang != lineCount)
                        {
                            ObservableCollection <DesignDimensionLine> AllLine   = design.rows.lineListChangeHandler.Items;
                            ObservableCollection <DesignDimensionLine> UPLines   = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(0, currentLineRang - 1));
                            ObservableCollection <DesignDimensionLine> DOWNLines = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(currentLineRang, AllLine.Count - currentLineRang));

                            m = getCartesianProductLineSize(UPLines);
                            n = getCartesianProductLineSize(DOWNLines);
                        }

                        for (int j = 1; j <= n; j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                for (int i = 1; i <= m; i++)
                                {
                                    if (showHeader)
                                    {
                                        int colone = cell.Column - inc > 0 ? cell.Column - inc : 1;
                                        this.page.getInputTableForm().SpreadSheet.SetValueAt(cell.Row + addRowIndex, colone, sheetName, item.GetValue().ToString(), Designer.DesignerForm.ROWS_COLOR);
                                        //this.page.getInputTableForm().SpreadSheet.SetColorAt(cell.Row + addRowIndex, colone, sheetName, Designer.DesignerForm.ROWS_COLOR);
                                    }
                                    for (int c = 0; c < columnCount; c++)
                                    {
                                        CellProperty cellProperty = GetCellProperty(cell.Row + addRowIndex, cell.Column + c, false);
                                        RefreshCellProperty(cellProperty, item);
                                    }
                                    addRowIndex++;
                                    row++;
                                }
                            }
                        }
                    }
                    inc++;
                    col--;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///Build columns
        /// </summary>
        /// <param name="range">Contains the current selected cell and the active sheet</param>
        /// <param name="coords">the number of columns and the number of lines</param>
        public void BuildColunms(Range range, System.Windows.Point coords, bool showHeader)
        {
            int  row = 1, col = 1;
            int  columnCount = (int)coords.X;
            int  rowCount    = (int)coords.Y != 0 ? (int)coords.Y : 1;
            Cell cell        = range.Cells[0];

            ObservableCollection <LineItem> centralLine = design.central.lineListChangeHandler.Items.Count > 0 &&
                                                          design.central.lineListChangeHandler.Items[0].itemListChangeHandler.Items.Count > 0 ?
                                                          design.central.lineListChangeHandler.Items[0].itemListChangeHandler.Items :
                                                          new ObservableCollection <LineItem>();

            ObservableCollection <DesignDimensionLine> Lines = new ObservableCollection <DesignDimensionLine>(design.columns.lineListChangeHandler.Items);
            int lineCount = Lines.Count;

            if (lineCount > 0)
            {
                int totalCardinality = getCartesianProductLineSize(Lines);
                row = lineCount;
                int inc = 1;
                for (int currentLineRang = lineCount; currentLineRang >= 1; currentLineRang--)
                {
                    col = design.rows.lineListChangeHandler.Items.Count > 0 ? design.rows.lineListChangeHandler.Items.Count + 1 : 2;

                    DesignDimensionLine currentLine = Lines[currentLineRang - 1];
                    int currentLineItemCount        = currentLine.GetItemCount();

                    ObservableCollection <DesignDimensionLine> AllLines = new ObservableCollection <DesignDimensionLine>(design.columns.lineListChangeHandler.Items);
                    AllLines.Remove(currentLine);
                    int cardinality = getCartesianProductLineSize(AllLines);
                    int addColIndex = 0;
                    if (currentLineRang == 1 && currentLine.GetItemCount() != 0)
                    {
                        for (int j = 1; j <= totalCardinality / currentLine.GetItemCount(); j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                if (showHeader)
                                {
                                    this.page.getInputTableForm().SpreadSheet.SetValueAt(cell.Row - inc, cell.Column + addColIndex, sheetName, item.GetValue().ToString(), Designer.DesignerForm.COLUMNS_COLOR);
                                    // this.page.getInputTableForm().SpreadSheet.SetValueAt(cell.Row - inc, cell.Column + addColIndex, sheetName, item.GetValue().ToString());
                                }
                                addColIndex++;
                                col++;
                            }
                        }
                    }
                    else
                    {
                        int n = totalCardinality - (currentLineItemCount * cardinality) + 1;
                        int m = cardinality;
                        if (currentLineRang != lineCount)
                        {
                            ObservableCollection <DesignDimensionLine> AllLine   = design.columns.lineListChangeHandler.Items;
                            ObservableCollection <DesignDimensionLine> UPLines   = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(0, currentLineRang - 1));
                            ObservableCollection <DesignDimensionLine> DOWNLines = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(currentLineRang, AllLine.Count - currentLineRang));

                            m = getCartesianProductLineSize(UPLines);
                            n = getCartesianProductLineSize(DOWNLines);
                        }
                        for (int j = 1; j <= n; j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                for (int i = 1; i <= m; i++)
                                {
                                    if (showHeader)
                                    {
                                        this.page.getInputTableForm().SpreadSheet.SetValueAt(cell.Row - inc, cell.Column + addColIndex, sheetName, item.GetValue().ToString(), Designer.DesignerForm.COLUMNS_COLOR);
                                    }
                                    for (int l = 0; l < rowCount; l++)
                                    {
                                        CellProperty cellProperty = GetCellProperty(cell.Row + l, cell.Column + addColIndex, true);
                                        RefreshCellProperty(cellProperty, centralLine);
                                        //this.page.getInputTableForm().SpreadSheet.SetColorAt(cell.Row-1;cell.Column-1,sheetName,item/
                                        RefreshCellProperty(cellProperty, item);
                                    }
                                    addColIndex++;
                                    col++;
                                }
                            }
                        }
                    }
                    inc++;
                    row--;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Build rows
        /// </summary>
        public void BuildRows()
        {
            Design design = this.EditedObject;
            string sheetName = this.SpreadSheet.getActiveSheetName();
            string value = "";
            string cont = "";
            int    row = 1, col = 1;
            bool   concat = design.concatenateRowHearder;

            ObservableCollection <DesignDimensionLine> Lines = new ObservableCollection <DesignDimensionLine>(design.rows.lineListChangeHandler.Items);
            int lineCount = Lines.Count;

            if (lineCount > 0)
            {
                int totalCardinality = getCartesianProductLineSize(Lines);
                col = lineCount;

                for (int currentLineRang = lineCount; currentLineRang >= 1; currentLineRang--)
                {
                    row = design.columns.lineListChangeHandler.Items.Count > 0 ? design.columns.lineListChangeHandler.Items.Count + 1 : 2;
                    if (design.concatenateColumnHearder)
                    {
                        row = 2;
                    }
                    DesignDimensionLine currentLine = Lines[currentLineRang - 1];
                    int currentLineItemCount        = currentLine.GetItemCount();

                    ObservableCollection <DesignDimensionLine> AllLines = new ObservableCollection <DesignDimensionLine>(design.rows.lineListChangeHandler.Items);
                    AllLines.Remove(currentLine);
                    int cardinality = getCartesianProductLineSize(AllLines);

                    if (currentLineRang == 1 && currentLine.GetItemCount() != 0)
                    {
                        for (int j = 1; j <= totalCardinality / currentLine.GetItemCount(); j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                value = item.GetValue().ToString();
                                if (!concat)
                                {
                                    this.SpreadSheet.SetValueAt(row, col, sheetName, value, Designer.DesignerForm.ROWS_COLOR);
                                }
                                else
                                {
                                    object excelValue = this.SpreadSheet.getValueAt(row, col, sheetName);
                                    if (excelValue == null)
                                    {
                                        excelValue = "";
                                    }
                                    if (string.IsNullOrEmpty(excelValue.ToString()))
                                    {
                                        cont = "";
                                    }
                                    else
                                    {
                                        cont = " ; ";
                                    }
                                    excelValue = "" + value + cont + excelValue;
                                    this.SpreadSheet.SetValueAt(row, col, sheetName, excelValue.ToString(), Designer.DesignerForm.ROWS_COLOR);
                                }

                                row++;
                            }
                        }
                    }

                    else
                    {
                        int n = totalCardinality - (currentLineItemCount * cardinality) + 1;
                        int m = cardinality;
                        if (currentLineRang != lineCount)
                        {
                            ObservableCollection <DesignDimensionLine> AllLine   = design.rows.lineListChangeHandler.Items;
                            ObservableCollection <DesignDimensionLine> UPLines   = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(0, currentLineRang - 1));
                            ObservableCollection <DesignDimensionLine> DOWNLines = new ObservableCollection <DesignDimensionLine>(AllLine.ToList().GetRange(currentLineRang, AllLine.Count - currentLineRang));

                            m = getCartesianProductLineSize(UPLines);
                            n = getCartesianProductLineSize(DOWNLines);
                        }

                        for (int j = 1; j <= n; j++)
                        {
                            foreach (LineItem item in currentLine.itemListChangeHandler.Items)
                            {
                                for (int i = 1; i <= m; i++)
                                {
                                    value = item.GetValue().ToString();
                                    if (!concat)
                                    {
                                        this.SpreadSheet.SetValueAt(row, col, sheetName, value.ToString(), Designer.DesignerForm.ROWS_COLOR);
                                    }
                                    else
                                    {
                                        object excelValue = this.SpreadSheet.getValueAt(row, 1, sheetName);
                                        if (excelValue == null)
                                        {
                                            excelValue = "";
                                        }
                                        if (string.IsNullOrEmpty(excelValue.ToString()))
                                        {
                                            cont = "";
                                        }
                                        else
                                        {
                                            cont = " ; ";
                                        }
                                        excelValue = "" + value + cont + excelValue;
                                        this.SpreadSheet.SetValueAt(row, col, sheetName, excelValue.ToString(), Designer.DesignerForm.ROWS_COLOR);
                                    }
                                    row++;
                                }
                            }
                        }
                    }
                    col--;
                }
            }
        }
Ejemplo n.º 9
0
        public void Add(DesignDimensionLine line)
        {
            LineField field = new LineField(line);

            this.Add(field);
        }