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 List <Dashboard> GetUserDashboards(int userID) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var userDashboardsResult = dbmlObject.RetreiveExistingDashboards(userID).ToList(); List <Dashboard> list = new List <Dashboard>(); foreach (var i in userDashboardsResult) { list.Add(new Dashboard { DashboardId = i.DashboardID, DashboardName = i.DashboardName, EndMonth = i.EndMonth, StartMonth = i.StartMonth, EndYear = i.EndYear, StartYear = i.StartYear, Description = i.Description, UserAccessRight = new AccessRight() { AccessRightName = i.AccessRight } }); } return(list); }
public bool DeleteDataItem(string ItemName) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteDataItem(ItemName); 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 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 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 EditDataItemName(string ItemName, int ItemID, int DashboardID) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.EditDataItemName(ItemName, ItemID, DashboardID); 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 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 deleteDashboardItem(int itemID) { try { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteDashboardItem(itemID); dbmlObject.SubmitChanges(); } catch (Exception e) { throw e; } return(true); }
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 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 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 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 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 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 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 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 DashboardItem RetreiveDashboardItem(string id) { int itemID = Convert.ToInt32(id); StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.RetreiveDashboardItem(itemID).ToList(); var i = result.FirstOrDefault(); DateTime startdatestring = i.StartDate; DateTime endDatestring = i.EndDate; DashboardItem item = new DashboardItem { ItemID = i.ItemID, DashboardID = i.DashboardID, ItemName = i.ItemName, EndDate = endDatestring, StartDate = startdatestring, StatusID = i.StatusID, WorkingTeams = RetreiveTeamsWorkingOnItem(itemID), Sources = GetSourcesByItemID(itemID) }; return(item); }
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 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 List <DashboardSource> GetSourcesByItemID(int itemID) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.GetSourcesByItemID(itemID).ToList(); List <DashboardSource> list = new List <DashboardSource>(); foreach (var i in result) { list.Add(new DashboardSource { SourceID = i.SourceID, Source = i.Source }); } return(list); }
public List<Company> RetriveCompanyNames() { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ResultCompanies = dbmlObject.RetreiveCompanies(); List<Company> list = new List<Company>(); foreach (var i in ResultCompanies) { list.Add(new Company { CompanyID = i.CompanyID, Name = i.Name }); } return list; }
public List <Company> RetriveCompanyNames() { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ResultCompanies = dbmlObject.RetreiveCompanies(); List <Company> list = new List <Company>(); foreach (var i in ResultCompanies) { list.Add(new Company { CompanyID = i.CompanyID, Name = i.Name }); } return(list); }
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<Team> ShowAllTeamsInCompany(string companyID) { int compantIDInt = Convert.ToInt32(companyID); StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.ShowAllTeamsInCompany(compantIDInt); List<Team> teams = new List<Team>(); foreach (var i in result) { teams.Add(new Team { TeamID = i.TeamID, TeamName = i.TeamName }); } return teams; }
public bool ChangePassword(int userid, string oldPassword, string newPassword) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); try { var res = dbmlObject.AuthenticationByID(userid, oldPassword).ToList(); if (res.Count == 0) { return(false); } dbmlObject.ChangePassword(userid, newPassword); } catch (Exception e) { return(false); } return(true); }
public List <Team> ShowAllTeamsInCompany(string companyID) { int compantIDInt = Convert.ToInt32(companyID); StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.ShowAllTeamsInCompany(compantIDInt); List <Team> teams = new List <Team>(); foreach (var i in result) { teams.Add(new Team { TeamID = i.TeamID, TeamName = i.TeamName }); } return(teams); }
public List<Team> RetreiveTeams(string id) { int companyID = Convert.ToInt32(id); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.RetreiveTeams(companyID).ToList(); List<Team> teamList = new List<Team>(); foreach (var i in result) { teamList.Add(new Team { TeamID = i.TeamID, TeamName = i.TeamName, CompanyID = i.CompanyID }); } return teamList; }
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 List <Team> RetreiveTeams(string id) { int companyID = Convert.ToInt32(id); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.RetreiveTeams(companyID).ToList(); List <Team> teamList = new List <Team>(); foreach (var i in result) { teamList.Add(new Team { TeamID = i.TeamID, TeamName = i.TeamName, CompanyID = i.CompanyID }); } return(teamList); }
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 <Team> RetreiveTeamsWorkingOnItem(int dashboardItemID) { StoredProcedureDataContext dbml = new StoredProcedureDataContext(); var result = dbml.RetreiveTeamsWorkingOnItem(dashboardItemID).ToList(); List <Team> list = new List <Team>(); try { foreach (var i in result) { list.Add(new Team { TeamID = i.TeamID, TeamName = i.TeamName }); } } catch (Exception ex) { Console.WriteLine(ex); } return(list); }
public List <DashboardSource> GetSourcesList(string id) { int dashboardID = Convert.ToInt32(id); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.RetreiveSource(dashboardID).ToList(); List <DashboardSource> list = new List <DashboardSource>(); foreach (var i in result) { list.Add(new DashboardSource { DashboardID = dashboardID, SourceID = i.SourceID, Source = i.Source }); } return(list); }
public List<DashboardUser> ShowAllAccessRights(string dashboard) { int dashboardID = Convert.ToInt32(dashboard); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ShowAccessRightResult = dbmlObject.ShowAllAccessRights(dashboardID).ToList(); List<DashboardUser> UserList = new List<DashboardUser>(); //proper conversion logic foreach (var i in ShowAccessRightResult) { UserList.Add(new DashboardUser { DashboardId = dashboardID, Name = i.FirstName, UserId = i.UserID, AccessRight = new AccessRight() { AccessRightName = i.AccessRight } }); } return UserList; }
public List <ShowAllDashboardItemTeams> ShowAllItemsAndTeams(string DashboardID) { int dashboardID = Convert.ToInt32(DashboardID); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ShowAllItemsAndTeamsResult = dbmlObject.ShowAllItemsAndTeamsOuterJoin(dashboardID).ToList(); List <ShowAllDashboardItemTeams> UserList = new List <ShowAllDashboardItemTeams>(); foreach (var i in ShowAllItemsAndTeamsResult) { UserList.Add(new ShowAllDashboardItemTeams { ItemID = i.ItemID, ItemName = i.ItemName, TeamID = Convert.ToInt32(i.TeamID), TeamName = i.TeamName }); } return(UserList); }
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 List <DashboardStatus> GetStatusList(string id) { int dashboardID = Convert.ToInt32(id); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var result = dbmlObject.RetreiveStatus(dashboardID).ToList(); List <DashboardStatus> list = new List <DashboardStatus>(); foreach (var i in result) { list.Add(new DashboardStatus { DashboardID = dashboardID, Color = i.Color, Status = i.Status, StatusID = i.StatusID }); } return(list); }
public List<ShowAllDashboardItemTeams> ShowAllItemsAndTeams(string DashboardID) { int dashboardID = Convert.ToInt32(DashboardID); StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); var ShowAllItemsAndTeamsResult = dbmlObject.ShowAllItemsAndTeamsOuterJoin(dashboardID).ToList(); List<ShowAllDashboardItemTeams> UserList = new List<ShowAllDashboardItemTeams>(); foreach (var i in ShowAllItemsAndTeamsResult) { UserList.Add(new ShowAllDashboardItemTeams { ItemID = i.ItemID, ItemName = i.ItemName, TeamID = Convert.ToInt32(i.TeamID), TeamName = i.TeamName }); } return UserList; }
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); }