Ejemplo n.º 1
0
      private static void MigrateCommandStatus()
      {
          cokecommandroutingEntities db = new cokecommandroutingEntities();
          System.Console.WriteLine("==================================================================");
          System.Console.WriteLine("Start Migrating  Command Status");
          System.Console.WriteLine("==================================================================");
          string connection = ConfigurationSettings.AppSettings["MongoRoutingConnectionString"];
          CommandRoutingOnRequestMongoRepository _repo = new CommandRoutingOnRequestMongoRepository(connection);
          int count = 0;
          foreach (tblRoutingStatu cmd in db.tblRoutingStatus.OrderBy(o => o.tblDistributrCommand.Id))
          {
              CommandRoutingStatus cmdmongo = new CommandRoutingStatus();
              cmdmongo.DateAdded = cmd.tblDistributrCommand.DateCommandInserted;
              cmdmongo.CommandRouteOnRequestId = cmd.tblDistributrCommand.Id;
              cmdmongo.DateAdded = DateTime.Now;
              cmdmongo.Delivered = true;
              cmdmongo.DateDelivered = DateTime.Now;
              cmdmongo.DestinationCostCentreApplicationId = cmd.DestinationCostCentreApplicationId;
              cmdmongo.CommandRouteOnRequestId = cmd.tblDistributrCommand.Id;
              cmdmongo.CommandId = cmd.tblDistributrCommand.CommandId;
              cmdmongo.Id = Guid.NewGuid();
              try
              {
                  _repo.AddStatus(cmdmongo);
                  count++;
              }catch{}
             

          }
          System.Console.WriteLine("==================================================================");
          System.Console.WriteLine(count + " Migrate Command Status migrated");
          System.Console.WriteLine("==================================================================");  
      }
Ejemplo n.º 2
0
 public void AddStatus(CommandRoutingStatus commandRoutingStatus)
 {
     _commandRoutingStatusCollection.Save(commandRoutingStatus);
 }