コード例 #1
0
        public bool CreatePost(ClassificationValuePropertyCreateGet ClassificationValueProperty)
        {
            string usp = "usp_ClassificationValuePropertyUpdatePost @ClassificationValueId, @PropertyId, @PropertyInt, @PropertyBool, @PropertyDate, @PropertyString, @PropertyValueId, @UserId";

            _sqlDataAccess.SaveData <ClassificationValuePropertyCreateGet>(usp, ClassificationValueProperty);
            return(true);
        }
コード例 #2
0
        public async Task <IActionResult> Create(ClassificationValuePropertyCreateGet ClassificationValueProperty)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ClassificationValuePropertyCreateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationValuePropertyCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ClassificationValueProperty/Create", ClassificationValueProperty, token);

            if (ClassificationValuePropertyCreateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                var AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

                AllStuff.ErrorMessages = ClassificationValuePropertyCreateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;
                //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/ClassificationValueProperty/Create", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = ClassificationValuePropertyCreateGetWithErrorMessage.ErrorMessages;
                return(View(ClassificationValuePropertyCreateGetWithErrorMessage.ClassificationValueProperty));
            }

            return(RedirectToAction("Index", new { id = ClassificationValueProperty.ClassificationId }));
        }
コード例 #3
0
        public async Task <List <ErrorMessage> > CreatePostCheck(ClassificationValuePropertyCreateGet ClassificationValueProperty)
        {
            string usp           = "usp_ClassificationValuePropertyCreatePostCheck @ClassificationValueId, @PropertyId, @PropertyInt, @PropertyBool, @PropertyDate, @PropertyString, @PropertyValueId, @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationValueProperty);

            return(ErrorMessages);
        }
コード例 #4
0
        public async Task <IActionResult> Create(ClassificationValuePropertyCreateGet ClassificationValueProperty)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            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 _classificationValuePropertyProvider.CreatePostCheck(ClassificationValueProperty);

                if (ErrorMessages.Count > 0)
                {
                    ClassificationValueProperty = await CreateAddDropDownBoxes(ClassificationValueProperty, CurrentUser.Id, ClassificationValueProperty.ClassificationValueId);
                }
                else
                {
                    _classificationValuePropertyProvider.CreatePost(ClassificationValueProperty);
                }
                ClassificationValuePropertyCreateGetWithErrorMessages ClassificationValuePropertyWithErrorMessage = new ClassificationValuePropertyCreateGetWithErrorMessages {
                    ClassificationValueProperty = ClassificationValueProperty, ErrorMessages = ErrorMessages
                };
                return(Ok(ClassificationValuePropertyWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ClassificationValuePropertyCreateGetWithErrorMessages ClassificationValuePropertyWithNoRights = new ClassificationValuePropertyCreateGetWithErrorMessages {
                ClassificationValueProperty = ClassificationValueProperty, ErrorMessages = ErrorMessages
            };

            return(Ok(ClassificationValuePropertyWithNoRights));
        }
コード例 #5
0
        public async Task <ClassificationValuePropertyCreateGet> CreateGetPropertyType(string UserId, int PropertyId)
        {
            string usp          = "usp_ClassificationValuePropertyCreateGetPropertyType @UserId, @PropertyID";
            var    PropertyType = await _sqlDataAccess.LoadSingleRecord <ClassificationValuePropertyCreateGetPropertyType, dynamic>(usp, new { UserId, PropertyId });

            ClassificationValuePropertyCreateGet ClassificationValueProperty = new ClassificationValuePropertyCreateGet();

            ClassificationValueProperty.PropertyTypeId   = PropertyType.PropertyTypeId;
            ClassificationValueProperty.PropertyTypeName = PropertyType.PropertyTypeName;
            ClassificationValueProperty.PropertyId       = PropertyId;
            return(ClassificationValueProperty);
        }
コード例 #6
0
        public async Task <IActionResult> CreateProperty(ClassificationValuePropertyCreateGet ClassificationValueProperty)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            await _client.PostProtectedAsync <ClassificationValuePropertyCreateGet>($"{_configuration["APIUrl"]}api/ClassificationValueProperty/Create", ClassificationValueProperty, token);

            ViewBag.ClassificationValueProperty = ClassificationValueProperty;
            return(RedirectToAction("Create"));

            //PETER TODO the strucutre of this mothod should be different
        }
コード例 #7
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 ClassificationValueProperty = new ClassificationValuePropertyCreateGet();
                ClassificationValueProperty = await CreateAddDropDownBoxes(ClassificationValueProperty, CurrentUser.Id, Id);

                return(Ok(ClassificationValueProperty));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
コード例 #8
0
        private async Task <ClassificationValuePropertyCreateGet> CreateAddDropDownBoxes(ClassificationValuePropertyCreateGet ClassificationValueProperty, string UserId, int ClassificationValueId)
        {
            var Properties = await _classificationValuePropertyProvider.CreateGetProperties(UserId, ClassificationValueId);

            ClassificationValueProperty.Properties            = Properties;
            ClassificationValueProperty.ClassificationValueId = ClassificationValueId;
            return(ClassificationValueProperty);
        }