Exemple #1
0
        public ModuleShopProductValueItem GetListValueByRequest(HttpRequestBase httpRequest, int agecncy, out decimal?total, out decimal?quantity)
        {
            Request = new ParramRequest(httpRequest);
            var isValue = httpRequest["IsValue"] ?? "1";
            var query   = (from o in FDIDB.sp_GetListInventoryValue(int.Parse(isValue), agecncy)
                           orderby o.ID descending
                           select new ShopProductValueItem
            {
                ID = o.ID,
                Name = o.Name,
                UnitName = o.Unitname,
                Quantity = o.slNhap,
                QuantityOut = o.slXuat,
                QuantityInv = o.tonkho
            }).ToList();
            var model = new ModuleShopProductValueItem
            {
                ListItems = query.ToList(),
            };

            //query = query.SelectByRequest(Request);
            //total = query.Sum(m => (m.Quantity - (m.QuantityOut ?? 0)) * m.Price);
            total    = 0;
            quantity = query.Sum(m => m.QuantityInv);
            //query = query.SelectPageByRequest(Request, ref TotalRecord);
            return(model);
        }
Exemple #2
0
        public List <SuggestionsProduct> GetListAutoFull(string keword, int showLimit, int agencyId, int type = 1)
        {
            var name  = FomatString.Slug(keword);
            var date  = DateTime.Now;
            var query = FDIDB.AutoSelectProductFull(name, showLimit).Select(c => new SuggestionsProduct
            {
                ID      = c.ID,
                IsCombo = 0,
                //name = "<span>Mã SP: <b>" + (c.CodeSku ?? "") + "</b> - BarCode:  <b>" + (c.BarCode ?? "") + "</b>- SL:  <b>" + (c.Quantity ?? 0) + "</b> - Màu: <b> " + (c.namecolor ?? "") + "</b> - Size: <b>" + (c.namesize ?? "") + "</b>" + "</span>",
                UrlImg = c.UrlImg ?? "/Content/Admin/images/auto-default.jpg",

                QuantityDay = c.QuantityDay,
                //Quantity = c.Quantity,
                DateS = date.ToString("yyyy-MM-dd"),
                DateE = date.AddMonths(c.QuantityDay ?? 0).ToString("yyyy-MM-dd"),
                code  = c.CodeSku,
                data  = c.PriceNew.ToString(),
                title = c.Name,
                //PriceCost = c.PriceCost,
                pricenew = (decimal)c.PriceNew,
                Type     = type
            });

            return(query.ToList());
        }
Exemple #3
0
        public BarcodeSouceItem GetByBarcode(string barcode, int cusId)
        {
            var query = from o in FDIDB.GetBySouceByBarcode(barcode, cusId)
                        select new BarcodeSouceItem
            {
                GID             = o.GID,
                BarCode         = o.BarCode,
                NameAgency      = o.NameAgency,
                AddressAgency   = o.AddressAgency,
                PhoneAgency     = o.PhoneAgency,
                Price           = o.Price,
                PriceNew        = o.PriceNew,
                IDStorage       = o.IDStorage,
                NameSupplier    = o.NameSupplier,
                AddressSupplier = o.AddressSupplier,
                Value           = o.Value,
                IsCheck         = o.Ischeck,
                FullName        = o.FullName,
                UserName        = o.UserName,
                CountSource1    = o.CountSource1,
                CountSource2    = o.CountSource2,
                CountSource3    = o.CountSource3,
                CountSource4    = o.CountSource4,
                DatePack        = o.DatePack,
                DateImport      = o.DateImport,
                DateOrder       = o.DateOrder,
                Status          = 1
            };

            return(query.FirstOrDefault());
        }
Exemple #4
0
        public List <SuggestionsProduct> GetListAuto(string keword, int showLimit, int agencyId, int type = 1)
        {
            var name  = FomatString.Slug(keword);
            var date  = DateTime.Now;
            var query = FDIDB.AutoSelectProduct(name, showLimit).Select(c => new SuggestionsProduct
            {
                ID          = c.ID,
                IdDetail    = c.IdDetail,
                IsCombo     = 0,
                name        = "<span>BarCode:  <b>" + (c.BarCode ?? "") + "</b>- SL:  <b>" + (c.Quantity ?? 0) + "</b></span>",
                UrlImg      = c.UrlImg ?? "/Content/Admin/images/auto-default.jpg",
                value       = c.BarCode,
                BarCode     = c.BarCode,
                QuantityDay = c.QuantityDay,
                Quantity    = c.Quantity,
                DateS       = date.ToString("yyyy-MM-dd"),
                DateE       = date.AddMonths(c.QuantityDay ?? 0).ToString("yyyy-MM-dd"),
                data        = c.PriceNew.ToString(),
                title       = c.Name,
                pricenew    = c.PriceNew,
                Type        = type,
            });

            return(query.ToList());
        }
Exemple #5
0
        public List <SuggestionsProduct> GetListAutoOne(string keword, int showLimit, int agencyId, int type = 1)
        {
            var name  = FomatString.Slug(keword);
            var query = FDIDB.AutoSelectProductOne(name, showLimit, agencyId).Select(c => new SuggestionsProduct
            {
                ID          = c.ID,
                IsCombo     = 0,
                name        = "<span>BarCode:  <b>" + (c.BarCode ?? "") + "</b>" + "</span>",
                UrlImg      = c.UrlImg ?? "/Content/Admin/images/auto-default.jpg",
                value       = c.BarCode,
                data        = c.PriceNew.ToString(),
                title       = c.Name,
                PriceCost   = c.Price,
                DateS       = c.Date.DecimalToString("dd/MM/yyyy"),
                DateE       = c.DateEnd.DecimalToString("dd/MM/yyyy"),
                Quantity    = 1,
                pricenew    = c.PriceNew,
                Type        = type,
                Idimport    = c.IdImport,
                BarCode     = c.BarCode,
                Valueweight = c.Value
            }).ToList();

            return(query.ToList());
        }
Exemple #6
0
        public AnalysisItem GetAllAnalysis(int agencyid, decimal start, decimal end)
        {
            var query = from c in FDIDB.GetAllAnalysis(agencyid, start, end)
                        select new AnalysisItem
            {
                CountC       = c.CountC,
                Later        = c.Later,
                CountO       = c.CountO,
                Cancelled    = c.Cancelled,
                CashAdvance  = c.CashAdvance,
                Complete     = c.Complete,
                CountU       = c.CountU,
                Onl          = c.Onl,
                Payment      = c.Payment,
                Pending      = c.Pending,
                PriceReceive = c.PriceReceive,
                PriceReward  = c.PriceReward,
                Processing   = c.Processing,
                Receipt      = c.Receipt,
                Refunded     = c.Refunded,
                Repay        = c.Repay,
            };

            return(query.FirstOrDefault());
        }
Exemple #7
0
        public List <CategoryItem> GetChildByParentId(bool setTitle)
        {
            var cate = from c in FDIDB.Category_GetList(LanguageId)
                       select new CategoryItem
            {
                ID               = c.Id,
                ParentId         = c.ParentId,
                Name             = c.Name,
                Slug             = c.NameRoot,
                Type             = c.Type,
                IsLevel          = c.IsLevel,
                Price            = c.Price,
                PriceRecipeFinal = c.PriceRecipeFinal,
                PriceFinal       = c.PriceFinal,
                PercentLoss      = c.PercentLoss,
                WeightDefault    = c.WeightDefault,
            };

            var re = cate.ToList();

            if (setTitle)
            {
                re.Insert(0, new CategoryItem {
                    ID = 0, Name = "-- Chọn chuyên mục --"
                });
            }
            return(re);
        }
Exemple #8
0
        public List <DNAgencyAppItem> ListAgencyByKm(double x, double y, int id, int aid, int km)
        {
            var date = DateTime.Now.TotalSeconds();

            if (aid > 0)
            {
                var query1 = from c in FDIDB.DN_Agency
                             where c.ID == aid
                             select new DNAgencyAppItem
                {
                    ID        = c.ID,
                    Name      = c.Name,
                    Latitute  = c.Latitute,
                    Longitude = c.Longitude,
                    Address   = c.Address,
                };
                return(query1.ToList());
            }

            var query = from c in FDIDB.ListAgencyByKm(km, x, y, id, date)
                        select new DNAgencyAppItem
            {
                ID        = c.ID,
                Name      = c.Name,
                Latitute  = c.Latitute,
                Longitude = c.Longitude,
                Address   = c.Address,
                Km        = c.Km
            };

            return(query.ToList());
        }
Exemple #9
0
        public List <CategoryAppIG4Item> GetChildByParentId(bool setTitle, int type = 0)
        {
            var cate = from c in FDIDB.Category_GetList(LanguageId)
                       select new CategoryAppIG4Item
            {
                ID       = c.Id,
                ParentId = c.ParentId,
                Name     = c.Name,
                Slug     = c.NameRoot,
                Type     = c.Type,
                IsLevel  = c.IsLevel
            };

            if (type != 0)
            {
                cate = cate.Where(c => c.Type == type);
            }
            var re = cate.ToList();

            if (setTitle)
            {
                re.Insert(0, new CategoryAppIG4Item {
                    ID = 0, Name = "-- Chọn chuyên mục --"
                });
            }
            return(re);
        }
Exemple #10
0
        public List <AnalysisItem> AnalysisByEnterprise(int enterpriseId, decimal start, decimal end)
        {
            var query = from c in FDIDB.AnalysisByEnterprise(enterpriseId, start, end)
                        select new AnalysisItem
            {
                CountC       = c.CountC,
                Later        = c.Later,
                CountO       = c.CountO,
                Cancelled    = c.Cancelled,
                CashAdvance  = c.CashAdvance,
                Complete     = c.Complete,
                CountU       = c.CountU,
                Onl          = c.Onl,
                Payment      = c.Payment,
                Pending      = c.Pending,
                PriceReceive = c.PriceReceive,
                PriceReward  = c.PriceReward,
                Processing   = c.Processing,
                Receipt      = c.Receipt,
                Refunded     = c.Refunded,
                Repay        = c.Repay,
            };

            return(query.ToList());
        }
Exemple #11
0
        public void Delete(Customer customer)
        {
            customer.IsDelete = true;
            FDIDB.Customers.Attach(customer);
            var entry = FDIDB.Entry(customer);

            entry.Property(e => e.IsDelete).IsModified = true;
            // DB.Customers.Remove(customer);
        }
Exemple #12
0
        /// <summary>
        /// Insert Log
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="userEdited"></param>
        /// <param name="propertiesChanged"></param>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        /// <param name="actionTable"></param>
        //public void InsertLog(int productId, string userEdited, string propertiesChanged, string oldValue, string newValue, string actionTable)
        //{
        //    try
        //    {
        //        var logProduct = new Log_Shop_Product()
        //        {
        //            ProductId = productId,
        //            UserEdited = userEdited,
        //            PropertiesChanged = propertiesChanged,
        //            OldValue = oldValue,
        //            NewValue = newValue,
        //            DateChanged = DateTime.Now,
        //            TypeActionName = actionTable
        //        };
        //        FDIDB.Log_Shop_Product.Add(logProduct);
        //        Save();
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }
        //}

        /// <summary>
        /// Nghiatc2.
        /// </summary>
        /// <returns></returns>
        public void Save()
        {
            try
            {
                FDIDB.SaveChanges();
            }
            catch (Exception)
            {
            }
        }
Exemple #13
0
        public List <ListChartAppIG4Item> GetStaticBarcharCustomerInMonth(int month)
        {
            var query = from c in FDIDB.StaticChartsCustomer(month)
                        select new ListChartAppIG4Item
            {
                I        = c.I,
                TotalCus = c.Total
            };

            return(query.ToList());
        }
Exemple #14
0
        public List <StaticWalletsTotal> GetStaticChartsTotalDay(int id, decimal fo, decimal to, int type)
        {
            var query = from c in FDIDB.StaticChartsbyDayAgencyTotalPrice(fo, to, id, type)
                        select new StaticWalletsTotal
            {
                Total      = c.Total ?? 0,
                DateCreate = c.DateCreate
            };

            return(query.ToList());
        }
Exemple #15
0
        public List <ListChartPacketAppIG4Item> GetStaticCustomerbuyPacketInMonth(int month)
        {
            var query = from c in FDIDB.StaticChartsCustomerBuyPacket(month)
                        select new ListChartPacketAppIG4Item
            {
                I     = c.I,
                Total = c.Total ?? 0
            };

            return(query.ToList());
        }
Exemple #16
0
        public List <StaticDocumentItem> GeneralListStatic(int year, int areaId)
        {
            var query = FDIDB.StaticDocumentYear(year, areaId).Select(m => new StaticDocumentItem
            {
                Month        = m.I ?? 0,
                TotalDoc     = m.totadocument,
                TotalValue   = m.totalvalue,
                TotalDeposit = m.totaldep
            }).ToList();

            return(query);
        }
Exemple #17
0
        public List <TopCustomerStaticAppIG4> Top100CustomerSell(int page, int take)
        {
            var query = from c in FDIDB.Top100CustomerSell()
                        select new TopCustomerStaticAppIG4
            {
                Fullname = c.FullName,
                Email    = c.Email,
                Total    = c.total,
            };

            return(query.Skip((page - 1) * take).Take(take).ToList());
        }
Exemple #18
0
        public void AddTagToProduct(int tagId, int productId)
        {
            var product = FDIDB.Shop_Product.Find(productId);
            var tag     = FDIDB.System_Tag.Find(tagId);

            if (product == null || tag == null)
            {
                return;
            }
            //product.System_Tag.Add(tag);
            FDIDB.SaveChanges();
        }
Exemple #19
0
        public List <SysPageItem> GetChildByParentId(int parentId, int moduleType, int root, int agencyId)
        {
            var query = from c in FDIDB.SysPage_GetChildByParent(parentId, moduleType, root, agencyId)
                        select new SysPageItem
            {
                ID       = c.Id,
                ParentId = c.ParentId,
                Layout   = c.Layout,
                Name     = c.Symbol + c.Name
            };

            return(query.ToList());
        }
Exemple #20
0
        public List <ModuleItem> DNModule_GetChildByParentId(int parentID, int agencyid)
        {
            var query = from c in FDIDB.DNModule_GetChildByParentId(parentID, agencyid, true)
                        select new ModuleItem
            {
                ID         = c.Id.Value,
                NameModule = c.Name,
                Tag        = c.Link,
                PrarentID  = c.Parent,
            };

            return(query.ToList());
        }
Exemple #21
0
        public List <AttributeDynamicItem> GetAttribute(string lstInts, int id)
        {
            var query = from c in FDIDB.GetAttribute(lstInts, id)
                        select new AttributeDynamicItem
            {
                ID        = c.AttributeID,
                ProductId = c.ProductId,
                Name      = c.Name,
                Value     = c.Values
            };

            return(query.ToList());
        }
        //public List<ProductAppIG4Item> ProductGetOrderShop(int cateid, int shopid, bool IsAll, decimal dates, decimal datee, int page, int pagesize)
        //{
        //    var query = FDIDB.ProductGetOrderShop(cateid, shopid, IsAll, dates, datee, page, pagesize).Select(m =>
        //         new ProductAppIG4Item
        //         {
        //             ID = m.ID,
        //             Name = m.Name,
        //             PriceNew = m.PriceNew ?? 0,
        //             DateCreated = m.DateCreated,
        //             Quantity = m.Quantity,
        //             UrlPicture = m.Folder + m.Url,
        //         });
        //    return query.ToList();
        //}
        public List <DashboardItem> GroupProductGetOrderShop(int shopid, bool IsAll, decimal dates, decimal datee, int cateId)
        {
            var query = FDIDB.GroupProductGetOrderShop(shopid, IsAll, dates, datee, cateId).Select(m =>
                                                                                                   new DashboardItem
            {
                CategoryId    = m.id,
                Name          = m.name,
                TotalPrice    = m.totalprice,
                totalquantity = m.totalproduct,
            });

            return(query.ToList());
        }
Exemple #23
0
        public List <DNTreeItem> GetListParent(int agencyId)
        {
            var query = from o in FDIDB.GetListTree(agencyId)
                        select new DNTreeItem
            {
                ID       = o.Id,
                Level    = o.Level,
                Name     = o.Symbol + o.NameRoot,
                UserName = o.UserName
            };

            return(query.ToList());
        }
Exemple #24
0
        public List <GeneralTotalItem> GeneralListTotal(int year, int agencyId)
        {
            var query = FDIDB.GeneralYear(year, agencyId).Select(m => new GeneralTotalItem
            {
                Month        = m.I ?? 0,
                TotalOrder   = m.TotalPriceO ?? 0,
                TotalCash    = m.TotalPriceCA ?? 0,
                TotalPayment = m.TotalPricePV ?? 0,
                TotalReceipt = m.TotalPriceRV ?? 0,
                TotalRepay   = m.TotalPriceR ?? 0,
            }).ToList();

            return(query);
        }
Exemple #25
0
        public StaticWalletsTotal GetStaticChartsTotal(int id, decimal fo, decimal to)
        {
            var query = from c in FDIDB.StaticChartsAgencyTotalPrice(fo, to, id)
                        select new StaticWalletsTotal
            {
                Total         = c.Total ?? 0,
                TotalCustomer = c.totalcustomer ?? 0,
                TotalAgency   = c.totalagency ?? 0,
                TotalSouce    = c.totalsouce ?? 0,
                Percent       = ((c.Total - c.TotalOld) * c.TotalOld / 100) ?? 0
            };

            return(query.FirstOrDefault());
        }
Exemple #26
0
 public IList <OrderDetailProductItem> GetSummary(decimal todayCode)
 {
     return(FDIDB.sp_GetOrderDetail(todayCode).Select(m => new OrderDetailProductItem()
     {
         ProductId = m.ProductDetailID,
         ProductName = m.Name,
         Quantity = m.Quantity ?? 0,
         CateID = m.CateID,
         CategoryName = m.CateName,
         SizeId = m.SizeID ?? 0,
         UnitName = m.UnitName,
         UnitValue = m.UnitValue ?? 0
     }).ToList());
 }
        public List <ProductAppIG4Item> ProductGetbyShop(int cateid, int shopid, bool IsAll, DateTime dates, DateTime datee, int page, int pagesize)
        {
            var query = FDIDB.ProductGetbyShop(cateid, shopid, IsAll, dates.TotalSeconds(), datee.TotalSeconds(), page, pagesize).Select(m =>
                                                                                                                                         new ProductAppIG4Item
            {
                ID          = m.ID,
                Name        = m.Name,
                PriceNew    = m.PriceNew ?? 0,
                DateCreated = m.DateCreated,
                Quantity    = m.Quantity,
                UrlPicture  = m.Folder + m.Url,
            });

            return(query.ToList());
        }
Exemple #28
0
        public List <HtmlItem> GetList(int id = 0)
        {
            var query = from c in FDIDB.GetListHtml(id, LanguageId)
                        select new HtmlItem
            {
                ID      = c.ID,
                CtrId   = c.ctrId,
                Sort    = c.Sort ?? 0,
                PageId  = c.PageID ?? 0,
                Name    = c.Name,
                Section = c.Section
            };

            return(query.ToList());
        }
Exemple #29
0
        public System_Tag AddOrGet(string tagName)
        {
            var systemTag = GetByName(tagName);

            if (systemTag == null)
            {
                var newTag = new System_Tag
                {
                    Name = tagName
                };
                FDIDB.System_Tag.Add(newTag);
                FDIDB.SaveChanges();
                return(newTag);
            }
            return(systemTag);
        }
Exemple #30
0
        public List <NewsAppIG4Item> StatisticsByActive(HttpRequestBase httpRequest)
        {
            var now       = DateTime.Now;
            var str       = httpRequest["fromdate"];
            var end       = httpRequest["todate"];
            var startdate = !string.IsNullOrEmpty(str) ? str.StringToDate() : new DateTime(now.Year, now.Month, 1);
            var endDate   = !string.IsNullOrEmpty(end) ? end.StringToDate().AddDays(1) : now;
            var query     = from c in FDIDB.sp_thongkenguoiduyet(startdate, endDate)
                            select new NewsAppIG4Item
            {
                UserActive = c.UserActive,
                Quantity   = c.Quantity
            };

            return(query.ToList());
        }