Exemplo n.º 1
0
        public static MvcHtmlString CompCombo(this HtmlHelper helper, string id, T_COMPANY_COND Param = null, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            Param            = (Param == null) ? new T_COMPANY_COND {
            } : Param;
            Param.PAGE_COUNT = 10000;
            Param.SORT       = "A.COMPANY_NAME";

            if (SessionHelper.LoginInfo.COMPANY_CODE != 1)
            {
                Param.COMPANY_CODE = SessionHelper.LoginInfo.COMPANY_CODE;
                optionLabel        = null;
            }
            IList <T_COMPANY> list = Service.basicService.GetCompanyList(Param);



            var combo = list.Select(s => new SelectListItem {
                Value = s.COMPANY_CODE.ToString(), Text = s.COMPANY_NAME, Selected = (selectedValue == s.COMPANY_CODE.ToString()) ? true : false
            });

            var    arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);
            string shtml           = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 2
0
        public static MvcHtmlString CommonComboNormal(this HtmlHelper helper, string id, List <SelectListItem> list, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            var    arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);
            string shtml           = helper.DropDownList(id, list, optionLabel, arrHtmlAtribute).ToHtmlString();

            //shtml += "<script >$('document').ready(function () { try{ $('#" + id + "').prev().html($('#" + id + "  option:selected').text()); } catch(e){} }); </script>";

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 3
0
        public static MvcHtmlString CompCombo(this HtmlHelper helper, string id, IList <T_COMPANY> list, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            var combo = list.Select(s => new SelectListItem {
                Value = s.COMPANY_CODE.ToString(), Text = s.COMPANY_NAME, Selected = (selectedValue == s.COMPANY_CODE.ToString()) ? true : false
            });

            var    arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);
            string shtml           = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 회원콤보
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="Param"></param>
        /// <param name="selectedValue"></param>
        /// <param name="optionLabel"></param>
        /// <param name="htmlAttributes"></param>
        /// <returns></returns>
        public static MvcHtmlString MemberCombo(this HtmlHelper helper, string id, T_MEMBER_COND Param, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            IList <T_MEMBER> list = new AccountService().GetMemberList(Param);

            var combo = list.Select(s => new SelectListItem {
                Value = s.MEMBER_CODE.ToString(), Text = s.USER_NAME, Selected = (selectedValue == s.MEMBER_CODE.ToString()) ? true : false
            });

            var    arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);
            string shtml           = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 공통코드
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="Param"></param>
        /// <param name="selectedValue"></param>
        /// <param name="optionLabel"></param>
        /// <param name="htmlAttributes"></param>
        /// <returns></returns>
        public static MvcHtmlString CommonCombo(this HtmlHelper helper, string id, T_COMMON_COND Param, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            Param.HIDE = (Param.HIDE == null) ? false : Param.HIDE;
            IList <T_COMMON> list = new BaseService().GetCommon(Param);

            var combo = list.Select(s => new SelectListItem {
                Value = s.SUB_CODE.ToString(), Text = s.NAME, Selected = (selectedValue == s.SUB_CODE.ToString()) ? true : false
            });
            var arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);

            string shtml = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            //shtml += "<script >$('document').ready(function () { try{ $('#" + id + "').prev().html($('#" + id + "  option:selected').text()); } catch(e){} }); </script>";

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 공통코드
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="Param"></param>
        /// <param name="selectedValue"></param>
        /// <param name="optionLabel"></param>
        /// <param name="htmlAttributes"></param>
        /// <returns></returns>
        public static MvcHtmlString CommonCombo(this HtmlHelper helper, string id, T_COMMON_COND Param, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null, enComboDisType enComboDisType = enComboDisType.NAME)
        {
            /***ID가 STATUS인경우 selected에 문제가 발생함(PartialView을 Ajax호출할 경우 발생함)  ****/
            optionLabel = optionLabel ?? "-선택-";
            if (optionLabel == "-1*")
            {
                optionLabel = null;
            }
            Param.HIDE = (Param.HIDE == null) ? false : Param.HIDE;
            IList <T_COMMON> list = new CommonService().GetCommon(Param);
            var arrHtmlAtribute   = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);


            IEnumerable <SelectListItem> combo = new List <SelectListItem>();

            switch (enComboDisType)
            {
            case enComboDisType.REF_DATA1:
                combo = list.Select(s => new SelectListItem {
                    Value = s.SUB_CODE.ToString(), Text = s.REF_DATA1, Selected = (selectedValue == s.SUB_CODE.ToString()) ? true : false
                }).ToList();
                break;

            case enComboDisType.REF_DATA2:
                combo = list.Select(s => new SelectListItem {
                    Value = s.SUB_CODE.ToString(), Text = s.REF_DATA2, Selected = (selectedValue == s.SUB_CODE.ToString()) ? true : false
                }).ToList();
                break;

            case enComboDisType.REF_DATA3:
                combo = list.Select(s => new SelectListItem {
                    Value = s.SUB_CODE.ToString(), Text = s.REF_DATA3, Selected = (selectedValue == s.SUB_CODE.ToString()) ? true : false
                }).ToList();
                break;

            default:
                combo = list.Select(s => new SelectListItem {
                    Value = s.SUB_CODE.ToString(), Text = s.NAME, Selected = (selectedValue == s.SUB_CODE.ToString()) ? true : false
                }).ToList();
                break;
            }
            string shtml = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            //shtml += "<script >$('document').ready(function () { try{ $('#" + id + "').prev().html($('#" + id + "  option:selected').text()); } catch(e){} }); </script>";

            return(new MvcHtmlString(shtml));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 매장콤보
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="Param"></param>
        /// <param name="selectedValue"></param>
        /// <param name="optionLabel"></param>
        /// <param name="htmlAttributes"></param>
        /// <returns></returns>
        public static MvcHtmlString StoreCombo(this HtmlHelper helper, string id, T_STORE_COND Param = null, string selectedValue = null, string optionLabel = "-선택-", object htmlAttributes = null)
        {
            Param = (Param == null) ? new T_STORE_COND {
                DISPLAY_MODE = "Normal"
            } : Param;
            if (Param.DISPLAY_MODE != "Total")
            {
                if (SessionHelper.LoginInfo.STORE.STORE_CODE != 1)
                {
                    Param.COMPANY_CODE = SessionHelper.LoginInfo.STORE.COMPANY_CODE;
                }

                if (!(SessionHelper.LoginInfo.STORE.STORE_TYPE == 1 || SessionHelper.LoginInfo.STORE.STORE_TYPE == 4))
                {
                    Param.STORE_CODE = SessionHelper.LoginInfo.STORE.STORE_CODE;
                    selectedValue    = null;
                }
            }
            if (Param.COMPANY_CODE == null)
            {
                Param.COMBO_DISPLAY = 1;
            }
            if (Param.PAGE_COUNT == null)
            {
                Param.PAGE_COUNT = 999999999;
            }
            IList <T_STORE> list = Service.basicService.GetStoreList(new T_STORE_COND());

            if (list.Count() == 1)
            {
                optionLabel = null;
            }
            var combo = list.Select(s => new SelectListItem {
                Value = s.STORE_CODE.ToString(), Text = ((Param.COMBO_DISPLAY == 1 && s.COMPANY_NAME != s.STORE_NAME) ? (s.COMPANY_NAME + ">") : "") + s.STORE_NAME, Selected = (selectedValue == s.STORE_CODE.ToString()) ? true : false
            });

            var    arrHtmlAtribute = SemanticUIHelper.SetDefaultSemanticSize(htmlAttributes, semaintic_size);
            string shtml           = helper.DropDownList(id, combo, optionLabel, arrHtmlAtribute).ToHtmlString();

            return(new MvcHtmlString(shtml));
        }
        /// <summary>
        /// 버튼(메뉴권한추가)
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="text"></param>
        /// <param name="btnType"></param>
        /// <param name="size"></param>
        /// <param name="htmlAttributes"></param>
        /// <returns></returns>
        public static MvcHtmlString Semantic_Button2(this HtmlHelper helper, string id, string text, SemanticUIHelper.enButtonType btnType, SemanticUIHelper.Size size, object htmlAttributes = null, string buttonpageURL = null, string iconName = null)
        {
            var chkurl = "/" + helper.ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + helper.ViewContext.RouteData.Values["action"].ToString().ToLower();

            if (!string.IsNullOrEmpty(buttonpageURL))
            {
                chkurl = buttonpageURL;
            }
            LOGIN_WEBMENU data = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_URL.ToLower().Contains(chkurl)).FirstOrDefault();

            data = (data == null) ? new LOGIN_WEBMENU()
            {
                INSERT_AUTH = true, UPDATE_AUTH = true, EXCEL_AUTH = true, PRINT_AUTH = true
            } : data;                                                                                                                            /*자신의 메뉴에 없을 경우 버튼 비활성화*/
            StringBuilder sbHtml = new StringBuilder();

            sbHtml.Append(" <button ");

            //// Type가 지정 안되었을 경우 기본 설정
            var arrType = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes).Where(w => w.Key.ToLower() == "type").ToList();

            if (arrType.Count > 0)
            {
                sbHtml.Append(arrType[0].Key).Append("='").Append(arrType[0].Value).Append("'");
            }
            else
            {
                sbHtml.Append("type='button'");
            }


            sbHtml.Append(" class='ui ");
            var arrClass = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes).Where(w => w.Key.ToLower() == "class").ToList();

            foreach (var cssData in arrClass)
            {
                sbHtml.Append(" ").Append(cssData.Value).Append(" ");
            }

            sbHtml.Append(" ").Append(btnType.ToString()).Append(" ");
            switch (btnType)
            {
            case SemanticUIHelper.enButtonType.Del:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.red.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.Cancel:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.orange.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.New:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.teal.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.Request:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.olive.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.Save:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.blue.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.Excel:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.green.ToString()).Append(" ");
                break;

            case SemanticUIHelper.enButtonType.ToList:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.grey.ToString()).Append(" ");
                sbHtml.Append("  ");
                break;

            case SemanticUIHelper.enButtonType.Check:
                sbHtml.Append(" check ");
                break;

            case SemanticUIHelper.enButtonType.Print:
                sbHtml.Append(" ").Append(SemanticUIHelper.enColor.brown.ToString()).Append(" ");
                break;

            default:
                break;
            }

            switch (btnType)
            {
            case SemanticUIHelper.enButtonType.New:
                if (!data.INSERT_AUTH)
                {
                    sbHtml.Append(" hide ");
                }
                else if (SessionHelper.LoginInfo.EDIT_MODE == enEditMode.READ)
                {
                    sbHtml.Append(" hide ");
                }
                break;

            case SemanticUIHelper.enButtonType.Save:
            case SemanticUIHelper.enButtonType.Del:
            case SemanticUIHelper.enButtonType.Cancel:
                if (!data.UPDATE_AUTH)
                {
                    sbHtml.Append(" hide ");
                }
                else if (SessionHelper.LoginInfo.EDIT_MODE == enEditMode.READ)
                {
                    sbHtml.Append(" hide ");
                }
                break;

            case SemanticUIHelper.enButtonType.Excel:
                if (!data.EXCEL_AUTH)
                {
                    sbHtml.Append(" hide ");
                }
                break;

            case SemanticUIHelper.enButtonType.Print:
                if (!data.PRINT_AUTH)
                {
                    sbHtml.Append(" hide ");
                }
                break;

            default:
                break;
            }



            sbHtml.Append(size.ToString()).Append(" button' id='").Append(id).Append("' name='").Append(id).Append("'").Append(SemanticUIHelper.GetHtmlAttributeString(htmlAttributes)).Append("> ").Append("\n");
            sbHtml.Append(text).Append("\n");
            if (!string.IsNullOrEmpty(iconName))
            {
                sbHtml.Append("<i class='").Append(iconName).Append("'></i>");
            }
            sbHtml.Append(" </button>").Append("\n");
            return(new MvcHtmlString(sbHtml.ToString().Trim()));
        }