public BrowseSetupList(VMSetup vmsetup)
        {
            // TODO: Complete member initialization
            InitializeComponent();
            _setupListManager = new SetupListManager();

            this.vmsetup = vmsetup;
            populateSetupLists(vmsetup);
        }
示例#2
0
        private void btnBrowseSetupList_Click(object sender, RoutedEventArgs e)
        {
            //check to see if an item is selected from the datagrid
            VMSetup vmsetup = new VMSetup();

            if (dgSetups.SelectedItem != null)
            {
                vmsetup = (VMSetup)dgSetups.SelectedItem;
                var browseSetupList = new BrowseSetupList(vmsetup);
                browseSetupList.ShowDialog();
            }
            else
            {
                var browseSetupList = new BrowseSetupList();
                browseSetupList.ShowDialog();
            }
        }
        public List <VMSetup> SelectSetupEventTitle(string eventTitle)
        {
            List <VMSetup> vmSetup = new List <VMSetup>();

            var conn    = DBConnection.GetDbConnection();
            var cmdText = @"sp_select_setup_event_title";
            var cmd     = new SqlCommand(cmdText, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EventTitle", eventTitle);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        VMSetup setup = new VMSetup();
                        setup.SetupID      = reader.GetInt32(0);
                        setup.EventID      = reader.GetInt32(1);
                        setup.DateEntered  = reader.GetDateTime(2);
                        setup.DateRequired = reader.GetDateTime(3);
                        setup.EventTitle   = reader.GetString(4);
                        vmSetup.Add(setup);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }

            return(vmSetup);
        }
 private void populateSetupLists(VMSetup vmsetup)
 {
     try
     {
         _setupLists        = _setupListManager.SelectAllVMSetupLists();
         _currentSetupLists = null;
         if (_currentSetupLists == null)
         {
             _currentSetupLists = new List <VMSetupList>();
             foreach (var item in _setupLists)
             {
                 if (item.SetupID == vmsetup.SetupID)
                 {
                     _currentSetupLists.Add(item);
                 }
             }
         }
         dgSetupList.ItemsSource = _currentSetupLists;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }