public async Task <IActionResult> Create(ProcessTypeFieldCreateGet ProcessTypeField)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            ProcessTypeField.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 _processTypeFieldProvider.CreatePostCheck(ProcessTypeField);

                if (ErrorMessages.Count > 0)
                {
                    ProcessTypeField = await CreateAddDropDownBoxes(ProcessTypeField, CurrentUser.Id, ProcessTypeField.ProcessTypeId);
                }
                else
                {
                    _processTypeFieldProvider.CreatePost(ProcessTypeField);
                }
                ProcessTypeFieldCreateGetWithErrorMessages ProcessTypeFieldWithErrorMessage = new ProcessTypeFieldCreateGetWithErrorMessages {
                    ProcessTypeField = ProcessTypeField, ErrorMessages = ErrorMessages
                };
                return(Ok(ProcessTypeFieldWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProcessTypeFieldCreateGetWithErrorMessages ProcessTypeFieldWithNoRights = new ProcessTypeFieldCreateGetWithErrorMessages {
                ProcessTypeField = ProcessTypeField, ErrorMessages = ErrorMessages
            };

            return(Ok(ProcessTypeFieldWithNoRights));
        }
Example #2
0
        public async Task <string> CreatePost(ProcessTypeFieldCreateGet ProcessTypeField)
        {
            string usp    = "usp_ProcessTypeFieldCreatePost @ProcessTypeId, @ProcessTypeFieldTypeId, @Name, @Description, @MenuName, @MouseOver, @CreatorId";
            var    String = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, ProcessTypeField);

            return(String);
        }
Example #3
0
        public async Task <List <ErrorMessage> > CreatePostCheck(ProcessTypeFieldCreateGet ProcessTypeField)
        {
            string usp           = "usp_ProcessTypeFieldCreatePostCheck @ProcessTypeId, @ProcessTypeFieldTypeId, @Name, @CreaterId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ProcessTypeField);

            return(ErrorMessages);
        }
Example #4
0
        public async Task <IActionResult> Create(ProcessTypeFieldCreateGet ProcessTypeField)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ProcessTypeFieldCreateGetWithErrorMessage = await _client.PostProtectedAsync <ProcessTypeFieldCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProcessTypeField/Create", ProcessTypeField, token);

            if (ProcessTypeFieldCreateGetWithErrorMessage.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/ProcessTypeField/Create", token);

                ViewBag.Env = _hostingEnv.EnvironmentName;

                ViewBag.ErrorMessages = ProcessTypeFieldCreateGetWithErrorMessage.ErrorMessages;
                return(View(ProcessTypeFieldCreateGetWithErrorMessage.ProcessTypeField));
            }


            return(RedirectToAction("Index", new { id = ProcessTypeField.ProcessTypeId }));
        }
        private async Task <ProcessTypeFieldCreateGet> CreateAddDropDownBoxes(ProcessTypeFieldCreateGet ProcessTypeField, string UserId, int ProcessTypeId)
        {
            var ProcessTypeFieldTypes = await _processTypeFieldTypeProvider.List(UserId);

            var UserLanguage = await _masterProvider.UserLanguageUpdateGet(UserId);

            ProcessTypeField.LanguageId            = UserLanguage.LanguageId;
            ProcessTypeField.LanguageName          = UserLanguage.Name;
            ProcessTypeField.ProcessTypeFieldTypes = ProcessTypeFieldTypes;
            ProcessTypeField.ProcessTypeId         = ProcessTypeId;
            return(ProcessTypeField);
        }
        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 ProcessTypeField = new ProcessTypeFieldCreateGet();
                ProcessTypeField = await CreateAddDropDownBoxes(ProcessTypeField, CurrentUser.Id, Id);

                return(Ok(ProcessTypeField));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }