public static List<Customer> GetCustomerByCustomerId(Guid customerId)
        {
            List<Customer> customerList = new List<Customer>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetCustomerByCustomerIdCommand objectCommand = new GetCustomerByCustomerIdCommand(objectConnection))
                {
                    objectCommand.CustomerId = customerId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return customerList;
                        }

                        using (CustomerSqlDataReader objectSqlDataReader = new CustomerSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                Customer customer = objectSqlDataReader.Customer;
                                customerList.Add(customer);
                            }
                        }
                    }
                }
            }

            return customerList;
        }
        public static List<Notification> GetByJobRoleAndIsRead(string permissionEnum, bool isRead)
        {
            List<Notification> notificationList = new List<Notification>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetNotificationByJobRoleAndIsReadCommand objectCommand = new GetNotificationByJobRoleAndIsReadCommand(objectConnection))
                {
                    objectCommand.PermissionEnum = permissionEnum;
                    objectCommand.IsRead = isRead;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return notificationList;
                        }

                        using (NotificationSqlDataReader objectSqlDataReader = new NotificationSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                Notification notification = objectSqlDataReader.Notification;
                                notificationList.Add(notification);
                            }
                        }
                    }
                }
            }

            return notificationList;
        }
        public static Person GetByPersonId(Guid personId)
        {
            Person person = new Person();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetPersonByPersonIdCommand objectCommand = new GetPersonByPersonIdCommand(objectConnection))
                {
                    objectCommand.PersonId = personId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return person;
                        }

                        using (PersonSqlDataReader objectSqlDataReader = new PersonSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                person = objectSqlDataReader.Person;
                            }
                        }
                    }
                }
            }

            return person;
        }
        public static List<Customer> GetCustomerByPersonFirstName(string personFirstName)
        {
            List<Customer> customerList = new List<Customer>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetCustomerByFirstNameCommand objectCommand = new GetCustomerByFirstNameCommand(objectConnection))
                {
                    objectCommand.PersonFirstName = personFirstName;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return customerList;
                        }

                        using (CustomerSqlDataReader objectSqlDataReader = new CustomerSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                Customer customer = objectSqlDataReader.Customer;
                                customerList.Add(customer);
                            }
                        }
                    }
                }
            }

            return customerList;
        }
        public static List<Person> GetByUserId(Guid userId)
        {
            List<Person> personList = new List<Person>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetPersonByUserIdCommand objectCommand = new GetPersonByUserIdCommand(objectConnection))
                {
                    objectCommand.UserId = userId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return personList;
                        }

                        using (PersonSqlDataReader objectSqlDataReader = new PersonSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                Person person = objectSqlDataReader.Person;
                                personList.Add(person);
                            }
                        }
                    }
                }
            }

            return personList;
        }
        public static List<Address> GetAddressByPersonId(Guid personId)
        {
            List<Address> addressList = new List<Address>();

              using (ObjectConnection objectConnection = new ObjectConnection())
              {
              using (GetAddressByPersonIdCommand objectCommand = new GetAddressByPersonIdCommand(objectConnection))
              {
                  objectCommand.PersonId = personId;

                  objectConnection.Open();
                  using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                  {
                      if (!sqlDataReader.HasRows)
                      {
                          return addressList;
                      }

                      using (AddressSqlDataReader objectSqlDataReader = new AddressSqlDataReader(sqlDataReader))
                      {
                          while (objectSqlDataReader.Read())
                          {
                              Address address = objectSqlDataReader.Address;
                              addressList.Add(address);
                          }
                      }
                  }
              }
              }
              return addressList;
        }
        public static CatalogItem GetByItemName(string itemName)
        {
            CatalogItem catalogItem = new CatalogItem();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetCatalogItemByItemNameCommand objectCommand = new GetCatalogItemByItemNameCommand(objectConnection))
                {
                    objectCommand.ItemName = itemName;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return catalogItem;
                        }

                        using (CatalogItemSqlDataReader objectSqlDataReader = new CatalogItemSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                catalogItem = objectSqlDataReader.CatalogItem;
                            }
                        }
                    }
                }
            }

            return catalogItem;
        }
        public static List<Order> GetByInventoryItemId(Guid inventoryItemId)
        {
            List<Order> orderList = new List<Order>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetOrderByInventoryItemId objectCommand = new GetOrderByInventoryItemId(objectConnection))
                {
                    objectCommand.InventoryItemId = inventoryItemId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return orderList;
                        }

                        using (OrderSqlDataReader objectSqlDataReader = new OrderSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                Order order = objectSqlDataReader.Order;
                                orderList.Add(order);
                            }
                        }
                    }
                }
            }

            return orderList;
        }
        public static List<UserAccess> GetAll()
        {
            List<UserAccess> userAccessList = new List<UserAccess>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetUserAccessCommand objectCommand = new GetUserAccessCommand(objectConnection))
                {
                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return userAccessList;
                        }

                        using (UserAccessSqlDataReader objectSqlDataReader = new UserAccessSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                UserAccess userAccess = objectSqlDataReader.UserAccess;
                                userAccessList.Add(userAccess);
                            }
                        }
                    }
                }
            }

            return userAccessList;
        }
        public static List<CatalogItem> GetByManufacturer(string manufacturer)
        {
            List<CatalogItem> catalogItemList = new List<CatalogItem>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetCatalogItemByManufacturerCommand objectCommand = new GetCatalogItemByManufacturerCommand(objectConnection))
                {
                    objectCommand.Manufacturer = manufacturer;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return catalogItemList;
                        }

                        using (CatalogItemSqlDataReader objectSqlDataReader = new CatalogItemSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                catalogItemList.Add(objectSqlDataReader.CatalogItem);
                            }
                        }
                    }
                }
            }

            return catalogItemList;
        }
        public static List<InventoryItem> GetByCatalogItemIdAndInventoryItemStatusId(Guid catalogItemId, int inventoryItemStatusId)
        {
            List<InventoryItem> inventoryItemList = new List<InventoryItem>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetInventoryItemByCatalogItemIdAndInventoryItemStatusIdCommand objectCommand = new GetInventoryItemByCatalogItemIdAndInventoryItemStatusIdCommand(objectConnection))
                {
                    objectCommand.CatalogItemId = catalogItemId;
                    objectCommand.InventoryItemStatusId = inventoryItemStatusId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return inventoryItemList;
                        }

                        using (InventoryItemSqlDataReader objectSqlDataReader = new InventoryItemSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                InventoryItem inventoryItem = objectSqlDataReader.InventoryItem;
                                inventoryItemList.Add(inventoryItem);
                            }
                        }
                    }
                }
            }
            return inventoryItemList;
        }
        public static List<OrderItem> GetByOrderItemId(Guid orderItemId)
        {
            List<OrderItem> orderItemList = new List<OrderItem>();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetOrderItemByOrderItemIdCommand objectCommand = new GetOrderItemByOrderItemIdCommand(objectConnection))
                {
                    objectCommand.OrderItemId = orderItemId;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return orderItemList;
                        }

                        using (OrderItemSqlDataReader objectSqlDataReader = new OrderItemSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                OrderItem orderItem = objectSqlDataReader.OrderItem;
                                orderItemList.Add(orderItem);
                            }
                        }
                    }
                }
            }

            return orderItemList;
        }
        public static UserAccess GetByUserName(string userName)
        {
            UserAccess userAccess = new UserAccess();

            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (GetUserAccessByUserNameCommand objectCommand = new GetUserAccessByUserNameCommand(objectConnection))
                {
                    objectCommand.UserName = userName;

                    objectConnection.Open();
                    using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader())
                    {
                        if (!sqlDataReader.HasRows)
                        {
                            return null;
                        }

                        using (UserAccessSqlDataReader objectSqlDataReader = new UserAccessSqlDataReader(sqlDataReader))
                        {
                            while (objectSqlDataReader.Read())
                            {
                                userAccess = objectSqlDataReader.UserAccess;
                            }
                        }
                    }
                }
            }

            return userAccess;
        }
        public static int DeleteNotification(Guid notificationId)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (DeleteNotificationByNotificationIdCommand objectCommand = new DeleteNotificationByNotificationIdCommand(objectConnection))
                {
                    objectCommand.NotificationId = notificationId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        public static int Delete(InventoryItem inventoryItem)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (DeleteInventoryItemByInventoryItemIdCommand objectCommand = new DeleteInventoryItemByInventoryItemIdCommand(objectConnection))
                {
                    objectCommand.InventoryItemId = inventoryItem.InventoryItemId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        public static int Delete(UserAccess user)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (DeleteUserAccessByUsernameCommand objectCommand = new DeleteUserAccessByUsernameCommand(objectConnection))
                {
                    objectCommand.Username = user.UserName;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        public static int Insert(Guid? personId, string firstName, string lastName, string phone, string email, int personTypeId)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (InsertPersonCommand objectCommand = new InsertPersonCommand(objectConnection))
                {
                    objectCommand.PersonId = personId ?? new Guid();
                    objectCommand.PersonFirstName = firstName;
                    objectCommand.PersonLastName = lastName;
                    objectCommand.PersonPhone = phone;
                    objectCommand.PersonEmail = email;
                    objectCommand.PersonTypeId = personTypeId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        public static int UpdateByAddressId(Address address)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
              {
              using (UpdateAddressByAddressIdCommand objectCommand = new UpdateAddressByAddressIdCommand(objectConnection))
              {
                  objectCommand.AddressId = address.AddressId;
                  objectCommand.PersonId = address.PersonId;
                  objectCommand.StreetNumber = address.StreetNumber;
                  objectCommand.StreetName = address.StreetName;
                  objectCommand.AddressCity = address.AddressCity;
                  objectCommand.AddressState = address.AddressState;
                  objectCommand.AddressZip = address.AddressZip;
                  objectCommand.AddressTypeId = address.AddressTypeId;

                  objectConnection.Open();
                  objectCommand.ExecuteNonQuery();

                  return objectCommand.ReturnValue;
              }
              }
        }
        public static int InsertAddress(Guid addressId, Guid personId, int streetNumber, string streetName, string addressCity,
                                    string addressState, string addressZip, int addressTypeId)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (InsertAddressCommand objectCommand = new InsertAddressCommand(objectConnection))
                {
                    objectCommand.AddressId = addressId;
                    objectCommand.PersonId = personId;
                    objectCommand.StreetNumber = streetNumber;
                    objectCommand.StreetName = streetName;
                    objectCommand.AddressCity = addressCity;
                    objectCommand.AddressState = addressState;
                    objectCommand.AddressZip = addressZip;
                    objectCommand.AddressTypeId = addressTypeId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
 public GetPersonByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertUserAccessCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 22
0
 public GetOrderByInventoryItemId(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertNotificationCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertOrderCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCustomerByFirstNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetPersonByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public DeleteInventoryItemByInventoryItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetOrderByOrderStatusId(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 29
0
 public GetOrderByLastName(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetOrderItemByOrderItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertAddressCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 32
0
 public GetNotificationByJobRoleAndIsReadCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCustomerByCustomerIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertInventoryItemCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 36
0
 public GetAddressByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 37
0
 public GetCustomerByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetOrdersCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByManufacturerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateUserAccessByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public DeleteUserAccessByUsernameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 42
0
 public GetInventoryItemByManufacturerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 44
0
 public UpdateAddressByAddressIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetNotificationByJobRoleCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 46
0
 public InsertPersonCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdatePersonByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 48
0
 public GetUserAccessByUserNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateOrderByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByInventoryItemIdAndInventoryItemStatusIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateAddressByAddressIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public InsertCustomerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateInventoryItemByInventoryItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByCatalogItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetUserAccessByUserNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCatalogItemByManufacturerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
Esempio n. 57
0
 public UpdatePersonByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCatalogItemByItemNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateNotificationByNotificationIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCatalogItemStockCountCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }