Exemplo n.º 1
0
        public async Task <IActionResult> Create(ProcessTypeFlowConditionCreateGet ProcessTypeFlowCondition)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            ProcessTypeFlowCondition.UserId = CurrentUser.Id;
            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _processTypeFlowConditionProvider.CreatePostCheck(ProcessTypeFlowCondition);

                if (ErrorMessages.Count > 0)
                {
                    ProcessTypeFlowCondition = await CreateAddDropDownBoxes(ProcessTypeFlowCondition, CurrentUser.Id, ProcessTypeFlowCondition.ProcessTypeFlowId);
                }
                else
                {
                    _processTypeFlowConditionProvider.CreatePost(ProcessTypeFlowCondition);
                }
                ProcessTypeFlowConditionCreateGetWithErrorMessages ProcessTypeFlowConditionWithErrorMessage = new ProcessTypeFlowConditionCreateGetWithErrorMessages {
                    ProcessTypeFlowCondition = ProcessTypeFlowCondition, ErrorMessages = ErrorMessages
                };
                return(Ok(ProcessTypeFlowConditionWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProcessTypeFlowConditionCreateGetWithErrorMessages ProcessTypeFlowConditionWithNoRights = new ProcessTypeFlowConditionCreateGetWithErrorMessages {
                ProcessTypeFlowCondition = ProcessTypeFlowCondition, ErrorMessages = ErrorMessages
            };

            return(Ok(ProcessTypeFlowConditionWithNoRights));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create(ProcessTypeFlowConditionCreateGet ProcessTypeFlowCondition)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ProcessTypeFlowConditionCreateGetWithErrorMessage = await _client.PostProtectedAsync <ProcessTypeFlowConditionCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProcessTypeFlowCondition/Create", ProcessTypeFlowCondition, token);

            if (ProcessTypeFlowConditionCreateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                ViewBag.Favorites = await _client.GetProtectedAsync <List <MVCFavoriteMenu> >($"{_configuration["APIUrl"]}api/MVCFavorite/Menu", token);

                ViewBag.FavoriteGroupList = await _client.GetProtectedAsync <List <MVCFavoriteGroupList> >($"{_configuration["APIUrl"]}api/MVCFavorite/GroupList", token);

                ViewBag.UITerms = await _client.GetProtectedAsync <List <UITermLanguageCustomizationList> >($"{_configuration["APIUrl"]}api/MVC/ProcessTypeFlowCondition/Create", token);

                ViewBag.Env = _hostingEnv.EnvironmentName;

                ViewBag.ErrorMessages = ProcessTypeFlowConditionCreateGetWithErrorMessage.ErrorMessages;
                return(View(ProcessTypeFlowConditionCreateGetWithErrorMessage.ProcessTypeFlowCondition));
            }


            return(RedirectToAction("Index", new { id = ProcessTypeFlowCondition.ProcessTypeFlowId }));
        }
Exemplo n.º 3
0
        public async Task <string> CreatePost(ProcessTypeFlowConditionCreateGet ProcessTypeFlowCondition)
        {
            string usp    = "usp_ProcessTypeFlowConditionCreatePost @ProcessTypeFlowId, @Sequence, @ProcessTypeFlowConditionTypeId, @ProcessTypeFieldId, @ProcessTypeFieldIDRole, @ComparisonOperatorId, @ProcessTypeFlowConditionString, @ProcessTypeFlowConditionInt, @ProcessTypeFlowConditionDate, @Name, @Description, @MenuName, @MouseOver, @UserId";
            var    String = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, ProcessTypeFlowCondition);

            return(String);
        }
Exemplo n.º 4
0
        public async Task <List <ErrorMessage> > CreatePostCheck(ProcessTypeFlowConditionCreateGet ProcessTypeFlowCondition)
        {
            string usp           = "usp_ProcessTypeFlowConditionCreatePostCheck @ProcessTypeFlowId, @Sequence, @ProcessTypeFlowConditionTypeId, @ProcessTypeFieldId, @ProcessTypeFieldIDRole, @ComparisonOperatorId, @Name, @CreaterId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ProcessTypeFlowCondition);

            return(ErrorMessages);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create(int Id)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                var ProcessTypeFlowCondition = new ProcessTypeFlowConditionCreateGet();
                ProcessTypeFlowCondition = await CreateAddDropDownBoxes(ProcessTypeFlowCondition, CurrentUser.Id, Id);

                return(Ok(ProcessTypeFlowCondition));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Exemplo n.º 6
0
        private async Task <ProcessTypeFlowConditionCreateGet> CreateAddDropDownBoxes(ProcessTypeFlowConditionCreateGet ProcessTypeFlowCondition, string UserId, int ProcessTypeFlowId)
        {
            var ProcessTypeFlowConditionCreateGetSequences = await _processTypeFlowConditionProvider.CreateGetSequence(UserId, ProcessTypeFlowId);

            var ProcessTypeFlowConditionTypes = await _processTypeFlowConditionTypeProvider.List(UserId);

            var ProcessTypeFields = await _processTypeFlowConditionProvider.CreateGetFieldList(UserId, ProcessTypeFlowId);

            var ProcessTypeFieldRoles = await _processTypeFlowConditionProvider.CreateGetFieldRoleList(UserId, ProcessTypeFlowId);

            var ComparisonOperators = await _processTypeFlowConditionComparisonOperatorProvider.List(UserId);

            var UserLanguage = await _masterProvider.UserLanguageUpdateGet(UserId);

            var SecurityLevels = await _securityLevelProvider.List(UserId);

            var Roles = await _roleProvider.List(UserId);

            var Organizations = await _organizationProvider.List(UserId);

            var Projects = await _projectProvider.List(UserId);

            var Users = await _userProvider.List();

            ProcessTypeFlowCondition.LanguageId   = UserLanguage.LanguageId;
            ProcessTypeFlowCondition.LanguageName = UserLanguage.Name;
            ProcessTypeFlowCondition.Sequences    = ProcessTypeFlowConditionCreateGetSequences;
            ProcessTypeFlowCondition.ProcessTypeFlowConditionTypes = ProcessTypeFlowConditionTypes;
            ProcessTypeFlowCondition.ProcessTypeFieldRoles         = ProcessTypeFieldRoles;
            ProcessTypeFlowCondition.ProcessTypeFields             = ProcessTypeFields;
            ProcessTypeFlowCondition.ComparisonOperators           = ComparisonOperators;
            ProcessTypeFlowCondition.ProcessTypeFlowId             = ProcessTypeFlowId;
            ProcessTypeFlowCondition.UserId         = UserId;
            ProcessTypeFlowCondition.SecurityLevels = SecurityLevels;
            ProcessTypeFlowCondition.Roles          = Roles;
            ProcessTypeFlowCondition.Organizations  = Organizations;
            ProcessTypeFlowCondition.Projects       = Projects;
            ProcessTypeFlowCondition.Users          = Users;
            return(ProcessTypeFlowCondition);
        }