Example #1
0
        public ActionResult Import(HttpPostedFileBase file)
        {
            ViewBag.FileFormat = "Build_1_Name,Id,Solution_1Id,Solution_1_Name,Organization_1_UniqueidentifierColumn,Organization_1_UniqueIdentifier,Organization_1Id,Organization_1_Name,Organization_2_UniqueidentifierColumn,Organization_2Id,Organization_2_UniqueIdentifier,Organization_2_Name,BuildEventCode_1_Name,BuildId,BuildEventCodeId,Message,EventTime";
            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;
                MSBuildExtensionPack.CommonBLL.BuildLogDataStreamService.Default   dataStreamServiceProvider = new MSBuildExtensionPack.CommonBLL.BuildLogDataStreamService.Default();
                MSBuildExtensionPack.DataSourceEntities.BuildLog.DefaultCollection collection = dataStreamServiceProvider.GetCollectionFromStream(dataStreamServiceResult);

                if (collection != null)
                {
                    MSBuildExtensionPack.DataSourceEntities.BuildLogCollection resultCollection = new MSBuildExtensionPack.DataSourceEntities.BuildLogCollection();
                    MSBuildExtensionPack.EntityContracts.IBuildLogHelper.CopyCollection <MSBuildExtensionPack.DataSourceEntities.BuildLog.DefaultCollection, MSBuildExtensionPack.DataSourceEntities.BuildLogCollection, MSBuildExtensionPack.DataSourceEntities.BuildLog.Default, MSBuildExtensionPack.DataSourceEntities.BuildLog>(collection, resultCollection);
                    var result = MSBuildExtensionPack.CommonBLLIoC.IoCBuildLog.BatchInsert(resultCollection);
                    ViewBag.Message = Framework.Resx.UIStringResource.Data_Import_Success;
                }
                else
                {
                    ViewBag.Message = Framework.Resx.UIStringResource.Data_Import_NoRecordInSourceFile;
                }

                log.Info(string.Format("{0}: Import", Framework.LoggingOptions.UI_Process_Ended.ToString()));

                return(View());
            }
            else
            {
                ViewBag.Message = "";
                return(View());
            }
        }
Example #2
0
 /// <summary>
 /// Validates the value before save to database.
 /// </summary>
 /// <param name="input">The input.</param>
 public static void ValidateValueBeforeSaveToDatabase(MSBuildExtensionPack.DataSourceEntities.BuildLogCollection input)
 {
     for (int i = 0; i < input.Count; i++)
     {
         MSBuildExtensionPack.DataSourceEntities.BuildLog _Item = input[i];
         ValidateValueBeforeSaveToDatabase(_Item);
     }
 }
Example #3
0
 /// <summary>
 /// Assigns the enity reference Ids.
 /// </summary>
 /// <param name="input">The input.</param>
 public static void AssignEnityReferenceIDs(MSBuildExtensionPack.DataSourceEntities.BuildLogCollection input, System.Int64 buildId, System.Int32 buildEventCodeId)
 {
     for (int i = 0; i < input.Count; i++)
     {
         MSBuildExtensionPack.DataSourceEntities.BuildLog _Item = input[i];
         _Item.BuildId          = buildId;
         _Item.BuildEventCodeId = buildEventCodeId;
     }
 }
        public async Task <MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn> BatchDelete(MSBuildExtensionPack.DataSourceEntities.BuildLogCollection input)
        {
            Task <MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn> resultTask = Task.Factory.StartNew <MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn>(() =>
            {
                MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn responseMessage = MSBuildExtensionPack.CommonBLLIoC.IoCBuildLog.BatchDelete(input);

                return(responseMessage);
            });

            return(await resultTask);
        }
Example #5
0
        /// <summary>
        /// batch delete a collection of <see cref=" MSBuildExtensionPack.DataSourceEntities.BuildLog"/>.
        /// http://[host]/api/BuildLogApi/BatchDelete
        /// </summary>
        /// <param name="input">The input collection.</param>
        // [HttpDelete, ActionName("BatchDelete")] //although JSON allowed in Http Delete request body, but not allowed in HttpClient
        public async Task <MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn> BatchDeleteAsync(MSBuildExtensionPack.DataSourceEntities.BuildLogCollection input)
        {
            string url = GetHttpRequestUrl(ActionName_BatchDelete);

            return(await Post <MSBuildExtensionPack.DataSourceEntities.BuildLogCollection, MSBuildExtensionPack.CommonBLLEntities.BuildLogResponseMessageBuiltIn>(url, input));
        }