Example #1
0
 // form1_load, accessed when the form is loaded
 private void Form1_Load(object sender, EventArgs e)
 {
     //make a db object to pull the data from
     DBConnect test = new DBConnect();
     //output the data in the label
      this.label1.Text = test.Select();
 }
        public Personnel_Management(mainform parent)
        {
            InitializeComponent();
            DB = new DBConnect();

            this.parent = parent;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        }
Example #3
0
        public void save(AddNewEntry cust)
        {
            DBConnect db = new DBConnect();
            //need to fill in addr
            Address addr = new Address();

            DateTime d1 = new DateTime(Convert.ToInt32(cust.yearTab1), Convert.ToInt32(cust.monthTab1), Convert.ToInt32(cust.dayTab1));
            PreviousVisit pv = new PreviousVisit(0, Convert.ToInt32(cust.numChildTextField), Convert.ToInt32(cust.numAdultsTextField), d1);
            Patron p = new Patron(0, cust.fNameTextField, cust.lNameTextField, cust.miTextField, cust.phoneTextField, addr, pv);
            db.addPatron(p);
        }
Example #4
0
        static void Main(string[] args)
        {
            //Establish a connection with DBConnect class to access patron table
            DBConnect db = new DBConnect();
            Address myAddress = new Address();
            PreviousVisit pVisit = new PreviousVisit();
            Patron myPatron = new Patron(2, "Joe", "Bloggs", "S", "5550134", myAddress,pVisit);

            //holds quiried data. First element will contain cells of first column from table. Second element contains second column and so on....
            List<Patron> list = new List<Patron>();

            list = db.SelectPatron("SELECT * FROM patron WHERE firstName = 'Rob'");
            for (int x = 0; x < list.Count; x++)
            {
                Console.WriteLine(list[x].Id);
                Console.WriteLine(list[x].FirstName);
                Console.WriteLine(list[x].LastName);
                Console.WriteLine(list[x].MiddleInitial);
                Console.WriteLine(list[x].Phone);
                Console.WriteLine(list[x].StreetNum);
                Console.WriteLine(list[x].AddressLine1);
                Console.WriteLine(list[x].AddressLine2);
                Console.WriteLine(list[x].City);
                Console.WriteLine(list[x].State);
                Console.WriteLine(list[x].Zip);
                Console.WriteLine(list[x].NumChildren);
                Console.WriteLine(list[x].NumAdults);
                Console.WriteLine(list[x].Date.Month+"/"+list[x].Date.Day+"/"+list[x].Date.Year);
                Console.WriteLine(" ");
            }

            /*list = db.SelectPatron("SELECT * FROM patron WHERE firstName = 'Rob'");
            foreach (var i in list)
            {
                Console.WriteLine(i);
            }
            for (int x = 0; x < list.Length; x++)
            {
                for(int y=0;y<list[x].Count;y++){
                    Console.WriteLine(list[x].ElementAt(y));
                }
            }*/
            //db.Query("INSERT INTO patron (patron_id, firstName, lastName, middleInitial, phone) VALUES ('10', 'Tom', 'Maey', 'ff', '2353744')");

            Console.ReadLine();
        }
Example #5
0
        public Form1()
        {
            /*
             * dataGridView2
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllFirstName;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllLastName;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllMiddleInitial;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllAddressLine1;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllAddressLine2;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllPhone;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllAdults;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllChildren;
            private System.Windows.Forms.DataGridViewTextBoxColumn viewAllPrevVisit;
            */

            InitializeComponent();
            DBConnect db = new DBConnect();

            int count = db.Count("SELECT * FROM patron");

            String[] rows = new String[count];

            List<Patron> list = new List<Patron>();
            list = db.SelectPatron("SELECT * FROM patron");

            for (int x = 0; x < list.Count; x++)
            {
                String date = list[x].Date.Month + "/" + list[x].Date.Day + "/" + list[x].Date.Year;
                String children = "";
                children += list[x].NumChildren;
                String adults = "";
                adults += list[x].NumAdults;
                string[] row = { list[x].FirstName, list[x].LastName, list[x].MiddleInitial, list[x].AddressLine1, list[x].AddressLine2, list[x].Phone, children, adults, date };
                dataGridView2.Rows.Add(row);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     DBConnect DB = new DBConnect();
         DB.Select_City_list();
 }