Ejemplo n.º 1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (Session["UserInformation"] == null && User.Identity.IsAuthenticated)
            {
                DOS_DBDataContext sql_conn = new DOS_DBDataContext();
                Session["UserInformation"] = sql_conn.usp_getUserInformation(User.Identity.Name).ElementAt(0).XML_F52E2B61_18A1_11d1_B105_00805F49916B;
                Session["AccessRight"]     = sql_conn.usp_getModuleFunctionsAccessRight(User.Identity.Name).ElementAt(0).FunctionAccessRight;
                Session["LogonUserName"]   = sql_conn.usp_getStaffName(User.Identity.Name).ElementAt(0).Name;

                WebClient client = new WebClient();

                Session["TextfieldLength"] = sql_conn.usp_getAllTextFieldLengthInXML().ElementAt(0).XML.ToString();
                IEnumerable <usp_getAppConfigResult> res = sql_conn.usp_getAppConfig().ToList();
                for (int x = 0; x < res.Count(); x++)
                {
                    if (res.ElementAt(x).ConfigName == "OneMapTokenURL")
                    {
                        getOneMapToken(res.ElementAt(x).value.Trim());
                    }
                    else if (res.ElementAt(x).ConfigName == "PostalCodeRetrivalURL")
                    {
                        Session[res.ElementAt(x).ConfigName] = res.ElementAt(x).value.Trim().Replace("<KSTOKEN>", (string)Session["OneMapToken"]);
                    }
                    else
                    {
                        Session[res.ElementAt(x).ConfigName] = res.ElementAt(x).value.Trim();
                    }
                }
                if (((string)Session["OneMapToken"]).ToString() == "null")
                {
                    Session["AutoPostalCode"] = "Off";
                }
            }

            base.OnActionExecuting(filterContext);
        }