Exemple #1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            FmLinkBillInfo fmLinkBill = new FmLinkBillInfo();

            fmLinkBill.SelectValue += (obj) =>
            {
                Info_link_bill_tent info = obj as Info_link_bill_tent;
                int rowOffset            = 2;// this.reoGridControl1.CurrentWorksheet.RowCount;
                InsertBillItem(rowOffset);

                SetItemCellValue(info, rowOffset);
            };
            fmLinkBill.ShowDialog();
        }
Exemple #2
0
        List <Info_link_bill_tent> GetItems()
        {
            List <Info_link_bill_tent> items = new List <Info_link_bill_tent>();

            for (int row = 2; row < reportTmpBillInfo.Sheet.RowCount;)
            {
                unvell.ReoGrid.Cell cell = reportTmpBillInfo.Sheet.Cells[row, 0];
                Info_link_bill_tent item = cell.Tag as Info_link_bill_tent;
                if (item != null)
                {
                    items.Add(item);
                }

                row += 17;
            }

            return(items);
        }
Exemple #3
0
        private void SetItemCellValue(Info_link_bill_tent item, int rowOffset, bool isEmpty = false)
        {
            List <unvell.ReoGrid.Cell> cellsTmp = reportTmpItem.GetAllMergedCells();

            foreach (var v in cellsTmp)
            {
                int    realRow = v.Row + rowOffset;
                string varText = Report.ReportTemplateBase.FindVarString(v.DisplayText);
                if (varText != null)
                {
                    if (isEmpty)
                    {
                        Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column];
                        cell.Data = "";
                    }
                    else
                    {
                        Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance;
                        string dataField = varText.Substring(2, varText.Length - 3);
                        object value     = memberAccessor.GetValue(item, dataField);
                        if (value != null)
                        {
                            Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column];
                            Miles.ReoGrid.ReportTemplate.SetCellValue(cell, value, item);
                        }
                    }
                }
                else
                {
                    Cell cell = reportTmpBillInfo.Sheet.Cells[realRow, v.Column];
                    cell.Data = v.Data;// value;
                }
            }

            if (!isEmpty)
            {
                reportTmpBillInfo.AutoFitAllColumnWidth();
                reportTmpBillInfo.AutoFitAllRowHeight();
            }

            reportTmpBillInfo.SetGridBorderLine();
        }
Exemple #4
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            RangePosition pos = this.reoGridControl1.CurrentWorksheet.SelectionRange;

            unvell.ReoGrid.Cell cell = reportTmpBillInfo.Sheet.Cells[pos.Row, pos.Col];
            Info_link_bill_tent item = cell.Tag as Info_link_bill_tent;

            if (item == null)
            {
                return;
            }
            if (this.GetItems().Count > 1)
            {
                reportTmpBillInfo.Sheet.DeleteRows(cell.Row, 17);
            }
            else
            {
                SetItemCellValue(new Info_link_bill_tent(), 2, true);
            }
        }
Exemple #5
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            RangePosition pos = this.reoGridControl1.CurrentWorksheet.SelectionRange;

            unvell.ReoGrid.Cell cell = this.reoGridControl1.CurrentWorksheet.Cells[pos.Row, pos.Col];
            Info_link_bill_tent item = cell.Tag as Info_link_bill_tent;

            if (item == null)
            {
                return;
            }
            FmLinkBillInfo fmLinkBill = new FmLinkBillInfo(item);

            fmLinkBill.SelectValue += (obj) =>
            {
                Info_link_bill_tent info = obj as Info_link_bill_tent;
                int rowOffset            = pos.Row;

                SetItemCellValue(info, rowOffset);
            };
            fmLinkBill.ShowDialog();
        }