public ActionResult GetFormJson(string keyValue) { var data = StreetApp.GetForm(keyValue); if (data.F_LastModifyUserId != null) { var data1 = StreetApp.GetForm(data.F_LastModifyUserId); if (data1 != null) { data.F_LastModifyUserId = data1.StreetName; } } if (data.F_CreatorUserId != null) { var data2 = StreetApp.GetForm(data.F_CreatorUserId); if (data2 != null) { data.F_CreatorUserId = data2.StreetName; } } return(Content(data.ToJson())); }
public ActionResult SummitImport(string CityId, string CountyId, string projectId, int isRename = 1) { projectId = "dd1bbf6b-bcea-4cad-851b-1be4adf71860"; string path = @"C:\Users\zps\Desktop\聚力环境测评系统样版\聚力环境测评系统样版\附件6、虹口市容点位\"; string fileName = "Book1.xlsx"; #region 导出 if (FileHelper.IsExistFile(Path.Combine(path, fileName))) { using (ExcelHelper exHelp = new ExcelHelper(Path.Combine(path, fileName))) { var datatable = exHelp.ExcelToDataTable(fileName, true); //ProfileAmenitiesConstructionSiteEntiy ProfileAmenitiesConstructionSiteEntity[] models = new ProfileAmenitiesConstructionSiteEntity[datatable.Rows.Count]; ProfileAmenitiesConstructionSiteEntity model; for (int i = 0; i < datatable.Rows.Count; i++) { try { var jdName = datatable.Rows[i]["街道"].ToString(); var fCode = datatable.Rows[i]["序号"].ToString(); var address = datatable.Rows[i]["地址"].ToString(); var name = datatable.Rows[i]["工地名称"].ToString(); var StreetNamekey = StreetApp.GetDictionary(d => d.StreetName == jdName)[0].Key; var streetModel = StreetApp.GetForm(StreetNamekey); model = new ProfileAmenitiesConstructionSiteEntity() { CityId = streetModel.CityId, CountyId = streetModel.CountyId, StreetId = streetModel.F_Id, Address = address, F_EnCode = fCode, SiteName = name, ProjectId = projectId }; models[i] = model; } catch { } } var thapp = new ProfileAmenitiesConstructionSiteApp(); foreach (var item in models) { try { if (item == null) { continue; } thapp.SubmitForm(item, string.Empty); } catch { } } } } #endregion return(Success("ss")); }
public ActionResult SummitImport(string CityId, string CountyId, int isRename = 1) { var file = Request.Files[0]; string path = @"D:\项目\卫星设备台账流程管理\NFine.Web\bin\TemporaryFilesDiskPath\"; string fileName = file.FileName; ImportResultModel result = new ImportResultModel(); int failureQuantity, successfulQuantity; try { file.SaveAs(Path.Combine(path, fileName)); #region 导出 if (FileHelper.IsExistFile(Path.Combine(path, fileName))) { FileHelper.DeleteFile(Path.Combine(path, fileName)); using (ExcelHelper exHelp = new ExcelHelper(Path.Combine(path, fileName))) { var datatable = exHelp.ExcelToDataTable(fileName, true); ProfileMainWayEntity[] models = new ProfileMainWayEntity[datatable.Rows.Count]; ProfileMainWayEntity model; for (int i = 0; i < datatable.Rows.Count; i++) { var mainWayName = datatable.Rows[i]["主路名"].ToString(); var jdName = datatable.Rows[i]["街道"].ToString(); var fCode = datatable.Rows[i]["序号"].ToString(); var StreetNamekey = StreetApp.GetDictionary(d => d.StreetName == jdName)[0].Key; var streetModel = StreetApp.GetForm(StreetNamekey); model = new ProfileMainWayEntity() { CityId = streetModel.CityId, CountyId = streetModel.CountyId, StreetId = streetModel.F_Id, MainWayName = mainWayName, F_EnCode = fCode }; models[i] = model; } mainWayApp.ImportData(models, out successfulQuantity, out failureQuantity); result.IsSucceed = true; result.FailureQuantity = failureQuantity; result.SuccessfulQuantity = successfulQuantity; result.TotalQuantity = models.Length; } } #endregion } catch (Exception ex) { result.IsSucceed = false; result.ErrorMessage = ex.ToString(); } finally { } return(Success(string.Format("总条数:{0},成功条数:{1},失败条数:{2}", result.TotalQuantity, result.FailureQuantity, result.ErrorMessage))); }