Пример #1
0
        protected void DoReport()
        {
            HttpResponseMessage resp = m_apiInterop.CallService("api/team/GetTeams", true);

            Task <Stream> tskStream = resp.Content.ReadAsStreamAsync();

            tskStream.Wait();

            Stream     stm = tskStream.Result;
            TextReader tr  = new StreamReader(stm);

            Response.Clear();
            Response.ContentType = "text/csv";
            Response.AddHeader("Content-Disposition", "filename=\"Teams.csv\"");

            string sLine;

            while ((sLine = tr.ReadLine()) != null)
            {
                Response.Write(sLine);
                Response.Write("\n");
            }

            Response.Write("\n");
            Response.Flush();
            Response.End();
        }
Пример #2
0
        protected void DoReport()
        {
            // future: wire up timezone info properly. for now hardcode PST
            HttpResponseMessage resp      = m_apiInterop.CallService("api/slot/GetSlots?TimeZoneID=Pacific%20Standard%20Time", true);
            Task <Stream>       tskStream = resp.Content.ReadAsStreamAsync();

            tskStream.Wait();

            Stream     stm = tskStream.Result;
            TextReader tr  = new StreamReader(stm);

            Response.Clear();
            Response.ContentType = "text/csv";
            Response.AddHeader("Content-Disposition", "filename=\"Slots.csv\"");

            string sLine;

            while ((sLine = tr.ReadLine()) != null)
            {
                Response.Write(sLine);
                Response.Write("\n");
            }

            Response.Write("\n");
            Response.Flush();
            Response.End();
            //HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Пример #3
0
        /*----------------------------------------------------------------------------
        *       %%Function: CheckServiceServerConsistency
        *       %%Qualified: Rwp.AdminPage.CheckServiceServerConsistency
        *       %%Contact: rlittle
        *
        *   verify that the web client is consistent with the web api (the web client
        *   access the SQL server as well as the web api -- it sucks when they
        *   don't agree on the SQL server to be working with)
        *  ----------------------------------------------------------------------------*/
        void CheckServiceServerConsistency(string sSqlConnectionString)
        {
            if (!m_auth.IsLoggedIn)
            {
                return;
            }

            ServerInfo si;

            si = m_apiInterop.CallService <ServerInfo>("api/core/GetServerInfo", false);

            ConnectionStringSettings conn = ConfigurationManager.ConnectionStrings["dbSchedule"];

            string sSqlServer = ExtractServerNameFromConnection(sSqlConnectionString);

            if (String.Compare(si.sSqlServerHash, sSqlServer, true) != 0)
            {
                throw new Exception($"SQL SERVER MISMATCH: {si.sSqlServerHash} != {sSqlServer}");
            }
        }
        /*----------------------------------------------------------------------------
        *       %%Function: DataGrid_DeleteItem
        *       %%Qualified: Rwp.CalendarLinkPage.DataGrid_DeleteItem
        *       %%Contact: rlittle
        *
        *  ----------------------------------------------------------------------------*/
        void DataGrid_DeleteItem(Object sender, DataGridCommandEventArgs e)
        {
            // e.Item is the table row where the command is raised. For bound
            // columns, the value is stored in the Text property of a TableCell.
            TableCell itemCell = e.Item.Cells[0];
            string    item     = itemCell.Text;

            // Remove the selected item from the data source
            RSR sr = m_apiInterop.CallService <RSR>($"api/calendar/RevokeCalendarLink/{item}", true);

            ReportSr(sr, "CreateLink");

            // Rebind the data source to refresh the DataGrid control.
            BindSource();
        }
Пример #5
0
        protected void DoReport(string sLinkID)
        {
            sLinkID = sLinkID.Replace(" ", "%20");

            RSR_CalItems rci = m_apiInterop.CallService <RSR_CalItems>($"api/opencalendar/GetCalendarForTeam/{sLinkID}", false);

            if (!rci.Result)
            {
                ErrorResponse.InnerText = String.Format("Failed to get calendar for {0}: {1}", sLinkID, rci.Reason);
                return;
            }

            Response.Clear();
            Response.ContentType = "text/calendar";
            Response.AddHeader("Content-Disposition", "filename=\"practices.ics\"");

            Response.Write("BEGIN:VCALENDAR\r\n");
            Response.Write("PRODID://Thetasoft//RWLL Practice Tool\r\n");
            Response.Write("VERSION:2.0\r\n");

            foreach (CalItem ci in rci.TheValue)
            {
                Response.Write("BEGIN:VEVENT\r\n");
                Response.Write(String.Format("UID:{0}\r\n", ci.UID));
                Response.Write(String.Format("DTSTART:{0}\r\n", ci.Start.ToString("yyyyMMddTHHmmssZ")));
                Response.Write(String.Format("DTEND:{0}\r\n", ci.End.ToString("yyyyMMddTHHmmssZ")));
                Response.Write(String.Format("DESCRIPTION:{0}\r\n", ci.Description));
                Response.Write(String.Format("LOCATION:{0}\r\n", ci.Location));
                Response.Write(String.Format("SUMMARY:{0}\r\n", ci.Title));

                Response.Write("END:VEVENT\r\n");
            }

            Response.Write("END:VCALENDAR\r\n");
            Response.Flush();
            Response.End();
        }