Exemple #1
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            DirectorManager manager  = new DirectorManager();
            Director        director = new Director {
                FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text
            };

            manager.Create(director);
            DoDataBind();
            manager.Dispose();
        }
Exemple #2
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            DirectorManager manager = new DirectorManager();
            int             id      = Convert.ToInt32(DirectorsDropdownList.SelectedValue);

            manager.Delete(id);
            DoDataBind();
            FirstNameTextBox.Text = string.Empty;
            LastNameTextBox.Text  = string.Empty;
            manager.Dispose();
        }
Exemple #3
0
        private void DoDataBind()
        {
            DirectorManager manager = new DirectorManager();

            DirectorsDropdownList.DataValueField = "Id";
            DirectorsDropdownList.DataTextField  = "FullName";
            DirectorsDropdownList.DataSource     = manager.GetAll();
            DirectorsDropdownList.DataBind();
            UpdateTextBoxes();
            manager.Dispose();
        }
Exemple #4
0
        protected void EditButton_Click(object sender, EventArgs e)
        {
            DirectorManager manager  = new DirectorManager();
            Director        director = new Director {
                FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text
            };

            director.Id = Convert.ToInt32(DirectorsDropdownList.SelectedValue);
            manager.Update(director);
            DoDataBind();
            manager.Dispose();
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DirectorManager manager = new DirectorManager();

            AllDirectors = manager.GetAll();
            if (!IsPostBack)
            {
                DoDataBind();
            }
            else
            {
                AllDirectors = manager.GetAll();
            }
            manager.Dispose();
        }
Exemple #6
0
 public void CleanUpAfterEachTest()
 {
     manager.Dispose();
 }