Пример #1
0
        public dynamic GetSystemLog(RequestWrapper request)
        {
            var page    = request.GetValue <int>("page", 1);
            var rows    = request.GetValue <int>("rows", 0);
            var logDate = request.GetValue("LogDate");

            var list     = new List <dynamic>();
            var basepath = HttpContext.Current.Server.MapPath("/logs/");
            var di       = new DirectoryInfo(basepath);

            if (!di.Exists)
            {
                di.Create();
            }

            string[] s  = logDate.Split('到');
            string   s1 = "1990-01-01";
            string   s2 = DateTime.Now.Date.ToString();

            switch (s.Length)
            {
            case 1:
                if (logDate.Length > 0)
                {
                    s1 = s[0];
                    s2 = s1;
                }
                break;

            case 2:
                s1 = s[0];
                s2 = s[1];
                break;
            }

            int t1 = Convert.ToInt32(Convert.ToDateTime(s1).ToString("yyyyMMdd"));
            int t2 = Convert.ToInt32(Convert.ToDateTime(s2).ToString("yyyyMMdd"));

            foreach (var fi in di.GetFiles().Where(x => (Convert.ToInt32(x.FullName.Replace(basepath, "").Substring(3, 8)) >= t1 && Convert.ToInt32(x.FullName.Replace(basepath, "").Substring(3, 8)) <= t2)))
            {
                dynamic item = new ExpandoObject();
                item.filename = fi.FullName.Replace(basepath, "");
                item.size     = (fi.Length / 1024).ToString() + " KB";
                item.time     = fi.CreationTime.ToString();
                item.id       = item.filename.Replace(".txt", "");
                list.Add(item);
            }

            var result = list.OrderByDescending(x => x.filename).Skip((page - 1) * rows).Take(rows);

            return(new { rows = result, total = list.Count() });
        }
Пример #2
0
        public override dynamic Get(RequestWrapper query)
        {
            query.SetXml(@"
<settings >
    <select>
        A.*, B.ProjectName, C.MerchantsName
    </select>
    <from>
        mms_rentOut A
        left join mms_project       B on B.ProjectCode      = A.ProjectCode
        left join mms_merchants     C on C.MerchantsCode    = A.SupplierCode
    </from>
    <where>
        <c column='BillNo'             symbol='equal'      ignore='empty'></c>
        <c column='ProjectName'        symbol='like'       ignore='empty'></c>
        <c column='C.MerchantsName'    symbol='like'       ignore='empty'></c>
        <c column='ContractCode'       symbol='like'       ignore='empty'></c>
        <c column='RentOutDate'        symbol='daterange'  ignore='empty'></c>
    </where>
    <orderby>BillNo</orderby>
</settings>");
            var pQuery = query.ToParamQuery().Where(c => c.Sql(query.GetValue <bool>("IsTotal") ? "IsTotal=1" : "isnull(IsTotal,0)<>1"));
            var result = masterService.GetDynamicListWithPaging(pQuery);

            return(result);
        }
Пример #3
0
        public override dynamic Get(RequestWrapper query)
        {
            query.SetXml(@"
<settings>
    <select>
        A.*, B.ProjectName, C.MaterialTypeName, D.WarehouseName
    </select>
    <from>
        mms_check A
        left join mms_project       B on B.ProjectCode      = A.ProjectCode
        left join mms_materialType  C on C.MaterialType = A.MaterialType
        left join mms_warehouse         D on D.WarehouseCode       = A.WarehouseCode
    </from>
    <where>
        <c column='BillNo'             symbol='equal'     ignore='empty'   ></c>
        <c column='ProjectName'        symbol='like'      ignore='empty'   ></c>
        <c column='DoPerson'           symbol='like'      ignore='empty'   ></c>
        <c column='A.WarehouseCode'    symbol='equal'     ignore='empty' values='{WarehouseCode}'></c>
        <c column='A.MaterialType'     symbol='equal'     ignore='empty'  ></c>
        <c column='CheckDate'          symbol='daterange' ignore='empty'  ></c>
    </where>
    <orderby>BillNo</orderby>
</settings>");
            //if(query["IsShowDiff"] == "true")
            //    var a =0;

            //var pQuery = query.ToParamQuery().Where("IsShowDiff", query["IsShowDiff"],
            //    x => "true".Equals(x.Value) ? "isnull(A.BookMoney,0)<>isnull(A.OperateMoney,0)" : "1=1").AndWhere("A.ProjectCode", MmsHelper.GetCurrentProject());
            //.AndWhere("CheckDate", query["CheckDate"], x => x == null ? "1=1" : string.Format("CheckDate", x.Value));
            var pQuery = query.ToParamQuery()
                         .Where(c => c.Sql("isnull(A.BookMoney,0)<>isnull(A.OperateMoney,0)").Ignore(x => query.GetValue("IsShowDiff").Equals("true")))
                         .Where("A.ProjectCode", MmsHelper.GetCurrentProject());
            var result = masterService.GetDynamicListWithPaging(pQuery);

            return(result);
        }