Example #1
0
        public ActionResult GetAduitMonthlyCarApplyData()
        {
            try
            {
                List <string> parkingIds = new List <string>();
                if (!string.IsNullOrEmpty(Request.Params["parkingId"]))
                {
                    parkingIds.Add(Request.Params["parkingId"].ToString());
                }
                else
                {
                    List <BaseParkinfo> parings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                    parkingIds = parings.Select(p => p.PKID).ToList();
                }
                if (parkingIds.Count == 0)
                {
                    throw new MyException("获取车场编号失败");
                }

                string applyInfo = Request.Params["applyInfo"];

                DateTime startTime = DateTime.Parse(Request.Params["starttime"]);
                DateTime endTime   = DateTime.Parse(Request.Params["endtime"]);

                MonthlyCarApplyStatus?status = null;
                int intStatus = 0;
                if (!string.IsNullOrWhiteSpace(Request.Params["status"]) && int.TryParse(Request.Params["status"].ToString(), out intStatus))
                {
                    status = (MonthlyCarApplyStatus)intStatus;
                }
                int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows = 15;

                int total = 0;
                List <ParkMonthlyCarApply> models = ParkMonthlyCarApplyServices.QueryPage(parkingIds, applyInfo, status, startTime, endTime, rows, page, out total);

                var result = from p in models
                             select new
                {
                    ID             = p.ID,
                    RecordID       = p.RecordID,
                    PKID           = p.PKID,
                    CarTypeID      = p.CarTypeID,
                    CarModelID     = p.CarModelID,
                    ApplyName      = p.ApplyName,
                    ApplyMoblie    = p.ApplyMoblie,
                    PlateNo        = GetNullToEmpty(p.PlateNo),
                    PKLot          = GetNullToEmpty(p.PKLot),
                    FamilyAddress  = GetNullToEmpty(p.FamilyAddress),
                    ApplyRemark    = GetNullToEmpty(p.ApplyRemark),
                    ApplyStatus    = (int)p.ApplyStatus,
                    ApplyStatusDes = p.ApplyStatus.GetDescription(),
                    AuditRemark    = GetNullToEmpty(p.AuditRemark),
                    ApplyDateTime  = p.ApplyDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    CarTypeName    = p.CarTypeName,
                    CarModelName   = p.CarModelName,
                    PKName         = p.PKName,
                };

                return(Json(MyResult.Success("", result)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "获取月租车申请信息失败", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("获取月租车申请信息失败")));
            }
        }
Example #2
0
        public string GetAduitMonthlyCarApplyData()
        {
            StringBuilder strData = new StringBuilder();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["parkingId"]))
                {
                    return(string.Empty);
                }
                List <string> parkingIds = new List <string>();
                parkingIds.Add(Request.Params["parkingId"].ToString());

                string applyInfo = Request.Params["applyInfo"];

                DateTime startTime = DateTime.Parse(Request.Params["starttime"]);
                DateTime endTime   = DateTime.Parse(Request.Params["endtime"]);

                MonthlyCarApplyStatus?status = null;
                int intStatus = 0;
                if (!string.IsNullOrWhiteSpace(Request.Params["status"]) && int.TryParse(Request.Params["status"].ToString(), out intStatus))
                {
                    status = (MonthlyCarApplyStatus)intStatus;
                }
                int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);

                int total = 0;
                List <ParkMonthlyCarApply> models = ParkMonthlyCarApplyServices.QueryPage(parkingIds, applyInfo, status, startTime, endTime, rows, page, out total);

                var result = from p in models
                             select new
                {
                    ID             = p.ID,
                    RecordID       = p.RecordID,
                    PKID           = p.PKID,
                    CarTypeID      = p.CarTypeID,
                    CarModelID     = p.CarModelID,
                    ApplyName      = p.ApplyName,
                    ApplyMoblie    = p.ApplyMoblie,
                    PlateNo        = p.PlateNo,
                    PKLot          = p.PKLot,
                    FamilyAddress  = p.FamilyAddress,
                    ApplyRemark    = p.ApplyRemark,
                    ApplyStatus    = (int)p.ApplyStatus,
                    ApplyStatusDes = p.ApplyStatus.GetDescription(),
                    AuditRemark    = p.AuditRemark,
                    ApplyDateTime  = p.ApplyDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    CarTypeName    = p.CarTypeName,
                    CarModelName   = p.CarModelName
                };

                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(result) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "查询月租车申请信息失败");
            }

            return(strData.ToString());
        }