private void GetVillageTreeData(string companyId, List <BaseParkinfo> parkings, StringBuilder strParkingTree) { List <BaseVillage> villages = GetLoginUserVillages.Where(p => p.CPID == companyId).ToList(); if (villages.Count == 0) { return; } strParkingTree.Append(",\"children\":["); int i = 1; foreach (var item in villages) { strParkingTree.Append("{"); strParkingTree.AppendFormat("\"id\":\"{0}\"", item.VID); strParkingTree.AppendFormat(",\"text\":\"{0}\"", item.VName); strParkingTree.Append(",\"iconCls\":\"my-village-icon\""); strParkingTree.Append(",\"attributes\":{\"type\":1}"); GetParkingTreeData(companyId, item.VID, parkings, strParkingTree); strParkingTree.Append("}"); if (i != villages.Count()) { strParkingTree.Append(","); } i++; } strParkingTree.Append("]"); }
/// <summary> /// 获取小区信息 /// </summary> /// <param name="Companyid"></param> /// <returns></returns> public string GetVillageData() { StringBuilder sb = new StringBuilder(); try { int pageIndex = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]); int pageSize = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]); string sort = Request.Params["sort"]; if (string.IsNullOrWhiteSpace(Request.Params["companyId"])) { return(string.Empty); } if (GetLoginUserVillages.Count == 0) { return(string.Empty); } string companyId = Request.Params["companyId"]; int totalRecord = 0; List <BaseVillage> list = VillageServices.QueryPage(GetLoginUserVillages.Select(p => p.VID).ToList(), companyId, pageIndex, pageSize, out totalRecord); sb.Append("{"); sb.Append("\"total\":" + totalRecord + ","); sb.Append("\"rows\":" + JsonHelper.GetJsonString(list) + ","); sb.Append("\"index\":" + pageIndex); sb.Append("}"); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "获取小区信息失败"); } return(sb.ToString()); }
/// <summary> /// 查询车场收入数据 /// </summary> /// <returns></returns> public JsonResult Get_HomeData() { JsonResult json = new JsonResult(); json.Data = StatisticsServices.GetHomeData(GetLoginUserVillages.Select(p => p.VID).ToList()); return(json); }
public string GetSellerTreeData() { try { StringBuilder strTree = new StringBuilder(); if (GetLoginUserVillages.Count == 0) { return(strTree.ToString()); } List <ParkSeller> sellers = ParkSellerServices.QueryByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); BaseCompany currCompany = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == GetCurrentUserCompanyId); if (currCompany == null) { return(string.Empty); } strTree.Append("[{\"id\":\"" + currCompany.CPID + "\","); strTree.Append("\"iconCls\":\"my-company-icon\","); strTree.Append("\"attributes\":{\"type\":0},"); strTree.Append("\"text\":\"" + currCompany.CPName + "\""); GetVillageTree(sellers, currCompany.CPID, strTree); strTree.Append("}]"); return(strTree.ToString()); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "构建商家树结构失败"); return(string.Empty); } }
public ActionResult Index() { List <BaseParkinfo> parings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); ViewBag.StartTime = DateTime.Now.AddDays(-7).Date.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"); ViewBag.EndTime = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"); return(View(parings)); }
/// <summary> /// 获得所有车场 /// </summary> /// <returns></returns> public JsonResult GetSellers() { JsonResult json = new JsonResult(); try { json.Data = ParkSellerServices.QueryByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); } catch { } return(json); }
private void CreateSubordinateVillageTreeDataOnlineStatus(List <BaseCompany> companys, string masterId, StringBuilder str) { List <BaseVillage> villages = GetLoginUserVillages.Where(p => p.CPID == masterId).ToList(); List <BaseCompany> subCompanys = companys.Where(p => p.MasterID == masterId).ToList(); str.Append(",\"children\":["); int i = 1; foreach (var item in subCompanys) { str.Append("{"); str.AppendFormat("\"id\":\"{0}\"", item.CPID); str.Append(",\"iconCls\":\"my-company-icon\""); str.AppendFormat(",\"text\":\"{0}\"", item.CPName); str.Append(",\"attributes\":{\"type\":0}"); CreateSubordinateVillageTreeDataOnlineStatus(companys, item.CPID, str); str.Append("}"); if (i != subCompanys.Count()) { str.Append(","); } i++; } if (subCompanys.Count > 0 && villages.Count > 0) { str.Append(","); } int index = 1; foreach (var item in villages) { str.Append("{"); str.AppendFormat("\"id\":\"{0}\"", item.VID); if (item.IsOnLine == 1) { str.Append(",\"iconCls\":\"icon-status-yes\""); } else { str.Append(",\"iconCls\":\"icon-status-no\""); } str.AppendFormat(",\"text\":\"{0}\"", item.VName); str.Append(",\"attributes\":{\"type\":1,\"CompanyID\":\"" + item.CPID + "\"}"); str.Append("}"); if (index != villages.Count()) { str.Append(","); } index++; } str.Append("]"); }
private void GetVillageTree(List <ParkSeller> sellers, string companyId, StringBuilder strTree) { List <BaseVillage> villages = GetLoginUserVillages.Where(p => p.CPID == companyId).ToList(); List <BaseCompany> companys = GetLoginUserRoleCompany.Where(p => p.MasterID == companyId).ToList(); if (villages.Count == 0 && companys.Count == 0) { return; } strTree.Append(",\"children\":["); int i = 1; foreach (var item in companys) { strTree.Append("{"); strTree.AppendFormat("\"id\":\"{0}\"", item.CPID); strTree.Append(",\"iconCls\":\"my-company-icon\""); strTree.AppendFormat(",\"text\":\"{0}\"", item.CPName); strTree.Append(",\"attributes\":{\"type\":0}"); GetVillageTree(sellers, item.CPID, strTree); strTree.Append("}"); if (i != companys.Count()) { strTree.Append(","); } i++; } if (companys.Count > 0 && villages.Count > 0) { strTree.Append(","); } int index = 1; foreach (var item in villages) { strTree.Append("{"); strTree.AppendFormat("\"id\":\"{0}\"", item.VID); strTree.Append(",\"iconCls\":\"my-village-icon\""); strTree.AppendFormat(",\"text\":\"{0}\"", item.VName); strTree.Append(",\"attributes\":{\"type\":0,\"CompanyID\":\"" + item.CPID + "\"}"); GetParkSellerTree(item.VID, sellers, strTree); strTree.Append("}"); if (index != villages.Count()) { strTree.Append(","); } index++; } strTree.Append("]"); }
public string CreateSelectVillageTreeData(bool needShowDefault = false, string defaultText = "不限") { StringBuilder str = new StringBuilder(); try { str.Append("["); if (needShowDefault) { str.Append("{\"id\":\"\","); str.Append("\"attributes\":{\"type\":1},"); str.Append("\"text\":\"" + defaultText + "\""); str.Append("}"); if (GetLoginUserVillages.Count > 0) { str.Append(","); } } int index = 1; foreach (var item in GetLoginUserVillages) { BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID); if (company == null) { index++; continue; } str.Append("{\"id\":\"" + item.VID + "\","); str.Append("\"attributes\":{\"type\":1},"); str.Append("\"iconCls\":\"my-village-icon\","); str.AppendFormat("\"text\":\"{0}\"", string.Format("{0}【{1}】", item.VName, company.CPName)); str.Append("}"); if (index != GetLoginUserVillages.Count()) { str.Append(","); } index++; } str.Append("]"); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "构建小区下拉结构树失败"); } return(str.ToString()); }
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("获取月租车申请信息失败"))); } }
public string GetParkingTreeData() { try { StringBuilder strParkingTree = new StringBuilder(); if (GetLoginUserVillages.Count == 0) { return(strParkingTree.ToString()); } List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); strParkingTree.Append("["); int index = 1; foreach (var obj in GetLoginUserRoleCompany) { //List<BaseVillage> childVillages = GetLoginUserVillages.Where(p => p.CPID == obj.CPID).ToList(); //if (childVillages.Count == 0) continue; //List<BaseParkinfo> childParkings = parkings.Where(p => childVillages.Select(o => o.VID).Contains(p.VID)).ToList(); //if (childParkings.Count == 0) continue; //if (index != 1) //{ // strParkingTree.Append(","); //} if (index != 1) { strParkingTree.Append(","); } strParkingTree.Append("{\"id\":\"" + obj.CPID + "\","); strParkingTree.Append("\"iconCls\":\"my-company-icon\","); strParkingTree.Append("\"attributes\":{\"type\":0},"); strParkingTree.Append("\"text\":\"" + obj.CPName + "\""); GetVillageTreeData(obj.CPID, parkings, strParkingTree); strParkingTree.Append("}"); index++; } strParkingTree.Append("]"); return(strParkingTree.ToString()); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "构建车场树异常"); return(string.Empty); } }
public string GetOnlyParkingTreeData() { try { StringBuilder strParkingTree = new StringBuilder(); if (GetLoginUserVillages.Count == 0) { return(strParkingTree.ToString()); } List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); strParkingTree.Append("["); int index = 1; foreach (var item in parkings) { strParkingTree.Append("{"); strParkingTree.AppendFormat("\"id\":\"{0}\"", item.PKID); strParkingTree.Append(",\"iconCls\":\"my-parking-icon\""); strParkingTree.AppendFormat(",\"text\":\"{0}\"", item.PKName); strParkingTree.Append(",\"attributes\":{\"type\":1}"); strParkingTree.Append("}"); if (index != parkings.Count()) { strParkingTree.Append(","); } index++; } strParkingTree.Append("]"); return(strParkingTree.ToString()); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "构建车场树异常"); return(string.Empty); } }
public string GetPrakAreaTreeData() { try { StringBuilder strAreaTree = new StringBuilder(); List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); if (parkings.Count == 0) { return(string.Empty); } List <ParkArea> parkAreas = ParkAreaServices.GetParkAreaByParkingIds(parkings.Select(p => p.PKID).ToList()); strAreaTree.Append("["); int index = 1; foreach (var item in GetLoginUserVillages) { BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID); if (company == null) { continue; } string text = string.Format("{0}【{1}】", item.VName, company.CPName); strAreaTree.Append("{\"id\":\"" + item.VID + "\","); strAreaTree.Append("\"iconCls\":\"my-village-icon\","); strAreaTree.Append("\"attributes\":{\"type\":0},"); strAreaTree.Append("\"text\":\"" + text + "\""); GetParkingTreeData(parkings, parkAreas, item.VID, strAreaTree); strAreaTree.Append("}"); if (index != GetLoginUserVillages.Count) { strAreaTree.Append(","); } index++; } strAreaTree.Append("]"); return(strAreaTree.ToString()); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "构建车场区域树失败"); return(string.Empty); } }
public JsonResult QueryRemotelyOpenGateData() { try { List <string> parkingIds = new List <string>(); if (!string.IsNullOrWhiteSpace(Request.Params["parkingId"])) { parkingIds.Add(Request.Params["parkingId"]); } else { List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); if (parkings.Count > 0) { parkingIds.AddRange(parkings.Select(p => p.PKID)); } } string areaId = Request.Params["areaId"]; string boxId = Request.Params["boxId"]; int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]); int rows = 15; int recordTotalCount = 0; List <RemotelyOpenGateView> models = ParkGateServices.QueryRemotelyOpenGate(parkingIds, areaId, boxId, page, rows, out recordTotalCount); return(Json(MyResult.Success("", models))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "微信获取远程开闸数据失败"); return(Json(MyResult.Error("获取失败"))); } }