Exemplo n.º 1
0
        }         // CreateUiExtReport

        private void ProcessTableReportRow(ReportQuery rptDef, SafeReader sr, Tbody oTbody, int lineCounter, List <string> oColumnTypes)
        {
            var oTr = new Tr().Add <Class>(lineCounter % 2 == 0 ? "Odd" : "Even");

            oTbody.Append(oTr);

            var oClassesToApply = new List <string>();

            for (int columnIndex = 0; columnIndex < rptDef.Columns.Length; columnIndex++)
            {
                ColumnInfo col    = rptDef.Columns[columnIndex];
                var        oValue = sr.ColumnOrDefault(col.FieldName);

                if (col.IsVisible)
                {
                    var oTd = new Td();
                    oTr.Append(oTd);

                    if (IsNumber(oValue))
                    {
                        ATag oInnerTag = new Text(NumStr(oValue, col.Format(IsInt(oValue) ? 0 : 2)));

                        if (col.ValueType == ValueType.UserID || col.ValueType == ValueType.BrokerID)
                        {
                            var oLink = new A();

                            oLink.Append(oInnerTag);
                            oLink.Target.Append("_blank");

                            var titleText = "Open this customer in underwriter.";
                            if (col.ValueType == ValueType.UserID)
                            {
                                oLink.Href.Append("https://" + UnderwriterSite + "/UnderWriter/Customers?customerid=" + oValue);
                            }
                            else
                            {
                                oLink.Href.Append("https://" + UnderwriterSite + "/UnderWriter/Customers#broker/" + oValue);
                                titleText = "Open this broker in underwriter.";
                            }

                            oLink.Alt.Append(titleText);
                            oLink.Title.Append(titleText);

                            oInnerTag = oLink;

                            if (oColumnTypes != null)
                            {
                                oColumnTypes[columnIndex] = "user-id";
                            }
                        }
                        else
                        {
                            if (oColumnTypes != null)
                            {
                                oColumnTypes[columnIndex] = "formatted-num";
                            }
                        }                         // if user id

                        oTd.Add <Class>("R").Append(oInnerTag);
                    }
                    else
                    {
                        oTd.Add <Class>("L").Append(new Text(oValue.ToString()));

                        if ((oColumnTypes != null) && (oValue is DateTime))
                        {
                            oColumnTypes[columnIndex] = "date";
                        }
                    }                     // if
                }
                else
                {
                    if (col.ValueType == ValueType.CssClass)
                    {
                        oClassesToApply.Add(oValue.ToString());
                    }
                }         // if
            }             // for each column

            if (oClassesToApply.Count > 0)
            {
                oTr.ApplyToChildren <Class>(string.Join(" ", oClassesToApply.ToArray()));
            }
        }         // ProcessTableReportRow