Exemplo n.º 1
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        db = new DB();

        if (Request.QueryString["JobRno"] != null)
        {
            string sJobRno = Request.QueryString["JobRno"];
            JobRno = Misc.UnMangleNumber(sJobRno);
            if (JobRno == 0)
            {
                JobRno = Str.Num(sJobRno);
            }
            if (JobRno != 0)
            {
                fReport    = true;
                fSingleJob = true;
            }
        }

        Pg = new WebPage("Images");
        if (JobRno == 0)
        {
            Pg.CheckLogin(Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath));
        }

        // Put user code to initialize the page here
        if (!Page.IsPostBack)
        {
            Session["Menu"] = WebPage.Reports.Title;
            Setup();
        }
        else
        {
            fLetterSize = rdoLetter.Checked;
        }

        //WebConfig wc = new WebConfig();
        //// has to be the system parm sling user so we can see the pending assignments
        SlingEmail    = SysParm.Get(Misc.cnSlingUserEmail);
        SlingPassword = SysParm.Get(Misc.cnSlingUserPassword);
        //SlingOrgId = wc.Str("SlingOrgId");
    }
Exemplo n.º 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);
        }
    }