Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            langHead = new LangHead();
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            if (!string.IsNullOrWhiteSpace(Id))
            {
                var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.FOUNDATION, $"Language/{Id}");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    langHead = response.ContentAsType <LangHead>();
                }
            }

            await PageConstructor(SaveStates.IGNORE, accessToken);

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.FOUNDATION, $"Setting/{Id}");

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                tenSetting = response.ContentAsType <TenSetting>();
            }
            else
            {
                tenSetting = new TenSetting();
            }

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync()
        {
            teamHead = new TeamHead();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            if (!string.IsNullOrWhiteSpace(Id))
            {
                var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.TEAM, $"Team/{Id}");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    teamHead = response.ContentAsType <TeamHead>();
                }
            }
            else
            {
                Id = Guid.Empty.ToString();
                var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            }

            await PageConstructor(SaveStates.IGNORE, accessToken);

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            taskGroupHead            = new TaskGroupHead();
            taskGroupHead.MainUserId = Guid.Parse(User.FindFirst("sub").Value);

            if (!string.IsNullOrWhiteSpace(Id))
            {
                if (Guid.TryParse(Id, out Guid parsedId))
                {
                    if (parsedId != Guid.Empty)
                    {
                        var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.TASK, $"TaskGroup/{Id}");

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            taskGroupHead = response.ContentAsType <TaskGroupHead>();
                            if (taskGroupHead != null)
                            {
                                ParentId = taskGroupHead.ParentTaskGroupId.ToString();
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrWhiteSpace(ParentId))
                        {
                            var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.TASK, $"TaskGroup/{ParentId}");

                            if (response.StatusCode == System.Net.HttpStatusCode.OK)
                            {
                                taskGroupHead                   = response.ContentAsType <TaskGroupHead>();
                                taskGroupHead.ShortName         = string.Empty;
                                taskGroupHead.LongName          = string.Empty;
                                taskGroupHead.Description       = string.Empty;
                                taskGroupHead.ParentTaskGroupId = taskGroupHead.Id;
                                taskGroupHead.Id                = Guid.Empty;
                            }
                        }
                    }
                }
            }
            else
            {
                Id = Guid.Empty.ToString();
            }

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.CLIENT, $"Client");

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                clientList = response.ContentAsType <ClientList>();
            }
            else
            {
                clientList = new ClientList();
            }

            //var response2 = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.GATEWAY, $"Client");

            //if (response2.StatusCode == System.Net.HttpStatusCode.OK)
            //{
            //    var clientList2 = response.ContentAsType<ClientList>();
            //}


            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> OnGetAsync()
        {
            usersViewModel = new UsersViewModel();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.IDENTITY, $"User");

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var userListModel = response.ContentAsType <UserListModel>();

                usersViewModel = _mapper.Map <UsersViewModel>(userListModel);
            }

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            userLanguageSetting = await GetUserSetting("USER_LANGUAGE", accessToken);

            await PageConstructor(SaveStates.IGNORE, accessToken);

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            userProfileModel.userModel       = new UserModel();
            userProfileModel.password        = string.Empty;
            userProfileModel.passwordConfirm = string.Empty;

            if (!string.IsNullOrWhiteSpace(Id))
            {
                if (Guid.TryParse(Id, out Guid foundId))
                {
                    if (foundId != Guid.Empty)
                    {
                        var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.IDENTITY, $"User/{foundId.ToString()}");

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            userProfileModel.userModel = response.ContentAsType <UserModel>();
                        }
                    }
                }
            }

            await PageConstructor(SaveStates.IGNORE, accessToken);

            //userTeamTableModel.StatusList = StatusList;
            //userTeamTableModel.userProfileModel = userProfileModel;

            //await CreateTeamSelectList(accessToken);
            //await CreateUserTeamModelList(accessToken);

            //await GeneratePageConstructionModel();

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            FileUploadModel = new FileUploadModel();

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            if (!string.IsNullOrWhiteSpace(Id))
            {
                if (Guid.TryParse(Id, out Guid parsedId))
                {
                    if (parsedId != Guid.Empty)
                    {
                        var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.FILE, $"File/{parsedId}");

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            FileUploadModel.FileHeader = response.ContentAsType <FileHead>();
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrWhiteSpace(linkId) && !string.IsNullOrWhiteSpace(linkType))
                        {
                            FileUploadModel.linkId   = Guid.Parse(linkId);
                            FileUploadModel.linkType = linkType;
                        }
                    }
                }
            }

            await PageConstructor(SaveStates.IGNORE, accessToken);

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            FileVersionUploadModel = new FileVersionUploadModel();
            FileHead fileHead = new FileHead();

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            if (!string.IsNullOrWhiteSpace(fileHeaderId))
            {
                if (Guid.TryParse(fileHeaderId, out Guid parsedId))
                {
                    if (parsedId != Guid.Empty)
                    {
                        var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.FILE, $"File/{parsedId}");

                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            fileHead = response.ContentAsType <FileHead>();
                        }
                    }
                }
            }

            if (fileHead != null)
            {
                if (!string.IsNullOrWhiteSpace(Id))
                {
                    if (Guid.TryParse(Id, out Guid parsedId))
                    {
                        if (parsedId != Guid.Empty)
                        {
                            FileVersionUploadModel.FileVersion = fileHead.FileVersions.Where(v => v.Id == parsedId).FirstOrDefault();
                        }
                    }
                }

                FileVersionUploadModel.FileTitle   = fileHead.FileDetail.FileTitle;
                FileVersionUploadModel.Description = fileHead.FileDetail.FileTitle;

                if (FileVersionUploadModel.FileVersion == null)
                {
                    FileVersionUploadModel.FileVersion = new FileVer()
                    {
                        FileHeaderId = fileHead.Id
                    };
                }
                else
                {
                    FileVersionUploadModel.FileVersion.FileHeaderId = fileHead.Id;
                }
            }

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken, SaveState);

            return(Page());
        }
        public async Task <IActionResult> OnGetAsync()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            await PageConstructor(SaveStates.IGNORE, accessToken);

            if (!await _apiHelper.AuthCheck(accessToken, User.FindFirst("sub").Value))
            {
                return(RedirectToPage("/Logout"));
            }

            taskGroupSummary = new TaskGroupSummary();
            clientSummary    = new ClientSummary();

            if (!string.IsNullOrWhiteSpace(Id))
            {
                var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.TASK, $"TaskGroup/GetTaskGroupSummary/{Id}");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    taskGroupSummary = response.ContentAsType <TaskGroupSummary>();
                }
                else
                {
                    return(RedirectToPage("/TaskGroup/TaskGroups"));
                }
            }
            else
            {
                return(RedirectToPage("/TaskGroup/TaskGroups"));
            }

            if (taskGroupSummary != null)
            {
                await GetFileLinks(accessToken);

                var response = await _apiHelper.MakeAPICallAsync(accessToken, HttpMethod.Get, APITypes.CLIENT, $"Client/GetClientSummary/{taskGroupSummary.ClientHeaderId}");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    clientSummary = response.ContentAsType <ClientSummary>();
                }

                GanttDataModel = GanttHelper.GenerateGanttDataModel(taskGroupSummary);
            }
            else
            {
                GanttDataModel = new GanttDataModel()
                {
                    Data  = new GanttData[0],
                    Links = new GanttLink[0]
                };
            }

            var userList = await GetUsernames(accessToken);

            //Temporary fix for adding language code data to partial pages.
            taskGroupSummary.langQueryList = taskGroupSummarylangQueryList;
            taskGroupSummary.MainUserName  = userList.Users.Where(u => u.Id == taskGroupSummary.MainUserId).FirstOrDefault().FullName;

            foreach (var childTaskGroupSummary in taskGroupSummary.ChildTaskGroups)
            {
                childTaskGroupSummary.langQueryList = taskGroupSummarylangQueryList;
                childTaskGroupSummary.MainUserName  = userList.Users.Where(u => u.Id == childTaskGroupSummary.MainUserId).FirstOrDefault().FullName;

                foreach (var childTaskSummary in childTaskGroupSummary.ChildTasks)
                {
                    childTaskSummary.langQueryList = taskSummarylangQueryList;
                    childTaskSummary.MainUserName  = userList.Users.Where(u => u.Id == childTaskSummary.MainUserId).FirstOrDefault().FullName;
                }
            }

            foreach (var childTaskSummary in taskGroupSummary.ChildTasks)
            {
                childTaskSummary.langQueryList = taskGroupSummarylangQueryList;
                childTaskSummary.MainUserName  = userList.Users.Where(u => u.Id == childTaskSummary.MainUserId).FirstOrDefault().FullName;
            }

            GanttJSON = JsonSerializer.Serialize(GanttDataModel);

            SaveMessageModel = await _apiHelper.GenerateSaveMessageModel(accessToken);

            return(Page());
        }