Пример #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        String username = Security.getUserName();
        bool   success  = UserDao.deleteAccount(username);

        if (success)
        {
            success = ProgramsDao.deletePrograms(username);
            if (success)
            {
                Security.logout();
            }
        }
    }
Пример #2
0
 protected void WritePrograms_Click(object sender, EventArgs e)
 {
     try
     {
         List <UserPrograms> programs = ProgramsDao.getAllPrograms();
         foreach (UserPrograms p in programs)
         {
             ProgramsXmlWriter writer = new ProgramsXmlWriter(p);
             writer.writeXML();
         }
         lblmsg.Text = "User Programs successfully saved to the App_Data directory.";
     }
     catch (System.IO.IOException ex)
     {
         lblmsg.Text = "Sorry, there was an error, please try again.";
     }
 }
Пример #3
0
    protected void btnAddProgram_Click(object sender, EventArgs e)
    {
        String username    = Security.getUserName();
        String language    = txtLanguage.Text;
        String programName = txtProgramName.Text;

        DateTime createdOnDate = DateTime.Parse(ddlCreatedOnDate.SelectedItem.Text);
        bool     success       = ProgramsDao.addProgram(username, language, programName, createdOnDate);

        if (success)
        {
            GridView1.DataBind();
            txtLanguage.Text    = "";
            txtProgramName.Text = "";
            ddlCreatedOnDate.ClearSelection();
        }
    }