Beispiel #1
0
    /// <summary>
    /// save agenda
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button8_Click(object sender,EventArgs e)
    {
        if (DoingAgenda())
        {
            AgendaBind ab = FromAgenda(Session[SelectedAgenda] as string);
            if (ab != null)
            {
                Agenda a = new Agenda();
                a.AGENDA_TYPE = RadioButtonList1.SelectedValue;
                if (a.AGENDA_TYPE == "W")
                {
                    a.DOW = RadioButtonList2.SelectedValue;
                }
                a.NICKNAME   = txtNickName.Text;
                a.SLOT       = TextBox7.Text;
                a.Parameters = new List <Parameter>();
                a.PKY        = ab.UUID;

                AgendaResult agenda = Model.UserSetAgenda(a);
                SetMessage("Schedule " + a.NICKNAME + " changed successfully");
            }
        }
        else // new agenda item ..
        {
            Agenda a = new Agenda();
            a.NICKNAME    = txtNickName.Text;
            a.AGENDA_TYPE = RadioButtonList1.SelectedValue;
            if (a.AGENDA_TYPE == "W")
            {
                a.DOW = RadioButtonList2.SelectedValue;
            }
            a.SLOT = TextBox7.Text;
            if (RadioButtonList3.SelectedValue == "N")
            {
                a.WithMetadata = "X";
            }
            else
            {
                a.ColumnsNamed = "X";
            }
            Scheduler s = DoWork(true);
            a.Name   = TextBox1.Text;
            a.USERID = s.Username;
            if (IsValid(TextBox4.Text))
            {
                a.Variant = TextBox4.Text;
            }
            else
            {
                a.Variant = Session[VarNameSaved] as string;
            }
            a.Parameters = new List <Parameter>();
            foreach (var item in s.Parameters)
            {
                a.Parameters.Add(item);
            }
            AgendaResult agenda = Model.UserSetAgenda(a);
            SetMessage("Schedule " + a.NICKNAME + " created successfully");
        }
    }
Beispiel #2
0
 protected void ConfirmDelete_Click(object sender,EventArgs e)
 {
     if (DoingAgenda())
     {
         string uuid = string.Empty;
         foreach (GridViewRow row in GridView3.Rows)
         {
             if (row.RowIndex == GridView3.SelectedIndex)
             {
                 uuid = GridView3.Rows[row.RowIndex].Cells[5].Text;
             }
         }
         if (uuid != string.Empty)
         {
             AgendaBind ab = FromAgenda(uuid);
             if (ab != null)
             {
                 Agenda a = new Agenda();
                 a.PKY        = ab.UUID;
                 a.DELETE     = "X";
                 a.Parameters = new List <Parameter>();
                 Parameter p = new Parameter();
                 a.Parameters.Add(p);
                 Session[SavedAgendaForUpdate] = a;
                 CheckBox2.Visible             = true;
             }
         }
     }
 }
Beispiel #3
0
 protected void Button7_Click(object sender, EventArgs e)
 {
     if (showAgenda == true)
     {
         SetMode("a");
         Button7.Text    = ShowA;
         Button8.Enabled = true;
         Button3.Enabled = true;
         Button4.Enabled = true;
     }
     else
     {
         SetMode("A");
         Button3.Enabled   = false;
         Button4.Enabled   = false;
         Grid3.Visible     = true;
         GridView3.Caption = "Schedule for User";
         AgendaQuery       agenda = Model.UserAgenda(GetUserName());
         List <AgendaBind> reps   = new List <AgendaBind>();
         if (agenda != null)
         {
             foreach (var l1 in agenda.AGENDA)
             {
                 var ab = new AgendaBind();
                 ab.NickName      = l1.NICKNAME;
                 ab.Schedule_Type = GetAgendaType(l1.AGENDA_TYPE);
                 ab.TimeSlot      = l1.SLOT;
                 if (ab.TimeSlot.Length == 1)
                 {
                     ab.TimeSlot = "0" + ab.TimeSlot;
                 }
                 ab.UUID     = l1.PKY;
                 ab.WeekDay  = GetDOW(l1.DOW);
                 ab.UserName = GetUserName();
                 reps.Add(ab);
             }
             GridView3.Caption = "Schedule found for user";
             BindData <List <AgendaBind> >(GridView3,reps,SaveAgenda);
         }
         ReportsShown        = true;
         Session[ShowAgenda] = true;
         Button7.Text        = HideA;
     }
 }
Beispiel #4
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.";
             }
         }
     }
 }