public ActionResult Add(string projectJson, string developersCompany, string managerCompany, UserCenter_LoginUserInfo loginUserInfo) { AjaxResult result = new AjaxResult("新增任务成功!!!"); Project project = JsonHelp.ParseJSONjss <Project>(projectJson); //检查是否已存在任务 Project exists = _unitOfWork.AllotFlowService.ExistsAllot(project); if (exists == null) { var ret = _unitOfWork.AllotFlowService.AddAllot(project, developersCompany, managerCompany, " 从调度中心 <span class=\"red\">创建任务</span>", loginUserInfo.NowCityId, loginUserInfo.FxtCompanyId, loginUserInfo.UserName, loginUserInfo.TrueName, SYSCodeManager.STATECODE_1); if (ret.AllotState == 0) { result.Result = false; result.Message = "新增任务失败。"; } } else { result.Result = false; result.Message = "任务重复"; } return(AjaxJson(result)); }
public static PlaceResponse SearchPOI(PlaceRequest request) { StringBuilder sb = new StringBuilder(_serviceUrl); sb.Append("?ak=" + request.ak); sb.Append("&query=" + HttpUtility.UrlEncode(request.query)); int a = (int)request.scope; sb.Append("&scope=" + a.ToString()); sb.Append("&output=" + request.output.ToString()); sb.Append("®ion=" + HttpUtility.UrlEncode(request.region)); if (!string.IsNullOrEmpty(request.tag)) { sb.Append("&tag=" + request.tag); } if (!string.IsNullOrEmpty(request.filter)) { sb.Append("&filter=" + request.filter); } if (request.page_size > 0) { sb.Append("&page_size=" + request.page_size.ToString()); } if (request.page_num > 0) { sb.Append("&page_num=" + request.page_num.ToString()); } if (!string.IsNullOrEmpty(request.sn)) { sb.Append("&sn=" + request.sn); sb.Append("×tamp=" + request.timestamp); } if (!string.IsNullOrEmpty(request.location)) { sb.Append("&location=" + request.location); } if (request.radius > 0) { sb.Append("&radius=" + request.radius.ToString()); } var result = ""; using (WebClient client = new WebClient()) { client.Headers.Add("Content-Type", "application/json"); //这里url要组装安全标记等参数 byte[] responseData = client.UploadData(sb.ToString(), "POST", new byte[0]); result = Encoding.UTF8.GetString(responseData); } PlaceResponse re = JsonHelp.ParseJSONjss <PlaceResponse>(result); return(re); }
/// <summary> /// 根据楼盘ID获取楼栋、房号数量 /// </summary> /// <param name="cityId"></param> /// <param name="projectid"></param> /// <param name="username"></param> /// <param name="signname"></param> /// <param name="appList"></param> /// <returns></returns> public static DatProjectTotal GetProjectBuildingHouseTotal(int cityId, int projectid, string username, string signname, List <UserCenter_Apps> appList) { var para = new { cityid = cityId, projectid = projectid }; DataCenterResult result = Common.PostDataCenter(username, signname, Common.buildinghousetotal, para, appList); DatProjectTotal entity = null; if (!string.IsNullOrEmpty(result.data)) { entity = JsonHelp.ParseJSONjss <DatProjectTotal>(result.data); } return(entity); }
public static GeocodingResponse Search(GeocodingRequest request) { StringBuilder sb = new StringBuilder(_serviceUrl); sb.Append("?ak=LfyRpG6vY5V0ZnGX0oh0MfqA"); sb.Append("&output=" + request.output.ToString()); sb.Append("&location=" + request.location); sb.Append("&pois=" + request.pois); var result = ""; using (WebClient client = new WebClient()) { client.Headers.Add("Content-Type", "application/json"); //这里url要组装安全标记等参数 byte[] responseData = client.UploadData(sb.ToString(), "POST", new byte[0]); result = Encoding.UTF8.GetString(responseData); } GeocodingResponse re = JsonHelp.ParseJSONjss <GeocodingResponse>(result); return(re); }
/// <summary> /// 调出 /// </summary> /// <param name="projects"></param> /// <returns></returns> public static bool Call(List <CAS.Entity.DBEntity.DATProject> projects) { DataBase db = new DataBase(); using (ITransaction tran = db.DB.BeginTransaction()) { try { foreach (var item in projects) { string json = item.ToJSONjss(); DATProject project = JsonHelp.ParseJSONjss <DATProject>(json); project.Status = SYSCodeManager.STATECODE_1; project.FxtProjectId = item.projectid; //db.DB.Create(project, tran); //string buildingJson = item.buildinglist.ToJson(); //List<DATBuilding> buildings = JsonHelp.ParseJSONList<DATBuilding>(buildingJson); ////db.DB.Create<DATBuilding>(buildings, tran); //foreach (var buildingItem in item.buildinglist) //{ // //buildingItem.houselist.GroupBy(m=>m.) // string houseJson = buildingItem.houselist.ToJson(); // List<DATHouse> houses = JsonHelp.ParseJSONList<DATHouse>(houseJson); // //db.DB.Create<DATHouse>(houses, tran); //} } tran.Commit(); } catch (Exception ex) { log.Error(ex.Message, ex); return(false); } } db.Close(); return(true); }
public static NearResponse Search(NearRequest requst) { StringBuilder sb = new StringBuilder(_serviceUrl + "?"); sb.Append("keyWord=" + HttpUtility.HtmlEncode(requst.keyWord)); sb.Append("&location=" + requst.location.lng + "," + requst.location.lat); sb.Append("&radius=" + requst.radius + "m"); sb.Append("&sort_rule=" + requst.sort_rule); sb.Append("&number=" + requst.number); sb.Append("&page=" + requst.page); sb.Append("&sort_rule=" + requst.sort_rule); sb.Append("&output=" + requst.output.ToString()); sb.Append("&coord_type=" + requst.coord_type.ToString()); sb.Append("&out_coord_type=" + requst.out_coord_type.ToString()); if (requst.tag != TagType.全部) { sb.Append("&tag=" + HttpUtility.HtmlEncode(requst.tag.ToString())); } if (!string.IsNullOrEmpty(requst.cityName)) { sb.Append("&cityName=" + requst.cityName); } HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(sb.ToString()); request.Method = "GET"; // 添加header request.Headers.Add("apikey", requst.apikey); HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); Stream s = response.GetResponseStream(); StreamReader Reader = new StreamReader(s, Encoding.UTF8); string value = Reader.ReadToEnd(); NearResponse res = JsonHelp.ParseJSONjss <NearResponse>(value); Reader.Dispose(); return(res); }
public static FxtApi_DATProjectView ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_DATProjectView>(json)); }
public static FxtApi_PriviCompanyShowData ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_PriviCompanyShowData>(json)); }
public static FxtApi_ProjectJoinPurposeTypeJoinVillaCaseCount ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_ProjectJoinPurposeTypeJoinVillaCaseCount>(json)); }
public static FxtApi_SYSCode ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_SYSCode>(json)); }
public static FxtApi_Result ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_Result>(json)); }
public static FxtApi_ProjectJoinBuildingTypeJoinAreaTypeJoinPublicCaseCount ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_ProjectJoinBuildingTypeJoinAreaTypeJoinPublicCaseCount>(json)); }
public static FxtApi_SYSProjectMatch ConvertToObj(string json) { return(JsonHelp.ParseJSONjss <FxtApi_SYSProjectMatch>(json)); }