Exemple #1
0
        private DrivObj FormatData(DataTable dt)
        {
            DrivObj obj = new DrivObj();

            try
            {
                DataTable dr = analyzeTable(dt);
                obj.Details    = dr;
                obj.Statistics = tongji(dr);
                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="inparams"></param>
        /// <returns></returns>
        public ResponseResult getData(Dictionary <string, string> inparams)
        {
            ResponseResult Result = null;

            string sysflag;
            string cid;
            string st;
            string et;

            if (!inparams.Keys.Contains("sysflag") || !inparams.Keys.Contains("cid") ||
                !inparams.Keys.Contains("st") || !inparams.Keys.Contains("et")
                )
            {
                Result = new ResponseResult(ResState.ParamsImperfect, "缺少参数", null);
                return(Result);
            }
            try
            {
                if (inparams["sysflag"] == "")
                {
                    Result = new ResponseResult(ResState.ParamsImperfect, "系统标识错误", null);
                    return(Result);
                }
                if (inparams["cid"] == "")
                {
                    Result = new ResponseResult(ResState.ParamsImperfect, "请选择车辆", null);
                    return(Result);
                }
                if (inparams["st"] == "")
                {
                    Result = new ResponseResult(ResState.ParamsImperfect, "开始时间不能为空", null);
                    return(Result);
                }
                if (inparams["et"] == "")
                {
                    Result = new ResponseResult(ResState.ParamsImperfect, "结束时间不能为空", null);
                    return(Result);
                }
                sysflag = inparams["sysflag"];
                SysFlag = sysflag;
                cid     = inparams["cid"];

                st = inparams["st"];
                et = inparams["et"];


                //调用存储过程查询车辆数据
                DataTable dt = GetTracksFromDB(sysflag, cid, st, et);

                DrivObj DObj = FormatData(dt);



                int     Total = DObj.Details.Rows.Count;
                ResList res   = new ResList();
                res.page    = 0;
                res.size    = 0;
                res.total   = Total;
                res.records = DObj;



                Result = new ResponseResult(ResState.Success, "", res);
            }
            catch (Exception ex)
            {
                Result = new ResponseResult(ResState.OperationFailed, ex.Message, "");
            }
            return(Result);
        }