namespace BLL { using Model; using Newtonsoft.Json; //using System.Net.Http.Headers; //using System.Net.Http; using System; using System.Linq; public static class CNCECHSSEWebService { #region 项目推送 /// /// 推送项目到集团 /// /// public static string PushProject() { string code = "0"; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { try { //查询所有在建项目 var upReport = (from x in db.Base_Project where (x.ProjectState == "1" || x.ProjectState == null) select new Model.BaseProjectItem { ProjectId = x.ProjectId, MasterSysId = x.MasterSysId, UnitId = BLL.Const.UnitId_SEDIN, ProjectCode = x.ProjectCode, ProjectName = x.ProjectName, StartDate = x.StartDate, EndDate = x.EndDate, ProjectAddress = x.ProjectAddress, ShortName = x.ShortName, ProjectType = x.ProjectType, PostCode = x.PostCode, Remark = x.Remark, ProjectState = x.ProjectState, ContractNo = x.ContractNo, WorkRange = x.WorkRange, Duration = x.Duration, IsUpTotalMonth = x.IsUpTotalMonth, ProjectMainPerson = x.ProjectMainPerson, ProjectLiaisonPerson = x.ProjectLiaisonPerson, IsForeign = x.IsForeign, FromProjectId = x.FromProjectId, MapCoordinates = x.MapCoordinates, ProjectMoney = x.ProjectMoney, ConstructionMoney = x.ConstructionMoney, Country = x.Country, Province = x.Province, City = x.City, Telephone = x.Telephone, EnglishRemark = x.EnglishRemark, IsFace = false, ProjectState2 = "", Progress = 0, MonitorPW = "", MonitorId = "", ProjectAttribute = "", SourceUnitId = BLL.Const.UnitId_SEDIN, } ); code = PushApiProject(upReport).ToString(); if (code == "1") { } } catch (Exception ex) { ErrLogInfo.WriteLog("【在建项目】上传到服务器", ex); } return code; } } /// /// 推送项目 /// /// /// private static int PushApiProject(IQueryable upReport) { string baseurl = "/api/InspectionBrigade/SaveBaseProjectData"; var resultJsonReport = JsonConvert.SerializeObject(upReport); resultJsonReport = "{\"BaseProjectItems\":" + resultJsonReport.Replace("}{", ",") + "}"; var responeData = BLL.ServerService.PushCNCEC(resultJsonReport, baseurl); return responeData.code; } #endregion #region 督查人员推送 public static int PushInspectionBrigadeUser() { string baseurl = "/api/InspectionBrigade/SaveInspectionBrigadeUser"; var CollCropCode = BLL.CommonService.GetIsThisUnit()?.CollCropCode; var userList = from x in Funs.DB.Person_Persons where x.IsInspectionBrigade == true select new Model.InspectionBrigadeUserItem() { UserId = x.PersonId, UserName = x.PersonName, Sex = x.Sex, Account = x.Account, Password = x.Password, IdentityCard = x.IdentityCard, Telephone = x.Telephone, CollCropCode = CollCropCode }; var resultJsonReport = JsonConvert.SerializeObject(userList.ToList()); resultJsonReport = "{\"InspectionBrigadeUserItems\":" + resultJsonReport.Replace("}{", ",") + "}"; var responeData = BLL.ServerService.PushCNCEC(resultJsonReport, baseurl); return responeData.code; } #endregion } }