Ejemplo n.º 1
0
        public List <ProductType> getAllProductTypes()
        {
            SqlHelper      helper = new SqlHelper();
            ProductTypeDAL dal    = new ProductTypeDAL(helper);
            var            types  = dal.getAllProductType();

            helper.Close();
            return(types);
        }
Ejemplo n.º 2
0
        public static bool database(string id)
        {
            int b = ProductTypeDAL.database(id);

            if (b >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var  dal       = new ProductTypeDAL();
     bool isSuccess = dal.Add(new ProductType
     {
         Brand     = "Test品牌",
         Spec      = "Spec",
         TypeCode1 = "TypeCode1",
         TypeCode2 = "TypeCode2",
         TypeName1 = "TypeName1",
         TypeName2 = "TypeName2"
     });
 }
Ejemplo n.º 4
0
        public static bool insert(string name)
        {
            int b = ProductTypeDAL.insert(name);

            if (b >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        public static bool update(string id, string name)
        {
            int b = ProductTypeDAL.update(id, name);

            if (b >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        public void createInvoice(Record document)
        {
            if (SafeUser != null && SafeUser.isLoggedIn())
            {
                try
                {
                    SqlHelper   helper = new SqlHelper();
                    SecurityDAL sdal   = new SecurityDAL(helper);
                    if (sdal.hasPermission(SafeUser.SignIN.UID, "UPDATE") &&
                        sdal.hasPermission(SafeUser.SignIN.UID, "DELETE"))
                    {
                        ProductInventoryDAL       piDAL = new ProductInventoryDAL(helper);
                        ProductDocumentDAL        pdDAL = new ProductDocumentDAL(helper);
                        ProductTypeDAL            ptDAL = new ProductTypeDAL(helper);
                        InventoryDocumentationDAL idDAL = new InventoryDocumentationDAL(helper);
                        ProductType type = ptDAL.getProductType(document.ProductType);
                        if (type == null)
                        {
                            ptDAL.addProductType(document.ProductType);
                            type = ptDAL.getProductType(document.ProductType);
                        }

                        ProductInventory product = piDAL.getProduct(document.ProductName, type.TID);
                        if (product != null && product.TotalQuantity - document.ProductQuantity >= 0)
                        {
                            product.TotalQuantity += document.ProductQuantity;
                            piDAL.updateProduct(product);
                        }
                        else
                        {
                            log(404, "No such product");
                            return;
                        }

                        ProductDocument delivery = new ProductDocument();
                        delivery.Name        = document.DocumentName;
                        delivery.PrID        = product.PrID;
                        delivery.Description = document.Description;
                        delivery.Quantity    = document.ProductQuantity;
                        pdDAL.addDocument(delivery);

                        delivery = pdDAL.getDocument(document.DocumentName, product.PrID,
                                                     document.ProductQuantity, document.Description);
                        idDAL.assignDocument(SafeUser.SignIN.UID, delivery.DocumentID);
                    }
                }catch (Exception ex)
                {
                    log(ex);
                }
            }
        }
Ejemplo n.º 7
0
        public void AddTest()
        {
            var  dal       = new ProductTypeDAL();
            bool isSuccess = dal.Add(new ProductType {
                Brand     = "Test品牌",
                Spec      = "Spec",
                TypeCode1 = "TypeCode1",
                TypeCode2 = "TypeCode2",
                TypeName1 = "TypeName1",
                TypeName2 = "TypeName2"
            });

            Assert.IsTrue(isSuccess);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Judge the ProductTypeId whether exist by Id before delete or update
 /// </summary>
 /// <param name="Id">Id</param>
 /// <returns>Return the counts of the ProductType by Id</returns>
 public static int ProductTypeIdIsExist(int Id)
 {
     return(ProductTypeDAL.ProductTypeIdIsExist(Id));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Out to excel the all data of ProductType
 /// </summary>
 /// <returns>Return DataTable Object</returns>
 public static DataTable OutToExcel_ProductType()
 {
     return(ProductTypeDAL.OutToExcel_ProductType());
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 删除商品类型
 /// </summary>
 /// <param name="p">房间类型对象</param>
 /// <returns>受影响的行数</returns>
 public static int DeleteProductType(ProductTypeMDL p)
 {
     return(ProductTypeDAL.DeleteProductType(p));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Judge the ProductTypeId whether has operation before delete by Id
 /// </summary>
 /// <param name="Id">Id</param>
 /// <returns>Return the counts of the ProductType by Id</returns>
 public static int ProductTypeIdWhetherHasOperation(int Id)
 {
     return(ProductTypeDAL.ProductTypeIdWhetherHasOperation(Id));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 添加产品类别
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int AddItem(ProductType item)
 {
     return(ProductTypeDAL.AddItem(item));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 修改商品类型
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public static int AlterProductType(ProductTypeMDL p)
 {
     return(ProductTypeDAL.AlterProductType(p));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 获取指定产品型号行数
 /// </summary>
 /// <param name="productTypeID">产品型号ID</param>
 /// <param name="productTypeName">产品型号名称</param>
 /// <returns>返回获取指定产品型号行数</returns>
 public static int GetProductTypeCountByIDName(int productTypeID, string productTypeName)
 {
     return(ProductTypeDAL.GetProductTypeCountByIDName(productTypeID, productTypeName));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 获取产品类型信息
 /// </summary>
 /// <returns>返回DataTable对象</returns>
 public static DataTable GetProductTypeInfo()
 {
     return(ProductTypeDAL.GetProductTypeInfo());
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 获取产品型号名称
 /// </summary>
 /// <param name="productTypeID">产品型号ID</param>
 /// <returns>返回产品型号名称</returns>
 public static string GetProductTypeNameByID(int productTypeID)
 {
     return(ProductTypeDAL.GetProductTypeNameByID(productTypeID));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 获取指定产品型号行数
 /// </summary>
 /// <param name="productTypeName">产品型号名称</param>
 /// <returns>返回获取指定产品型号行数</returns>
 public static int GetProductTypeCountByName(string productTypeName)
 {
     return(ProductTypeDAL.GetProductTypeCountByName(productTypeName));
 }
Ejemplo n.º 18
0
        public IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
        {
            Type    controllerType = Type.GetType(string.Concat(_controllerNamespace, ".", controllerName, "Controller"));
            dynamic service        = new CustomerProductDAL();

            switch (controllerName)
            {
            case "CustomerProducts":
            {
                service = new CustomerProductDAL();
                break;
            }

            case "Orders":
            {
                service = new OrderDAL();
                break;
            }

            case "Home":
            {
                service = new DashBoardDAL();
                break;
            }

            case "Categories":
            {
                service = new CategoryDAL();
                break;
            }

            case "Products":
            {
                service = new ProductDAL();
                break;
            }

            case "BulkBuys":
            {
                service = new BulkBuyDAL();
                break;
            }

            case "Buyers":
            {
                service = new BuyerDAL();
                break;
            }

            case "Sellers":
            {
                service = new SellerDAL();
                break;
            }

            case "Borrowers":
            {
                service = new BorrowerDAL();
                break;
            }

            case "ProductTypes":
            {
                service = new ProductTypeDAL();
                break;
            }

            case "Customers":
            {
                service = new CustomerDAL();
                break;
            }

            case "Account":
            {
                service = new AccountDAL();
                break;
            }

            case "Manage":
            {
                service = new ManageDAL();
                break;
            }

            case "Vendors":
            {
                service = new VendorDAL();
                break;
            }
            }
            IController controller = Activator.CreateInstance(controllerType, new[] { service }) as Controller;

            return(controller);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 删除产品类别
 /// </summary>
 /// <param name="id">id</param>
 /// <returns></returns>
 public int DeleteItem(int id)
 {
     return(ProductTypeDAL.DeleteItem(id));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 修改产品类别
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int UpdateItem(ProductType item)
 {
     return(ProductTypeDAL.UpdateItem(item));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 删除指定产品型号信息
 /// </summary>
 /// <param name="productTypeID">产品型号ID</param>
 /// <returns>返回删除指定产品型号信息所影响的行数</returns>
 public static int DelProductTypeByID(int productTypeID)
 {
     return(ProductTypeDAL.DelProductTypeByID(productTypeID));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 获取实体对象
 /// </summary>
 /// <param name="id">产品类别ID</param>
 /// <returns></returns>
 public ProductType GetItem(int id)
 {
     return(ProductTypeDAL.GetItem(id));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 更新指定产品模型信息
 /// </summary>
 /// <param name="productType">产品型号模型</param>
 /// <returns>返回更新指定产品模型信息所影响的行数</returns>
 public static int UpdProductTypeByID(ProductTypeModel productType)
 {
     return(ProductTypeDAL.UpdProductTypeByID(productType));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// combox高级绑定
 /// </summary>
 /// <returns></returns>
 public static DataTable selectcombox()
 {
     return(ProductTypeDAL.selectcombox());
 }
Ejemplo n.º 25
0
 /// <summary>
 /// 获取指定产品类型信息
 /// </summary>
 /// <param name="productTypeID">产品型号ID</param>
 /// <returns>返回DataTable对象</returns>
 public static DataTable GetProductTypeInfoByID(int productTypeID)
 {
     return(ProductTypeDAL.GetProductTypeInfoByID(productTypeID));
 }
Ejemplo n.º 26
0
        public string GetTypeNameById(int typeid)
        {
            ProductType item = ProductTypeDAL.GetItem(typeid);

            return(item != null ? item.TypeName : "");
        }
Ejemplo n.º 27
0
 /// <summary>
 /// 向产品型号表中插入相关记录
 /// </summary>
 /// <param name="productType">产品型号模型</param>
 /// <returns>返回向产品型号表中插入相关记录所影响的行数</returns>
 public static int AddProductType(ProductTypeModel productType)
 {
     return(ProductTypeDAL.AddProductType(productType));
 }
 public ProductTypeController(ApplicationDbContext _context, IWebHostEnvironment _env)
 {
     DAL     = new ProductTypeDAL(_context);
     context = _context;
     env     = _env;
 }
Ejemplo n.º 29
0
 public ProductTypeController()
 {
     DAL     = new ProductTypeDAL();
     context = new ApplicationDbContext();
 }
Ejemplo n.º 30
0
 /// <summary>
 /// 查询商品类型
 /// </summary>
 public static List <ProductTypeMDL> selectProductType()
 {
     return(ProductTypeDAL.selectProductType());
 }