protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
            string controllerName = this.RouteData.Values["controller"].ToString().ToLower();
            string actionName     = this.RouteData.Values["action"].ToString().ToLower();

            #region >> 로그저장
            if (!(controllerName == "account" && (actionName == "dologin" || actionName == "dologout")))
            {
                LOGIN_WEBMENU menu = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_URL.ToLower().Equals("/" + controllerName + "/" + actionName)).FirstOrDefault();
                if (menu != null)
                {
                    SessionHelper.LOG_NAME = menu.NAME;
                    SessionHelper.LoginInfo.CURRENT_MENU_NAME = menu.NAME;
                }
                if (!string.IsNullOrEmpty(SessionHelper.LOG_NAME))
                {
                    Service.commoneService.SaveLog(new T_LOG
                    {
                        STORE_CODE  = SessionHelper.LoginInfo.STORE_CODE ?? 0,
                        LOG_TYPE    = 2,
                        LOG_DATA1   = "/" + controllerName + "/" + actionName,
                        LOG_DATA2   = SessionHelper.LOG_NAME,
                        USE_IP      = Request.UserHostAddress,
                        LOG_DESC    = SessionHelper.LOG_PARAM,
                        INSERT_CODE = (SessionHelper.LoginInfo.MEMBER == null || SessionHelper.LoginInfo.MEMBER.MEMBER_CODE == null) ? 0 : SessionHelper.LoginInfo.MEMBER.MEMBER_CODE
                    });
                }
            }
            SessionHelper.LOG_NAME  = "";
            SessionHelper.LOG_PARAM = "";
            #endregion >> 로그저장

            #region >> 세션아웃시 로그아웃 처리
            if (filterContext.HttpContext.Request.IsAjaxRequest())
            {
                if ((SessionHelper.LoginInfo.MEMBER == null || SessionHelper.LoginInfo.MEMBER.MEMBER_CODE == null || SessionHelper.LoginInfo.WebMemu == null) &&
                    SessionHelper.LoginNonCheckPageList.PAGE.Where(w => w.ToLower().Contains("/" + controllerName + "/" + actionName)).Count() == 0 &&
                    SessionHelper.LoginNonCheckPageList.PAGE.Where(w => w.ToLower().Contains("/" + controllerName + "/")).Count() == 0 &&
                    SessionHelper.LoginNonCheckPageList.ControllerNames.Where(w => w.ToLower() == controllerName).Count() == 0
                    )
                {
                    filterContext.Result = new JsonResult
                    {
                        Data = new
                        {
                            logout = true,
                            // put whatever data you want which will be sent
                            // to the client
                            ERROR_MESSAGE = "죄송합니다. 당신은 로그아웃되었습니다."
                        },
                        JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    };
                }
            }
            #endregion >> 세션아웃시 로그아웃 처리

            SessionHelper.SetSession();
        }
示例#2
0
        public List <LOGIN_WEBMENU> GetLoginWebMenuList(LOGIN_WEBMENU Cond)
        {
            string sql = Global.DBAgent.LoadSQL(sqlBasePath + "HomePage\\T_STORE_WEBMENU.xml", "GetStoreWebMenuList"
                                                , Cond.PROJECT_SITE.ToString("")
                                                , Cond.STORE_CODE.ToString("")
                                                , Cond.NAME.ToString("")
                                                , (Cond.HIDE == null ? "0" : ((Cond.HIDE == true) ? "0" : "1"))
                                                );

            return(db.ExecuteQuery <LOGIN_WEBMENU>(sql).ToList());
        }
        /// <summary>
        /// 로그인한 직원 메뉴정보 가져오기
        /// </summary>
        /// <param name="Cond"></param>
        /// <returns></returns>
        public List <LOGIN_WEBMENU> GetLoginWebMenuList(LOGIN_WEBMENU Cond)
        {
            string sql = Global.DBAgent.LoadSQL(sqlBasePath + "BizService\\Member\\T_MEMBER.xml", "GetLoginWebMenuList"
                                                , Cond.PROJECT_SITE.ToString("")
                                                , Cond.STORE_CODE.ToString("1")
                                                , Cond.MEMBER_CODE.ToString("")

                                                );

            return(db.ExecuteQuery <LOGIN_WEBMENU>(sql).ToList());
        }
示例#4
0
        public static MvcHtmlString Title(this HtmlHelper helper)
        {
            if (string.IsNullOrEmpty(helper.ViewBag.Title))
            {
                var           chkurl = "/" + helper.ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + helper.ViewContext.RouteData.Values["action"].ToString().ToLower();
                LOGIN_WEBMENU data   = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_URL.ToLower().Contains(chkurl)).FirstOrDefault();
                if (data == null)
                {
                    data = new LOGIN_WEBMENU {
                        NAME = "loggal Management"
                    };
                }

                helper.ViewBag.Title = data.NAME;
                SessionHelper.LoginInfo.CURRENT_MENU_NAME = data.NAME;
            }

            return(new MvcHtmlString(helper.ViewBag.Title));
        }
示例#5
0
        public static MvcHtmlString TitleHeader(this HtmlHelper helper, string addTitle = "")
        {
            if (string.IsNullOrEmpty(helper.ViewBag.Title))
            {
                var           chkurl = "/" + helper.ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + helper.ViewContext.RouteData.Values["action"].ToString().ToLower();
                LOGIN_WEBMENU data   = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_URL.ToLower().Contains(chkurl)).FirstOrDefault();
                if (data == null)
                {
                    data = new LOGIN_WEBMENU {
                        NAME = "온닫이"
                    };
                }

                helper.ViewBag.Title = data.NAME;

                SessionHelper.LoginInfo.CURRENT_MENU_NAME = data.NAME;
            }

            return(new MvcHtmlString("<h2 class=\"ui header\">" + helper.ViewBag.Title + addTitle + "</h2>"));
        }
        /// <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()));
        }
示例#7
0
        public static MvcHtmlString TitleNavigation(this HtmlHelper helper, SemanticUIHelper.Size size = SemanticUIHelper.Size.big, string addTitle = "")
        {
            List <LOGIN_WEBMENU> activeMenuList = new List <LOGIN_WEBMENU>();

            var           chkurl = "/" + helper.ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + helper.ViewContext.RouteData.Values["action"].ToString().ToLower();
            LOGIN_WEBMENU data   = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_URL.ToLower().Contains(chkurl)).FirstOrDefault();

            if (data == null)
            {
                data = new LOGIN_WEBMENU {
                    NAME = "loggal Management"
                };
            }
            else
            {
                activeMenuList.Add(data);
            }
            SessionHelper.LoginInfo.CURRENT_MENU_NAME = data.NAME;
            while (true)
            {
                data = SessionHelper.LoginInfo.WebMemu.Where(w => w.MENU_CODE == data.PARENT_CODE).FirstOrDefault();
                if (data == null)
                {
                    break;
                }
                else
                {
                    activeMenuList.Add(data);
                }
            }

            if (activeMenuList.Count() == 0)
            {
                return(TitleHeader(helper, addTitle));
            }
            else
            {
                activeMenuList = activeMenuList.OrderBy(o => o.SEARCH_CODE).ToList();
                StringBuilder sbHtml = new StringBuilder();
                sbHtml.Append("<div class='ui ").Append(size.ToString()).Append(" breadcrumb'>");

                for (int i = 0; i < activeMenuList.Count(); i++)
                {
                    if (i < activeMenuList.Count() - 1)
                    {
                        sbHtml.Append("<a class='section'>").Append(activeMenuList[i].NAME).Append("</a>");
                        sbHtml.Append("<i class='right angle icon divider'></i> ");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(helper.ViewBag.Title))
                        {
                            string name = activeMenuList[i].NAME;
                            try
                            {
                                if (Global.Format.IsNumeric(HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Count() - 1]))
                                {
                                    name = name.Replace("등록", "정보");
                                }
                            }
                            catch (Exception) { }


                            sbHtml.Append("<div class='active section'>").Append(name);

                            SessionHelper.LoginInfo.CURRENT_MENU_NAME = name;
                        }
                        else
                        {
                            sbHtml.Append("<div class='active section'>").Append(helper.ViewBag.Title);
                        }

                        sbHtml.Append("</div>");
                    }
                }
                sbHtml.Append((string.IsNullOrEmpty(addTitle) ? "" : addTitle)).Append("</div>");
                return(new MvcHtmlString(sbHtml.ToString()));
            }
        }