示例#1
0
    private void ReadReport(string guid, bool metadata)
    {
        SchedulerSet sc = new SchedulerSet();

        sc.ReportGuid = guid;
        dynamic d  = Controller.RetriveAsDynamic(Dict[Calls.Retriever], sc);
        JObject jo = null;

        // Special case under OData 4 - the dynamic is a list
        if (Controller.IsOD4)
        {
            IEnumerable <dynamic> ie = d as IEnumerable <dynamic>;
            foreach (var item in ie)
            {
                jo = (JObject)item;
            }
        }
        else
        {
            jo = d;
        }
        if (jo.Count == 1)
        {
            ReportJsonNamed rjn = new ReportJsonNamed();
            rjn.CONTENT    = jo.First.ToString();
            ReportDownload = rjn;
        }
        else if (jo.Count == 2)
        {
            ReportJsonEDM rjd = new ReportJsonEDM();
            rjd.EDM        = jo.First.ToString();
            rjd.CONTENT    = jo.Last.ToString();
            ReportDownload = rjd;
        }
    }
示例#2
0
 protected void GridView3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DoingAgenda())
     {
         BeforeB2.Visible = true;
         Button2.Visible  = false;
         Button9.Visible  = true;
         DOWs.Visible     = true;
         Button8.Text     = "Save Item";
         foreach (GridViewRow row in GridView3.Rows)
         {
             if (row.RowIndex == GridView3.SelectedIndex)
             {
                 string uuid = GridView3.Rows[row.RowIndex].Cells[5].Text;
                 row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
                 row.ToolTip   = "Retrieving Schedule for user";
                 AgendaBind ab = FromAgenda(uuid);
                 if (ab != null)
                 {
                     Button8.Enabled          = true;
                     Session[SelectedAgenda]  = uuid;
                     RadioButtonList2.Visible = false;
                     TextBox7.Text            = ab.TimeSlot;
                     txtNickName.Text         = ab.NickName;
                     lbDOW.Text = "Schedule Time Slot";
                     if (ab.WeekDay != string.Empty)
                     {
                         RadioButtonList2.SelectedValue = ab.WeekDay;
                         RadioButtonList2.Visible       = true;
                         lbDOW.Text = "Schedule Day of the Week and Time Slot";
                     }
                     if (ab.Schedule_Type != string.Empty)
                     {
                         RadioButtonList1.SelectedValue = ab.Schedule_Type.Substring(0, 1);
                     }
                     else
                     {
                         RadioButtonList1.SelectedValue = "D";
                     }
                 }
             }
             else
             {
                 row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                 row.ToolTip   = "Click to select this row.";
             }
         }
     }
     else
     {
         Button9.Visible = false;
         Dictionary <string, string> Files = new Dictionary <string, string>();
         foreach (GridViewRow row in GridView3.Rows)
         {
             if (row.RowIndex == GridView3.SelectedIndex)
             {
                 string name = GridView3.Rows[row.RowIndex].Cells[4].Text;
                 string zn   = name + ".zip";
                 row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
                 row.ToolTip   = "Retrieving Report";
                 Thread.Sleep(100);
                 Model.ReportRetriever(GridView3.Rows[row.RowIndex].Cells[3].Text, true);
                 if (Model.ReportDownload is ReportJsonEDM)
                 {
                     ReportJsonEDM rje = Model.ReportDownload as ReportJsonEDM;
                     WriteTempFile(name + "_EDM.json", rje.EDM, Files);
                     WriteTempFile(name + "_Content.json", rje.CONTENT, Files);
                     DownloadZipFiles(zn, Files);
                 }
                 else if (Model.ReportDownload is ReportJsonNamed)
                 {
                     ReportJsonNamed rjn = Model.ReportDownload as ReportJsonNamed;
                     WriteTempFile(name + "_Content.json", rjn.CONTENT, Files);
                     DownloadZipFiles(zn, Files);
                 }
             }
             else
             {
                 row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                 row.ToolTip   = "Click to select this row.";
             }
         }
     }
 }