Exemplo n.º 1
0
        private void btnViewInventory_Click(object sender, EventArgs e)
        {
            //lstInventory.Items.Clear();

            //currentDateLbl.Text = DateTime.Now.ToLongDateString();

            int empID = Convert.ToInt32(employeeIdTxtBx.Text);
            employee = Employee.FindEmployee(empID);

            lstInventory.Items.Clear();
            foreach(Product i in products)
            {
                ListViewItem lvi = new ListViewItem(i.productName);
                lvi.SubItems.Add(i.productQuantity.ToString());
                lvi.SubItems.Add(i.productBuyPrice.ToString());
                lstInventory.Items.Add(lvi);
            }
            timer1.Enabled = true;
            //try
            //{

            //    if (employee.EmployeeID == 0)
            //        throw new Exception();
            //    else
            //    {
            //        for (int i = 0; i < products.Length; i++)
            //        {
            //            productname.Add(products[i].productName);
            //            quantity.Add(products[i].productQuantity.ToString());
            //            cost.Add(products[i].productBuyPrice);
            //        }

            //        for (int i = 0; i < products.Length; i++)
            //        {
            //            txtBxDisplayinventory.AppendText(string.Format("\r\n\t{0}", productname[i]));
            //            txtBxDisplayinventory.AppendText(string.Format("\r\n\tRemaining: {0}", quantity[i].ToString()));
            //            txtBxDisplayinventory.AppendText(string.Format("\r\n\tPurchase Cost per case: {0:C}",cost[i]*24));
            //            txtBxDisplayinventory.AppendText("\r\n");
            //        }

            //        string empName = string.Format("{0} {1}",employee.FirstName,employee.LastName);
            //        lblEmpName.Text = empName;
            //        string userlog = string.Format("User {0} {1} logged to inventory", empID, empName);
            //        Logging.Log(userlog);
            //    }
            //}
            //catch(Exception)
            //{
            //    MessageBox.Show("Please supply valid employee ID");
            //}
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs an array of employee objects from the data in the Employee_T Table
        /// </summary>
        /// <returns>
        /// Returns an array of Employee objects
        /// </returns>
        public static Employee[] GetAllEmployees()
        {
            string query = "SELECT * FROM Employee_T";
            List<Employee> employees = new List<Employee>();
            Employee outEmployee;

            DataRowCollection results = DatabaseController.GetQueryResults(query, new Dictionary<string, object>());

            foreach(DataRow i in results)
            {
                outEmployee = new Employee((int)i["ID"], (string)i["FirstName"], (string)i["LastName"]);
                employees.Add(outEmployee);
            }

            return employees.ToArray();
        }
Exemplo n.º 3
0
 public transFrm(Employee employee)
 {
     current = employee;
     InitializeComponent();
 }