public void AddDashboardItemTeams(int[] dashboardItemTeam, int itemID) { try { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (var j = 0; j < dashboardItemTeam.Length; j++) { dbmlObject.AddTeamToDashboardItem(itemID, dashboardItemTeam[j]); dbmlObject.SubmitChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public void WriteAllDashboardItemTeams(DashboardItemTeam[] dashboardItemTeam) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (var i = 0; i < dashboardItemTeam.Length; i++) { dbmlObject.DeleteTeamsFromDashboardItem(dashboardItemTeam[i].ItemID); } dbmlObject.SubmitChanges(); for (var j = 0; j < dashboardItemTeam.Length; j++) { dbmlObject.AddTeamToDashboardItem(dashboardItemTeam[j].ItemID, dashboardItemTeam[j].TeamID); dbmlObject.SubmitChanges(); } }
public void WriteAllDashboardItemTeams(DashboardItemTeam[] dashboardItemTeam) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (var i = 0; i < dashboardItemTeam.Length; i++) { dbmlObject.DeleteTeamsFromDashboardItem(dashboardItemTeam[i].ItemID); } dbmlObject.SubmitChanges(); for (var j = 0; j < dashboardItemTeam.Length; j++) { dbmlObject.AddTeamToDashboardItem(dashboardItemTeam[j].ItemID, dashboardItemTeam[j].TeamID); dbmlObject.SubmitChanges(); } }
public bool CreateNewDashboardByExistingDashboard(int dashboardID, int userID, string dashboardName, string description) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.GetDashboardByID(dashboardID).ToList(); var dashboardDetails = result.FirstOrDefault(); var resNewDashboardID = dbmlObject.CreateDashboard(dashboardName, dashboardDetails.StartMonth, dashboardDetails.StartYear, dashboardDetails.EndMonth, dashboardDetails.EndYear, userID, "ADMIN", description).ToList(); int newDashboardID = Convert.ToInt32(resNewDashboardID.FirstOrDefault().Column1); //Dashboard Source var resDashboardSources = dbmlObject.RetreiveSource(dashboardID).ToList(); foreach (var i in resDashboardSources) { dbmlObject.AddDashboardSources(i.Source, newDashboardID); } //dashboard Status var resStatus = dbmlObject.RetreiveStatus(dashboardID); foreach (var i in resStatus) { dbmlObject.AddDashboardStatus(i.Status, i.Color, newDashboardID); } var resultItems = dbmlObject.RetreiveExistingDashboardItems(dashboardID, "StartDate").ToList(); foreach (var i in resultItems) { var resItemID = dbmlObject.AddDataItem(i.ItemName, i.StartDate, i.EndDate, newDashboardID, i.StatusID).ToList(); int itemID = Convert.ToInt32(resItemID.FirstOrDefault().Column1); var resTeams = dbmlObject.RetreiveTeamsWorkingOnItem(i.ItemID).ToArray(); for (var j = 0; j < resTeams.Length; j++) { dbmlObject.AddTeamToDashboardItem(itemID, resTeams[j].TeamID); } var resSources = dbmlObject.GetSourcesByItemID(i.ItemID).ToArray(); for (var j = 0; j < resSources.Length; j++) { dbmlObject.AddDataItemSource(itemID, resSources[j].SourceID); } } dbmlObject.SubmitChanges(); return(true); }