コード例 #1
0
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] param)
        {
            AddProcurementCommandToEditMenu(page, page);

            StringBuilder html = new StringBuilder();

            ProcurementDb db = new ProcurementDb();

            ProcurementDb.ProcurementAggregatorData ProcurementAggregator = db.fetchProcurementAggregator(page, identifier, langToRenderFor, true);

            int currYear = PageUtils.getFromForm("yr", Int32.MinValue);

            if (currYear == Int32.MinValue)
            {
                currYear = ProcurementAggregator.YearToDisplay;
            }

            List <ProcurementDb.ProcurementDetailsData>      articleList = new List <ProcurementDb.ProcurementDetailsData>();
            Dictionary <CmsPage, CmsPlaceholderDefinition[]> childPages  = CmsContext.getAllPlaceholderDefinitions("ProcurementDetails", page, CmsContext.PageGatheringMode.ChildPagesOnly);

            foreach (CmsPage childPage in childPages.Keys)
            {
                foreach (CmsPlaceholderDefinition def in childPages[childPage])
                {
                    ProcurementDb.ProcurementDetailsData entity = db.fetchProcurementDetails(childPage, def.Identifier, langToRenderFor, true);
                    articleList.Add(entity);
                }
            }

            // -- display results
            html.Append(getHtmlForSummaryView(articleList.ToArray(), currYear, langToRenderFor));
            writer.Write(html.ToString());
        }
コード例 #2
0
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] param)
        {
            // CmsContext.setCurrentCultureInfo(langToRenderFor);
            StringBuilder html = new StringBuilder();

            ProcurementDb db = new ProcurementDb();

            ProcurementDb.ProcurementDetailsData Procurement = db.fetchProcurementDetails(page, identifier, langToRenderFor, true);

            html.Append("<h2>");
            html.Append(Procurement.DateOfProcurement.ToString("MMM d yyyy"));
            html.Append("</h2>");
            writer.Write(html.ToString());
        }
コード例 #3
0
        public override void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] param)
        {
            // CmsContext.setCurrentCultureInfo(langToRenderFor);
            ProcurementDb db = new ProcurementDb();

            ProcurementDb.ProcurementAggregatorData entity = db.fetchProcurementAggregator(page, identifier, langToRenderFor, true);

            string ProjectSummaryId = "ProjectSummary_" + page.ID.ToString() + "_" + identifier.ToString() + "_" + langToRenderFor.shortCode;

            // ------- CHECK THE FORM FOR ACTIONS
            string action = PageUtils.getFromForm(ProjectSummaryId + "_Action", "");

            if (action.Trim().ToLower() == "update")
            {
                // save the data to the database
                int id             = PageUtils.getFromForm(ProjectSummaryId + "_ProjectSummaryId", -1);
                int newDefaultYear = PageUtils.getFromForm("defaultYear_" + ProjectSummaryId, -1);

                entity.YearToDisplay = newDefaultYear;

                bool b = db.updateProcurementAggregator(page, identifier, langToRenderFor, entity);
                if (!b)
                {
                    writer.Write("Error saving updates to database!");
                }
            }

            // ------- START RENDERING
            // note: no need to put in the <form></form> tags.

            StringBuilder html = new StringBuilder();

            html.Append("<p><strong>Procurement Aggregator Display Settings:</strong></p>");

            html.Append("<table>");
            string s = PageUtils.getInputTextHtml("defaultYear_" + ProjectSummaryId, "defaultYear_" + ProjectSummaryId, entity.YearToDisplay.ToString(), 7, 4);

            html.Append("<tr><td>Default Year to display summaries for: (-1 = all years)</td>");
            html.Append("<td>" + s + "</td></tr>");

            html.Append("</table>");

            html.Append("<input type=\"hidden\" name=\"" + ProjectSummaryId + "_Action\" value=\"update\">");
            html.Append("<input type=\"hidden\" name=\"" + ProjectSummaryId + "_ProjectSummaryId\" value=\"" + page.ID.ToString() + "\">");

            writer.WriteLine(html.ToString());
        }
コード例 #4
0
        public override void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] param)
        {
            // CmsContext.setCurrentCultureInfo(langToRenderFor);
            ProcurementDb db = new ProcurementDb();

            ProcurementDb.ProcurementDetailsData entity = new ProcurementDb.ProcurementDetailsData(page, identifier, langToRenderFor);
            string dateString = "";
            string editId     = "ProcurementDetails_" + page.Id.ToString() + "_" + identifier.ToString() + "_" + langToRenderFor.shortCode;

            // ------- CHECK THE FORM FOR ACTIONS
            string action = PageUtils.getFromForm(editId + "_Action", "");

            if (action.Trim().ToLower() == "update")
            {
                dateString = PageUtils.getFromForm("dateOfProcurement_" + editId, "");
                try
                {
                    entity.DateOfProcurement = Convert.ToDateTime(dateString);
                }
                catch { }
                db.updateProcurementDetails(page, identifier, langToRenderFor, entity);
            }
            else
            {
                entity     = db.fetchProcurementDetails(page, identifier, langToRenderFor, true);
                dateString = entity.DateOfProcurement.ToString("d");
            }

            // ------- START RENDERING
            StringBuilder arg0 = new StringBuilder();

            arg0.Append("<div style=\"width: 100%\">");
            arg0.Append("<p>Date of Procurement (" + CmsLanguage.CurrentShortDateFormat + "): ");
            arg0.Append(PageUtils.getInputTextHtml("dateOfProcurement_" + editId, "dateOfProcurement_" + editId, dateString, 10, 10));
            arg0.Append("</p>");

            arg0.Append("<input type=\"hidden\" name=\"" + editId + "_Action\" value=\"update\">");
            arg0.Append("</div>");

            writer.WriteLine(arg0.ToString());
        }