Beispiel #1
0
        protected void Session_Start(object sender, EventArgs e)
        {
            WebClient         client   = new WebClient();
            DOS_DBDataContext sql_conn = new DOS_DBDataContext();

            Session["FileIOStream"]    = null;
            Session["FileName"]        = "";
            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++)
            {
                //Not using onemap.sg api. using googlemap api instead.
                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 if (res.ElementAt(x).ConfigName == "BasicSearchRetrivalURL")
                {
                    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();
                }
            }
            //not using onemap.sg api, using googlemap instead
            if (((string)Session["OneMapToken"]).ToString() == "null")
            {
                Session["AutoPostalCode"] = "Off";
            }
            if (((string)Session["SystemMode"]).ToUpper() != "FULL")
            {
                IEnumerable <usp_getAllEmailResult> emailres = sql_conn.usp_getAllEmail().ToList();
                for (int x = 0; x < emailres.Count(); x++)
                {
                    Session[emailres.ElementAt(x).EmailType] = emailres.ElementAt(x).EmailContent;
                }
            }
        }
        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);
        }