Exemplo n.º 1
0
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (List01.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a category to view its products";
            }
            else
            {
                try
                {
                    Controller01 sysmgr01 = new Controller01();
                    Entity01     info01   = null;
                    info01                  = sysmgr01.FindByID(int.Parse(List01.SelectedValue));
                    IDLabel01.Text          = "Category ID:";
                    IDLabel02.Text          = info01.CategoryID.ToString();
                    NameLabel01.Text        = "Category Name:";
                    NameLabel02.Text        = info01.CategoryName;
                    DescriptionLabel01.Text = "Category Description:";
                    DescriptionLabel02.Text = info01.Description;

                    Controller02    sysmgr02 = new Controller02();
                    List <Entity02> info02   = null;
                    info02 = sysmgr02.FindByID(int.Parse(List01.SelectedValue));
                    info02.Sort((x, y) => x.ProductName.CompareTo(y.ProductName));
                    List02.DataSource = info02;
                    List02.DataBind();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }
Exemplo n.º 2
0
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (List01.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a Team to view its information";
            }
            else
            {
                try
                {
                    Controller02    sysmgr       = new Controller02();
                    Controller01    sysmgr2      = new Controller01();
                    List <Entity02> info         = null;
                    Entity03        SearchEntity = sysmgr2.FindByID(int.Parse(List01.SelectedValue));
                    info = sysmgr.FindByID(int.Parse(List01.SelectedValue));

                    info.Sort((x, y) => x.LastName.CompareTo(y.LastName));
                    List02.DataSource = info;
                    List02.DataBind();
                    Coach.Text       = SearchEntity.Coach.ToString();
                    AssistCoach.Text = SearchEntity.AssistantCoach.ToString();
                    Wins.Text        = SearchEntity.Wins.ToString();
                    Losses.Text      = SearchEntity.Losses.ToString();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message + "Test";
                }
            }
        }
Exemplo n.º 3
0
 protected void Fetch_Click(object sender, EventArgs e)
 {
     if (List01.SelectedIndex == 0)
     {
         MessageLabel.Text = "Select a category to view its products";
     }
     else
     {
         try
         {
             Controller01 sysmgr01 = new Controller01();
             Entity01     info01   = null;
             info01                  = sysmgr01.FindByPKID(int.Parse(List01.SelectedValue));
             NameLabel01.Text        = "Coach:";
             NameLabel02.Text        = info01.Coach;
             DescriptionLabel01.Text = "Assistant Coach:";
             DescriptionLabel02.Text = info01.AssistantCoach;
             IDLabel01.Text          = "Wins:";
             IDLabel02.Text          = info01.Wins.ToString();
             IDLabel201.Text         = "Losses:";
             IDLabel202.Text         = info01.Losses.ToString();
             Controller02    sysmgr02 = new Controller02();
             List <Entity02> info02   = null;
             info02 = sysmgr02.FindByID(int.Parse(List01.SelectedValue));
             info02.Sort((x, y) => x.FirstAndLast.CompareTo(y.FirstAndLast));
             List02.DataSource = info02;
             List02.DataBind();
         }
         catch (Exception ex)
         {
             MessageLabel.Text = ex.Message;
         }
     }
 }
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(IDArg.Text))
            {
                MessageLabel.Text = "Enter a ID value.";
                ID.Text           = "";
                Name.Text         = "";
            }

            else
            {
                int id = 0;
                if (int.TryParse(IDArg.Text, out id))
                {
                    if (id > 0)
                    {
                        Controller01 sysmgr = new Controller01();
                        Entity01     info   = null;
                        info = sysmgr.FindByID(id); //BLL controller method

                        if (info == null)
                        {
                            MessageLabel.Text = "ID not found.";
                            ID.Text           = "";
                            Name.Text         = "";
                        }
                        else
                        {
                            ID.Text   = info.TeamID.ToString();
                            Name.Text = info.TeamName;
                        }
                    }
                    else
                    {
                        MessageLabel.Text = "ID must be greater than 0";
                        ID.Text           = "";
                        Name.Text         = "";
                    }
                }
                else
                {
                    MessageLabel.Text = "ID must be a number.";
                    ID.Text           = "";
                    Name.Text         = "";
                }
            }
        }
Exemplo n.º 5
0
 protected void BindList()
 {
     try
     {
         Controller01    sysmgr = new Controller01();
         List <Entity01> info   = null;
         info = sysmgr.List();
         info.Sort((x, y) => x.TeamName.CompareTo(y.TeamName));
         List01.DataSource     = info;
         List01.DataTextField  = nameof(Entity01.TeamName);
         List01.DataValueField = nameof(Entity01.TeamID);
         List01.DataBind();
         List01.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         MessageLabel.Text = ex.Message;
     }
 }
Exemplo n.º 6
0
 protected void BindCategoryList()
 {
     try
     {
         Controller01    sysmgr = new Controller01();
         List <Entity01> info   = null;
         info = sysmgr.List();
         info.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName));
         CategoryList.DataSource     = info;
         CategoryList.DataTextField  = nameof(Entity01.CategoryName);
         CategoryList.DataValueField = nameof(Entity01.CategoryID);
         CategoryList.DataBind();
         CategoryList.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         errormsgs.Add(GetInnerException(ex).ToString());
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
 }
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (List01.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a team to view its players";
            }
            else
            {
                try
                {
                    //Controller01 Teamsysmgr = new Controller01();
                    //List<Entity01> Teaminfo = null;
                    //Teaminfo = Teamsysmgr.FindByID(int.Parse(List01.SelectedValue));
                    ////info.Sort((x, y) => x.ProductName.CompareTo(y.ProductName));
                    //TeamInfo.DataSource = Teaminfo;
                    //TeamInfo.DataBind();
                    TeamInfoLabel.Text = "Team Information";
                    Controller01    Teamsysmgr = new Controller01();
                    List <Entity01> Teaminfo   = null;
                    Teaminfo = Teamsysmgr.FindByID(int.Parse(List01.SelectedValue));
                    //Teaminfo = Teamsysmgr.List();
                    TeamInfo.DataSource = Teaminfo;
                    TeamInfo.DataBind();

                    RosterLabel.Text = "Team Roster";
                    Controller02    sysmgr = new Controller02();
                    List <Entity02> info   = null;
                    info = sysmgr.FindByID(int.Parse(List01.SelectedValue));
                    info.Sort((x, y) => x.PlayerName.CompareTo(y.PlayerName));
                    //info.Sort((x, y) => x.ProductName.CompareTo(y.ProductName));
                    List02.DataSource = info;
                    List02.DataBind();
                }
                catch (Exception ex)
                {
                    TeamInfoLabel.Text = "";
                    RosterLabel.Text   = "";
                    MessageLabel.Text  = ex.Message;
                }
            }
        }
 protected void Fetch_Click(object sender, EventArgs e)
 {
     if (List01.SelectedIndex == 0)
     {
         MessageLabel.Text = "Select a team to view details";
         //clear details
         Coach.Text          = "";
         AssistantCoach.Text = "";
         Wins.Text           = "";
         Losses.Text         = "";
     }
     else
     {
         try
         {
             Controller02    sysmgr = new Controller02();
             List <Entity02> info   = null;
             info = sysmgr.FindByID(int.Parse(List01.SelectedValue));
             info.Sort((x, y) => x.PlayerName.CompareTo(y.PlayerName));
             List02.DataSource = info;
             List02.DataBind();
             // Team info
             Controller01 teamController = new Controller01();
             Entity01     teamInfo       = null;
             teamInfo            = teamController.TeamGet(int.Parse(List01.SelectedValue));
             Coach.Text          = teamInfo.Coach;
             AssistantCoach.Text = teamInfo.AssistantCoach;
             Wins.Text           = teamInfo.Wins.ToString();
             Losses.Text         = teamInfo.Losses.ToString();
         }
         catch (Exception ex)
         {
             MessageLabel.Text = ex.Message;
         }
     }
 }