private BasePlan(ProjectBasePlanInfoRow row) { _srcRow = row; }
/// <summary> /// Saves the specified Active Data by Project to Base Plan Slot. /// </summary> /// <param name="ProjectId">The project id.</param> /// <param name="BasePlanSlotId">The base plan slot id.</param> public static void Save(int ProjectId, int BasePlanSlotId) { using(DbTransaction tran = DbTransaction.Begin()) { // Step. Create or Update ProjectBasePlanInfoRow ProjectBasePlanInfoRow infoRow = new ProjectBasePlanInfoRow(); ProjectBasePlanInfoRow[] activeInfoRowList = ProjectBasePlanInfoRow.List(ProjectId); foreach(ProjectBasePlanInfoRow activeInfoRow in activeInfoRowList) { if(activeInfoRow.BasePlanSlotId==BasePlanSlotId) { infoRow = activeInfoRow; break; } } infoRow.BasePlanSlotId = BasePlanSlotId; infoRow.ProjectId = ProjectId; infoRow.Created = DateTime.UtcNow; infoRow.Update(); //DV. Fix Exception, when finances are not active! if (ProjectSpreadSheet.IsActive(ProjectId)) { // Step 1. Save Spread Sheet View from Currency ProjectSpreadSheetDataRow.Delete(ProjectId, BasePlanSlotId); ProjectSpreadSheetDataRow[] srcRowList = ProjectSpreadSheetDataRow.ListCurrentByProjectId(ProjectId); foreach (ProjectSpreadSheetDataRow srcRow in srcRowList) { ProjectSpreadSheetDataRow newRow = new ProjectSpreadSheetDataRow(); newRow.Index = BasePlanSlotId; newRow.ProjectSpreadSheetId = srcRow.ProjectSpreadSheetId; newRow.ColumnId = srcRow.ColumnId; newRow.RowId = srcRow.RowId; newRow.CellType = srcRow.CellType; newRow.Value = srcRow.Value; newRow.Update(); } SpreadSheetView view = ProjectSpreadSheet.LoadView(ProjectId, BasePlanSlotId, 2001, 2001); ProjectSpreadSheet.SaveBusinessScore(ProjectId, BasePlanSlotId, view.Document); } // Step 2. Save Tasks ProjectTaskBasePlanRow.Fill(ProjectId, BasePlanSlotId); tran.Commit(); } }