Пример #1
0
 public BackupDatabaseCommand(ICommandPerformer<string> exec, Document value)
 {
     this.backupFolder = value.Settings.Keys.Any(x => x == Keys.BackupFolder) ? value.Settings[Keys.BackupFolder] : null;
     this.restoreFolder = value.Settings.Keys.Any(x => x == Keys.RestoreFolder) ? value.Settings[Keys.RestoreFolder] : null;
     this.database = value.Name;
     this.commmandExecutor = exec;
 }
Пример #2
0
        public CreateTableCommand(ICommandPerformer<string> exec, Entity value)
        {
            this.database = value.Schema.Name;
            this.schema = value.Settings[Keys.Namespace];
            this.table = value.Name;
            this.columns = value.Properties.Select(x =>
            {
                var result = new List<string> { x.Name, x.PropertyType };
                if (x.Settings.ContainsKey(Keys.Identity))
                {
                    result.Add(Keys.Identity + x.Settings[Keys.Identity]);
                }
                if (x.Settings.ContainsKey(Keys.IsNotSupportNull) && x.Settings[Keys.IsNotSupportNull].ToBoolean())
                {
                    result.Add("NOT NULL");
                }
                else
                {
                    result.Add("NULL");
                }
                return result.ToArray();
            }).ToArray();

            this.commmandExecutor = exec;
        }
 public CreatePrimaryKeyCommand(ICommandPerformer<string> exec, Property value)
 {
     this.database = value.Entity.Schema.Name;
     this.schema = value.Settings[Keys.Namespace];
     this.table = value.Entity.Name;
     this.field = value.Name;
     this.executor = exec;
 }
Пример #4
0
        public void Handle_CommandNotParsed_DoesNothing()
        {
            ICommandPerformer commandPerformer = null;

            this.commandParser.Setup(
                p => p.TryGetCommandPerformer(UnparsedCommand, out commandPerformer)).Returns(false);
            this.commandHandler.Handle(UnparsedCommand);
        }
Пример #5
0
 public InsertDataCommand(ICommandPerformer<string> exec, ICache cache, ITypeMapper mapper, EntityData value)
 {
     this.value = value;
     this.cache = cache;
     this.executor = exec;
     this.schema = cache.Pick<Document>();
     this.nameSpace = schema.Settings[Keys.Namespace];
     this.mapper = mapper;
     this.properties = schema.Entities.Single(x => x.Name == value.EntityName).Properties;
 }
Пример #6
0
 public BulkInsertDataCommand(ICache cache, ICommandPerformer<IBulkInsertDetails> executor, EntityData value)
 {
     this.value = value;
     var database = cache.Pick<Document>();
     this.schema = database.Settings[Keys.Namespace];
     this.database = database.Name;
     this.executor = executor;
     this.properties = database.Entities.Single(x => x.Name == value.EntityName).Properties.Select(x => x.Name).ToList();
     this.columnNumber = properties.Count();
 }
 public CreateForeignKeyCommand(ICommandPerformer<string> exec, Relation value)
 {
     this.database = value.Entity.Schema.Name;
     this.schema = value.Settings[Keys.Namespace];
     this.primaryTable = value.PrimaryEntity;
     this.foreignTable = value.ForeignEntity;
     this.primaryProperty = value.PrimaryProperty;
     this.foreignProperty = value.ForeignProperty;
     this.executor = exec;
 }
Пример #8
0
        public bool TryGetCommandPerformer(
            string unparsedCommand, out ICommandPerformer commandPerformer)
        {
            if (unparsedCommand == "REPORT")
            {
                commandPerformer = this.commandPerformerFactory.CreateReportPerformer();
                return(true);
            }

            commandPerformer = null;
            return(false);
        }
Пример #9
0
        public bool TryGetCommandPerformer(
            string unparsedCommand, out ICommandPerformer commandPerformer)
        {
            foreach (var commandParser in this.commandParsers)
            {
                if (commandParser.TryGetCommandPerformer(unparsedCommand, out commandPerformer))
                {
                    return(true);
                }
            }

            commandPerformer = null;
            return(false);
        }
Пример #10
0
        public bool TryGetCommandPerformer(
            string unparsedCommand, out ICommandPerformer commandPerformer)
        {
            var placeAndState = unparsedCommand.Split(' ');

            if (placeAndState.Length != 2 || placeAndState[0] != "PLACE")
            {
                commandPerformer = null;
                return(false);
            }

            var unparsedState = placeAndState[1].Split(',');

            if (unparsedState.Length != 3)
            {
                commandPerformer = null;
                return(false);
            }

            int xCoordinate;

            if (!int.TryParse(unparsedState[0], out xCoordinate))
            {
                commandPerformer = null;
                return(false);
            }

            int yCoordinate;

            if (!int.TryParse(unparsedState[1], out yCoordinate))
            {
                commandPerformer = null;
                return(false);
            }

            IOrientation orientation;

            if (!this.orientationParser.TryParse(unparsedState[2], out orientation))
            {
                commandPerformer = null;
                return(false);
            }

            commandPerformer = this.commandPerformerFactory.CreatePlacePerformer(
                xCoordinate, yCoordinate, orientation);
            return(true);
        }
Пример #11
0
 public void PerformWith(ICommandPerformer performer)
 {
     performer.SearchTrack();
 }
Пример #12
0
 public DeleteDatabaseCommand(ICommandPerformer<string> performaer, Document value)
     : base(performaer, value)
 {
 }
Пример #13
0
 public void PerformWith(ICommandPerformer performer)
 {
     performer.ShowPlaylist();
 }
Пример #14
0
 public void PerformWith(ICommandPerformer performer)
 {
     performer.AddNewTrack();
 }
Пример #15
0
 public CreateDatabaseCommand(ICommandPerformer<string> performaer, Document value)
 {
     this.database = value.Name;
     this.commmandExecutor = performaer;
 }
Пример #16
0
 public void Update(ICommandPerformer commandPerformer)
 {
     this.robotState = commandPerformer.Perform(this.robotState);
 }
Пример #17
0
 public void PerformWith(ICommandPerformer performer)
 {
     performer.DeleteTrack();
 }