Exemple #1
0
        public String FillSucessMessage(ApplicationMetadata applicationMetadata, string id, string operation)
        {
            string successMessage     = null;
            var    applicationCommand = ApplicationCommandUtils.GetApplicationCommand(applicationMetadata, operation);

            if (applicationCommand != null)
            {
                successMessage = applicationCommand.SuccessMessage;
            }
            else
            {
                //TODO: refactor this
                var baseMessage = applicationMetadata.Title + (id == null ? " " : " " + id + " ");
                switch (operation)
                {
                case OperationConstants.CRUD_CREATE:
                    return(baseMessage + Resolver.I18NValue("messagesection.success.created", "successfully created"));

                case OperationConstants.CRUD_UPDATE:
                    return(baseMessage + Resolver.I18NValue("messagesection.success.updated", "successfully updated"));

                case OperationConstants.CRUD_DELETE:
                    return(baseMessage + Resolver.I18NValue("messagesection.success.deleted", "successfully deleted"));

                default:
                    return(Resolver.I18NValue("messagesection.success." + operation.ToLower(), "Operation Executed successfully", null, new object[] { id }));
                }
            }
            return(successMessage);
        }
        /// <summary>
        /// First tries to locate the next schema from the command. If its not specified, then fallbacks for locating it from a schema property.
        ///  if not specified, continues on the current schema
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="currentschemaKey"></param>
        /// <param name="platform"></param>
        /// <param name="applicationMetadata"></param>
        /// <returns></returns>
        public ApplicationMetadataSchemaKey ResolveNextSchemaKey(string operation,
                                                                 ApplicationMetadataSchemaKey currentschemaKey, ClientPlatform platform,
                                                                 ApplicationMetadata applicationMetadata)
        {
            string nextSchemaId;
            var    applicationCommand = ApplicationCommandUtils.GetApplicationCommand(applicationMetadata, operation);

            if (applicationCommand != null && !String.IsNullOrWhiteSpace(applicationCommand.NextSchemaId))
            {
                nextSchemaId = applicationCommand.NextSchemaId;
            }
            else
            {
                //TODO: adjust metadatas to allow the entire schema string representation as a property ==> "nextschema.schema"
                nextSchemaId = applicationMetadata.Schema.Properties["nextschema.schemaid"];
            }

            if (String.IsNullOrWhiteSpace(nextSchemaId))
            {
                //if none set, consider that the application should stay on the same schema
                return(currentschemaKey);
            }
            //TODO: what about the mode?suppose the scenario, where we have to schemas named detail, one for input other for output...
            return(GetSchemaKeyFromString(applicationMetadata.Name, nextSchemaId + ".." + platform, platform));
        }