private string LoadTeamTiles() { var teamGuid = Request.Params["SiteGUID"].ToString(); string userAlias = Session["UserName"].ToString(); // tile data JavaScriptSerializer jss = new JavaScriptSerializer(); // Save the tile data into our database using (MainDBUnitWorkContext context = new MainDBUnitWorkContext()) { TileRepository repository = new TileRepository(context); // Get the team id by its team guid value TeamRepository tRepository = new TeamRepository(context); TeamAppService teamService = new TeamAppService(tRepository); TileQueryLogicRepository tileQueryRepository = new TileQueryLogicRepository(context); ReportRepository reportRepository = new ReportRepository(context); int teamId = teamService.GetAllTeamSites().First(_ => _.TeamGuid == Guid.Parse(teamGuid)).Id.Value; TileServices tService = new TileServices(repository, tRepository, reportRepository, null, null, null, tileQueryRepository); List <TileViewModel> tiles = tService.GetCustomerizeTilesWithCountByTeamId(teamId, userAlias, true, teamGuid).Select(_ => _.ToTileViewModel()).ToList <TileViewModel>(); return(jss.Serialize(tiles)); } }
public string GetTeamsAvailable() { JavaScriptSerializer jss = new JavaScriptSerializer(); using (MainDBUnitWorkContext context = new MainDBUnitWorkContext()) { ITeamRepository divisionRepository = new TeamRepository(context); TeamAppService service = new TeamAppService(divisionRepository); IEnumerable <AppTeamSite> divisions = service.GetAllSingleTeams(); return(jss.Serialize(divisions)); } }
private string GetTeams() { JavaScriptSerializer jss = new JavaScriptSerializer(); TeamParameter param = new TeamParameter(); using (MainDBUnitWorkContext context = new MainDBUnitWorkContext()) { ITeamRepository teamRepository = new TeamRepository(context); TeamAppService teamManager = new TeamAppService(teamRepository); param.Teams = teamManager.GetAllTeamSites(); return(jss.Serialize(param)); } }
private string AddTeamSite() { JavaScriptSerializer jss = new JavaScriptSerializer(); var paramDes = jss.Deserialize <TeamParameter>(Request["queryParam"]); using (MainDBUnitWorkContext context = new MainDBUnitWorkContext()) { ITeamRepository repository = new TeamRepository(context); IUserRepository userRepository = new UserRepository(context); TeamAppService teamService = new TeamAppService(repository, userRepository); return(jss.Serialize(teamService.Update(paramDes.Teams))); } }
private void UpdateTileInformation() { // Update team site dashboard settings var tileData = Request.Params["TilesData"]; var teamGuid = Request.Params["SiteGUID"].ToString(); // tile data JavaScriptSerializer jss = new JavaScriptSerializer(); List <TileViewModel> paraTileList = jss.Deserialize <List <TileViewModel> >(tileData); // Save the tile data into our database using (MainDBUnitWorkContext context = new MainDBUnitWorkContext()) { TileRepository repository = new TileRepository(context); // Get the team id by its team guid value TeamRepository tRepository = new TeamRepository(context); TeamAppService teamService = new TeamAppService(tRepository); TileQueryLogicRepository tileQueryRepository = new TileQueryLogicRepository(context); int teamId = teamService.GetAllTeamSites().First(_ => _.TeamGuid == Guid.Parse(teamGuid)).Id.Value; //validate the data if (paraTileList.Count() > 24) { throw new ArgumentException("the count of the tile is more than 24"); } foreach (var item in paraTileList) { if (item.coordinateX < 0 || item.coordinateX > 7) { throw new ArgumentException("coordinateX must be between 0 and 7"); } if (item.coordinateY < 0 || item.coordinateY > 2) { throw new ArgumentException("coordinateY must be between 0 and 2"); } if (item.demensionX < 1 || item.demensionX > 8) { throw new ArgumentException("demensionX must be between 1 and 8"); } if (item.demensionY < 1 || item.demensionY > 3) { throw new ArgumentException("demensionY must be between 1 and 3"); } } TileServices tService = new TileServices(repository, null, null, null, null, null, tileQueryRepository); List <AppTile> tiles = new List <AppTile>(); List <AppTile> orignalTiles = tService.GetTilesByTeamId(teamId).ToList(); //tiles will be remove foreach (var item in orignalTiles) { if (!paraTileList.Any(_ => _.id == item.Id)) { if (item.logicType == LogicType.AllReports) { continue; } AppTile appTile = tService.GetTileById(item.Id.Value); appTile.Status = ChangeStatus.Delete; tiles.Add(appTile); } } foreach (var para in paraTileList) { //tiles will be Added if (para.id < 0) { AppTile appTile = new AppTeamSiteCustomizedTile(); appTile.TileType = TileType.TeamSite; appTile.Status = ChangeStatus.Add; appTile.Title = para.title; appTile.Top = para.coordinateY; appTile.Left = para.coordinateX; appTile.Width = para.demensionX; appTile.Height = para.demensionY; appTile.BackgroundColor = para.backgroundColor; appTile.Icon = para.icon; appTile.BackgroundImage = para.backgroundImage; appTile.ImageOverlayColor = para.overlayColor; appTile.ReportCountStyle = para.shownCount; appTile.OwnerTeamSiteId = teamId; appTile.IsCustomized = true; appTile.logicType = (LogicType)Enum.Parse(typeof(LogicType), para.LogicType); SetAppTitleLogic(para.LogicString, appTile); tiles.Add(appTile); } //tiles will be Updated if (para.id > 0) { AppTile appTile = tService.GetTileById(para.id); if (appTile == null) { continue; } appTile.Status = ChangeStatus.Change; appTile.Top = para.coordinateY; appTile.Left = para.coordinateX; appTile.Width = para.demensionX; appTile.Height = para.demensionY; appTile.BackgroundColor = para.backgroundColor; appTile.Icon = para.icon; appTile.BackgroundImage = para.backgroundImage; appTile.ImageOverlayColor = para.overlayColor; appTile.ReportCountStyle = para.shownCount; appTile.IsCustomized = true; if (appTile.logicType != LogicType.AllReports) { appTile.Title = para.title; appTile.logicType = (LogicType)Enum.Parse(typeof(LogicType), para.LogicType); SetAppTitleLogic(para.LogicString, appTile); } tiles.Add(appTile); } } tService.ModifyTile(tiles); } }