/// <summary> /// 提交,修改 /// </summary> /// <param name="tandasEntity"></param> /// <param name="keyValue"></param> public void SubmitForm(ProfileMainWayEntity mainWayEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { mainWayEntity.Modify(keyValue); service.Update(mainWayEntity); try { //添加日志 LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改环卫主路信息【" + mainWayEntity.MainWayName + "】成功!"); } catch { } } else { mainWayEntity.Create(); service.Insert(mainWayEntity); try { //添加日志 LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建环卫主路信息【" + mainWayEntity.MainWayName + "】成功!"); } catch { } } }
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))); }
public ActionResult SubmitForm(ProfileMainWayEntity mainWayEntity, string keyValue) { mainWayApp.SubmitForm(mainWayEntity, keyValue); return(Success("操作成功。")); }