コード例 #1
0
 public OrderForm(UserAccount user, Order _order, LoginForm loginForm)
 {
     userAccount = user;
     _loginForm = loginForm;
     order = _order;
     InitializeComponent();
 }
コード例 #2
0
 public Checklist(UserAccount user, Order order, LoginForm loginForm)
 {
     InitializeComponent();
     userAccount = user;
     _order = order;
     _loginForm = loginForm;
 }
コード例 #3
0
 public OrderForm(UserAccount user, Guid orderId, InventoryItem invItem, LoginForm loginForm)
 {
     userAccount = user;
     _loginForm = loginForm;
     InitializeComponent();
     order = ApplicationObjects.GetOrder(orderId);
     inventoryItem = invItem;
 }
コード例 #4
0
        public void ShowCheckListForm(UserAccount user, Order order, LoginForm loginForm)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (String.Compare(form.Name, "Checklist") == 0) { form.Show(); return; }
            }

            checkListForm = new Checklist(user, order, loginForm);
            checkListForm.Show();
        }
コード例 #5
0
        public static BusinessObject.Order ToBusinessObject(Entities.Order entity)
        {
            if (entity == null)
                return null;

            BusinessObject.Order businessObject = new BusinessObject.Order
            {
                OrderEntryDate = entity.OrderEntryDate,
                OrderFulfillDate = entity.OrderFulfillDate,
                OrderId = entity.OrderId,
                OrderStatus = (Enumeration.OrderStatus)entity.OrderStatusId,
                Person = new BusinessObject.Person(entity.PersonId)
            };

            return businessObject;
        }
コード例 #6
0
        public static BusinessObject.Order ToBusinessObject(Entities.Order entity)
        {
            if (entity == null)
            {
                return(null);
            }

            BusinessObject.Order businessObject = new BusinessObject.Order
            {
                OrderEntryDate   = entity.OrderEntryDate,
                OrderFulfillDate = entity.OrderFulfillDate,
                OrderId          = entity.OrderId,
                OrderStatus      = (Enumeration.OrderStatus)entity.OrderStatusId,
                Person           = new BusinessObject.Person(entity.PersonId)
            };

            return(businessObject);
        }
コード例 #7
0
        public static Entities.Order ToEntity(BusinessObject.Order businessObject)
        {
            if (businessObject == null)
            {
                return(null);
            }

            Entities.Order entity = new Entities.Order
            {
                OrderEntryDate   = businessObject.OrderEntryDate,
                OrderFulfillDate = businessObject.OrderFulfillDate,
                OrderStatusId    = (int)businessObject.OrderStatus,
                OrderId          = businessObject.OrderId,
                PersonId         = businessObject.Person.PersonId
            };

            return(entity);
        }
コード例 #8
0
 private void btn_CreateNewOrder_Click(object sender, EventArgs e)
 {
     if (catalogItemCollection.Count > 0)
     {
         Order newOrder = new Order();
         OrderItem newItem = new OrderItem();
         newItem.CatalogItem = catalogItemCollection[cbx_CatalogResultsList.SelectedIndex];
         newOrder.ItemList.Add(newItem);
         _loginForm.ShowOrderForm(userAccount, newOrder, _loginForm);
     }
     else
     {
         _loginForm.ShowOrderForm(userAccount, _loginForm);
     }
     this.Close();
 }
コード例 #9
0
        public void ShowOrderForm(UserAccount user, Order order, LoginForm loginForm)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (String.Compare(form.Name, "OrderForm") == 0) { form.Show(); return; }
            }

            orderForm = new OrderForm(user, order, loginForm);
            orderForm.Show();
        }
コード例 #10
0
        public ActionResult CheckOut()
        {
            string userName = User.Identity.Name;
            OrderLine orderLine = new OrderLine {

            };
            Random rad = new Random();
            Order order = new Order {
                Customer = db.Customers.Single(x => x.UserName == userName),
                OrderNo = rad.Next(1,1000000),
                CustomerId = db.Customers.Single(x => x.UserName == userName).CustomerId,
                OrderTime = DateTime.Now.Date,
                Total = CaculateTotalPrice(),
                IsChecked =false,
                IsReceived = false,
                IsShipped = false
            };
            db.Orders.Add(order);

            foreach (var item in (List<ShoppingItemViewModel>)Session["Cart"])
            {
                OrderLine orderItem = new OrderLine
                {
                    Order = order,
                    OrderId = order.OrderId,
                    ProductId = item.Product.Id,
                    Product = db.Products.Single(x=>x.Id == item.Product.Id),
                    Quantity = item.quantity
                };
                db.OrderLines.Add(orderItem);
            }
            db.SaveChanges();
            Session["Cart"] = null;
            return  Content("<script> alert('Congratulations!your order has been sent to the seller');window.location='/Product/ShowProductShoppingPage'</script>");
        }
コード例 #11
0
 public static int CreateOrder(Order order)
 {
     BusinessObjects _businessObjects = new BusinessObjects();
     return _businessObjects.InsertOrder(order);
 }
コード例 #12
0
        // ORDER METHODS
        public static int UpdateOrderStatusWithNotification(Order order, Enumeration.Permission senderPermissionScope)
        {
            int returnValue = 1;

            BusinessObjects _businessObjects = new BusinessObjects();
            returnValue = _businessObjects.UpdateOrder(order);

            if (returnValue == 1)
                return returnValue;

            Notification notification = new Notification
            {
                NotificationId = Guid.NewGuid(),
                IsRead = false,
                OrderId = order.OrderId
            };

            string message = "";
            switch (order.OrderStatus)
            {
                case Enumeration.OrderStatus.WorkComplete:
                    message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Work Complete";
                    notification.NotificationMessage = message;
                    notification.NotificationType = Enumeration.NotificationType.WorkComplete;
                    notification.PermissionScope = Enumeration.Permission.OperationsManager;
                    returnValue = _businessObjects.InsertNotification(notification);
                    break;
                case Enumeration.OrderStatus.EnRoute:
                    message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = En Route";
                    notification.NotificationMessage = message;
                    notification.NotificationType = Enumeration.NotificationType.EnRoute;
                    notification.PermissionScope = Enumeration.Permission.WorkSpecialist;
                    returnValue = _businessObjects.InsertNotification(notification);
                    break;
                case Enumeration.OrderStatus.Delivered:
                    if (senderPermissionScope == Enumeration.Permission.SalesPerson)
                    {
                        message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Delivered";
                        notification.NotificationMessage = message;
                        notification.NotificationType = Enumeration.NotificationType.Delivered;
                        notification.PermissionScope = Enumeration.Permission.OperationsManager;
                        returnValue = _businessObjects.InsertNotification(notification);
                    }
                    else if (senderPermissionScope == Enumeration.Permission.StockClerk)
                    {
                        message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Delivered";
                        notification.NotificationMessage = message;
                        notification.NotificationType = Enumeration.NotificationType.Delivered;
                        notification.PermissionScope = Enumeration.Permission.WorkSpecialist;
                        returnValue = _businessObjects.InsertNotification(notification);
                    }
                    break;
                case Enumeration.OrderStatus.Complete:
                    message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Order Complete";
                    notification.NotificationMessage = message;
                    notification.NotificationType = Enumeration.NotificationType.OrderComplete;
                    notification.PermissionScope = Enumeration.Permission.SalesPerson;
                    returnValue = _businessObjects.InsertNotification(notification);
                    break;
                case Enumeration.OrderStatus.FailedValidation:
                    message = "Order ID: " + order.OrderId.ToString() + " - STATUS CHANGE = Failed Validation";
                    notification.NotificationMessage = message;
                    notification.NotificationType = Enumeration.NotificationType.FailedQualityControl;
                    notification.PermissionScope = Enumeration.Permission.WorkSpecialist;
                    returnValue = _businessObjects.InsertNotification(notification);
                    break;
            }

            return returnValue;
        }
コード例 #13
0
        public static void RemoveOrderItemsFromInventory(Order order)
        {
            BusinessObjects _businessObjects = new BusinessObjects();
            using (TransactionScope scope = new TransactionScope())
            {
                int returnValue = 1;
                foreach (OrderItem orderItem in order.ItemList)
                {
                    //Get list of items in the inventory that match the catalog id and are on hold by this order
                    List<InventoryItem> inventoryList = (List<InventoryItem>)ApplicationObjects.GetInventoryItemByCatalogItemId(orderItem.CatalogItem
                        ).Where(o => o.OrderId == order.OrderId);

                    returnValue = _businessObjects.DeleteInventoryItems(inventoryList);
                    if (returnValue == 1)
                    {
                        scope.Dispose(); //kick transactionscope thus rolling back transaction.
                        break;
                    }
                }

                if (returnValue == 0)
                    scope.Complete(); //commit transaction
            }
        }
コード例 #14
0
 public string RegisterOrder(string username, Book[] books, string creditcard, ContactDetails shipping, ContactDetails invoicing)
 {
     string guid = null;
     if (Order.VerifyCreditCard(creditcard) == true)
     {
         int i = 0;
         bool verifybook = true;
         Library lib = new Library();
         lib.UpdateDB();
         while (i < books.Length && verifybook == true)
         {
             verifybook = lib.Contains(books[i++]);
         }
         if (verifybook == true)
         {
             Order toregister = new Order(shipping, invoicing, creditcard, books);
             toregister.OrderSerializer();
             toregister.OrderStorage(username);
             guid = toregister.Ordernumber;
         }
     }
     return guid;
 }