コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: CharlierIsabelle/Henalux
        public async Task AssertCustomerExists()
        {
            var context = new CompanyContext();
            var numberOfCustomers = await context.Customers.CountAsync();
            Assert.IsTrue(numberOfCustomers > 0);

        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: CharlierIsabelle/Henalux
        public void DetecteLesEditionsConcurrentes()
        {
            var contexteDeJohn = new CompanyContext();
            var clientDeJohn = contexteDeJohn.Customers.First();

            var contexteDeSarah = new CompanyContext();
            var clientDeSarah = contexteDeSarah.Customers.First();

            clientDeJohn.AccountBalance += 1000;
            contexteDeJohn.SaveChanges();

            clientDeSarah.AccountBalance += 2000;
            contexteDeSarah.SaveChanges();

        }
コード例 #3
0
        private Employee GetEmployee(ApplicationUser user)
        {
            using (var context = new CompanyContext())
            {
                var employees = from employee in context.Employees
                                where employee.EmployeeId == user.Id
                                select employee;

                foreach (var e in employees)
                {
                    return e;
                }
            }

            return null;
        }
コード例 #4
0
        private ApplicationUser LoggedInUser()
        {
            var userId = User.Identity.GetUserId();
            using (var context = new CompanyContext())
            {
                var users = from u in context.Users
                            where u.Id == userId
                            select u;

                foreach (var u in users)
                {
                    return u;
                }
            }

            return null;
        }
コード例 #5
0
 public ActionResult Completed(string id)
 {
     var user = LoggedInUser();
     using (var context = new CompanyContext())
     {
         var tasks = from task in context.Tasks
                     where task.EmployeeId == user.Id && task.TaskId == id
                     select task;
         foreach (var t in tasks)
         {
             t.EndDate = DateTime.Now;
             t.Status = "COMPLETED";
         }
         context.SaveChanges();
     }
     return View();
 }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: CharlierIsabelle/Henalux
 public async Task InsertionFonctionnelle()
 {
     Database.SetInitializer(new DropCreateDatabaseAlways<CompanyContext>());
     CompanyContext context = new CompanyContext();
     Customer customer = new Customer()
     {
         Name = "Albert Dupont",
         AddressLine1 = "Rue des cerisiers, 16",
         City = "Arlon",
         Country = "Belgique",
         EMail = "*****@*****.**",
         Id = 3,
         Remark = "Ne pas avoir peur des chiens pour aller chez ce client",
         PostCode = "6700"
     };
     context.Customers.Add(customer);
     context.SaveChanges();
     await AssertCustomerExists();
 }
コード例 #7
0
 static MyConfiguration()
 {
     _context   = new CompanyContext();//CompanyContext.GetContext();
     unitOfWork = new UnitOfWork(_context);
     mapper     = MappingConfiguration.ConfigurationMapper().CreateMapper();
 }
コード例 #8
0
 public EmployeeController()
 {
     db = new CompanyContext();
 }
コード例 #9
0
 public SupplierProcessNpracticeController(CompanyContext context)
 {
     _CompanyContext = context;
 }
コード例 #10
0
 public EmpRepo(CompanyContext temp) : base(temp)
 {
     cc = temp;
 }
コード例 #11
0
 public ProgressEmployeesController(CompanyContext context)
 {
     _context = context;
 }
コード例 #12
0
 public EmployeeService(CompanyContext context)
     : base(context)
 {
 }
コード例 #13
0
 public CategoryController()
 {
     _context = new CompanyContext();
 }
コード例 #14
0
ファイル: ProjectRepository.cs プロジェクト: Grellinn/Company
 public ProjectRepository(CompanyContext context)
 {
     this.context = context;
 }
コード例 #15
0
        private ActionResult Tasks(bool completed)
        {
            var employee = LoggedInUser();
            IEnumerable<Task> tasks;

            using (var context = new CompanyContext())
            {
                tasks = from task in context.Tasks
                        where task.EmployeeId == employee.Id && (completed ? task.Status == "COMPLETED" : task.Status == "OPENED")
                        orderby task.Deadline
                        select task;
                tasks = tasks.ToList();
            }

            return View(tasks);
        }
コード例 #16
0
 public EmployeePlansController(CompanyContext context)
 {
     _context = context;
 }
コード例 #17
0
 public Repositry(CompanyContext company)
 {
     Company = company;
 }
コード例 #18
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     _context = new CompanyContext(@"Data Source=vm-sql.iesn.be\Stu3IG;User ID=IG3A8;Password=pwUserdb39");
     _customer = _context.Customers.First();
     Formulaire.DataContext = _customer;
 }
コード例 #19
0
 public TodoItemsController(CompanyContext context)
 {
     _context = context;
 }
コード例 #20
0
 public HourlyPaidEmployeeController(CompanyContext db)
 {
     _db = db;
 }
コード例 #21
0
ファイル: ClientRepository.cs プロジェクト: Grellinn/Company
 public ClientRepository(CompanyContext context)
 {
     this.context = context;
 }
コード例 #22
0
 public BaseRepo(CompanyContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #23
0
 public PrivateLimitedModel(CompanyContext context)
 {
     _context = context;
 }
コード例 #24
0
 public CoinTypeService(CompanyContext context)
 {
     _repo = new CoinRepo(context);
 }
コード例 #25
0
 public EmployeeController(IEmployeeService employeeService, IService <IEmployee> service, IDepartmentService departmentService, IMapper mapper, CompanyContext context)
 {
     this.employeeService   = employeeService;
     this.service           = service;
     this.departmentService = departmentService;
     this.mapper            = mapper;
 }
コード例 #26
0
 public ReviewLogic()
 {
     _reviewContext  = new ReviewContext();
     _companyContext = new CompanyContext();
 }
コード例 #27
0
 public CompaniesController(CompanyContext db)
 {
     _db = db;
 }
コード例 #28
0
 public OrderController(CompanyContext context)
 {
     _context = context;
 }
コード例 #29
0
 /// <summary>
 /// Instance an new instance of the class <see cref="CompanyExampleTest"/>.
 /// </summary>
 public CompanyExampleTestRemoting()
 {
     companyExampleContext = new CompanyContext(ClientEnvironment.GetInstanceRemoting(ServiceConstants.SqlServiceName).QueryHandler);
 }
コード例 #30
0
 public EmployeeFactsController(CompanyContext context)
 {
     _context = context;
 }
コード例 #31
0
 public TaskService(CompanyContext context)
     : base(context)
 {
 }
コード例 #32
0
 public CompanyRepository(CompanyContext db)
 {
     _db = db;
 }
コード例 #33
0
 public CompanyService(CompanyContext companyContext, OrderContext orderContext)
 {
     _companyContext = companyContext;
     _orderContext   = orderContext;
 }
コード例 #34
0
 public EmployeeServices(CompanyContext _context)
 {
     departmentRepo = new Repository <CompanyDepartment>(_context);
     employeeRepo   = new Repository <CompanyEmployee>(_context);
 }
コード例 #35
0
        public static void EnsureSeedDataForContext(this CompanyContext context)
        {
            if (context.Companies.Any())
            {
                return;
            }

            var companies = new List <Company>()
            {
                new Company()
                {
                    Name        = "Microsoft",
                    Description =
                        "Microsoft Corporation is an American multinational technology company with headquarters in Redmond, Washington.",
                    Founded      = new DateTime(1975, 4, 4),
                    Technologies = new List <Technology>()
                    {
                        new Technology()
                        {
                            Name        = "C#",
                            Description =
                                "a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.",
                            Appeared = new DateTime(2000, 1, 1)
                        },
                        new Technology()
                        {
                            Name        = "Typescript",
                            Description =
                                "It is a strict syntactical superset of JavaScript, and adds optional static typing to the language. ",
                            Appeared = new DateTime(2012, 1, 1)
                        },
                        new Technology()
                        {
                            Name        = "F#",
                            Description =
                                "a strongly typed, multi-paradigm programming language that encompasses functional, imperative, and object-oriented programming methods.",
                            Appeared = new DateTime(2005, 1, 1)
                        }
                    }
                },
                new Company()
                {
                    Name        = "Apple",
                    Description =
                        "Apple Inc. is an American multinational technology company headquartered in Cupertino, California that designs, develops, and sells consumer electronics, computer software, and online services.",
                    Founded      = new DateTime(1976, 4, 1),
                    Technologies = new List <Technology>()
                    {
                        new Technology()
                        {
                            Name        = "Objective-c",
                            Description =
                                "It was the main programming language used by Apple for the OS X and iOS operating systems, and their respective application programming interfaces (APIs) Cocoa and Cocoa Touch prior to the introduction of Swift.",
                            Appeared = new DateTime(1984, 1, 1)
                        },
                        new Technology()
                        {
                            Name        = "Swift",
                            Description =
                                "Swift is designed to work with Apple\'s Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C (ObjC) code written for Apple products.",
                            Appeared = new DateTime(2014, 1, 1)
                        }
                    }
                }
            };

            context.Companies.AddRange(companies);
            context.SaveChanges();
        }
コード例 #36
0
 public CustomerController(CompanyContext context)
 {
     _context = context;
 }
コード例 #37
0
 public ProvidersController(CompanyContext context)
 {
     _context = context;
 }
コード例 #38
0
 public ManagerController(CompanyContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
コード例 #39
0
 public EmployeesController(CompanyContext db)
 {
     _db = db;
 }
コード例 #40
0
 public DepartmentRepository(CompanyContext db)
 {
     this.db = db;
 }
コード例 #41
0
ファイル: ExpenseRepository.cs プロジェクト: Grellinn/Company
 public ExpenseRepository(CompanyContext context)
 {
     this.context = context;
 }
コード例 #42
0
ファイル: IncomeRepository.cs プロジェクト: Grellinn/Company
 public IncomeRepository(CompanyContext context)
 {
     this.context = context;
 }