private string BuildDateSelectors(bool IsDisplayRating) { StringBuilder sbHtml = new StringBuilder(); Ektron.Cms.EkDTSelector dateSchedule = new Ektron.Cms.EkDTSelector(common.RequestInformationRef); string StartElementID = "start_date"; string EndElementID = "end_date"; if (!IsDisplayRating) { StartElementID = "start_date2"; EndElementID = "end_date2"; } try { if (Request.Form[StartElementID + "_iso"] != "") { if (!IsDisplayRating) { start_date2 = (string)(Request.Form[StartElementID + "_iso"] + " " + Request.Form[StartElementID + "_hr"] + ":" + Request.Form[StartElementID + "_mi"]); } else { start_date = (string)(Request.Form[StartElementID + "_iso"] + " " + Request.Form[StartElementID + "_hr"] + ":" + Request.Form[StartElementID + "_mi"]); } } } catch (Exception) { start_date = ""; } try { if (Request.Form[EndElementID + "_iso"] != "") { if (!IsDisplayRating) { end_date2 = (string)(Request.Form[EndElementID + "_iso"] + " " + Request.Form[EndElementID + "_hr"] + ":" + Request.Form[EndElementID + "_mi"]); } else { end_date = (string)(Request.Form[EndElementID + "_iso"] + " " + Request.Form[EndElementID + "_hr"] + ":" + Request.Form[EndElementID + "_mi"]); } } } catch (Exception) { end_date = ""; } sbHtml.Append("<table class=\"ektronGrid\">"); sbHtml.Append("<tr>"); sbHtml.Append("<td class=\"label\">"); sbHtml.Append(_MessageHelper.GetMessage("generic start date label")); sbHtml.Append("</td>"); sbHtml.Append("<td class=\"value\">"); dateSchedule.formName = "form1"; dateSchedule.extendedMeta = true; dateSchedule.formElement = StartElementID; dateSchedule.spanId = StartElementID + "_span"; if (start_date != "") { try { dateSchedule.targetDate = DateTime.Parse(start_date); } catch (Exception) { start_date = ""; } } if (start_date2 != "") { try { dateSchedule.targetDate = DateTime.Parse(start_date2); } catch (Exception) { start_date2 = ""; } } sbHtml.Append(dateSchedule.displayCultureDateTime(true, "", "")); sbHtml.Append("</td>"); sbHtml.Append("</tr>"); sbHtml.Append("<tr>"); sbHtml.Append("<td class=\"label\">"); sbHtml.Append(_MessageHelper.GetMessage("generic end date label")); sbHtml.Append("</td>"); sbHtml.Append("<td class=\"value\">"); dateSchedule = new Ektron.Cms.EkDTSelector(common.RequestInformationRef); dateSchedule.formName = "form1"; dateSchedule.extendedMeta = true; dateSchedule.formElement = EndElementID; dateSchedule.spanId = EndElementID + "_span"; if (end_date != "") { try { dateSchedule.targetDate = DateTime.Parse(end_date); } catch (Exception) { end_date = ""; } } if (end_date2 != "") { try { dateSchedule.targetDate = DateTime.Parse(end_date2); } catch (Exception) { end_date2 = ""; } } sbHtml.Append(dateSchedule.displayCultureDateTime(true, "", "")); sbHtml.Append("</td>"); sbHtml.Append("</tr>"); sbHtml.Append("</table>"); return sbHtml.ToString(); }
private void BuildDateSelectors() { Ektron.Cms.EkDTSelector dateSchedule = new Ektron.Cms.EkDTSelector(common.RequestInformationRef); this.lblQuickView.Text = common.EkMsgRef.GetMessage("quick view lbl") + ":"; this.lblJumpTo.Text = common.EkMsgRef.GetMessage("jump to lbl") + ":"; StringBuilder sbHtml = new StringBuilder(); sbHtml.Append("<tr>"); sbHtml.Append("<td class=\"label\">"); sbHtml.Append(common.EkMsgRef.GetMessage("generic start date label")); sbHtml.Append("</td>"); sbHtml.Append("<td>"); dateSchedule.formName = "form1"; dateSchedule.extendedMeta = true; dateSchedule.formElement = "start_date"; dateSchedule.spanId = "start_date_span"; if (start_date != "") { try { dateSchedule.targetDate = StartDate; } catch (Exception) { start_date = ""; } } sbHtml.Append(dateSchedule.displayCultureDate(true, "", "")); sbHtml.Append("</td>"); sbHtml.Append("</tr>"); sbHtml.Append("<tr>"); sbHtml.Append("<td class=\"label\">"); sbHtml.Append(common.EkMsgRef.GetMessage("generic end date label")); sbHtml.Append("</td>"); sbHtml.Append("<td>"); dateSchedule = new Ektron.Cms.EkDTSelector(common.RequestInformationRef); dateSchedule.formName = "form1"; dateSchedule.extendedMeta = true; dateSchedule.formElement = "end_date"; dateSchedule.spanId = "end_date_span"; if (end_date != "") { try { dateSchedule.targetDate = EndDate; } catch (Exception) { end_date = ""; } } sbHtml.Append(dateSchedule.displayCultureDate(true, "", "")); sbHtml.Append("</td>"); sbHtml.Append("</tr>"); lblViewing.Text = sbHtml.ToString(); }