예제 #1
0
        public bool ProcessChildPage(string parent_id,
            IEnumerable<Dictionary<string, object>> buildings,
            string[] zoom, string[] lat, string[] lng,
            ref Novacode.DocX docx, Dictionary<string, object> currentBuilding = null
            )
        {
            OracleRepository repo = new OracleRepository();
            var childIds = repo.LoadChildDocumentIDs(parent_id);

            foreach (var childId in childIds)
            {
                if (currentBuilding != null)
                {
                    ProcessDocument(childId, currentBuilding, buildings, 0, ref docx, zoom, lat, lng);
                    ProcessChildPage(childId.ToString(), buildings, zoom, lat, lng, ref docx, currentBuilding);
                    return true;
                }

                int index = 0;
                foreach (Dictionary<string, object> b in buildings)
                {
                    index++;
                    if (!b.ContainsKey("INDEX"))
                    {
                        b.Add("INDEX", index);
                        b.Add("SIZE_SQ_FORMATTED", "");
                        b.Add("BASE_RENT_FORMATTED", "");
                        b.Add("OP_COST_FORMATTED", "");
                        b.Add("TERM_FORMATTED", "");
                        b.Add("NET_RENTABLE_FORMATTED", "");
                        b.Add("FLOOR_PLATE_FORMATTED", "");

                        if (b["SIZE_SQ"] != null && b["SIZE_SQ"] != DBNull.Value)
                        {
                            b["SIZE_SQ_FORMATTED"] = String.Format("{0} sf", b["SIZE_SQ"]);
                        }
                        if (b["BASE_RENT"] != null && b["BASE_RENT"] != DBNull.Value)
                        {
                            b["BASE_RENT_FORMATTED"] = String.Format("$ {0} per sf", b["BASE_RENT"]);
                        }
                        if (b["LATEST_OP_COST_AMT"] != null && b["LATEST_OP_COST_AMT"] != DBNull.Value)
                        {
                            b["OP_COST_FORMATTED"] = String.Format("$ {0} (est {1})", b["LATEST_OP_COST_AMT"], b["OP_COST_YEAR"]);
                        }
                        if (b["TERM"] != null && b["TERM"] != DBNull.Value)
                        {
                            b["TERM_FORMATTED"] = String.Format("{0} years", b["TERM"]);
                        }
                        if (b["PARKING_RATIO"] != null && b["PARKING_RATIO"] != DBNull.Value)
                        {
                            b["PARKING_RATIO_FORMATTED"] = String.Format("1 stall per {0} sf", b["PARKING_RATIO"]);
                        }
                        if (b["NET_RENTABLE"] != null && b["NET_RENTABLE"] != DBNull.Value)
                        {
                            b["NET_RENTABLE_FORMATTED"] = String.Format("{0:N0} sf", b["NET_RENTABLE"]);
                        }
                        if (b["FLOOR_PLATE"] != null && b["FLOOR_PLATE"] != DBNull.Value)
                        {
                            b["FLOOR_PLATE_FORMATTED"] = String.Format("{0:N0} sf", b["FLOOR_PLATE"]);
                        }
                    }

                    ProcessDocument(childId, b, buildings, index, ref docx, zoom, lat, lng);
                    ProcessChildPage(childId.ToString(), buildings, zoom, lat, lng,ref docx, b);
                }
            }
            return true;
        }