Beispiel #1
0
        public static int AddProductType(ProductTypeInfo productType)
        {
            int result;

            if (productType == null)
            {
                result = 0;
            }
            else
            {
                Globals.EntityCoding(productType, true);
                int num = new ProductTypeDao().AddProductType(productType);
                if (num > 0)
                {
                    if (productType.Brands.Count > 0)
                    {
                        new ProductTypeDao().AddProductTypeBrands(num, productType.Brands);
                    }
                    EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[]
                    {
                        productType.TypeName
                    }));
                }
                result = num;
            }
            return(result);
        }
Beispiel #2
0
        public static bool UpdateProductType(ProductTypeInfo productType)
        {
            bool result;

            if (productType == null)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(productType, true);
                bool flag = new ProductTypeDao().UpdateProductType(productType);
                if (flag)
                {
                    if (new ProductTypeDao().DeleteProductTypeBrands(productType.TypeId))
                    {
                        new ProductTypeDao().AddProductTypeBrands(productType.TypeId, productType.Brands);
                    }
                    EventLogs.WriteOperationLog(Privilege.EditProductType, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的商品类型", new object[]
                    {
                        productType.TypeId
                    }));
                }
                result = flag;
            }
            return(result);
        }
Beispiel #3
0
        public PartialViewResult LeftMain()
        {
            var model = new ProductTypeDao().GetProductType();

            ViewBag.ProductCate1 = new ProductTypeDao().GetProductCategory(1);
            ViewBag.ProductCate2 = new ProductTypeDao().GetProductCategory(2);
            ViewBag.ProductCate3 = new ProductTypeDao().GetProductCategory(3);
            return(PartialView(model));
        }
        public JsonResult DeleteCategory(int id)
        {
            var  dao  = new ProductTypeDao();
            bool temp = dao.Delete(id);

            return(Json(new
            {
                status = temp
            }));
        }
 public static bool DeleteProductType(int typeId)
 {
     ManagerHelper.CheckPrivilege(Privilege.DeleteProductType);
     bool flag = new ProductTypeDao().DeleteProducType(typeId);
     if (flag)
     {
         EventLogs.WriteOperationLog(Privilege.DeleteProductType, string.Format(CultureInfo.InvariantCulture, "删除了编号为”{0}”的商品类型", new object[] { typeId }));
     }
     return flag;
 }
        public JsonResult GetDetail(int id)
        {
            var dao      = new ProductTypeDao();
            var category = dao.FindID(id);

            return(Json(new
            {
                data = category,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
 public static int GetTypeId(string typeName)
 {
     int typeId = new ProductTypeDao().GetTypeId(typeName);
     if (typeId > 0)
     {
         return typeId;
     }
     ProductTypeInfo productType = new ProductTypeInfo {
         TypeName = typeName
     };
     return new ProductTypeDao().AddProductType(productType);
 }
        public JsonResult LoadData(string name, int page, int pageSize)
        {
            var dao      = new ProductTypeDao();
            var model    = dao.ListAllPage(name, page, pageSize);
            int totalRow = dao.Count(name);

            return(Json(new
            {
                data = model,
                total = totalRow,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
        public static int GetTypeId(string typeName)
        {
            ProductTypeDao productTypeDao = new ProductTypeDao();
            int            typeId         = productTypeDao.GetTypeId(typeName);

            if (typeId > 0)
            {
                return(typeId);
            }
            ProductTypeInfo productTypeInfo = new ProductTypeInfo();

            productTypeInfo.TypeName = typeName;
            return((int)productTypeDao.Add(productTypeInfo, null));
        }
Beispiel #10
0
        public static int GetTypeId(string typeName, string wid)
        {
            int typeId = new ProductTypeDao().GetTypeId(typeName, wid);

            if (typeId > 0)
            {
                return(typeId);
            }
            ProductTypeInfo productType = new ProductTypeInfo {
                TypeName = typeName,
                wid      = wid
            };

            return(new ProductTypeDao().AddProductType(productType));
        }
Beispiel #11
0
        public static int GetTypeId(string typeName)
        {
            int typeId = new ProductTypeDao().GetTypeId(typeName);
            int result;

            if (typeId > 0)
            {
                result = typeId;
            }
            else
            {
                ProductTypeInfo productTypeInfo = new ProductTypeInfo();
                productTypeInfo.TypeName = typeName;
                result = new ProductTypeDao().AddProductType(productTypeInfo);
            }
            return(result);
        }
Beispiel #12
0
        public static int GetTypeId(string typeName)
        {
            ProductTypeDao productTypeDao = new ProductTypeDao();
            int            typeId         = productTypeDao.GetTypeId(typeName);
            int            result;

            if (typeId > 0)
            {
                result = typeId;
            }
            else
            {
                result = productTypeDao.AddProductType(new ProductTypeInfo
                {
                    TypeName = typeName
                });
            }
            return(result);
        }
Beispiel #13
0
        public JsonResult SaveData(ProductType category)
        {
            var  dao  = new ProductTypeDao();
            bool temp = false;

            //Save
            //Add category
            if (category.IDProductType == 0)
            {
                dao.Insert(category);
                temp = true;
            }
            else
            {
                dao.Edit(category);
                temp = true;
            }
            return(Json(new
            {
                status = temp
            }));
        }
        public static bool UpdateProductType(ProductTypeInfo productType)
        {
            if (productType == null)
            {
                return(false);
            }
            ProductTypeDao productTypeDao = new ProductTypeDao();

            Globals.EntityCoding(productType, true);
            bool flag = productTypeDao.Update(productType, null);

            if (flag)
            {
                if (productTypeDao.DeleteProductTypeBrands(productType.TypeId))
                {
                    productTypeDao.AddProductTypeBrands(productType.TypeId, productType.Brands);
                }
                EventLogs.WriteOperationLog(Privilege.EditProductType, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的商品类型", new object[1]
                {
                    productType.TypeId
                }), false);
            }
            return(flag);
        }
        public static int AddProductType(ProductTypeInfo productType)
        {
            if (productType == null)
            {
                return(0);
            }
            ProductTypeDao productTypeDao = new ProductTypeDao();

            Globals.EntityCoding(productType, true);
            int num = (int)productTypeDao.Add(productType, null);

            if (num > 0)
            {
                if (productType.Brands.Count > 0)
                {
                    productTypeDao.AddProductTypeBrands(num, productType.Brands);
                }
                EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[1]
                {
                    productType.TypeName
                }), false);
            }
            return(num);
        }