public IQueryable <EmployeeHistory> GetAll()
 {
     using (var context = new ElysiumContext())
     {
         return(context.EmployeeHistory.AsQueryable());
     }
 }
 public EmployeeHistory GetById(Guid Id)
 {
     using (var context = new ElysiumContext())
     {
         return(context.EmployeeHistory.First(x => x.Id == Id));
     }
 }
Exemplo n.º 3
0
 public IQueryable <EmployeeSettings> GetAll()
 {
     using (var context = new ElysiumContext())
     {
         return(context.EmployeeSettings.AsQueryable());
     }
 }
Exemplo n.º 4
0
 public Employee GetById(Guid Id)
 {
     using (var context = new ElysiumContext())
     {
         context.Configuration.LazyLoadingEnabled = false;
         return(context.Employee.First(x => x.Id == Id));
     }
 }
Exemplo n.º 5
0
 public List <Employee> GetAll()
 {
     using (var context = new ElysiumContext())
     {
         context.Configuration.LazyLoadingEnabled = false;
         return(context.Employee.ToList());
     }
 }
Exemplo n.º 6
0
 public void Edit(Employee employee)
 {
     using (var context = new ElysiumContext())
     {
         var dbEmployee = context.Employee.Find(employee.Id);
         context.Entry(dbEmployee).CurrentValues.SetValues(employee);
         context.SaveChanges();
     }
 }
Exemplo n.º 7
0
        public void Add(Employee employee)
        {
            using (var context = new ElysiumContext())
            {
                context.Employee.Add(employee);

                context.SaveChanges();
            }
        }
        public void Add(EmployeeHistory employeeHistory)
        {
            using (var context = new ElysiumContext())
            {
                context.EmployeeHistory.Add(employeeHistory);

                context.SaveChanges();
            }
        }
Exemplo n.º 9
0
        public void Add(EmployeeSettings employeeSettings)
        {
            using (var context = new ElysiumContext())
            {
                context.EmployeeSettings.Add(employeeSettings);

                context.SaveChanges();
            }
        }
Exemplo n.º 10
0
        public void Delete(Guid Id)
        {
            using (var context = new ElysiumContext())
            {
                var employeeHistory = new EmployeeHistory()
                {
                    Id = Id
                };
                context.EmployeeHistory.Remove(employeeHistory);

                context.SaveChanges();
            }
        }
Exemplo n.º 11
0
        public void Delete(Guid Id)
        {
            using (var context = new ElysiumContext())
            {
                var employeeSettings = new EmployeeSettings()
                {
                    Id = Id
                };
                context.EmployeeSettings.Remove(employeeSettings);

                context.SaveChanges();
            }
        }
Exemplo n.º 12
0
        public static void Main(string[] args)
        {
            string configFileName;

            if (args.Length >= 1)
            {
                configFileName = args[0];
            }
            else
            {
                configFileName = "Load.json";
            }

            Console.Write("loading configuration...");
            var config = GetConfiguration(configFileName);

            Console.WriteLine("done!");

            Console.Write("starting orleans...");
            GrainClient.Initialize(GetOrleansConfiguration(config));
            Console.WriteLine("done!");

            try
            {
                Console.WriteLine($"loading dbc {nameof(MapDefinitionEntity)}");
                new DbcLoader <IMapDefinition, MapDefinitionEntity>(config.Dbc.Path).LoadEntities(GrainClient.GrainFactory);
                Console.WriteLine($"loading dbc {nameof(RaceDefinitionEntity)}");
                new DbcLoader <IRaceDefinition, RaceDefinitionEntity>(config.Dbc.Path).LoadEntities(GrainClient.GrainFactory);

                using (var context = new ElysiumContext(config.Sql.Address, config.Sql.Port, config.Sql.Schema, config.Sql.User, config.Sql.Password))
                {
                    Console.WriteLine($"loading sql {nameof(CharacterTemplateEntity)}");
                    new SqlLoader <ICharacterTemplate, CharacterTemplateEntity, PlayerCreateInfo>(context).LoadEntities(GrainClient.GrainFactory);
                    Console.WriteLine($"loading sql {nameof(CreatureDefinitionEntity)}");
                    new SqlLoader <ICreatureDefinition, CreatureDefinitionEntity, CreatureTemplate>(context).LoadEntities(GrainClient.GrainFactory);
                }
            }
            finally
            {
                Console.Write("stopping orleans...");
                GrainClient.Uninitialize();
                Console.WriteLine("done!");
            }

            if (Debugger.IsAttached)
            {
                Console.WriteLine("running with attached debugger; press enter to quit");
                Console.ReadLine();
            }
        }
Exemplo n.º 13
0
        public void Delete(Guid id)
        {
            using (var context = new ElysiumContext())
            {
                var employee = new Employee()
                {
                    Id = id
                };

                var settings = new EmployeeSettings {
                    Id = id
                };
                context.Entry(settings).State = EntityState.Deleted;
                context.SaveChanges();

                context.Employee.Attach(employee);
                context.Entry(employee).State = EntityState.Deleted;
                context.SaveChanges();
            }
        }