Пример #1
0
        void dbController_DeleteEntity(object sender, EntityArgs e)
        {
            IEntity entity = e.Entity;

            if (entity is User)
            {
                Employee employee = dbController.getEmployeeFromUser(entity as User);
                try
                {
                    if (File.Exists(employee.ImagePath))
                    {
                        File.Delete(employee.ImagePath);
                    }
                }
                catch (IOException iex)
                {
                    ErrorLog.Log(iex);
                }
                catch (Exception ex)
                {
                    ErrorLog.Log(ex);
                }
            }

            reloadUsers();
            lbUsers.Text = masterController.LoginEmployee.User_id;
        }
Пример #2
0
        void dbController_InsertEntity(object sender, EntityArgs e)
        {
            fillgdInventory();
            IEntity entity = e.Entity;

            string nameField = string.Empty, message = string.Empty, action = string.Empty, petsize = string.Empty;

            if (entity is Product)
            {
                Product p = entity as Product;
                nameField = p.Description;

                message = string.Format("New product: {0} has been added", nameField);
                action  = string.Format("has added a new product", nameField);
            }
            else if (entity is Inventory)
            {
                Inventory i = entity as Inventory;
                Product   p = dbController.getProductFromBarcode(i.Barcode);
                nameField = p.Description;

                message = string.Format("New stock of product {0} has been added", nameField);
                action  = string.Format("added a new stock of product", nameField);
            }

            MessageBanner banner = new MessageBanner(message, 2000);

            banner.Show();
            dbController.insertAuditTrail(action);
        }
 public void updateEmployee(Employee oldE, Employee newE)
 {
     if (employeeMapper.updateEmployee(oldE, newE))
     {
         EntityArgs e = new EntityArgs(newE);
         OnUpdateEntity(e);
     }
 }
        private void OnDeleteEntity(EntityArgs e)
        {
            EventHandler <EntityArgs> onDeleteEntity = DeleteEntity;

            if (onDeleteEntity != null)
            {
                onDeleteEntity(this, e);
            }
        }
        /* Events trigger */
        private void OnInsertEntity(EntityArgs e)
        {
            EventHandler <EntityArgs> onInsertEntity = InsertEntity;

            if (onInsertEntity != null)
            {
                onInsertEntity(this, e);
            }
        }
 public bool removeUser(User user)
 {
     if (userMapper.inactivateUser(user))
     {
         EntityArgs e = new EntityArgs(user);
         OnDeleteEntity(e);
         return(true);
     }
     return(false);
 }
Пример #7
0
 void dbController_UpdateEntity(object sender, EntityArgs e)
 {
     if (e.Entity is Employee)
     {
         Employee employee = e.Entity as Employee;
         userEmployeeMap[employee.User_id] = employee;
         populateUserListbox();
         lbUsers.Text = employee.User_id;
     }
 }
Пример #8
0
 void dbController_InsertEntity(object sender, EntityArgs e)
 {
     if (e.Entity is Employee)
     {
         Employee employee = e.Entity as Employee;
         usernames.Add(employee.User_id);
         userEmployeeMap.Add(employee.User_id, employee);
         populateUserListbox();
         lbUsers.Text = employee.User_id;
     }
 }
        public void createUserEmployee(User user, Employee employee)
        {
            string insertUser     = userMapper.createUser(user);
            string insertEmployee = employeeMapper.createEmployee(employee);

            if (createTransaction(insertUser, insertEmployee))
            {
                EntityArgs e = new EntityArgs(employee);
                OnInsertEntity(e);
            }
            user.Dispose();
        }
Пример #10
0
        void dbController_UpdateEntity(object sender, EntityArgs e)
        {
            fillgdInventory();
            IEntity entity = e.Entity;

            string message = string.Empty, action = string.Empty, nameField = string.Empty, petsize = string.Empty;

            if (entity is Product)
            {
                Product p = entity as Product;
                nameField = p.Description;
                message   = string.Format("Product {0} has been updated", nameField);
                action    = string.Format("has updated the product {0}", nameField);
            }

            MessageBanner banner = new MessageBanner(message, 3000);

            banner.Show();
            dbController.insertAuditTrail(action);
        }
 /* Events trigger */
 private void OnInsertEntity(EntityArgs e)
 {
     EventHandler<EntityArgs> onInsertEntity = InsertEntity;
     if (onInsertEntity != null)
         onInsertEntity(this, e);
 }
 public bool removeUser(User user)
 {
     if (userMapper.inactivateUser(user)){
         EntityArgs e = new EntityArgs(user);
         OnDeleteEntity(e);
         return true;
     }
     return false;
 }
Пример #13
0
        void dbController_UpdateEntity(object sender, EntityArgs e)
        {
            fillgdInventory();
            IEntity entity = e.Entity;

            string message = string.Empty, action = string.Empty, nameField = string.Empty, petsize = string.Empty;

            if (entity is Product)
            {
                Product p = entity as Product;
                nameField = p.Description;
                message = string.Format("Product {0} has been updated", nameField);
                action = string.Format("has updated the product {0}", nameField);
            }
            
            MessageBanner banner = new MessageBanner(message, 3000);
            banner.Show();
            dbController.insertAuditTrail(action);

        }
 public void updateEmployee(Employee oldE, Employee newE)
 {
     if (employeeMapper.updateEmployee(oldE, newE))
     {
         EntityArgs e = new EntityArgs(newE);
         OnUpdateEntity(e);
     }
 }
Пример #15
0
 void dbController_UpdateEntity(object sender, EntityArgs e)
 {
     if (e.Entity is Employee)
     {
         Employee employee = e.Entity as Employee;
         userEmployeeMap[employee.User_id] = employee;
         populateUserListbox();
         lbUsers.Text = employee.User_id;
     }
 }
Пример #16
0
 void dbController_InsertEntity(object sender, EntityArgs e)
 {
     if (e.Entity is Employee)
     {
         Employee employee = e.Entity as Employee;
         usernames.Add(employee.User_id);
         userEmployeeMap.Add(employee.User_id, employee);
         populateUserListbox();
         lbUsers.Text = employee.User_id;
     }
 }
Пример #17
0
        void dbController_InsertEntity(object sender, EntityArgs e)
        {
            fillgdInventory();
            IEntity entity = e.Entity;

            string nameField = string.Empty, message = string.Empty, action = string.Empty, petsize = string.Empty;

            if (entity is Product)
            {
                Product p = entity as Product;
                nameField = p.Description;

                message = string.Format("New product: {0} has been added", nameField);
                action = string.Format("has added a new product", nameField);
            }
            else if (entity is Inventory)
            {
                Inventory i = entity as Inventory;
                Product p = dbController.getProductFromBarcode(i.Barcode);
                nameField = p.Description;

                message = string.Format("New stock of product {0} has been added", nameField);
                action = string.Format("added a new stock of product", nameField);
            }
            
            MessageBanner banner = new MessageBanner(message, 2000);
            banner.Show();
            dbController.insertAuditTrail(action);

            
        }
 public void createUserEmployee(User user, Employee employee)
 {
     string insertUser = userMapper.createUser(user);
     string insertEmployee = employeeMapper.createEmployee(employee);
     if (createTransaction(insertUser, insertEmployee)){
         EntityArgs e = new EntityArgs(employee);
         OnInsertEntity(e);
     }
     user.Dispose();
 }
Пример #19
0
 void dbController_DeleteEntity(object sender, EntityArgs e)
 {
     throw new NotImplementedException();
 }
 private void OnDeleteEntity(EntityArgs e)
 {
     EventHandler<EntityArgs> onDeleteEntity = DeleteEntity;
     if (onDeleteEntity != null)
         onDeleteEntity(this, e);
 }
Пример #21
0
        void dbController_DeleteEntity(object sender, EntityArgs e)
        {
            IEntity entity = e.Entity;
            if (entity is User)
            {
                Employee employee = dbController.getEmployeeFromUser(entity as User);
                try
                {
                    if (File.Exists(employee.ImagePath))
                        File.Delete(employee.ImagePath);
                }
                catch (IOException iex)
                {
                    ErrorLog.Log(iex);
                }
                catch (Exception ex)
                {
                    ErrorLog.Log(ex);
                }

            }

            reloadUsers();
            lbUsers.Text = masterController.LoginEmployee.User_id;
        }
Пример #22
0
 void dbController_DeleteEntity(object sender, EntityArgs e)
 {
     throw new NotImplementedException();
 }