public ActionResult Import(HttpPostedFileBase file) { ViewBag.FileFormat = "Solution_1_Name,Id,SolutionId,Name,Description,BuildStartTime"; if (file != null && file.ContentLength > 0 && !string.IsNullOrWhiteSpace(file.FileName)) { log.Info(string.Format("{0}: Import", Framework.LoggingOptions.UI_Process_Started.ToString())); Framework.DataStreamServiceResult dataStreamServiceResult = new Framework.DataStreamServiceResult(file.FileName, file.ContentType, file.ContentLength, file.InputStream); dataStreamServiceResult.TempFilePath = Framework.Web.WebFormApplicationApplicationVariables.FileStorageRootFolder; MSBuildLogsExtended.CommonBLL.BuildDataStreamService.Default dataStreamServiceProvider = new MSBuildLogsExtended.CommonBLL.BuildDataStreamService.Default(); MSBuildLogsExtended.DataSourceEntities.Build.DefaultCollection collection = dataStreamServiceProvider.GetCollectionFromStream(dataStreamServiceResult); if (collection != null) { MSBuildLogsExtended.DataSourceEntities.BuildCollection resultCollection = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); MSBuildLogsExtended.EntityContracts.IBuildHelper.CopyCollection <MSBuildLogsExtended.DataSourceEntities.Build.DefaultCollection, MSBuildLogsExtended.DataSourceEntities.BuildCollection, MSBuildLogsExtended.DataSourceEntities.Build.Default, MSBuildLogsExtended.DataSourceEntities.Build>(collection, resultCollection); var result = MSBuildLogsExtended.CommonBLLIoC.IoCBuild.BatchInsert(resultCollection); ViewBag.Message = Framework.Resources.UIStringResource.Data_Import_Success; } else { ViewBag.Message = Framework.Resources.UIStringResource.Data_Import_NoRecordInSourceFile; } log.Info(string.Format("{0}: Import", Framework.LoggingOptions.UI_Process_Ended.ToString())); return(View()); } else { ViewBag.Message = ""; return(View()); } }
public void LoadData( bool isToLoadFK_Build_Solution = true ) { // 1. master on accessory part - Aside UIWorkspaceItemSetting var masterEntityResult = MSBuildLogsExtended.CommonBLLIoC.IoCSolution.GetMessageOfEntityOfByIdentifier(this.CriteriaOfMasterEntity, this.QueryPagingSettingOneRecord, null); this.StatusOfMasterEntity = masterEntityResult.BusinessLogicLayerResponseStatus; if (masterEntityResult.BusinessLogicLayerResponseStatus == Framework.CommonBLLEntities.BusinessLogicLayerResponseStatus.MessageOK) { this.MasterEntity = masterEntityResult.Message[0]; // 2. accessory part - Aside UIWorkspaceItemSetting // 3. Major part - Article UIWorkspaceItemSetting - EntityReference/FK downtree // FK_Build_Solution if (isToLoadFK_Build_Solution) { this.CriteriaOfFK_Build_Solution.BuildQueryCriteriaByFKOnly.IdByFKOnlyOfSolution_1.IsToCompare = true; this.CriteriaOfFK_Build_Solution.BuildQueryCriteriaByFKOnly.IdByFKOnlyOfSolution_1.ValueToCompare = this.MasterEntity.Id; var resultFK_Build_Solution = MSBuildLogsExtended.CommonBLLIoC.IoCBuild.GetMessageOfDefaultOfByFKOnly(this.CriteriaOfFK_Build_Solution, this.QueryPagingSetting, null); this.StatusOfFK_Build_Solution = resultFK_Build_Solution.BusinessLogicLayerResponseStatus; if (resultFK_Build_Solution.BusinessLogicLayerResponseStatus == Framework.CommonBLLEntities.BusinessLogicLayerResponseStatus.MessageOK) { this.FK_Build_Solution = resultFK_Build_Solution.Message; } else { this.StatusMessageOfFK_Build_Solution = resultFK_Build_Solution.GetStatusMessage(); #if DEBUG this.StatusMessageOfFK_Build_Solution = string.Format("{0} {1}", this.StatusMessageOfFK_Build_Solution, resultFK_Build_Solution.ServerErrorMessage); #endif } } // 4. Major part - Article UIWorkspaceItemSetting - EntityReference/FK CrossJoin } else { this.StatusMessageOfMasterEntity = masterEntityResult.GetStatusMessage(); #if DEBUG this.StatusMessageOfMasterEntity = string.Format("{0} {1}", this.StatusMessageOfMasterEntity, masterEntityResult.ServerErrorMessage); #endif } }