예제 #1
0
        protected void SetFilters(bool isAjax, string keyword = null, string state = null, DateTime?startDate = null, DateTime?endDate = null)
        {
            if (!isAjax)
            {
                this.StateList = StateNames.GetStateDropdown(state);
            }

            this.FilterKeyword   = keyword;
            this.FilterState     = state;
            this.FilterStartDate = (startDate != null) ? ((DateTime)startDate).ToShortDateString() : String.Empty;
            this.FilterEndDate   = (endDate != null) ? ((DateTime)endDate).ToShortDateString() : String.Empty;

            StringBuilder subtitle = new StringBuilder();

            if (!String.IsNullOrEmpty(keyword))
            {
                subtitle.Append(String.Format("Keyword: {0}; ", HttpUtility.HtmlEncode(keyword)));
            }

            if ((startDate != null) && (endDate != null))
            {
                DateTimeFormatInfo dtfi = CultureInfo.CreateSpecificCulture("en-US").DateTimeFormat;
                subtitle.Append(String.Format("Date Range: {0} - {1}; ", ((DateTime)startDate).ToString("d", dtfi), ((DateTime)endDate).ToString("d", dtfi)));
            }

            char[] charsToTrim = { ';', ' ' };
            this.Subtitle = subtitle.ToString().TrimEnd(charsToTrim);
        }
예제 #2
0
 public BaseViewModel(bool setStates = true)
 {
     if (setStates)
     {
         this.StateList = StateNames.GetStateDropdown(String.Empty);
     }
 }