public ActionResult Edit(MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM vm) { try { log.Info(string.Format("{0}: Edit", Framework.LoggingOptions.UI_Process_Started.ToString())); MSBuildLogsExtended.DataSourceEntities.Build entity = MSBuildLogsExtended.EntityContracts.IBuildHelper.Clone <MSBuildLogsExtended.DataSourceEntities.Build.Default, MSBuildLogsExtended.DataSourceEntities.Build>(vm.Item); var _Response = MSBuildLogsExtended.CommonBLLIoC.IoCBuild.UpdateEntity(entity); log.Info(string.Format("{0}: Edit", Framework.LoggingOptions.UI_Process_Ended.ToString())); return(RedirectToAction(UrlStringsAlias.ActionName_Build_Index)); } catch (Exception ex) { Framework.UIAction uiAction = Framework.UIAction.Update; vm.ContentData.Title = Framework.Resources.UIStringResource.EditAlternativeText; vm.ContentData.Summary = MSBuildLogsExtended.Resources.UIStringResourcePerEntityBuild.Edit_Build; vm.StatusOfResult = Framework.CommonBLLEntities.BusinessLogicLayerResponseStatus.MessageErrorDetected; vm.StatusMessageOfResult = ex.Message; vm.UIActionStatusMessage = new Framework.UIActionStatusMessage(typeof(MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM).FullName, uiAction.ToString(), uiAction, Framework.UIActionStatus.Failed); log.Error(string.Format("{0}: {1}, {2}, {3}", uiAction, Framework.LoggingOptions.UI_Process_Failed.ToString(), vm.StatusOfResult, vm.StatusMessageOfResult)); return(View(vm)); } }
public ActionResult Delete(bool isToCompareIdByIdentifierOftOfByIdentifier, System.Int64 valueToCompareIdByIdentifierOftOfByIdentifier, MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM vm, FormCollection collection) { try { log.Info(string.Format("{0}: Delete", Framework.LoggingOptions.UI_Process_Started.ToString())); var _Response = MSBuildLogsExtended.CommonBLLIoC.IoCBuild.ExistsOfEntityOfByIdentifier(isToCompareIdByIdentifierOftOfByIdentifier, valueToCompareIdByIdentifierOftOfByIdentifier, -1, -1, null); if (_Response) { MSBuildLogsExtended.DataSourceEntities.Build entity = MSBuildLogsExtended.EntityContracts.IBuildHelper.Clone <MSBuildLogsExtended.DataSourceEntities.Build.Default, MSBuildLogsExtended.DataSourceEntities.Build>(vm.Item); MSBuildLogsExtended.CommonBLLIoC.IoCBuild.DeleteEntity(entity); log.Info(string.Format("{0}: Delete", Framework.LoggingOptions.UI_Process_Ended.ToString())); } else { log.Warn(string.Format("{0}: Delete, Entity not exists", Framework.LoggingOptions.UI_Process_Ended.ToString())); } return(RedirectToAction("UrlStringsAlias.ActionName_Build_Index")); } catch (Exception ex) { Framework.UIAction uiAction = Framework.UIAction.Delete; vm.ContentData.Title = Framework.Resources.UIStringResource.DeleteAlternativeText; vm.ContentData.Summary = MSBuildLogsExtended.Resources.UIStringResourcePerEntityBuild.Delete_Build; vm.StatusOfResult = Framework.CommonBLLEntities.BusinessLogicLayerResponseStatus.MessageErrorDetected; vm.StatusMessageOfResult = ex.Message; vm.UIActionStatusMessage = new Framework.UIActionStatusMessage(typeof(MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM).FullName, uiAction.ToString(), uiAction, Framework.UIActionStatus.Failed); log.Error(string.Format("{0}: {1}, {2}, {3}", uiAction, Framework.LoggingOptions.UI_Process_Failed.ToString(), vm.StatusOfResult, vm.StatusMessageOfResult)); return(View(vm)); } }
public void TestMethodOfInsert() { MSBuildLogsExtended.DALContracts.IBuildRepository _DALInstance = MSBuildLogsExtended.LinqDAL.LinqToSqlDataAccessLayerFactorySingleton.Instance.CreateDALInstanceOfBuild(); MSBuildLogsExtended.DataSourceEntities.Build _TestData = MSBuildLogsExtended.EntityContracts.IBuildHelper.GetDefaultValue <MSBuildLogsExtended.DataSourceEntities.Build>(); _DALInstance.Insert(_TestData); //Assert.IsTrue(_TestData.ID != 0); }
public ActionResult AddNew(MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM vm) { try { log.Info(string.Format("{0}: AddNew", Framework.LoggingOptions.UI_Process_Started.ToString())); MSBuildLogsExtended.DataSourceEntities.Build entity = MSBuildLogsExtended.EntityContracts.IBuildHelper.Clone <MSBuildLogsExtended.DataSourceEntities.Build.Default, MSBuildLogsExtended.DataSourceEntities.Build>(vm.Item); var _Response = MSBuildLogsExtended.CommonBLLIoC.IoCBuild.InsertEntity(entity); TempData[TempDataKey_BuildController_Copy] = null; TempData.Remove(TempDataKey_BuildController_Copy); log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.UI_Process_Ended.ToString())); return(RedirectToAction(UrlStringsAlias.ActionName_Build_Index)); } catch (Exception ex) { Framework.UIAction uiAction = Framework.UIAction.ViewDetails; var entity = CreateEmptyEntityOrGetFromTempData(TempDataKey_BuildController_Copy); vm = MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM.CreateNewViewModel(entity); vm.StatusOfResult = Framework.CommonBLLEntities.BusinessLogicLayerResponseStatus.MessageErrorDetected; vm.StatusMessageOfResult = ex.Message; vm.UIActionStatusMessage = new Framework.UIActionStatusMessage(typeof(MSBuildLogsExtended.AspNetMvc40ViewModel.BuildItemVM).FullName, uiAction.ToString(), uiAction, Framework.UIActionStatus.Failed); log.Error(string.Format("{0}: AddNew: {1}", Framework.LoggingOptions.Business_Logic_Layer_Process_Failed.ToString(), ex.Message)); return(View(vm)); } }
/// <summary> /// Assigns the enity reference Ids. /// </summary> /// <param name="input">The input.</param> public static void AssignEnityReferenceIDs(MSBuildLogsExtended.DataSourceEntities.BuildCollection input, System.Int32 solutionId) { for (int i = 0; i < input.Count; i++) { MSBuildLogsExtended.DataSourceEntities.Build _Item = input[i]; _Item.SolutionId = solutionId; } }
/// <summary> /// Validates the value before save to database. /// </summary> /// <param name="input">The input.</param> public static void ValidateValueBeforeSaveToDatabase(MSBuildLogsExtended.DataSourceEntities.BuildCollection input) { for (int i = 0; i < input.Count; i++) { MSBuildLogsExtended.DataSourceEntities.Build _Item = input[i]; ValidateValueBeforeSaveToDatabase(_Item); } }
/// <summary> /// Validates the value before save to database. /// </summary> /// <param name="item">The item.</param> public static void ValidateValueBeforeSaveToDatabase(MSBuildLogsExtended.DataSourceEntities.Build item) { // DateTimePropertiesToMinValueOfDateTimeInSQL if (item.BuildStartTime < Framework.DateTimePeriodHelper.MinValueOfDateTimeInSQL) { item.BuildStartTime = Framework.DateTimePeriodHelper.MinValueOfDateTimeInSQL; } }
public void TestMethodOfBatchUpdate() { MSBuildLogsExtended.DALContracts.IBuildRepository _DALInstance = MSBuildLogsExtended.LinqDAL.LinqToSqlDataAccessLayerFactorySingleton.Instance.CreateDALInstanceOfBuild(); MSBuildLogsExtended.DataSourceEntities.Build _TestData = MSBuildLogsExtended.EntityContracts.IBuildHelper.GetDefaultValue <MSBuildLogsExtended.DataSourceEntities.Build>(); MSBuildLogsExtended.DataSourceEntities.BuildCollection _Collection = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _Collection.Add(_TestData); _DALInstance.BatchInsert(_Collection); _DALInstance.BatchDelete(_Collection); Assert.IsTrue(true); }
/// <summary> /// Creates the entity. /// </summary> /// <returns>a new instance of <see cref="MSBuildLogsExtended.DataSourceEntities.Build"/></returns> public static MSBuildLogsExtended.DataSourceEntities.Build CreateEntity( System.Int64 id ,System.Int32 solutionId ,System.String name ,System.String description ,System.DateTime buildStartTime ) { MSBuildLogsExtended.DataSourceEntities.Build _retval = new MSBuildLogsExtended.DataSourceEntities.Build( id ,solutionId ,name ,description ,buildStartTime ); return _retval; }
/// <summary> /// Creates the entity. /// </summary> /// <returns>a new instance of <see cref="MSBuildLogsExtended.DataSourceEntities.Build"/></returns> public static MSBuildLogsExtended.DataSourceEntities.Build CreateEntity( System.Int64 id , System.Int32 solutionId , System.String name , System.String description , System.DateTime buildStartTime ) { MSBuildLogsExtended.DataSourceEntities.Build _retval = new MSBuildLogsExtended.DataSourceEntities.Build( id , solutionId , name , description , buildStartTime ); return(_retval); }
/// <summary> /// single item insert with entity input /// </summary> /// <param name="input">to-be-inserted instance of entity class</param> public MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild Insert(MSBuildLogsExtended.DataSourceEntities.Build input) { log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild(); _retval.OriginalValue = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _retval.OriginalValue.Add(input); if (input != null) { MSBuildLogsExtended.EntityFrameworkContext.Build _LinqItem = MSBuildLogsExtended.EntityContracts.IBuildHelper.Clone<MSBuildLogsExtended.DataSourceEntities.Build, MSBuildLogsExtended.EntityFrameworkContext.Build>(input); this.LinqContext.Build.Add(_LinqItem); this.LinqContext.SaveChanges(); MSBuildLogsExtended.DataSourceEntities.Build _Result = new MSBuildLogsExtended.DataSourceEntities.Build(); MSBuildLogsExtended.EntityContracts.IBuildHelper.Copy<MSBuildLogsExtended.EntityFrameworkContext.Build, MSBuildLogsExtended.DataSourceEntities.Build>(_LinqItem, _Result); _retval.Result = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _retval.Result.Add(_Result); } log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString())); return _retval; }
/// <summary> /// single item delete by identifier with entity identifier input /// </summary> /// <param name="id">delete the item if its identifier equals to this parameter</param> public MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild DeleteByIdentifier(MSBuildLogsExtended.DataSourceEntities.BuildIdentifier id) { log.Info(string.Format("{0}: DeleteByIdentifier", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild(); if (id != null) { MSBuildLogsExtended.EntityFrameworkContext.Build _LinqItem = GetLinqObjectByIdentifier(id); if (_LinqItem != null) { MSBuildLogsExtended.DataSourceEntities.Build _Original = new MSBuildLogsExtended.DataSourceEntities.Build(); MSBuildLogsExtended.EntityContracts.IBuildHelper.Copy<MSBuildLogsExtended.EntityFrameworkContext.Build, MSBuildLogsExtended.DataSourceEntities.Build>(_LinqItem, _Original); _retval.OriginalValue = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _retval.OriginalValue.Add(_Original); this.LinqContext.Build.Remove(_LinqItem); this.LinqContext.SaveChanges(); } } log.Info(string.Format("{0}: DeleteByIdentifier", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString())); return _retval; }
/// <summary> /// single item update with entity input /// </summary> /// <param name="input">to-be-updated instance of entity class</param> public MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild Update(MSBuildLogsExtended.DataSourceEntities.Build input) { log.Info(string.Format("{0}: Update", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionBuild(); _retval.OriginalValue = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _retval.OriginalValue.Add(input); if (input != null) { MSBuildLogsExtended.LinqToSqlContexts.Build _LinqItem = GetLinqObjectByIdentifier(input); if (_LinqItem != null) { //MSBuildLogsExtended.EntityContracts.IBuildHelper.Copy<MSBuildLogsExtended.DataSourceEntities.Build, MSBuildLogsExtended.LinqToSqlContexts.Build>(input, _LinqItem); _LinqItem.Id = input.Id; _LinqItem.SolutionId = input.SolutionId; _LinqItem.Name = input.Name; _LinqItem.Description = input.Description; _LinqItem.BuildStartTime = input.BuildStartTime; this.LinqContext.SubmitChanges(); MSBuildLogsExtended.DataSourceEntities.Build _Result = new MSBuildLogsExtended.DataSourceEntities.Build(); MSBuildLogsExtended.EntityContracts.IBuildHelper.Copy<MSBuildLogsExtended.LinqToSqlContexts.Build, MSBuildLogsExtended.DataSourceEntities.Build>(_LinqItem, _Result); _retval.Result = new MSBuildLogsExtended.DataSourceEntities.BuildCollection(); _retval.Result.Add(_Result); } } log.Info(string.Format("{0}: Update", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString())); return _retval; }