コード例 #1
0
        public object JTableExtend([FromBody] JTableModelExtend jTablePara)
        {
            int      intBeginFor = (jTablePara.CurrentPage - 1) * jTablePara.Length;
            int?     customerId  = jTablePara.CustomerId;
            DateTime?fromdate    = !string.IsNullOrEmpty(jTablePara.FromDate) ? DateTime.ParseExact(jTablePara.FromDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : (DateTime?)null;
            DateTime?todate      = !string.IsNullOrEmpty(jTablePara.ToDate) ? DateTime.ParseExact(jTablePara.ToDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : (DateTime?)null;
            var      query       = from a in _context.CustomerExtends
                                   where (a.isdeleted == false &&
                                          a.customer_code == customerId) &&
                                   a.isdeleted == false &&
                                   ((fromdate == null || (a.created_time >= fromdate)) && (todate == null || (a.created_time <= todate))) &&
                                   (string.IsNullOrEmpty(jTablePara.Extvalue) || a.ext_value.ToLower().Contains(jTablePara.Extvalue.ToLower()))
                                   select new
            {
                id           = a.id,
                code         = a.ext_code,
                value        = a.ext_value,
                created_time = a.created_time.Value.ToString("dd/MM/yyyy HH:mm:ss")
            };
            int count = query.Count();
            var data  = query.OrderUsingSortExpression(jTablePara.QueryOrderBy).Skip(intBeginFor).Take(jTablePara.Length).AsNoTracking().ToList();
            var jdata = JTableHelper.JObjectTable(data, jTablePara.Draw, count, "id", "code", "value", "created_time");

            return(Json(jdata));
        }
コード例 #2
0
        public object JTableExtend([FromBody] JTableModelExtend jTablePara)
        {
            int intBeginFor = (jTablePara.CurrentPage - 1) * jTablePara.Length;
            int?customerId  = jTablePara.SupplierId;

            var query = from a in _context.SupplierExtends
                        where (a.isdeleted == false &&
                               a.supplier_code == customerId)
                        select new
            {
                id    = a.id,
                code  = a.ext_code,
                value = a.ext_value
            };
            int count = query.Count();
            var data  = query.OrderUsingSortExpression(jTablePara.QueryOrderBy).Skip(intBeginFor).Take(jTablePara.Length).AsNoTracking().ToList();
            var jdata = JTableHelper.JObjectTable(data, jTablePara.Draw, count, "id", "code", "value");

            return(Json(jdata));
        }