Exemple #1
0
      private static void MigrateCommandCentre()
      {
          cokecommandroutingEntities db = new cokecommandroutingEntities();
          System.Console.WriteLine("==================================================================");
          System.Console.WriteLine("Start migrating Migrate Command Centre");
          System.Console.WriteLine("==================================================================");
          string connection = ConfigurationSettings.AppSettings["MongoRoutingConnectionString"];
          CommandRoutingOnRequestMongoRepository _repo = new CommandRoutingOnRequestMongoRepository(connection);
          int count = 0;
          foreach (tblRoutingCentre cmd in db.tblRoutingCentres.OrderBy(o => o.tblDistributrCommand.Id))
          {
              CommandRouteOnRequestCostcentre cmdmongo = new CommandRouteOnRequestCostcentre();
              cmdmongo.CommandType =cmd.tblDistributrCommand.CommandType;
              cmdmongo.DateAdded = cmd.tblDistributrCommand.DateCommandInserted;
              cmdmongo.CommandRouteOnRequestId = cmd.tblDistributrCommand.Id;
              cmdmongo.CostCentreId = cmd.RoutingCostCentreId;
              cmdmongo.IsRetired = cmd.tblDistributrCommand.IsRetired;
              cmdmongo.IsValid = cmd.Valid;
              cmdmongo.Id = Guid.NewGuid();
              
              _repo.AddRoutingCentre(cmdmongo);
              count++;

          }
          System.Console.WriteLine("==================================================================");
          System.Console.WriteLine(count + " Migrate Command Centre migrated");
          System.Console.WriteLine("==================================================================");
          

      }
Exemple #2
0
 public void AddRoutingCentre(CommandRouteOnRequestCostcentre commandRouteOnRequestCostcentre)
 {
     //commandRouteOnRequestCostcentre.IsValid = true;
     commandRouteOnRequestCostcentre.DateAdded = DateTime.Now;
     _CommandRouteOnRequestCostcentreCollection.Save(commandRouteOnRequestCostcentre);
 }