Example #1
0
        public async Task AssertCustomerExists()
        {
            var context = new CompanyContext();
            var numberOfCustomers = await context.Customers.CountAsync();
            Assert.IsTrue(numberOfCustomers > 0);

        }
Example #2
0
        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();

        }
        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;
        }
        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;
        }
 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();
 }
Example #6
0
 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();
 }
Example #7
0
 static MyConfiguration()
 {
     _context   = new CompanyContext();//CompanyContext.GetContext();
     unitOfWork = new UnitOfWork(_context);
     mapper     = MappingConfiguration.ConfigurationMapper().CreateMapper();
 }
Example #8
0
 public EmployeeController()
 {
     db = new CompanyContext();
 }
Example #9
0
 public SupplierProcessNpracticeController(CompanyContext context)
 {
     _CompanyContext = context;
 }
Example #10
0
 public EmpRepo(CompanyContext temp) : base(temp)
 {
     cc = temp;
 }
Example #11
0
 public ProgressEmployeesController(CompanyContext context)
 {
     _context = context;
 }
Example #12
0
 public EmployeeService(CompanyContext context)
     : base(context)
 {
 }
Example #13
0
 public CategoryController()
 {
     _context = new CompanyContext();
 }
Example #14
0
 public ProjectRepository(CompanyContext context)
 {
     this.context = context;
 }
        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);
        }
 public EmployeePlansController(CompanyContext context)
 {
     _context = context;
 }
 public Repositry(CompanyContext company)
 {
     Company = company;
 }
 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;
 }
 public TodoItemsController(CompanyContext context)
 {
     _context = context;
 }
Example #20
0
 public HourlyPaidEmployeeController(CompanyContext db)
 {
     _db = db;
 }
Example #21
0
 public ClientRepository(CompanyContext context)
 {
     this.context = context;
 }
Example #22
0
 public BaseRepo(CompanyContext dbContext)
 {
     _dbContext = dbContext;
 }
 public PrivateLimitedModel(CompanyContext context)
 {
     _context = context;
 }
Example #24
0
 public CoinTypeService(CompanyContext context)
 {
     _repo = new CoinRepo(context);
 }
Example #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;
 }
Example #26
0
 public ReviewLogic()
 {
     _reviewContext  = new ReviewContext();
     _companyContext = new CompanyContext();
 }
Example #27
0
 public CompaniesController(CompanyContext db)
 {
     _db = db;
 }
Example #28
0
 public OrderController(CompanyContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Instance an new instance of the class <see cref="CompanyExampleTest"/>.
 /// </summary>
 public CompanyExampleTestRemoting()
 {
     companyExampleContext = new CompanyContext(ClientEnvironment.GetInstanceRemoting(ServiceConstants.SqlServiceName).QueryHandler);
 }
 public EmployeeFactsController(CompanyContext context)
 {
     _context = context;
 }
Example #31
0
 public TaskService(CompanyContext context)
     : base(context)
 {
 }
 public CompanyRepository(CompanyContext db)
 {
     _db = db;
 }
Example #33
0
 public CompanyService(CompanyContext companyContext, OrderContext orderContext)
 {
     _companyContext = companyContext;
     _orderContext   = orderContext;
 }
 public EmployeeServices(CompanyContext _context)
 {
     departmentRepo = new Repository <CompanyDepartment>(_context);
     employeeRepo   = new Repository <CompanyEmployee>(_context);
 }
        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();
        }
Example #36
0
 public CustomerController(CompanyContext context)
 {
     _context = context;
 }
Example #37
0
 public ProvidersController(CompanyContext context)
 {
     _context = context;
 }
Example #38
0
 public ManagerController(CompanyContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #39
0
 public EmployeesController(CompanyContext db)
 {
     _db = db;
 }
Example #40
0
 public DepartmentRepository(CompanyContext db)
 {
     this.db = db;
 }
Example #41
0
 public ExpenseRepository(CompanyContext context)
 {
     this.context = context;
 }
Example #42
0
 public IncomeRepository(CompanyContext context)
 {
     this.context = context;
 }