示例#1
0
        /// <summary>
        /// 収入と支出と合計の表示
        /// </summary>
        private void DisplayPropertyManagement(DisplayListType listType)
        {
            DateTime start;
            DateTime end;

            switch (listType)
            {
            case DisplayListType.OneDay:
                //1日ごとの全データを設定
                SetPropertyManagementList(DateTime.MinValue, DateTime.MinValue);
                break;

            case DisplayListType.ByDay:
                start = new DateTime(DTPickerBreakdown.Value.Year, DTPickerBreakdown.Value.Month, 1);
                SetPropertyManagementList(start, start.AddMonths(1));
                break;

            case DisplayListType.ByWeek:
                start = new DateTime(DTPickerBreakdown.Value.Year, DTPickerBreakdown.Value.Month, 1);
                SetPropertyManagementList(start, start.AddMonths(1));
                break;

            case DisplayListType.ByMonth:
                start = new DateTime(DTPickerBreakdown.Value.Year, 1, 1);
                end   = new DateTime(DTPickerBreakdown.Value.AddYears(1).Year, 1, 1);
                SetPropertyManagementList(start, end);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// ListViewコントロールを変更する
        /// </summary>
        /// <param name="listType"></param>
        private void ChangeListView(DisplayListType listType)
        {
            // ListViewコントロールのプロパティを設定
            LvRecord.FullRowSelect = true;
            LvRecord.GridLines     = true;
            LvRecord.Sorting       = SortOrder.Ascending;
            LvRecord.View          = View.Details;

            // 列(コラム)ヘッダの登録
            ColumnHeader[] colHeaderRegValue = ChangeHeader(listType);
            if (colHeaderRegValue == null)
            {
                return;
            }
            LvRecord.Columns.AddRange(colHeaderRegValue);
        }
示例#3
0
        /// <summary>
        /// 日付文字列取得
        /// </summary>
        /// <param name="listType">表示リスト種類</param>
        /// <returns>日付文字列</returns>
        private string DTPickerBreakdownStr(DisplayListType listType)
        {
            switch (listType)
            {
            case DisplayListType.OneDay:
            case DisplayListType.ByDay:
            case DisplayListType.ByWeek:
                DTPBreakdownStr = AppConst.DTP_MONTH_TIMESTR;
                break;

            case DisplayListType.ByMonth:
                DTPBreakdownStr = AppConst.DTP_YEAR_TIMESTR;
                break;
            }

            return(DTPBreakdownStr);
        }
示例#4
0
        /// <summary>
        /// ListViewの項目を追加
        /// </summary>
        /// <param name="listType"></param>
        private void ChangeListViewItems(DisplayListType listType)
        {
            // ListViewコントロールのデータをすべて消去します。
            LvRecord.Items.Clear();

            // ListViewコントロールにデータを追加します。
            ListViewItem[] items = ChangeItems(listType);
            if (items == null)
            {
                return;
            }
            LvRecord.Items.AddRange(items);

            if (listType == DisplayListType.ByMonth)
            {
                LvRecord.Sorting            = SortOrder.Descending;
                LvRecord.ListViewItemSorter = new ValueCompare();
            }
        }
示例#5
0
        /// <summary>
        /// 表示項目の作成
        /// </summary>
        /// <param name="pairs">リスト表示の動的配列</param>
        /// <returns>ヘッダー</returns>
        private ListViewItem[] CreateItemsList(DisplayListType listType)
        {
            ListViewItem[] listViewItems = null;

            try
            {
                List <ListViewItem> itemsList = new List <ListViewItem>();

                // 列(コラム)ヘッダの作成
                switch (listType)
                {
                case DisplayListType.OneDay:
                    itemsList = OneDayCreateItems();
                    break;

                case DisplayListType.ByDay:
                    break;

                case DisplayListType.ByWeek:
                    itemsList = WeekCreateItems();
                    break;

                case DisplayListType.ByMonth:
                    itemsList = MonthCreateItems();
                    break;
                }

                listViewItems = itemsList.ToArray();
                return(listViewItems);
            }
            catch
            {
                OriginMBox.MBoxErrorOK(AppConst.LIST_ITEM_MESSAGE);
                return(null);
            }
        }
示例#6
0
        /// <summary>
        /// データごとに表示項目を変更する
        /// </summary>
        /// <param name="displayListType">表示リスト種類</param>
        /// <returns>リストのヘッダー</returns>
        private ListViewItem[] ChangeItems(DisplayListType displayListType)
        {
            ListViewItem[] viewItems = null;
            //データごとにヘッダーの中身を変更する
            switch (displayListType)
            {
            case DisplayListType.OneDay:
                viewItems = CreateItemsList(DisplayListType.OneDay);
                break;

            case DisplayListType.ByDay:
                break;

            case DisplayListType.ByWeek:
                viewItems = CreateItemsList(DisplayListType.ByWeek);
                break;

            case DisplayListType.ByMonth:
                viewItems = CreateItemsList(DisplayListType.ByMonth);
                break;
            }

            return(viewItems);
        }
示例#7
0
        /// <summary>
        /// データごとにヘッダーの中身を変更する
        /// </summary>
        /// <param name="displayListType">表示リスト種類</param>
        /// <returns>リストのヘッダー</returns>
        private ColumnHeader[] ChangeHeader(DisplayListType displayListType)
        {
            ColumnHeader[] colHeaderList = null;
            //データごとにヘッダーの中身を変更する
            switch (displayListType)
            {
            case DisplayListType.OneDay:
                colHeaderList = CreateColumnHeader(ONEDAY_PARAM_DICT);
                break;

            case DisplayListType.ByDay:
                break;

            case DisplayListType.ByWeek:
                colHeaderList = CreateColumnHeader(BYWEEK_PARAM_DICT);
                break;

            case DisplayListType.ByMonth:
                colHeaderList = CreateColumnHeader(BYMONTH_PARAM_DICT);
                break;
            }

            return(colHeaderList);
        }
        public static MvcHtmlString DynamicDisplayListFor <TModel, TProperty>(this HtmlHelper <TModel> helper, Expression <Func <TModel, TProperty> > expression, IEnumerable <SelectListItem> selectList, string optionLabel, DisplayListType displayType = DisplayListType.SelectedLabel, object viewData = null)
        {
            DynamicComponentBaseFor <TModel, TProperty> dynamicComponentBase = new DynamicComponentBaseFor <TModel, TProperty>(helper, expression, viewData, true, true);
            object selectedValue = dynamicComponentBase.FieldValue;
            string selectedText  = selectList.Where(w => w.Value == selectedValue?.ToString()).FirstOrDefault()?.Text;

            switch (displayType)
            {
            case DisplayListType.DropDownList:
                TagBuilder_Select <TModel, TProperty> tagBuilder = new TagBuilder_Select <TModel, TProperty>(dynamicComponentBase);
                tagBuilder.AddOptionLabel(optionLabel);
                tagBuilder.AddOptions(selectList);
                tagBuilder.TagElement.AddInputAttributeStaticValue("disabled", null);
                tagBuilder.TagElement.AddInputAttributeStaticValue("class", "");
                return(tagBuilder.GenerateElementMvcString(TagRenderMode.Normal));

            case DisplayListType.SelectedEdit:
                dynamicComponentBase.HtmlAttributes = (RouteValueDictionary)helper.MergeHtmlAttributes(dynamicComponentBase.HtmlAttributes, new RouteValueDictionary()
                {
                    { "class", "control-input" }
                });
                return(TagBuilderGenerators.GenerateTagEditor(dynamicComponentBase.SanitizedId, selectedText, dynamicComponentBase.HtmlAttributes, dynamicComponentBase.FieldModelMetadata.Description, false, true).ToMvcHtmlString(TagRenderMode.Normal));

            case DisplayListType.OptionsList:
                return(null);

            case DisplayListType.SelectedLabel:
                dynamicComponentBase.HtmlAttributes = (RouteValueDictionary)helper.MergeHtmlAttributes(dynamicComponentBase.HtmlAttributes, new RouteValueDictionary()
                {
                    { "class", "control-label" }
                });
                return(TagBuilderGenerators.GenerateTagLabel(dynamicComponentBase.SanitizedId, selectedText, dynamicComponentBase.SanitizedId, dynamicComponentBase.HtmlAttributes, dynamicComponentBase.FieldModelMetadata.Description).ToMvcHtmlString(TagRenderMode.Normal));

            case DisplayListType.SelectedSpan:
                dynamicComponentBase.HtmlAttributes = (RouteValueDictionary)helper.MergeHtmlAttributes(dynamicComponentBase.HtmlAttributes, new RouteValueDictionary()
                {
                    { "class", "control-span" }
                });
                return(TagBuilderGenerators.GenerateTagDisplay(dynamicComponentBase.SanitizedId, selectedText, dynamicComponentBase.HtmlAttributes, dynamicComponentBase.FieldModelMetadata.Description).ToMvcHtmlString(TagRenderMode.Normal));

            case DisplayListType.SelectedOnlyText:
            default:
                return(TagBuilderGenerators.GenerateOnlyText(selectedText, dynamicComponentBase.HtmlAttributes));
            }
        }