コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
        }
コード例 #12
0
        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;
        }
コード例 #13
0
        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;
        }
コード例 #14
0
        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;
                }
            }
        }
コード例 #15
0
        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;
                }
            }
        }
コード例 #16
0
        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;
                }
            }
        }
コード例 #17
0
        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;
                }
            }
        }
コード例 #18
0
        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;
              }
              }
        }
コード例 #19
0
        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;
                }
            }
        }
コード例 #20
0
 public GetPersonByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #21
0
 public InsertUserAccessCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #22
0
 public GetOrderByInventoryItemId(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #23
0
 public InsertNotificationCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #24
0
 public InsertOrderCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #25
0
 public GetCustomerByFirstNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #26
0
 public GetPersonByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public DeleteInventoryItemByInventoryItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #28
0
 public GetOrderByOrderStatusId(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #29
0
 public GetOrderByLastName(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetOrderItemByOrderItemIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #31
0
 public InsertAddressCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #32
0
 public GetNotificationByJobRoleAndIsReadCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetCustomerByCustomerIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #34
0
 public InsertInventoryItemCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #36
0
 public GetAddressByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #37
0
 public GetCustomerByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #38
0
 public GetOrdersCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByManufacturerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #40
0
 public UpdateUserAccessByUserIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public DeleteUserAccessByUsernameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #42
0
 public GetInventoryItemByManufacturerCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #44
0
 public UpdateAddressByAddressIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #45
0
 public GetNotificationByJobRoleCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #46
0
 public InsertPersonCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdatePersonByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #48
0
 public GetUserAccessByUserNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #49
0
 public UpdateOrderByOrderIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public GetInventoryItemByInventoryItemIdAndInventoryItemStatusIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateAddressByAddressIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #52
0
 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())
 {
 }
コード例 #57
0
 public UpdatePersonByPersonIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #58
0
 public GetCatalogItemByItemNameCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
 public UpdateNotificationByNotificationIdCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }
コード例 #60
0
 public GetCatalogItemStockCountCommand(ObjectConnection objectConnection)
     : this(objectConnection.CreateCommand())
 {
 }