Example #1
0
        public static List <OrderDiscount> Search(OrderDiscountParam param, Pagination paging)
        {
            var sql = Sql.Builder;

            if (!Equals(param.Term, string.Empty))
            {
                sql.Where(string.Format("SearchMeta like '%{0}%'", param.Term.RemoveUnicode()));
            }
            if (param.IDCustomer > 0)
            {
                sql.Where("IDCustomer =@0", param.IDCustomer);
            }
            if (param.Year > 0)
            {
                sql.Where("Year =@0", param.Year);
            }
            if (param.Quater > 0)
            {
                sql.Where("Quater =@0", param.Quater);
            }
            if (param.Type > 0)
            {
                sql.Where("Type =@0", param.Type);
            }
            return(UseInstance.GetListOrDefault(sql, paging));
        }
        public static List <ProductOrder> Search(ProductOrderParam param)
        {
            var sql = Sql.Builder
                      .Where("IDProduct = @0", param.IDProduct)
                      .Where("IDOrder = @0", param.IDOrder);

            return(UseInstance.GetListOrDefault(sql));
        }
        public static List <Product> Search(SearchParam param, Pagination paging)
        {
            var sql = Sql.Builder;

            if (!Equals(param.Term, string.Empty))
            {
                sql.Where(string.Format("SearchMeta like '%{0}%'", param.Term.RemoveUnicode()));
            }
            return(UseInstance.GetListOrDefault(sql, paging));
        }
        public static List <CategoryType> Search(SearchParam param, Pagination paging)
        {
            var sql = Sql.Builder;

            if (!param.Term.IsNullOrEmpty())
            {
                sql.Where(string.Format("SearchMeta like '%{0}%'", param.Term.RemoveUnicode()));
            }
            return(UseInstance.GetListOrDefault(sql, paging));
        }
        public static OrderFile GetFirstOrDefault(OrderFileParam param)
        {
            var sql = Sql.Builder
                      .Where("IDOrder =@0", param.IDOrder);

            if (!param.Types.IsNullOrEmpty())
            {
                sql.Where("Type in (@0)", param.Types);
            }
            return(UseInstance.GetFirstByFieldOrdefault(sql));
        }
        public static List <OrderFile> Search(OrderFileParam param, Pagination paging)
        {
            var sql = Sql.Builder
                      .Where("IDOrder =@0", param.IDOrder);

            if (!param.Types.IsNullOrEmpty())
            {
                sql.Where("Type in (@0)", param.Types);
            }
            return(UseInstance.GetListOrDefault(sql, paging));
        }
Example #7
0
        public static List <Order> Search(SearchParam param, Pagination paging)
        {
            var sql = Sql.Builder;

            sql.Where("Type = @0", param.Type);
            if (!param.Term.IsNullOrEmpty())
            {
                sql.Where(string.Format("SearchMeta like '%{0}%'", param.Term.RemoveUnicode()));
            }
            if (!param.ListStatus.IsNullOrEmpty() && param.ListStatus[0] != 0)
            {
                sql.Where("Status in (@0)", param.ListStatus);
            }
            if (param.Status > 0)
            {
                sql.Where("Status = @0", param.Status);
            }
            if (!Equals(param.StartDate, null) && !Equals(param.EndDate, null))
            {
                sql.Where("((PODate >= @startDate AND PODate <= @endDate) OR (DeliveryDate >= @startDate AND DeliveryDate <= @endDate) OR (PODate <= @startDate AND DeliveryDate >= @endDate))", new
                {
                    startDate = param.StartDate,
                    endDate   = param.EndDate
                });
            }
            else if (!Equals(param.StartDate, null))
            {
                sql.Where("(@startDate <= DeliveryDate)", new
                {
                    startDate = param.StartDate
                });
            }
            else if (!Equals(param.EndDate, null))
            {
                sql.Where("(PODate <= @endDate)", new
                {
                    endDate = param.EndDate
                });
            }
            if (!Equals(param.IRVReturnDateDate, null))
            {
                sql.Where("IRVReturnDate =@0", param.IRVReturnDateDate.Value.Date);
            }
            if (!Equals(param.PayedDate, null))
            {
                sql.Where(string.Format("convert(varchar(10),PayedDate, 103) = '{0}'", Utils.DateToString(param.PayedDate, "dd/MM/yyyy")));
            }
            sql.OrderBy("PODate DESC");
            return(UseInstance.GetListOrDefault(sql, paging));
        }
 public static bool DelChildNotParent()
 {
     try
     {
         var sql = Sql.Builder
                   .Where("Parent > 0")
                   .Where(string.Format("Parent NOT IN (SELECT ID FROM {0})", UseInstance.GetTableName()));
         return(Instance.Delete <Category>(sql) > 0 ? true : false);
     }
     catch (Exception e)
     {
         var mess = e.Message;
         return(false);
     }
 }
        public static List <Category> Search(SearchParam param, Pagination paging)
        {
            var sql = Sql.Builder
                      .Where("IDCategoryType = @0", param.Type)
                      .Where("Parent = @0", param.Parent);

            if (!param.Term.IsNullOrEmpty())
            {
                sql.Where(string.Format("SearchMeta like '%{0}%'", param.Term.RemoveUnicode()));
            }
            if (Equals(paging, null))
            {
                return(UseInstance.GetListOrDefault(sql));
            }
            else
            {
                return(UseInstance.GetListOrDefault(sql, paging));
            }
        }
        public static List <AccountingDept> Search(AccountingDeptParam param, Pagination paging)
        {
            var sql = Sql.Builder;

            if (!param.Term.IsNullOrEmpty())
            {
                sql.Where(string.Format("IDOrder in (Select ID From [dbo].[Order] Where SearchMeta like '%{0}%')", param.Term.RemoveUnicode()));
            }
            if (param.OrderType > 0)
            {
                sql.Where("Type =@0", param.OrderType);
            }
            if (param.Status > 0)
            {
                sql.Where("Status = @0", param.Status);
            }
            if (!Equals(param.StartDate, null) && !Equals(param.EndDate, null))
            {
                sql.Where("(Created >= @startDate AND Created <= @endDate)", new
                {
                    startDate = param.StartDate,
                    endDate   = param.EndDate
                });
            }
            else if (!Equals(param.StartDate, null))
            {
                sql.Where("(@startDate <= Created)", new
                {
                    startDate = param.StartDate
                });
            }
            else if (!Equals(param.EndDate, null))
            {
                sql.Where("(Created <= @endDate)", new
                {
                    endDate = param.EndDate
                });
            }
            return(UseInstance.GetListOrDefault(sql, paging));
        }