public ProductBE SearchCupboard(int SEARIDPRO)
        {
            ProductLogic PRODL = new ProductLogic();
            var          ARS   = PRODL.SearchIdProduct(SEARIDPRO);

            return(ARS);
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var productService = new ProductLogic();

            productService.RemoveProduct(id);
            return(RedirectToAction("Index", "StoreManager"));
        }
示例#3
0
        public void TestMethodSaveCreatedOrder()
        {
            string          message = "";
            OrderLogic      logicO  = new OrderLogic();
            ProductLogic    logicP  = new ProductLogic();
            OrderPageDriver driver  = new OrderPageDriver(new UiContext(logicO, logicP), null);

            driver.ShowInfoMessage = (msg) => { message = msg; };

            try
            {
                logicP.Create(new ProductBinding {
                    Price = 10
                });
                driver.MoveToOrderProductPage = (context, order, orderProduct) => order.OrderProducts.Add(new OrderProductView {
                    ProductId = 1
                });
                driver.AddOrderProduct();
                driver.AddOrderProduct();
                driver.AddOrderProduct();

                bool             result = driver.SaveOrder();
                List <OrderView> list   = logicO.Read(null);

                Assert.True(result);
                Assert.Single(list);
                Assert.Single(list[0].OrderProducts);
                Assert.Equal("Order was created", message);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
        // GET: Product
        public ActionResult Index(ProductModel model)
        {
            var pageIndex = Request.QueryString["pageindex"];
            int index     = 0;
            int pageSize  = 10;

            Int32.TryParse(pageIndex, out index);
            if (index == 0)
            {
                index = 1;
            }
            var UserInfo = NFine.Code.OperatorProvider.Provider.GetCurrent();

            if (UserInfo == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            ProductModel viewModel = new ProductModel();

            if (base.agentInfo != null)
            {
                CommLogic.DeepClone <AgentInfoModel>(viewModel, agentInfo);
                List <Product> list = ProductLogic.GetList().Where(t => t.F_DeleteMark == false || t.F_DeleteMark == null).ToList();
                viewModel.productList            = new PagerResult <Product>();
                viewModel.productList.DataList   = list.OrderByDescending(t => t.F_CreatorTime).Skip <Product>((index - 1) * pageSize).Take(pageSize);
                viewModel.productList.Code       = 0;
                viewModel.productList.Total      = list.Count();
                viewModel.productList.PageIndex  = index;
                viewModel.productList.PageSize   = pageSize;
                viewModel.productList.RequestUrl = "Index?pageindex=" + index;
            }
            return(View(viewModel));
        }
        public ActionResult GetOrderDetail(string OrderId)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                var list = OrderDetailLogic.GetList().Where(t => t.c_order_id == OrderId).ToList();
                foreach (var item in list)
                {
                    item.Pro = ProductLogic.GetEnityById(item.c_product_id);
                }
                result.data    = list;
                result.state   = ResultType.success.ToString();
                result.message = "成功";
                return(Content(result.ToJson()));
            }
            catch (Exception ex)
            {
                result.state   = ResultType.error.ToString();
                result.message = string.Format("({0})", ex.Message);
                return(Content(result.ToJson()));

                throw;
            }
        }
示例#6
0
        public void TestGetProductById()
        {
            Mock <IProductRepository> mock     = new Mock <IProductRepository>(MockBehavior.Loose);
            List <ProductTable>       products = new List <ProductTable>()
            {
                new ProductTable()
                {
                    P_ID   = 1,
                    P_NAME = "p1",
                },
                new ProductTable()
                {
                    P_ID   = 2,
                    P_NAME = "p2",
                },
            };

            mock.Setup(repo => repo.GetAll()).Returns(products.AsQueryable());
            ProductLogic productLogic = new ProductLogic(mock.Object);
            var          result       = productLogic.GetProductById(1);

            Assert.That(result.Count(), Is.EqualTo(1));
            Assert.That(result.Select(x => x.P_ID), Does.Contain(1));
            mock.Verify(repo => repo.GetAll(), Times.Once);
        }
示例#7
0
        public void TestUpdateProduct()
        {
            Mock <IProductRepository> mock = new Mock <IProductRepository>();

            mock.Setup(x => x.GetAll());
            List <ProductTable> products = new List <ProductTable>()
            {
                new ProductTable()
                {
                    P_ID = 1, P_NAME = "p1"
                },
                new ProductTable()
                {
                    P_ID = 2, P_NAME = "p2"
                },
                new ProductTable()
                {
                    P_ID = 3, P_NAME = "p3"
                },
            };
            ProductLogic productLogic = new ProductLogic(mock.Object);

            productLogic.Update(
                new ProductTable()
            {
                P_ID   = 4,
                P_NAME = "p4",
            }, 1);
            mock.Verify(repo => repo.Update(It.Is <ProductTable>(x => x.P_NAME == "p4"), 1));
        }
示例#8
0
        public void TestOrderProductPrice()
        {
            OrderLogic   logicO = new OrderLogic();
            ProductLogic logicP = new ProductLogic();

            try
            {
                ProductBinding product = new ProductBinding {
                    Name = "Test", Price = 20
                };
                OrderBinding order = new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                };
                order.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1, Count = 2
                });
                logicP.Create(product);
                logicO.Create(order);

                List <OrderView> list = logicO.Read(null);

                Assert.Equal(20, list[0].OrderProducts[0].Price);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
示例#9
0
        public void Test_Get_Product_1()
        {
            //Arrange
            ProductLogic productArrange = new ProductLogic()
            {
                productId          = 1,
                productName        = "Tuinstoel",
                productDescription = "Tuinstoel zwart",
                quantity           = 1,
                productPrice       = (decimal)25.00,
                productCategory    = "Other",
                company            = companyTest
            };

            //Act
            productManager.CreateProduct("Tuinstoel", "Tuinstoel zwart", 1, (decimal)25.00, 1, "Other");
            ProductLogic product = productManager.GetProductById(1);

            //Assert
            Assert.AreEqual(productArrange.productId, product.productId);
            Assert.AreEqual(productArrange.productName, product.productName);
            Assert.AreEqual(productArrange.productCategory, product.productCategory);
            Assert.AreEqual(productArrange.productDescription, product.productDescription);
            Assert.AreEqual(productArrange.productPrice, product.productPrice);
            Assert.AreEqual(productArrange.quantity, product.quantity);
        }
示例#10
0
        public void TestIncorrectPrice()
        {
            List <string> messages = new List <string>();
            List <bool>   results  = new List <bool>();
            ProductLogic  logic    = new ProductLogic();

            try
            {
                ProductPageDriver driver = new ProductPageDriver(new UiContext(new OrderLogic(), logic), null);
                driver.ShowErrorMessage = (msg) => messages.Add(msg);

                driver.ProductName  = () => "Ananas";
                driver.ProductPrice = () => 0;
                results.Add(driver.SaveProduct());

                driver.ProductName  = () => "Banan";
                driver.ProductPrice = () => - 1;
                results.Add(driver.SaveProduct());

                Assert.Equal(2, results.Count);
                Assert.False(results[0]);
                Assert.False(results[1]);
                Assert.Equal(2, messages.Count);
                Assert.Equal("Incorrect price", messages[0]);
                Assert.Equal("Incorrect price", messages[1]);
            }
            finally
            {
                logic.Delete(null);
            }
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get the category from the querystring
            string category = Request.QueryString["category"];

            // Check if we received a category
            if (!string.IsNullOrWhiteSpace(category))
            {
                // Display the images
                List <ProductDetail> productsForCategory = new List <ProductDetail>();
                var profiler = MiniProfiler.Current;
                using (profiler.Step("Retrieve Products"))
                {
                    ProductLogic productLogic = new ProductLogic();
                    productsForCategory = productLogic.GetProductDetailByCategory(category);
                }

                using (profiler.Step("Build HTML"))
                {
                    // Loop through each product and build the HTML that we are going to
                    // return to the web page
                    foreach (ProductDetail product in productsForCategory)
                    {
                        phProductImages.Controls.Add(BuildHtml(category, product.ImageUrl, product.ProductDescription));
                    }
                }
            }
        }
        protected void btnFinalizar_Click(object sender, EventArgs e)
        {
            List <LineaVenta> carrito = (List <LineaVenta>)Session["myCart"];

            lblState.CssClass = "purchaseCompleted";
            Producto producto;

            try
            {
                foreach (LineaVenta lineaVenta in carrito)
                {
                    try
                    {
                        producto = ProductLogic.GetProducto(lineaVenta.ProductId);
                        producto.UnitsInStock = (short)(producto.UnitsInStock - lineaVenta.Quantity);
                        ProductLogic.Update(producto);
                    }
                    catch (NullReferenceException)
                    {
                        lblState.CssClass = "dbConnectionError";
                    }
                }
                Session["myCart"] = null;
                Response.Redirect("~/Cart.aspx");
            }
            catch (NullReferenceException)
            {
                lblState.CssClass = "invalidAction";
            }
        }
示例#13
0
        public ActionResult GetProduct(int id)
        {
            ProductLogic proLogic = new ProductLogic();
            Product      pro      = proLogic.GetProduct(id);

            return(View(pro));
        }
示例#14
0
        public void InsertProduct_Empty()
        {
            ProductLogic.Insert(pEmpty);
            var result = ProductLogic.GetProducts().Last();

            Assert.AreNotEqual(pEmpty, result);
        }
示例#15
0
        public void InsertProduct()
        {
            ProductLogic.Insert(newProduct);
            var result = ProductLogic.GetProducts().Last();

            Assert.AreEqual(newProduct.Name, result.Name);
        }
        public ActionResult RemoveFromCart(int id)
        {
            var cart = ShoppingCartLogic.GetCart(this.HttpContext);

            var     shoppingCart    = new ShoppingCartLogic();
            int     productId       = shoppingCart.GetCartItemProductId(id);
            var     productService  = new ProductLogic();
            Product productToRemove = productService.FindProduct(productId);

            int itemCount = cart.RemoveFromCart(id);

            var removeViewModel = new ShoppingCartRemoveVM
            {
                Message = Server.HtmlEncode(productToRemove.Name) +
                          " has been removed from your shopping cart.",
                CartCount    = cart.GetCount(),
                CartSubTotal = cart.GetSubtotal(),
                CartSalesTax = cart.GetSalesTax(),
                CartTotal    = cart.GetTotal(),
                ItemCount    = itemCount,
                DeleteId     = id,
            };

            return(Json(removeViewModel));
        }
示例#17
0
        public void TestGetAllProducts()
        {
            ProductLogic logic = new ProductLogic();

            try
            {
                logic.Create(new ProductBinding {
                    Name = "Test1", Price = 10
                });
                logic.Create(new ProductBinding {
                    Name = "Test2", Price = 15
                });

                OrderProductPageDriver driver = new OrderProductPageDriver(new UiContext(new OrderLogic(), logic), new OrderView(), null);

                List <ProductView> list = driver.GetAllProducts();

                Assert.Equal(2, list.Count);
                Assert.Equal("Test1", list[0].Name);
                Assert.Equal(10, list[0].Price);
                Assert.Equal("Test2", list[1].Name);
                Assert.Equal(15, list[1].Price);
            }
            finally
            {
                logic.Delete(null);
            }
        }
示例#18
0
        public override OPResult AddOrUpdate(OrganizationContractDiscount entity)
        {
            OrganizationContractDiscountBO contractdiscount = (OrganizationContractDiscountBO)entity;
            var byq = ProductLogic.GetBYQ(contractdiscount.BrandID, contractdiscount.Year, contractdiscount.Quarter);

            if (byq == null)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "未找到相应的品牌年份季度信息"
                });
            }
            contractdiscount.BYQID = byq.ID;
            bool isAdd = contractdiscount.ID == default(int);

            if (isAdd)
            {
                if (LinqOP.Any <OrganizationContractDiscount>(o => o.OrganizationID == contractdiscount.OrganizationID && o.BYQID == contractdiscount.BYQID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的合同折扣"
                    });
                }
            }
            else
            {
                if (LinqOP.Any <OrganizationContractDiscount>(o => o.OrganizationID == contractdiscount.OrganizationID && o.ID != contractdiscount.ID && o.BYQID == contractdiscount.BYQID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的合同折扣"
                    });
                }
            }
            return(base.AddOrUpdate(entity));
        }
示例#19
0
        public override OPResult AddOrUpdate(OrganizationPriceFloat entity)
        {
            OrganizationPriceFloatBO pricefloat = (OrganizationPriceFloatBO)entity;
            var byq = ProductLogic.GetBYQ(pricefloat.BrandID, pricefloat.Year, pricefloat.Quarter);

            if (byq == null)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "未找到相应的品牌年份季度信息."
                });
            }
            pricefloat.BYQID = byq.ID;
            if (pricefloat.ID == default(int))
            {
                if (IsSetted(pricefloat.OrganizationID, byq.ID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的价格上浮策略."
                    });
                }
            }
            else
            {
                if (LinqOP.Any <OrganizationPriceFloat>(o => o.OrganizationID == pricefloat.OrganizationID && o.ID != pricefloat.ID && o.BYQID == byq.ID))
                {
                    return(new OPResult {
                        IsSucceed = false, Message = "已为该机构指定了对应款式的价格上浮策略."
                    });
                }
            }
            return(base.AddOrUpdate(entity));
        }
 public ActionResult Conversion(int ID)
 {
     ViewBag.Products = ProductLogic.GetFinishedProducts();
     if (ID > 0)
     {
         var conversion = ProductLogic.GetConversionByID(ID).FirstOrDefault();
         ViewBag.FromShades   = ShadeLogic.GetShadeByProductID(conversion.FromProductId);
         ViewBag.FromPackings = PackingLogic.GetPackingByProductID(Convert.ToInt32(conversion.FromProductId));
         if (conversion.FromProductId == conversion.ToProductId)
         {
             ViewBag.ToShades = ViewBag.FromShades;
         }
         else
         {
             ViewBag.ToShades = ShadeLogic.GetShadeByProductID(conversion.ToProductId);
         }
         ViewBag.ToPackings = ViewBag.FromPackings;
         return(View(conversion));
     }
     else
     {
         var conversion = new ProductConversion();
         conversion.DocNo = ProductLogic.GetNewConverstionDocNo();
         return(View(conversion));
     }
 }
示例#21
0
        private Boolean saveAction()
        {
            // Check input
            if (checkValideSubmit() == false)
            {
                return(false);
            }
            FormAddProductObj frmObj = tranfersInput();

            if (currentMode == CONS_MODE_ADD)
            {
                LogicResult rs = new ProductLogic().addProduct(frmObj);
                if (rs.severity == Contanst.MSG_ERROR)
                {
                    MessageBox.Show(rs.msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    return(true);
                }
            }
            if (currentMode == CONS_MODE_EDIT)
            {
                LogicResult rs = new ProductLogic().updateProduct(frmObj);
                if (rs.severity == Contanst.MSG_ERROR)
                {
                    MessageBox.Show(rs.msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    return(true);
                }
            }
            return(true);
        }
        public ActionResult GetOrderDetail(int ID, int DispatchID)
        {
            var order = OrderLogic.GetOrderByID(ID).FirstOrDefault();

            ViewBag.Parties    = PartyLogic.GetPartyByID(order.PartyID);
            ViewBag.Transports = TransportLogic.GetTransportByID(0);
            ViewBag.Products   = ProductLogic.GetFinishedProducts();
            ViewBag.Addresses  = PartyAddressLogic.GetPartyAddress(order.PartyID);
            var dispatch = new Dispatch();

            if (DispatchID == 0)
            {
                dispatch.DONo   = DispatchLogic.GetMaxDispatchNo();
                dispatch.DODate = DateTime.Now;
            }
            else
            {
                dispatch = DispatchLogic.GetDispatchByID(DispatchID).FirstOrDefault();
            }
            dispatch.order   = order;
            dispatch.details = DispatchLogic.GetDispatchDetail(DispatchID, order.ID);
            if (DispatchID > 0)
            {
                dispatch.order.PartyID           = dispatch.PartyID;
                dispatch.order.DeliveryAddressID = dispatch.DeliveryAddressID;
                dispatch.order.TransportID       = dispatch.TransportID;
                dispatch.order.BookingAt         = dispatch.BookingAt;
            }
            return(PartialView("_DispatchDetails", dispatch));
        }
        //
        // GET: /BillOfMaterial/

        public ActionResult Add(string ID)
        {
            ViewBag.FinishedProductList    = ProductLogic.GetFinishedProducts();
            ViewBag.RawMaterialProductList = ProductLogic.GetRawMaterialProducts();
            ViewBag.BOMProcessList         = BOMProcessLogic.BOMProcessByID(0);
            ViewBag.UnitList      = ProductUnitLogic.GetProductUnitByID(0);
            ViewBag.LabParameters = LabParameterLogic.GetLabParameterByID(0);
            ViewBag.UserType      = currUser.Type;
            if (Convert.ToInt32(ID) > 0)
            {
                var bom = BillOfMaterialLogic.GetBillOfMaterialByID(Convert.ToInt32(ID)).FirstOrDefault();
                ViewBag.ShadeList = ShadeLogic.GetShadeByProductID(Convert.ToInt32(bom.ProductID)).Select(x => new { x.ShadeID, x.ShadeName }).Distinct();
                //var productShades = ShadeLogic.GetShadeByProductID(bom.ProductID);
                //if (productShades != null && productShades.Count() > 0)
                //{
                //    foreach (var productShade in productShades.Select(x => x.ShadeID).Distinct())
                //    {
                //        ViewBag.ShadeList = ShadeLogic.GetShadeByID(Convert.ToInt32(productShade));
                //    }
                //}
                //else
                //{
                //    ViewBag.ShadeList = null;
                //}
                return(View(bom));
            }
            else
            {
                ViewBag.ShadeList = null;
                return(View(new BillOfMaterial()));
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (!(e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
        {
            OrderLogic ol = new OrderLogic();
            Order      o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));;

            if (o1 != null)
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(o1.ProductID);
                Label1.Text  = p1.Name;
                Label2.Text  = o1.QuotationID.ToString();
                Label3.Text  = o1.Quantity.ToString();
                Label4.Text  = o1.Rate.ToString();
                Label5.Text  = o1.PONumber.ToString();
                Label6.Text  = o1.PODate.ToString("dd/MM/yyyy");
                Label7.Text  = o1.CreateDate.ToString("dd/MM/yyyy");
                Label8.Text  = o1.Status;
                Label9.Text  = o1.StatusRemarks;
                Label10.Text = o1.DeliveryAddress;
                Label11.Text = o1.DeliveryDate.ToString("dd/MM/yyyy");
                String oo = o1.AttachPO;
                lnkImage1.Text        = oo.Substring(25);
                lnkImage1.NavigateUrl = oo;
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
示例#25
0
        public void TestMethodSaveUpdatedProduct()
        {
            string       message = "";
            ProductLogic logic   = new ProductLogic();

            try
            {
                logic.Create(new ProductBinding {
                    Name = "Ananas", Price = 87
                });
                ProductPageDriver driver = new ProductPageDriver(new UiContext(new OrderLogic(), logic), logic.Read(null)[0]);
                driver.ProductName     = () => "Banan";
                driver.ProductPrice    = () => 38;
                driver.ShowInfoMessage = (msg) => message = msg;

                bool result             = driver.SaveProduct();
                List <ProductView> list = logic.Read(null);

                Assert.True(result);
                Assert.Single(list);
                Assert.Equal("Banan", list[0].Name);
                Assert.Equal(38, list[0].Price);
                Assert.Equal("Product №1 was updated", message);
            }
            finally
            {
                logic.Delete(null);
            }
        }
示例#26
0
        public ActionResult Product(string category)
        {
            // Check if a category was passed in first.
            if (!string.IsNullOrWhiteSpace(category))
            {
                List <ProductDetail> productDetails;
                var profiler = MiniProfiler.Current; // it's ok if this is null
                using (profiler.Step("Retrieve Products"))
                {
                    // Retrieve the products for the category
                    ProductLogic productLogic = new ProductLogic();
                    productDetails = productLogic.GetProductDetailByCategory(category);
                }

                // Loop through the results and add to our model
                List <ProductModel> productModel = new List <ProductModel>();
                using (profiler.Step("Build Model"))
                {
                    foreach (ProductDetail product in productDetails)
                    {
                        productModel.Add(new ProductModel
                        {
                            ImageDescription = product.ProductDescription,
                            ImageUrl         = product.ImageUrl
                        });
                    }
                }

                // Return the populated model to the view
                return(View(productModel));
            }

            // Incorrect parameters were passed in, so return nothing.
            return(View());
        }
示例#27
0
        static void Main(string[] args)
        {
            UserLogic userLogic = new UserLogic();

            if (userLogic.GetUser("abdul76").Count() > 0)
            {
                WebClient webClient = new WebClient();
                String    context   = webClient.DownloadString("http://localhost:8080/MyTobaccoShop.Java/username?username="******"abdul76");
                Console.WriteLine(context);
            }
            CustomerLogic customerLogic = new CustomerLogic();
            // userLogic.UpdateUserType(2, "Admin");
            var s = userLogic.GetAdminUsers();

            foreach (var item in s)
            {
                Console.WriteLine(item.Name + "Type : " + item.User_type);
            }

            //Console.WriteLine(userLogic.GetUser(1));
            //Console.WriteLine(userLogic.GetUser(2));
            Console.WriteLine(customerLogic.SumOfCustomers());

            ProductLogic productLogic = new ProductLogic();
            var          avgPrice     = productLogic.GetAveragePrices();

            foreach (var item in avgPrice)
            {
                Console.WriteLine(item);
            }
        }
示例#28
0
        public void TestIncorrectProductName()
        {
            List <string> messages = new List <string>();
            List <bool>   results  = new List <bool>();
            ProductLogic  logic    = new ProductLogic();

            try
            {
                logic.Create(new ProductBinding {
                    Name = "Ananas", Price = 87
                });
                ProductPageDriver driver = new ProductPageDriver(new UiContext(new OrderLogic(), logic), null);
                driver.ShowErrorMessage = (msg) => messages.Add(msg);

                driver.ProductName  = () => "Ananas";
                driver.ProductPrice = () => 87;
                results.Add(driver.SaveProduct());

                driver.ProductName  = () => " ";
                driver.ProductPrice = () => 87;
                results.Add(driver.SaveProduct());

                Assert.Equal(2, results.Count);
                Assert.False(results[0]);
                Assert.False(results[1]);
                Assert.Equal(2, messages.Count);
                Assert.Equal("Product with name Ananas already exist", messages[0]);
                Assert.Equal("Field name is empty", messages[1]);
            }
            finally
            {
                logic.Delete(null);
            }
        }
        public JsonResult Conversion(ProductConversion conversion)
        {
            ResponseMsg response = new ResponseMsg();

            response.IsSuccess = ProductLogic.Convert(conversion);
            return(Json(response));
        }
示例#30
0
        public void TestGetSelectedProduct()
        {
            ProductLogic logic = new ProductLogic();

            try
            {
                logic.Create(new ProductBinding {
                    Name = "Test1", Price = 10
                });
                OrderProductView orderProduct = new OrderProductView {
                    ProductId = 1
                };

                OrderProductPageDriver driver   = new OrderProductPageDriver(new UiContext(new OrderLogic(), logic), new OrderView(), orderProduct);
                ProductView            product1 = driver.GetSelectedProduct();
                driver = new OrderProductPageDriver(new UiContext(new OrderLogic(), logic), new OrderView(), null);
                ProductView product2 = driver.GetSelectedProduct();

                Assert.Equal("Test1", product1.Name);
                Assert.Equal(10, product1.Price);
                Assert.Null(product2);
            }
            finally
            {
                logic.Delete(null);
            }
        }
示例#31
0
        public ApiModule()
            : base("/api")
        {
            #region  ///  Help Page  ///
            Get["/help"] = x => View["help"];
            #endregion

            #region  ///  Category  ///

            #region  ///  /api/Categories/  ///
            Get["/categories"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Categories/1234  ///
            Get["/categories/{id:int}"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Customer  ///

            #region  ///  /api/Customers/  ///
            Get["/customers"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Customers/1234  ///
            Get["/customers/{id*}"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Employee  ///

            #region  ///  /api/employees  ///
            Get["/employees"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  ///  /api/employees/1234  ///
            Get["/employees/{id:int}"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Order  ///

            #region  ///  /api/Orders/  ///
            Get["/orders"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Orders/1234  ///
            Get["/orders/{id:int}"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Product  ///

            #region  ///  /api/Products/  ///
            Get["/products"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Products/1234  ///
            Get["/products/{id:int}"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Region  ///

            #region  ///  /api/Regions/  ///
            Get["/regions"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Regions/1234  ///
            Get["/regions/{id:int}"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Shipper  ///

            #region  ///  /api/Shippers/  ///
            Get["/shippers"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Shippers/1234  ///
            Get["/shippers/{id:int}"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Supplier  ///

            #region  ///  /api/Suppliers/  ///
            Get["/suppliers"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Suppliers/1234  ///
            Get["/suppliers/{id:int}"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Territory  ///

            #region  ///  /api/Territories/  ///
            Get["/territories"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Territories/1234  ///
            Get["/territories/{id:string}"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion
        }
示例#32
0
 public StoreController()
 {
     catBLL = new CategoryBLL();
     prodBLL = new ProductBLL();
 }
 public ProductsController(ProductLogic stub)
 {
     db = stub;
 }
示例#34
0
 public StoreController(CategoryLogic stub, ProductLogic prostub)
 {
     catBLL = stub;
     prodBLL = prostub;
 }
 public ShopCartController(ShoppingCartLogic stub, ProductLogic prodStub)
 {
     storeDB = stub;
     prodBLL = prodStub;
 }
 public ShopCartController()
 {
     storeDB = new ShoppingCartBLL();
     prodBLL = new ProductBLL();
 }
 public ProductsController()
 {
     db = new ProductBLL();
 }