public void WriteAllAccessRights(DashboardUser[] DashboardUser) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteUsersFromDashboard(DashboardUser[0].DashboardId); dbmlObject.SubmitChanges(); for (var i = 0; i < DashboardUser.Length; i++) { dbmlObject.AddUserToDashboard(DashboardUser[i].AccessRight.AccessRightName, DashboardUser[i].DashboardId, DashboardUser[i].UserId); 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 EditDashboard(Dashboard dashboardDetails, int UserDetails, string[] newSource, int[] deletedSource, DashboardStatus[] newStatus, int[] deletedStatus) { try { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.EditDashboard(dashboardDetails.DashboardId, dashboardDetails.DashboardName, dashboardDetails.StartMonth, dashboardDetails.StartYear, dashboardDetails.EndMonth, dashboardDetails.EndYear, dashboardDetails.Description); int dashboardID = dashboardDetails.DashboardId; foreach (var source in newSource) { dbmlObject.AddDashboardSources(source, dashboardID); } foreach (int sid in deletedSource) { dbmlObject.DeleteDashboardSource(sid); } foreach (var status in newStatus) { dbmlObject.AddDashboardStatus(status.Status, status.Color, dashboardID); } foreach (int sid in deletedStatus) { dbmlObject.DeleteDashboardStatus(sid); } dbmlObject.SubmitChanges(); } catch (Exception e) { throw e; } return(true); }
public bool UserRegistration(DataContracts.UserDetails userDetails) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.InsertUserDetails(userDetails.CompanyId, userDetails.FirstName, userDetails.LastName, userDetails.UserEmail, userDetails.IsOwner, userDetails.EncryptedPassword); dbmlObject.SubmitChanges(); return(true); }
public bool EditDataItemLength(DashboardItem dashboardItem) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.EditDataItemLength(dashboardItem.StartDate, dashboardItem.EndDate, dashboardItem.DashboardID, dashboardItem.ItemID); dbmlObject.SubmitChanges(); return(true); }
public bool DeleteDataItem(string ItemName) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteDataItem(ItemName); dbmlObject.SubmitChanges(); return(true); }
public bool EditDataItemName(string ItemName, int ItemID, int DashboardID) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.EditDataItemName(ItemName, ItemID, DashboardID); dbmlObject.SubmitChanges(); return(true); }
public bool UserRegistration(DataContracts.UserDetails userDetails) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.InsertUserDetails(userDetails.CompanyId, userDetails.FirstName, userDetails.LastName, userDetails.UserEmail, userDetails.IsOwner, userDetails.EncryptedPassword); dbmlObject.SubmitChanges(); return true; }
public int CompanyRegistration(Company company) { StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.CompanyRegisteration(company.Account, company.Name, company.Url).ToList(); dbml.SubmitChanges(); var cID = result.First(); int companyID = Convert.ToInt32(cID.Column1); return companyID; }
public bool DeleteTeams(Team[] teams) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (int i = 0; i < teams.Length; i++) { dbmlObject.DeleteTeam(teams[i].TeamID); } dbmlObject.SubmitChanges(); return true; }
public void AddDashboardItemSource(int[] sources, int itemID) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (var j = 0; j < sources.Length; j++) { dbmlObject.AddDataItemSource(itemID, sources[j]); dbmlObject.SubmitChanges(); } }
public bool DeleteTeams(Team[] teams) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (int i = 0; i < teams.Length; i++) { dbmlObject.DeleteTeam(teams[i].TeamID); } dbmlObject.SubmitChanges(); return(true); }
public bool ModifyDashboardItem(DashboardItem[] modified) { StoredProcedureDataContext dbml = new StoredProcedureDataContext(); for (int i = 0; i < modified.Length; i++) { dbml.EditDataItemLength(modified[i].StartDate, modified[i].EndDate, modified[i].DashboardID, modified[i].ItemID); } dbml.SubmitChanges(); return(true); }
public int CompanyRegistration(Company company) { StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.CompanyRegisteration(company.Account, company.Name, company.Url).ToList(); dbml.SubmitChanges(); var cID = result.First(); int companyID = Convert.ToInt32(cID.Column1); return(companyID); }
public bool deleteDashboardItem(int itemID) { try { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteDashboardItem(itemID); dbmlObject.SubmitChanges(); } catch (Exception e) { throw e; } return(true); }
public int CreateDashboard(Dashboard dashboardDetails, UserDetails UserDetails) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var res = dbmlObject.CreateDashboard(dashboardDetails.DashboardName, dashboardDetails.StartMonth, dashboardDetails.StartYear, dashboardDetails.EndMonth, dashboardDetails.EndYear, UserDetails.UserId, "ADMIN", dashboardDetails.Description); dbmlObject.SubmitChanges(); var resTemp = res.FirstOrDefault(); int NewDashID = Convert.ToInt32(resTemp.Column1); return(NewDashID); }
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 bool AddTeams(Team[] teamsToAdd, int[] deletedTeams) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (int i = 0; i < deletedTeams.Length; i++) { dbmlObject.DeleteTeam(deletedTeams[i]); } for (int i = 0; i < teamsToAdd.Length; i++) { dbmlObject.AddTeams(teamsToAdd[i].TeamName, teamsToAdd[i].CompanyID); } dbmlObject.SubmitChanges(); return true; }
public bool AddTeams(Team[] teamsToAdd, int[] deletedTeams) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); for (int i = 0; i < deletedTeams.Length; i++) { dbmlObject.DeleteTeam(deletedTeams[i]); } for (int i = 0; i < teamsToAdd.Length; i++) { dbmlObject.AddTeams(teamsToAdd[i].TeamName, teamsToAdd[i].CompanyID); } dbmlObject.SubmitChanges(); return(true); }
public bool deleteDashboard(int dashboardID) { try { StoredProcedureDataContext dbmlobject = new StoredProcedureDataContext(); var result = dbmlobject.RetreiveExistingDashboardItems(dashboardID, "nothing").ToList(); foreach (var item in result) { dbmlobject.DeleteDashboardItem(item.ItemID); } dbmlobject.DeleteDashboard(dashboardID); dbmlobject.SubmitChanges(); } catch (Exception e) { throw e; } return(true); }
public List<UserDetails> ShowAllUsersInCompany(string companyId) { int companyID = Convert.ToInt32(companyId); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ShowAllUsersInCompanyResult = dbmlObject.ShowAllUsersInCompany(companyID).ToList(); dbmlObject.SubmitChanges(); List<UserDetails> userDetails = new List<UserDetails>(); foreach (var i in ShowAllUsersInCompanyResult) { userDetails.Add(new UserDetails { FirstName = i.FirstName, UserId = i.UserId }); } return userDetails; }
public bool AddDashboardItem(DashboardItem Item, int[] Sources, int[] WorkingTeams) { try { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); if (Item.ItemID != 0) //if it is a Edit Option { dbmlObject.DeleteDashboardItem(Item.ItemID); } var resItemID = dbmlObject.AddDataItem(Item.ItemName, Item.StartDate, Item.EndDate, Item.DashboardID, Item.StatusID).ToList(); dbmlObject.SubmitChanges(); int itemID = Convert.ToInt32(resItemID.FirstOrDefault().Column1); AddDashboardItemTeams(WorkingTeams, itemID); AddDashboardItemSource(Sources, itemID); } catch (Exception e) { Console.WriteLine(e); } return(true); }
public List <UserDetails> ShowAllUsersInCompany(string companyId) { int companyID = Convert.ToInt32(companyId); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ShowAllUsersInCompanyResult = dbmlObject.ShowAllUsersInCompany(companyID).ToList(); dbmlObject.SubmitChanges(); List <UserDetails> userDetails = new List <UserDetails>(); foreach (var i in ShowAllUsersInCompanyResult) { userDetails.Add(new UserDetails { FirstName = i.FirstName, UserId = i.UserId }); } return(userDetails); }
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); }