Exemplo n.º 1
0
 /// <summary>
 /// 产品详情页
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult ProductDetail(string id)
 {
     var model = new ProductsBusiness().GetProductByID(id, CurrentUser.ClientID);
     ViewBag.Model = model;
     ViewBag.UnitList = new ProductsBusiness().GetUnits();
     return View();
 }
Exemplo n.º 2
0
        public ActionResult OrderCategory()
        {
            var list = new ProductsBusiness().GetChildCategorysByID("", IntFactoryEnum.EnumCategoryType.Order);
            foreach (var item in list)
            {
                if (item.ChildCategory == null || item.ChildCategory.Count == 0)
                {
                    item.ChildCategory = new ProductsBusiness().GetChildCategorysByID(item.CategoryID, IntFactoryEnum.EnumCategoryType.Order);
                }
            }
            ViewBag.Items = list;

            return View();
        }
Exemplo n.º 3
0
 public ActionResult ChooseDetail(string pid)
 {
     if (string.IsNullOrEmpty(pid))
     {
         return Redirect("ProductList");
     }
     var model = new ProductsBusiness().GetProductByIDForDetails(pid, "");
     if (model == null || string.IsNullOrEmpty(model.ProductID))
     {
         return Redirect("ProductList");
     }
     ViewBag.Url = CloudSalesTool.AppSettings.Settings["IntFactoryUrl"];
     ViewBag.Model = model;
     return View();
 }
Exemplo n.º 4
0
 public ActionResult SetCategory()
 {
     if (CurrentUser.Client.GuideStep != 2)
     {
         return Redirect("/Default/Index");
     }
     var list = new ProductsBusiness().GetChildCategorysByID("", IntFactoryEnum.EnumCategoryType.Order);
     foreach (var item in list)
     {
         if (item.ChildCategory == null || item.ChildCategory.Count == 0)
         {
             item.ChildCategory = new ProductsBusiness().GetChildCategorysByID(item.CategoryID, IntFactoryEnum.EnumCategoryType.Order);
         }
     }
     ViewBag.Items = list;
     return View();
 }
        /// <summary>
        /// 过滤产品
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public JsonResult GetProductListForShopping(string filter)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            FilterProduct model = serializer.Deserialize<FilterProduct>(filter);
            int totalCount = 0;
            int pageCount = 0;

            List<ProductDetail> list = new ProductsBusiness().GetFilterProducts(model.CategoryID, model.Attrs, model.DocType, model.BeginPrice, model.EndPrice, model.IsPublic, model.Keywords, model.OrderBy, model.IsAsc, 20, model.PageIndex, ref totalCount, ref pageCount, CurrentUser.ClientID);
            JsonDictionary.Add("Items", list);
            JsonDictionary.Add("TotalCount", totalCount);
            JsonDictionary.Add("PageCount", pageCount);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加产品
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductAdd(string id, string type = "", string guid = "", string tid = "") 
        {
            if (string.IsNullOrEmpty(type)) 
            {
                type = "0";
            }
            ViewBag.Type = type;
            ViewBag.GUID = guid;
            ViewBag.TID = tid;

            if (string.IsNullOrEmpty(id))
            {
                var list = new ProductsBusiness().GetChildCategorysByID("", EnumCategoryType.Product);
                ViewBag.Items = list;
                return View("ChooseCategory");
            }
            
            ViewBag.Model = new ProductsBusiness().GetCategoryDetailByID(id);
            ViewBag.UnitList = new ProductsBusiness().GetUnits();
            return View();
        }
Exemplo n.º 7
0
 public ActionResult OrderCategory()
 {
     var list = new ProductsBusiness().GetChildCategorysByID("", EnumCategoryType.Order);
     ViewBag.Items = list;
     return View();
 }
Exemplo n.º 8
0
        public JsonResult GetProductList(string filter)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            FilterProduct model = serializer.Deserialize<FilterProduct>(filter);
            int totalCount = 0;
            int pageCount = 0;

            List<Products> list = new ProductsBusiness().GetProductsAll(model.CategoryID, model.ProviderID, model.BeginPrice, model.EndPrice, model.IsPublic, model.Keywords, model.OrderBy, model.IsAsc, PageSize, model.PageIndex, ref totalCount, ref pageCount);
            JsonDictionary.Add("Items", list);
            JsonDictionary.Add("TotalCount", totalCount);
            JsonDictionary.Add("PageCount", pageCount);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 9
0
 public JsonResult DeleteProductIsPublic(string productid)
 {
     bool bl = new ProductsBusiness().DeleteProductIsPublic(productid, OperateIP, CurrentUser.UserID);
     JsonDictionary.Add("Status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 10
0
        //获取订单详情
        public JsonResult GetOrderDetailByID(string orderID,string clientID)
        {
            var item = OrdersBusiness.BaseBusiness.GetOrderBaseInfoByID(orderID, clientID, clientID);
            Dictionary<string, object> obj = new Dictionary<string, object>();
            obj.Add("orderID", item.OrderID);
            obj.Add("goodsName", item.GoodsName);
            obj.Add("intGoodsCode", item.IntGoodsCode);
            obj.Add("finalPrice", item.FinalPrice);
            obj.Add("orderImage", item.OrderImage);
            obj.Add("orderImages", item.OrderImages);
            obj.Add("categoryID", item.CategoryID);
            obj.Add("categoryName", item.CategoryName);
            obj.Add("platemaking", item.Platemaking);
            obj.Add("createTime", item.CreateTime);
            obj.Add("endTime", item.EndTime);
            obj.Add("clientID", item.ClientID);

            //材料列表
            var details = new List<Dictionary<string, object>>();
            foreach (var d in item.Details) {
                Dictionary<string, object> detail = new Dictionary<string, object>();
                detail.Add("detailsCode", d.DetailsCode);
                detail.Add("imgS", d.ImgS);
                detail.Add("price", d.Price);
                detail.Add("unitName", d.UnitName);
                detail.Add("productCode", d.ProductCode);
                detail.Add("productName", d.ProductName);
                detail.Add("productImage", d.ProductImage);

                details.Add(detail);
            }
            obj.Add("details", details);
            //制版工艺
            var plateMakings = TaskBusiness.GetPlateMakings(orderID);
            var plates = new List<Dictionary<string, object>>();
            foreach (var p in plateMakings) {
                Dictionary<string, object> plate = new Dictionary<string, object>();
                plate.Add("plateID", p.PlateID);
                plate.Add("icon", p.Icon);
                plate.Add("title", p.Title);
                plate.Add("remark", p.Remark);
                plate.Add("type", p.Type);

                plates.Add(plate);
            }
            obj.Add("plateMakings", plates);
            //订单品类
            var category = new ProductsBusiness().GetOrderCategoryDetailsByID(item.CategoryID, item.OrderID);
            var attrLists = new List<Dictionary<string, object>>();
            var saleAttrs = new List<Dictionary<string, object>>();
            foreach (var attr in category.AttrLists) {
                Dictionary<string, object> attrObj= new Dictionary<string, object>();
                attrObj.Add("attrID", attr.AttrID);
                attrObj.Add("attrName", attr.AttrName);
                var attrValues = new List<Dictionary<string, object>>();
                foreach (var value in attr.AttrValues) {
                    Dictionary<string, object> valueObj = new Dictionary<string, object>();
                    valueObj.Add("valueID", value.ValueID);
                    valueObj.Add("valueName", value.ValueName);

                    attrValues.Add(valueObj);
                }
                attrObj.Add("attrValues", attrValues);
                attrLists.Add(attrObj);
            }
            foreach (var attr in category.SaleAttrs)
            {
                Dictionary<string, object> attrObj = new Dictionary<string, object>();
                attrObj.Add("attrID", attr.AttrID);
                attrObj.Add("attrName", attr.AttrName);
                var attrValues = new List<Dictionary<string, object>>();
                foreach (var value in attr.AttrValues)
                {
                    Dictionary<string, object> valueObj = new Dictionary<string, object>();
                    valueObj.Add("valueID", value.ValueID);
                    valueObj.Add("valueName", value.ValueName);

                    attrValues.Add(valueObj);
                }
                attrObj.Add("attrValues", attrValues);
                saleAttrs.Add(attrObj);
            }
            obj.Add("attrLists", attrLists);
            obj.Add("saleAttrs", saleAttrs);
            JsonDictionary.Add("order",obj);

            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取属性列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="keyWorks"></param>
        /// <returns></returns>
        public JsonResult GetAttrList(int index, string keyWorks)
        {
            List<ProductAttr> list = new List<ProductAttr>();

            int totalCount = 0, pageCount = 0;
            list = new ProductsBusiness().GetAttrList("", keyWorks, PageSize, index, ref totalCount, ref pageCount);

            JsonDictionary.Add("Items", list);
            JsonDictionary.Add("TotalCount", totalCount);
            JsonDictionary.Add("PageCount", pageCount);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 12
0
        public ActionResult SelfOrder(string id)
        {

            if (string.IsNullOrEmpty(id))
            {
                return Redirect("/Home/Login");
            }
            var model = ClientBusiness.GetClientDetail(id);
            if (model == null || string.IsNullOrEmpty(model.ClientID))
            {
                return Redirect("/Home/Login");
            }
            ViewBag.Model = model;
            var list = new ProductsBusiness().GetClientCategorysByPID("", EnumCategoryType.Order, id);
            ViewBag.Items = list;
            return View();
        }
Exemplo n.º 13
0
 public JsonResult GetProductDetails(string wareid, string keywords)
 {
     var list = new ProductsBusiness().GetProductDetails(wareid, keywords, CurrentUser.AgentID, CurrentUser.ClientID);
     JsonDictionary.Add("items", list);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 14
0
 /// <summary>
 /// 删除属性值
 /// </summary>
 /// <param name="valueid"></param>
 /// <returns></returns>
 public JsonResult DeleteAttrValue(string valueid,string attrid)
 {
     bool bl = new ProductsBusiness().UpdateAttrValueStatus(valueid, attrid, EnumStatus.Delete, OperateIP, CurrentUser.UserID);
     JsonDictionary.Add("Status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 15
0
 /// <summary>
 /// 更新属性值排序
 /// </summary>
 /// <param name="valueid"></param>
 /// <param name="attrid"></param>
 /// <param name="sort"></param>
 /// <returns></returns>
 public JsonResult UpdateAttrValueSort(string valueid, string attrid,int sort)
 {
     bool bl = new ProductsBusiness().UpdateAttrValueSort(valueid, attrid,sort);
     JsonDictionary.Add("Status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 16
0
        /// <summary>
        /// 保存属性值
        /// </summary>
        /// <param name="attr"></param>
        /// <returns></returns>
        public JsonResult SaveAttrValue(string value)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            AttrValue model = serializer.Deserialize<AttrValue>(value);

            string valueID = string.Empty;
            if (!string.IsNullOrEmpty(model.AttrID))
            {
                if (string.IsNullOrEmpty(model.ValueID))
                {
                    valueID = new ProductsBusiness().AddAttrValue(model.ValueName, model.AttrID, CurrentUser.UserID);
                }
                else if (new ProductsBusiness().UpdateAttrValue(model.ValueID, model.AttrID, model.ValueName, OperateIP, CurrentUser.UserID))
                {
                    valueID = model.ValueID.ToString();
                }
            }

            JsonDictionary.Add("ID", valueID);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 17
0
 /// <summary>
 /// 添加分类通用属性
 /// </summary>
 /// <param name="categoryid"></param>
 /// <param name="attrid"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public JsonResult AddCategoryAttr(string categoryid, string attrid, int type)
 {
     bool bl = new ProductsBusiness().AddCategoryAttr(categoryid, attrid, type, OperateIP, CurrentUser.UserID);
     JsonDictionary.Add("Status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 18
0
 /// <summary>
 /// 获取属性详情
 /// </summary>
 /// <param name="attr"></param>
 /// <returns></returns>
 public JsonResult GetAttrByID(string attrID = "")
 {
     if (string.IsNullOrEmpty(attrID))
     {
         JsonDictionary.Add("Item", null);
     }
     else
     {
         var model = new ProductsBusiness().GetAttrByID(attrID);
         JsonDictionary.Add("Item", model);
     }
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 19
0
        /// <summary>
        /// 保存属性
        /// </summary>
        /// <param name="attr"></param>
        /// <returns></returns>
        public JsonResult SaveAttr(string attr)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            ProductAttr model = serializer.Deserialize<ProductAttr>(attr);

            string attrID = string.Empty;
            if (string.IsNullOrEmpty(model.AttrID))
            {
                attrID = new ProductsBusiness().AddAttr(model.AttrName, model.Description, model.CategoryID, model.Type, CurrentUser.UserID);
            }
            else if (new ProductsBusiness().UpdateProductAttr(model.AttrID, model.AttrName, model.Description, OperateIP, CurrentUser.UserID))
            {
                attrID = model.AttrID.ToString();
            }


            JsonDictionary.Add("ID", attrID);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 20
0
        /// <summary>
        /// 获取所有属性
        /// </summary>
        /// <returns></returns>
        public JsonResult GetAttrsByCategoryID(string categoryid)
        {
            List<ProductAttr> list = new List<ProductAttr>();
            list = new ProductsBusiness().GetAttrsByCategoryID(categoryid);

            JsonDictionary.Add("Items", list);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 21
0
        public JsonResult GetProductUseLogs(string productid,int pageindex)
        {
            int totalCount = 0;
            int pageCount = 0;

            var list = new ProductsBusiness().GetProductUseLogs(productid, 20, pageindex, ref totalCount, ref pageCount);
            JsonDictionary.Add("items", list);
            JsonDictionary.Add("totalCount", totalCount);
            JsonDictionary.Add("pageCount", pageCount);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 22
0
 /// <summary>
 /// 编辑子产品状态
 /// </summary>
 /// <param name="productdetailid"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public JsonResult UpdateProductDetailsStatus(string productdetailid, int status)
 {
     bool bl = new ProductsBusiness().UpdateProductDetailsStatus(productdetailid, (EnumStatus)status, OperateIP, CurrentUser.UserID);
     JsonDictionary.Add("Status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 23
0
        /// <summary>
        /// 保存单位
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public JsonResult SaveUnit(string unit)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            ProductUnit model = serializer.Deserialize<ProductUnit>(unit);

            string UnitID = "";
            if (string.IsNullOrEmpty(model.UnitID))
            {
                UnitID = new ProductsBusiness().AddUnit(model.UnitName, model.Description, CurrentUser.UserID);
            }
            else
            {
                bool bl = new ProductsBusiness().UpdateUnit(model.UnitID, model.UnitName, model.Description, CurrentUser.UserID);
                if (bl)
                {
                    UnitID = model.UnitID;
                }
            }
            JsonDictionary.Add("ID", UnitID);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Exemplo n.º 24
0
 /// <summary>
 /// 获取下级分类
 /// </summary>
 /// <param name="categoryid"></param>
 /// <returns></returns>
 public JsonResult GetChildCategorysByID(string categoryid, int type = 1)
 {
     var list = new ProductsBusiness().GetChildCategorysByID(categoryid, (EnumCategoryType)type);
     JsonDictionary.Add("Items", list);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 25
0
 public JsonResult GetChildOrderCategorysByID(string categoryid, string clientid)
 {
     Dictionary<string, object> JsonDictionary = new Dictionary<string, object>();
     var list = new ProductsBusiness().GetClientCategorysByPID(categoryid, EnumCategoryType.Order, clientid);
     JsonDictionary.Add("Items", list);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 26
0
 /// <summary>
 /// 获取分类详情(带属性)
 /// </summary>
 /// <param name="categoryid"></param>
 /// <returns></returns>
 public JsonResult GetCategoryDetailsByID(string categoryid)
 {
     var model = new ProductsBusiness().GetCategoryDetailByID(categoryid);
     JsonDictionary.Add("Model", model);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 27
0
 public ActionResult Create(string cid)
 {
     var list = new ProductsBusiness().GetClientCategorysByPID("", EnumCategoryType.Order, CurrentUser.ClientID);
     ViewBag.CID = cid;
     ViewBag.Items = list;
     return View();
 }
Exemplo n.º 28
0
 public JsonResult DeleteCategory(string id)
 {
     int result = 0;
     bool bl = new ProductsBusiness().DeleteCategory(id, CurrentUser.UserID, OperateIP, out result);
     JsonDictionary.Add("status", result);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 29
0
 /// <summary>
 /// 保存分类
 /// </summary>
 /// <param name="category"></param>
 /// <param name="attrlist"></param>
 /// <returns></returns>
 public JsonResult SavaCategory(string category, string attrlist, string saleattr)
 {
     JavaScriptSerializer serializer = new JavaScriptSerializer();
     Category model = serializer.Deserialize<Category>(category);
     //参数
     if (!string.IsNullOrEmpty(attrlist))
     {
         attrlist = attrlist.Substring(0, attrlist.Length - 1);
     }
     //规格
     if (!string.IsNullOrEmpty(saleattr))
     {
         saleattr = saleattr.Substring(0, saleattr.Length - 1);
     }
     string caregoryid = "";
     if (string.IsNullOrEmpty(model.CategoryID))
     {
         caregoryid = new ProductsBusiness().AddCategory(model.CategoryCode, model.CategoryName, model.PID, model.CategoryType, model.Status.Value, attrlist.Split(',').ToList(), saleattr.Split(',').ToList(), model.Description, CurrentUser.UserID);
     }
     else
     {
         bool bl = new ProductsBusiness().UpdateCategory(model.CategoryID, model.CategoryName, model.Status.Value, attrlist.Split(',').ToList(), saleattr.Split(',').ToList(), model.Description, CurrentUser.UserID);
         if (bl)
         {
             caregoryid = model.CategoryID;
         }
     }
     JsonDictionary.Add("ID", caregoryid);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Exemplo n.º 30
0
 public JsonResult GetClientOrderCategorys()
 {
     var list = new ProductsBusiness().GetClientCategorysByPID("", IntFactoryEnum.EnumCategoryType.Order, CurrentUser.ClientID).Where(m => m.Status == 1).ToList();
     foreach (var item in list)
     {
         if (item.ChildCategory == null || item.ChildCategory.Count == 0)
         {
             item.ChildCategory = new ProductsBusiness().GetClientCategorysByPID(item.CategoryID, IntFactoryEnum.EnumCategoryType.Order, CurrentUser.ClientID).Where(m => m.Status == 1).ToList();
         }
     }
     JsonDictionary.Add("items", list);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }