Esempio n. 1
0
 public PatronForm(Patrons p)
 {
     InitializeComponent();
       patronID = p.PatronID;
       txtName.Text = p.Name;
       txtPhoneNumber.Text = p.PhoneNumber;
       txtAddress.Text = p.Address;
       cmbGender.SelectedIndex = (p.Gender == "male") ? 0 : 1;
       cmbAge.SelectedIndex = (p.Age == "adult") ? 0 : 1;
       //dtpDOB.Value = new DateTime(); // todo
 }
Esempio n. 2
0
        private void lsv_Patron_SelectedIndexChanged(object sender, EventArgs e)
        {
            btn_checkInOut.Enabled = true;
            ListView.SelectedListViewItemCollection patrons = lsv_Patron.SelectedItems;

            if ((patrons != null) && (patrons.Count == 1))
            {
                foreach (PatronsListViewItem patron in patrons)
                {
                    _selectedPatron =  new Patrons(MC.GetPatron((patron as PatronsListViewItem).PatronID));
                    gb_PatronCheckedOut.Text = "Books and Media Checked Out by " + (patron as PatronsListViewItem).PatronName;
                    MC.RefreshPatronCheckedOut(_selectedPatron.PatronID);
                }
            }
        }
Esempio n. 3
0
 private void editPatronToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _selectedPatron = new Patrons(MC.GetPatron((lsv_Patron.SelectedItems[0] as PatronsListViewItem).PatronID));
       MC.LoadPatronDetails(_selectedPatron.PatronID);
 }
Esempio n. 4
0
 private void deletePatronToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Really delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
       {
     _selectedPatron = new Patrons(MC.GetPatron((lsv_Patron.SelectedItems[0] as PatronsListViewItem).PatronID));
     MC.PatronDelete(_selectedPatron.PatronID);
       }
 }
Esempio n. 5
0
 internal void LoadPatronDetails(int patronID)
 {
     DataSet patronsDS;
     Patrons p;
     try
     {
         patronsDS = data.RetrievePatron(patronID, null);
         if ((patronsDS.Tables.Count > 0) && (patronsDS.Tables["Patrons"].Rows.Count > 0))
         {
             DataRow patronDR = patronsDS.Tables["Patrons"].Rows[0];
             p = new Patrons(patronDR);
             LaunchPatronsDialog(p);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 6
0
 internal void LaunchPatronsDialog(Patrons p)
 {
     PatronForm pf = new PatronForm(p);
     if (pf.ShowDialog() == DialogResult.OK)
     {
         //Update Patrons View
         RefreshPatrons();
     }
 }