Пример #1
0
    private void Page_Init(object sender, System.EventArgs e)
    {
        InitCalendars();

        WebConfig Cfg = new WebConfig();

        fByKitchenLocation = Cfg.Bool("ByKitchenLocation");
    }
Пример #2
0
    // debugging
    //TextWriterTraceListener tl = new TextWriterTraceListener("C:\\Temp\\Debug.txt");
    //Debug.Listeners.Add(tl);
    //Debug.AutoFlush = true;

    //Debug.Listeners.Remove(tl);


    public Sling()
    {
        WebConfig wc = new WebConfig();

        sEmail     = wc.Str("SlingEmail");
        sPassword  = wc.Str("SlingPassword");
        sOrgId     = string.Empty;
        sUserId    = string.Empty;
        sLocation  = wc.Str("SlingLocation");
        sPosition  = wc.Str("SlingPosition");
        sUserEmail = SysParm.Get(Misc.cnSlingUserEmail);
        fDebug     = wc.Bool("SlingDebug");
        fDebugLog  = wc.Bool("SlingLog");

        sScheme = HttpContext.Current.Request.Url.Scheme;
        sHost   = HttpContext.Current.Request.Url.Host;
        sPort   = (HttpContext.Current.Request.Url.Port == 80 ||
                   HttpContext.Current.Request.Url.Port == 443 ?
                   string.Empty :
                   string.Format(":{0}", HttpContext.Current.Request.Url.Port));

        if (HttpContext.Current.Session["SlingAuth"] != null)
        {
            Authorization = HttpContext.Current.Session["SlingAuth"].ToString();
        }
        if (HttpContext.Current.Session["SlingOrg"] != null)
        {
            sOrgId   = HttpContext.Current.Session["SlingOrg"].ToString();
            sBaseUrl = string.Format(@"https://api.sling.is/v1/{0}/", sOrgId);
            sBaseUrl = @"https://api.sling.is/v1/";
        }
        if (HttpContext.Current.Session["SlingUser"] != null)
        {
            sUserId = HttpContext.Current.Session["SlingUser"].ToString();
        }

        if (fDebug && fDebugLog)
        {
            LogFile = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "SlingLog.txt"), true);
        }
    }