Ejemplo n.º 1
0
        public ResultCodeModel InsertAppTool(AppToolModel appTool)
        {
            _log.Info("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool() starting ...");
            ResultCodeModel result = null;

            if (AppToolValidation.ValidateInputAppTool(appTool))
            {
                if (_appToolAdapter == null)
                {
                    _log.Error(_appToolAdapterExceptionMessage);
                    result = new ResultCodeModel();
                    ErrorModel error = new ErrorModel(_appToolAdapterExceptionMessage, "Web AppTool Service");
                    _log.Error("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool(): " + _appToolAdapterExceptionMessage);
                    result.ErrorList.Add(error);
                }
                else
                {
                    result = _appToolAdapter.SaveAppTool(appTool);
                }
            }
            else
            {
                result = new ResultCodeModel();
                ErrorModel error = new ErrorModel("Invalid information input for this appTool", "Web AppTool Service");
                _log.Error("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool(): Invalid information input for this appTool");
                result.ErrorList.Add(error);
            }


            _log.Info("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool() ending ...");
            return(result);
        }
Ejemplo n.º 2
0
        public AppToolModel GetAppTool(string toolType)//(string personId, string toolType)
        {
            AppToolModel AppTool = null;

            string personId = ""; // TODO: get "individualId" from security context here, and use that value.

            if (AppToolValidation.ValidateSearchId(personId) && AppToolValidation.ValidateSearchId(toolType))
            {
                int searchId; int toolTypeId;
                if (Int32.TryParse(personId, out searchId) && Int32.TryParse(toolType, out toolTypeId))
                {
                    if (_appToolAdapter == null)
                    {
                        _log.Error(_appToolAdapterExceptionMessage);
                        AppTool = new AppToolModel();
                        ErrorModel error = new ErrorModel(_appToolAdapterExceptionMessage, "Web AppTool Service");
                        AppTool.ErrorList.Add(error);
                    }
                    else
                    {
                        AppTool = _appToolAdapter.GetAppTool(searchId, toolTypeId);
                    }
                }
            }
            else
            {
                AppTool = new AppToolModel();
                ErrorModel error = new ErrorModel("Invalid search criteria", "Web AppTool Service");
                AppTool.ErrorList.Add(error);
            }

            return(AppTool);
        }