示例#1
0
        public void LoadValues(Dictionary <string, object> values, System.Data.DataRow dataRow, Durados.View view, Durados.ParentField parentField, Durados.View rootView, string dynastyPath, string prefix, string postfix, Dictionary <string, Durados.Workflow.DictionaryField> dicFields, string internalDynastyPath)
        {
            if (view.Equals(rootView))
            {
                dynastyPath         = GetViewDisplayName((View)view) + ".";
                internalDynastyPath = view.Name + ".";
            }
            foreach (Durados.Field field in view.Fields.Values.Where(f => f.FieldType == Durados.FieldType.Column))
            {
                LoadValue(values, dataRow, view, field, dynastyPath, prefix, postfix, dicFields, internalDynastyPath);
            }

            var childrenFields = view.Fields.Values.Where(f => f.FieldType == Durados.FieldType.Children && ((ChildrenField)f).LoadForBlockTemplate);

            foreach (ChildrenField field in childrenFields)
            {
                string name                = prefix + dynastyPath + field.DisplayName + postfix;
                string internalName        = prefix + internalDynastyPath + field.Name + postfix;
                System.Data.DataView value = GetDataView(field, dataRow);
                if (!values.ContainsKey(name))
                {
                    values.Add(name, value);
                    dicFields.Add(internalDynastyPath, new Durados.Workflow.DictionaryField {
                        DisplayName = field.DisplayName, Type = field.DataType, Value = value
                    });
                }

                foreach (ColumnField columnField in field.ChildrenView.Fields.Values.Where(f => f.FieldType == Durados.FieldType.Column))
                {
                    if (columnField.Upload != null)
                    {
                        value.Table.Columns[columnField.Name].ExtendedProperties["ImagePath"] = columnField.GetUploadPath();
                    }
                }
            }

            foreach (ParentField field in view.Fields.Values.Where(f => f.FieldType == Durados.FieldType.Parent))
            {
                if (view.Equals(rootView))
                {
                    dynastyPath         = view.DisplayName + ".";
                    internalDynastyPath = view.Name + ".";
                }
                LoadValue(values, dataRow, view, field, dynastyPath, prefix, postfix, dicFields, internalDynastyPath);

                System.Data.DataRow parentRow = null;
                View parentView = null;
                if (dataRow != null)
                {
                    parentRow  = dataRow.GetParentRow(field.DataRelation.RelationName);
                    parentView = (View)field.ParentView;
                    if (parentRow == null)
                    {
                        string key = field.GetValue(dataRow);
                        if (!string.IsNullOrEmpty(key))
                        {
                            parentRow = parentView.GetDataRow(key, dataRow.Table.DataSet);
                        }
                    }
                }
                if (parentRow != null && parentField != field)
                {
                    if (parentView != rootView)
                    {
                        //dynastyPath += field.DisplayName + ".";
                        dynastyPath         = GetDynastyPath(dynastyPath, (ParentField)parentField, field);
                        internalDynastyPath = GetInternalDynastyPath(internalDynastyPath, (ParentField)parentField, field);
                        LoadValues(values, parentRow, parentView, field, rootView, dynastyPath, prefix, postfix, dicFields, internalDynastyPath);
                    }
                }
            }
        }
示例#2
0
        private void ReportDetail(PdfPTable pdfTable, System.Data.DataSet theData)
        {
            PdfPCell cell = new PdfPCell();

            System.Data.DataTable pawnData = theData.Tables["EXT_INFO"];
            string last_group = "";

            for (int i = 0; i < pawnData.Rows.Count; i++)
            {
                System.Data.DataRow pawnLoan = pawnData.Rows[i];
                System.Data.DataRow customer = pawnLoan.GetParentRow("customerRelation");

                object groupBy = pawnLoan[_groupByField];
                string groupByValue;
                if (groupBy is DateTime)
                {
                    groupByValue = ((DateTime)pawnLoan[_groupByField]).FormatDate();
                }
                else if (groupBy is double)
                {
                    groupByValue = string.Format("{0:c}", pawnLoan[_groupByField]);
                }
                else
                {
                    groupByValue = pawnLoan[_groupByField].ToString();
                }

                if (groupByValue != last_group)
                {
                    cell                     = new PdfPCell(new Phrase("", _reportFont));
                    cell.Colspan             = 9;
                    cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                    cell.Border              = Rectangle.NO_BORDER;
                    pdfTable.AddCell(cell);

                    //row 1
                    cell                     = new PdfPCell(new Phrase("", _reportFont));
                    cell.Colspan             = 9;
                    cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                    cell.Border              = Rectangle.BOTTOM_BORDER;
                    pdfTable.AddCell(cell);

                    cell                     = new PdfPCell(new Phrase(groupByValue, _reportFont));
                    cell.Colspan             = 9;
                    cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                    cell.Border              = Rectangle.BOTTOM_BORDER;
                    pdfTable.AddCell(cell);

                    last_group = groupByValue;
                }

                //row 2

                cell                     = new PdfPCell(new Phrase(customer["CUSTOMERNUMBER"].ToString(), _reportFont));
                cell.Colspan             = 3;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(customer["CUST_NAME"].ToString(), _reportFont));
                cell.Colspan             = 3;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(customer["ID"].ToString(), _reportFont));
                cell.Colspan             = 2;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(customer["BIRTHDATE"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                // row 3
                cell                     = new PdfPCell();
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["TICKET_NUMBER"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["DATE_MADE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["DATE_DUE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["PFI_ELIG"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["PRIN_AMOUNT"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["FIN_CHG"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["SERV_CHG"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["LOAN_STATUS"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);


                // row 4
                cell                     = new PdfPCell();
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["RECEIPT_NUMBER"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["REF_DATE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["NEW_MADE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["NEW_DUE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["NEW_PFI"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["REF_AMT"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(pawnLoan["EXT_STATUS"].ToString(), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);

                cell                     = new PdfPCell(new Phrase(string.Format("{0:d}", pawnLoan["CREATIONDATE"]), _reportFont));
                cell.Colspan             = 1;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);


                // blank line after record
                cell                     = new PdfPCell();
                cell.Colspan             = 9;
                cell.HorizontalAlignment = Rectangle.ALIGN_LEFT;
                cell.Border              = Rectangle.NO_BORDER;
                pdfTable.AddCell(cell);
            }
        }