Ejemplo n.º 1
0
        public PartialViewResult ProductCategory()
        {
            var model = new CategoryDao().ListAllCategory();

            return(PartialView(model));
        }
        public void SetViewBag(long?selectedId = null)
        {
            var dao = new CategoryDao();

            ViewBag.CategoryID = new SelectList(dao.AllList(), "ID", "Name", selectedId);
        }
Ejemplo n.º 3
0
        // GET: Admin/Category
        public ActionResult Index()
        {
            var categoryList = new CategoryDao().ListCate();

            return(View(categoryList));
        }
        public ActionResult Edit(int id)
        {
            var cate = new CategoryDao().ViewDetail(id);

            return(View(cate));
        }
Ejemplo n.º 5
0
        protected string BuildActiveTopicProductBrowseQuerySearch(ProductBrowseQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("IsApproved = 1 and SaleStatus = {0}", (int)query.ProductSaleStatus);
            stringBuilder.AppendFormat(" AND SaleStatus = {0}", 1);
            if (!query.IsPrecise)
            {
                if (!string.IsNullOrEmpty(query.ProductCode))
                {
                    stringBuilder.AppendFormat(" AND LOWER(ProductCode) Like  '%{0}%'", DataHelper.CleanSearchString(query.ProductCode).ToLower());
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(query.ProductCode))
                {
                    stringBuilder.AppendFormat(" AND LOWER(ProductCode)='{0}'", DataHelper.CleanSearchString(query.ProductCode).ToLower());
                }
            }
            if (query.AttributeValues.Count > 0)
            {
                foreach (AttributeValueInfo current in query.AttributeValues)
                {
                    stringBuilder.AppendFormat(" AND ProductId IN ( SELECT ProductId FROM Ecshop_ProductAttributes WHERE AttributeId={0} And ValueId={1}) ", current.AttributeId, current.ValueId);
                }
            }
            if (!string.IsNullOrWhiteSpace(query.StrBrandId))
            {
                stringBuilder.AppendFormat(" AND BrandId in ({0})", query.StrBrandId);
            }

            if (query.MinSalePrice.HasValue)
            {
                stringBuilder.AppendFormat(" AND SalePrice >= {0}", query.MinSalePrice.Value);
            }
            if (query.MaxSalePrice.HasValue)
            {
                stringBuilder.AppendFormat(" AND SalePrice <= {0}", query.MaxSalePrice.Value);
            }
            if (!string.IsNullOrEmpty(query.Keywords) && query.Keywords.Trim().Length > 0)
            {
                if (!query.IsPrecise)
                {
                    query.Keywords = DataHelper.CleanSearchString(query.Keywords);
                    string[]      array = Regex.Split(query.Keywords.Trim(), "\\s+");
                    List <string> list  = new List <string>();
                    list.Add(string.Format("(replace(ProductName,' ','') LIKE '%{0}%' or LOWER(ProductCode) LIKE '%{0}%' or ShopName like '%{0}%')", DataHelper.CleanSearchString(array[0])));
                    int num = 1;
                    while (num < array.Length && num <= 4)
                    {
                        list.Add(string.Format("(replace(ProductName,' ','') LIKE '%{0}%' or LOWER(ProductCode) LIKE '%{0}%' or ShopName like '%{0}%')", DataHelper.CleanSearchString(array[num])));
                        num++;
                    }
                    stringBuilder.Append(" and (" + string.Join(" and ", list.ToArray()) + ")");
                }
                else
                {
                    stringBuilder.AppendFormat(" AND (ProductName = '{0}'  or ShopName = '{0}') ", DataHelper.CleanSearchString(query.Keywords));
                }
            }

            if (!string.IsNullOrEmpty(query.SubKeywords) && query.SubKeywords.Trim().Length > 0)
            {
                if (!query.IsPrecise)
                {
                    query.SubKeywords = DataHelper.CleanSearchString(query.SubKeywords);
                    string[]      array = Regex.Split(query.SubKeywords.Trim(), "\\s+");
                    List <string> list  = new List <string>();
                    list.Add(string.Format("(replace(ProductName,' ','') LIKE '%{0}%' or LOWER(ProductCode) LIKE '%{0}%' or ShopName like '%{0}%')", DataHelper.CleanSearchString(array[0])));
                    int num = 1;
                    while (num < array.Length && num <= 4)
                    {
                        list.Add(string.Format("(replace(ProductName,' ','') LIKE '%{0}%' or LOWER(ProductCode) LIKE '%{0}%' or ShopName like '%{0}%')", DataHelper.CleanSearchString(array[num])));
                        num++;
                    }
                    stringBuilder.Append(" and (" + string.Join(" and ", list.ToArray()) + ")");
                }
                else
                {
                    stringBuilder.AppendFormat(" AND (ProductName = '{0}'or ShopName = '{0}')", DataHelper.CleanSearchString(query.SubKeywords));
                }
            }
            if (!string.IsNullOrWhiteSpace(query.StrCategoryId))
            {
                IList <CategoryInfo> categorys = new CategoryDao().GetListCategoryByIds(query.StrCategoryId);
                if (categorys != null && categorys.Count > 0)
                {
                    stringBuilder.Append(" and ( ");
                    foreach (CategoryInfo category in categorys)
                    {
                        stringBuilder.AppendFormat(" MainCategoryPath LIKE '{0}|%' OR ExtendCategoryPath LIKE '{0}|%' or", category.Path);
                    }
                    stringBuilder.Remove(stringBuilder.ToString().LastIndexOf("or"), 2);
                    stringBuilder.Append(" ) ");
                }
                //stringBuilder.AppendFormat(" AND ( MainCategoryPath LIKE 'SELECT Path FROM Ecshop_Categories WHERE CategoryId in ({0})|%' OR ExtendCategoryPath LIKE 'SELECT Path FROM Ecshop_Categories WHERE CategoryId in ({0})|%') ", query.StrCategoryId);
            }
            if (!string.IsNullOrWhiteSpace(query.StrImportsourceId))//原产地
            {
                stringBuilder.AppendFormat(" AND ImportsourceId in ({0}) ", query.StrImportsourceId);
            }
            if (!string.IsNullOrEmpty(query.TagIds))
            {
                string[] array2 = query.TagIds.Split(new char[]
                {
                    '_'
                });
                string[] array3 = array2;
                for (int i = 0; i < array3.Length; i++)
                {
                    string text = DataHelper.CleanSearchString(array3[i]);
                    if (!string.IsNullOrEmpty(text))
                    {
                        stringBuilder.AppendFormat(" AND ProductId IN(SELECT ProductId FROM Ecshop_ProductTag WHERE TagId = {0})", text);
                    }
                }
            }
            if (query.HasStock)
            {
                stringBuilder.Append(" AND stock>0 ");
            }

            if (query.supplierid.HasValue)
            {
                stringBuilder.AppendFormat(" AND supplierid={0} ", query.supplierid.Value);
            }

            if (query.TopId.HasValue)
            {
                if (query.TopId.Value > 0)
                {
                    stringBuilder.AppendFormat(" AND topicid={0} ", query.TopId.Value);
                }
            }



            return(stringBuilder.ToString());
        }
Ejemplo n.º 6
0
        public ActionResult DatHang(string shipName, string shipMobile, string shipAddress, string shipEmail)
        {
            if (Session["cart"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            //Thêm chi tiết vào giỏ hàng
            Customer cus  = new Customer();
            Customer test = model.Customers.SingleOrDefault(x => x.shipName == shipName && x.shipMobile == shipMobile && x.shipAddress == shipAddress && x.shipEmail == shipEmail);

            if (test != null)
            {
                cus.makhachhang = test.makhachhang;
                cus.shipName    = test.shipName;
                cus.shipMobile  = test.shipMobile;
                cus.shipAddress = test.shipAddress;
                cus.shipEmail   = test.shipEmail;
            }
            else
            {
                cus.shipName    = shipName;
                cus.shipMobile  = shipMobile;
                cus.shipAddress = shipAddress;
                cus.shipEmail   = shipEmail;
                model.Customers.Add(cus);
                model.SaveChanges();
            }
            ShoppingCart Cart  = (ShoppingCart)Session["cart"];
            Order        order = new Order();

            order.ngaydathang  = DateTime.Now;
            order.ngaygiaohang = DateTime.Now;
            order.status       = "Đang giao hang";
            order.makhachhang  = cus.makhachhang;
            model.Orders.Add(order);
            model.SaveChanges();
            CategoryDao     categoryDao = new CategoryDao();
            List <ItemCart> listItem    = new List <ItemCart>();
            IndexData       data        = new IndexData();

            data.listCategory = categoryDao.GetCategory();

            if (Cart != null)
            {
                data.listItemCart = Cart.listItem;
                foreach (var item in data.listItemCart)
                {
                    OrderDetail detail = new OrderDetail();
                    detail.madathang = order.ma;
                    detail.masanpham = item.Product.ma;
                    detail.soluong   = item.soluong;
                    detail.dongia    = item.Product.dongia;
                    Product sp = model.Products.Find(detail.masanpham);
                    sp.soluong = sp.soluong - item.soluong;
                    SubCategory subcategory = model.SubCategories.Find(sp.producttype);
                    subcategory.soluong = subcategory.soluong - item.soluong;
                    Category category = model.Categories.Find(subcategory.danhmucma);
                    category.soluong = category.soluong - item.soluong;
                    model.OrderDetails.Add(detail);
                    model.SaveChanges();
                }
                ViewData["DonHang"] = order;
            }

            return(View(data));
        }
Ejemplo n.º 7
0
        public ActionResult Create()
        {
            var model = new CategoryDao().ListAll();

            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult Edit(long id)
        {
            var category = new CategoryDao().GetByID(id);

            return(View(category));
        }
Ejemplo n.º 9
0
        public JsonResult BindNameByIdCateGoryId(long id)
        {
            var result = new CategoryDao().getByid(id);

            return(Json(result.name, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public JsonResult BindCategory()
        {
            var result = new CategoryDao().getAll();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public void SetViewBag(int?selectedId = null)
        {
            var dao = new CategoryDao();

            ViewBag.IDCaterogy = new SelectList(dao.ListAll(), "ID", "Name", selectedId);
        }
Ejemplo n.º 12
0
        // GET: Category

        //Trang danh mục sản phẩm
        public ActionResult Index(int CategoryID = 1)
        {
            var model = new CategoryDao().GetListAllProduct(CategoryID);

            return(View(model));
        }
Ejemplo n.º 13
0
        public ActionResult EditProductCategory(long id)
        {
            ProductCategory current = new CategoryDao().getbyID(id);

            return(View(current));
        }
Ejemplo n.º 14
0
 public Common()
 {
     CategoryDao = new CategoryDao();
 }
 public CategoryService()
 {
     CategoryDao = new CategoryDao<Category>();
 }
Ejemplo n.º 16
0
        public void SetViewBag(long?selectedID = null)
        {
            var categoryDao = new CategoryDao();

            ViewBag.CategoryID = new SelectList(categoryDao.GetAllCategory(), "ID", "Name", selectedID);
        }
Ejemplo n.º 17
0
        public ICollection <Category> FindAllCategories()
        {
            ICollection <Category> categories = CategoryDao.GetAllElements();

            return(categories);
        }
Ejemplo n.º 18
0
        public ActionResult NavigationBar()
        {
            var listCategory = new CategoryDao().ListCateClient();

            return(PartialView(listCategory));
        }
        public void Initialize()
        {
            // 受信したいAppIfメッセージと、対応するハンドラの呼び出しをハードコーディングする

            Electron.IpcMain.On("async-msg", (args) =>
            {
                Console.WriteLine("async-msg = " + args.GetType());
            });

            Electron.IpcMain.OnSync("EVT_TRNS_CONTENTLIST", (args) =>
            {
                Console.WriteLine("[ContentMainWorkflowEventEmiter][Initialize] : IN");
                // TODO: ワークフロー制御

                var mainWindow = Electron.WindowManager.BrowserWindows.First();
                Electron.IpcMain.Send(mainWindow, "MSG_SHOW_CONTENLIST", args);

                Console.WriteLine("[ContentMainWorkflowEventEmiter][Initialize] : メッセージ送信");
                return(0);
            });

            Electron.IpcMain.OnSync("EVT_TRNS_CONTENTPREVIEW", (args) =>
            {
                Console.WriteLine("[ContentMainWorkflowEventEmiter][EVT_TRNS_CONTENTPREVIEW] : IN");
                // TODO: ワークフロー制御

                var mainWindow = Electron.WindowManager.BrowserWindows.First();
                Electron.IpcMain.Send(mainWindow, "MSG_SHOW_CONTENTPREVIEW", args);

                Console.WriteLine("[ContentMainWorkflowEventEmiter][EVT_TRNS_CONTENTPREVIEW] : メッセージ送信");
                return(0);
            });

            Electron.IpcMain.OnSync("EAV_GETCATEGORY", (args) =>
            {
                long categoryId         = long.Parse(args.ToString());
                CategoryDao catgeoryDao = new CategoryDao();
                var category            = catgeoryDao.LoadCategory(categoryId);
                return(JsonConvert.SerializeObject(category));
            });

            Electron.IpcMain.OnSync("EAV_GETSUBCATEGORY", (args) =>
            {
                long categoryId         = long.Parse(args.ToString());
                CategoryDao catgeoryDao = new CategoryDao();
                var categoryList        = catgeoryDao.GetSubCategory(categoryId);
                return(JsonConvert.SerializeObject(categoryList));
            });

            Electron.IpcMain.OnSync("EAV_GETTHUMBNAIL", (args) =>
            {
                var thumbnailHash         = args.ToString();
                ThumbnailDao thumbnailDao = new ThumbnailDao();
                var thumbnail             = thumbnailDao.LoadByThumbnailKey(thumbnailHash);
                return(JsonConvert.SerializeObject(thumbnail));
            });

            Electron.IpcMain.OnSync("EAV_GET_CONTENTPREVIEW", (args) =>
            {
                long contentId        = long.Parse(args.ToString());
                ContentDao contentDao = new ContentDao();
                var previewUrl        = contentDao.LoadContentData(contentId);

                var response = new Response_EAV_GET_CONTENTPREVIEW(true)
                {
                    Content = new Content
                    {
                        Id = contentId
                    },
                    PreviewUrl = previewUrl
                };

                //return content;
                return(JsonConvert.SerializeObject(response));
            });
        }
Ejemplo n.º 20
0
        public ActionResult Category(long cateId)
        {
            var category = new CategoryDao().ViewDetail(cateId);

            return(View(category));
        }
Ejemplo n.º 21
0
 public List <Category> GetBrotherNode(int id)
 {
     return(CategoryDao.GetBrotherNode(id));
 }
Ejemplo n.º 22
0
        public void SetViewbag(long?selectedID = null)
        {
            var dao = new CategoryDao();

            ViewBag.Categorys = dao.brand();
        }
        public ActionResult Edit(int id)
        {
            var cat = new CategoryDao().ViewdetailCat(id);

            return(View(cat));
        }
Ejemplo n.º 24
0
        // GET: Admin/Category/Edit/5
        public ActionResult Edit(int id)
        {
            var data = new CategoryDao().getCategoryDetail(id);

            return(View(data));
        }
Ejemplo n.º 25
0
        //Ham lay tat ca danh sach category de do vao dropdownlist
        public void SetViewBag(long?selectedId = null)
        {
            var dao = new CategoryDao();

            ViewBag.CategoryID = new SelectList(dao.ListAll(), "ID", "Name", selectedId);//danhsachdulieu,keydata,textdata
        }
Ejemplo n.º 26
0
        public ActionResult Edit(int id)
        {
            var cate = new CategoryDao().GetByID(id);

            return(View(cate));
        }
Ejemplo n.º 27
0
        // GET: Admin/Category/Edit/5
        public ActionResult Edit(int id)
        {
            var model = new CategoryDao().GetByID(id);

            return(View(model));
        }
Ejemplo n.º 28
0
        public ActionResult CategoryLoad()
        {
            var model = new CategoryDao().GetAllCategory();

            return(PartialView(model));
        }
Ejemplo n.º 29
0
        public static OrderInfo GetCalculadtionCommission(OrderInfo order)
        {
            DistributorsDao     dao             = new DistributorsDao();
            DistributorGradeDao dao2            = new DistributorGradeDao();
            DistributorsInfo    distributorInfo = dao.GetDistributorInfo(order.ReferralUserId);

            if (distributorInfo != null)
            {
                decimal  num         = 0M;
                decimal  num2        = 0M;
                decimal  num3        = 0M;
                DataView defaultView = dao2.GetAllDistributorGrade().DefaultView;
                if (distributorInfo.DistriGradeId.ToString() != "0")
                {
                    defaultView.RowFilter = " GradeId=" + distributorInfo.DistriGradeId;
                    if (defaultView.Count > 0)
                    {
                        num = decimal.Parse(defaultView[0]["FirstCommissionRise"].ToString());
                    }
                }
                if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                {
                    string[] strArray = distributorInfo.ReferralPath.Split(new char[] { '|' });
                    if (strArray.Length == 1)
                    {
                        DistributorsInfo info2 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info2.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info2.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                    }
                    else
                    {
                        DistributorsInfo info3 = dao.GetDistributorInfo(int.Parse(strArray[1]));
                        if (info3.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info3.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                        DistributorsInfo info4 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info4.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info4.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num3 = decimal.Parse(defaultView[0]["ThirdCommissionRise"].ToString());
                            }
                        }
                    }
                }
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info5 = new LineItemInfo();
                DataView     view2 = new CategoryDao().GetCategories(order.wid).DefaultView;
                string       str   = null;
                string       str2  = null;
                string       str3  = null;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    info5 = pair.Value;
                    if (info5.Type == 0)
                    {
                        info5.ItemsCommission       = num;
                        info5.SecondItemsCommission = num2;
                        info5.ThirdItemsCommission  = num3;
                        decimal num4 = (info5.GetSubTotal() - info5.DiscountAverage) - info5.ItemAdjustedCommssion;
                        if (num4 > 0M)
                        {
                            if (info5.IsSetCommission)
                            {
                                info5.ItemsCommission       = ((info5.FirstCommission + num) / 100M) * num4;
                                info5.SecondItemsCommission = ((info5.SecondCommission + num2) / 100M) * num4;
                                info5.ThirdItemsCommission  = ((info5.ThirdCommission + num3) / 100M) * num4;
                            }
                            else
                            {
                                DataTable productCategories = new ProductDao().GetProductCategories(info5.ProductId);
                                if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                                {
                                    view2.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                                    str             = view2[0]["FirstCommission"].ToString();
                                    str2            = view2[0]["SecondCommission"].ToString();
                                    str3            = view2[0]["ThirdCommission"].ToString();
                                    if ((!string.IsNullOrEmpty(str) && !string.IsNullOrEmpty(str2)) && !string.IsNullOrEmpty(str3))
                                    {
                                        info5.ItemsCommission       = ((decimal.Parse(str) + num) / 100M) * num4;
                                        info5.SecondItemsCommission = ((decimal.Parse(str2) + num2) / 100M) * num4;
                                        info5.ThirdItemsCommission  = ((decimal.Parse(str3) + num3) / 100M) * num4;
                                    }
                                }
                            }
                        }
                        else
                        {
                            info5.ItemsCommission       = 0M;
                            info5.SecondItemsCommission = 0M;
                            info5.ThirdItemsCommission  = 0M;
                        }
                        if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                        {
                            if (distributorInfo.ReferralPath.Split(new char[] { '|' }).Length == 1)
                            {
                                info5.ThirdItemsCommission = 0M;
                            }
                        }
                        else
                        {
                            info5.SecondItemsCommission = 0M;
                            info5.ThirdItemsCommission  = 0M;
                        }
                    }
                }
            }
            return(order);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 添加类别
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool Add(string name)
        {
            int res = CategoryDao.Add(name);

            return(res > 0);
        }
Ejemplo n.º 31
0
        public ActionResult Edit(int id)
        {
            var user = new CategoryDao().ViewDetail(id);

            return(View(user));
        }