コード例 #1
0
        /// <summary>
        /// Tìm kiếm theo tên khách hàng
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public JsonResult seachCusomer(SearchModelRes info)
        {
            int total = 0;
            var list  = CusDao.seachCustumer(info, out total);

            return(Json(new { Data = list, Message = "Success", Total = total }));
        }
コード例 #2
0
        /// <summary>
        /// danh sách toàn bộ khách hàng
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public JsonResult getCustomer(SearchModelRes info)
        {
            int total = 0;
            var list  = CusDao.getAllCustomer(info, out total);

            return(Json(new { Data = list, Total = total, Message = "Success" }));
        }
コード例 #3
0
        public JsonResult seachProduct(SearchModelRes info)
        {
            int total   = 0;
            var message = "Successful";

            var list = PrDAO.seachProductName(info, out total);

            return(Json(new { Data = list, Message = message, Total = total }));
        }
コード例 #4
0
ファイル: CustomerDAO.cs プロジェクト: 97DuyBC/StoreAdmin
 public Boolean insertCustomer(SearchModelRes info)
 {
     using (var db = new DataEntities())
     {
         db.Customers.Add(info.CustomerSMR);
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
コード例 #5
0
        /// <summary>
        /// thêm khách hàng
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public JsonResult insertCustomer(SearchModelRes info)
        {
            var Message = "Fail";
            var val     = CusDao.insertCustomer(info);

            if (val == true)
            {
                Message = "Successful";
            }
            return(Json(new { Message = Message }));
        }
コード例 #6
0
ファイル: CustomerDAO.cs プロジェクト: 97DuyBC/StoreAdmin
        public List <SearchModelRes> seachCustumer(SearchModelRes info, out int total)
        {
            using (var db = new DataEntities())
            {
                List <SearchModelRes> rs = new List <SearchModelRes>();
                var list = from cust in db.Customers
                           where ((cust.FirstName + " " + cust.LastName).Contains(info.CustomerSMR.FirstName))
                           orderby cust.FirstName ascending, cust.LastName ascending
                select(new SearchModelRes {
                    CustomerSMR = cust
                });

                total = list.Count();
                rs    = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList();
                return(rs);
            }
        }
コード例 #7
0
ファイル: CustomerDAO.cs プロジェクト: 97DuyBC/StoreAdmin
 /// <summary>
 /// Đưa ra toàn bộ danh sách khách hàng
 /// </summary>
 /// <returns>List<Customer></returns>
 public List <SearchModelRes> getAllCustomer(SearchModelRes info, out int total)
 {
     using (var db = new DataEntities())
     {
         List <SearchModelRes> rs = new List <SearchModelRes>();
         total = 0;
         var list = from cust in db.Customers
                    orderby cust.Id
                    select new SearchModelRes
         {
             CustomerSMR = cust
         };
         total = list.Count();
         rs    = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList();;
         return(rs);
     }
 }
コード例 #8
0
        public List <SearchModelRes> seachProductName(SearchModelRes info, out int total)
        {
            using (var db = new DataEntities())
            {
                List <SearchModelRes> rp = new List <SearchModelRes>();
                var list = from pr in db.Products
                           join supp in db.Suppliers on pr.SupplierId equals supp.Id
                           where pr.ProductName.Contains(info.ProductSMR.ProductName)
                           orderby pr.Id
                           select(new SearchModelRes
                {
                    ProductSMR  = pr,
                    SupplierSMR = supp
                });

                total = list.Count();
                rp    = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList();
                return(rp);
            }
        }