public Task Execute(IJobExecutionContext context) { var students = StoredProcedure.GetFrequenciesAllResult(80); var contextOptions = new DbContextOptionsBuilder <ApplicationDBContext>() .UseSqlServer(@"Server=DESKTOP-B1TS7RO;Database=CRM_UniversityDB;Trusted_Connection=True;MultipleActiveResultSets=true") .Options; var context2 = new ApplicationDBContext(contextOptions); var uow = new UnitOfWorkRepository(context2); var emailLogs = uow.EmailLogRepository.List(); var dateNowMonth = DateTime.Now.Month; foreach (var student in students) { if (emailLogs.FirstOrDefault(e => e.StudentId == student.StudentId) is null) { var message = "Դուք ստացել եք նկատողություն 80 ժամից ավել բացակայելու պատճառով"; EmailSender.SendEmail(student.Email, message); ReprimandedStudent reprimandedStudent = new ReprimandedStudent(); reprimandedStudent.StudentId = student.StudentId; reprimandedStudent.DateOfReprimand = DateTime.Now; uow.ReprimandedStudentRepository.Save(reprimandedStudent); uow.EmailLogRepository.Save(new EmailLog { StudentId = student.StudentId, SendEmailDate = DateTime.Now, AlertType = AlertType.SentForAssessment }); } } return(null); }
public static void RemovePizza(PizzaModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var pizza = PizzaFactory.ConvertPizzaModel(model); unitOfWork.PizzaRepository.RemovePizza(pizza.Id); }
public OrdersController(ApplicationDbContext context, IProduct product, ICustomer customer) { _uow = new UnitOfWorkRepository(context); _product = product; _customer = customer; _context = context; }
public static void RemoveBottom(BottomModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var bottom = BottomFactory.ConvertBottom(model); unitOfWork.BottomRepository.RemoveBottom(bottom.Id); }
public void Execute(IEnumerable <IAggregateCommand> commands, int expectedVersion) { var bus = new UnitOfWorkEventBus(this.context.EventBus); using (bus) { var scope = this.context.BeginUnitOfWork(); using (scope) { var uow = new UnitOfWorkRepository <T>(this.context.GetAggregateRepository <T>(bus)); // uow will be owned by the scope, so we don't need to dispose explicitly scope.Add(uow); var cmd = new CommandExecutor <T>(uow); foreach (var command in commands.ToList()) { cmd.Execute(command, 0); } Console.WriteLine("DomainCommandExecutor - commit scope"); scope.Commit(); } Console.WriteLine("DomainCommandExecutor - commit bus"); bus.Commit(); } }
public static void RemoveUser(UserModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var user = UserFactory.ConvertUser(model); unitOfWork.UserRepository.RemoveUser(user.Id); }
public static void RemoveOrder(OrderModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var order = OrderFactory.ConvertOrderModel(model); unitOfWork.OrderRepository.RemoveOrder(order.Id); }
public static void RemoveIngredient(IngredientModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var ingredient = IngredientFactory.ConvertIngredientModel(model); unitOfWork.IngredientRepository.RemoveIngredient(ingredient.Id); }
public ChatController(UserManager <SecureChat.DAL.User> userManager, MessagesDBContext context, SignInManager <SecureChat.DAL.User> signInManager, IMessage message, IUser user) { _uow = new UnitOfWorkRepository(userManager, context, signInManager); _message = message; _user = user as SecureChat.DAL.User; }
public static void RemoveSauce(SauceModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var sauce = SauceFactory.ConvertSauce(model); unitOfWork.SauceRepository.RemoveSauce(sauce.Id); }
public static OrderModel GetOrder(Guid userID) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var orders = unitOfWork.OrderRepository.GetAllOrders(); var model = OrderModelFactory.ConvertOrder(orders.Where(x => x.UserId == userID).FirstOrDefault()); return(model); }
public static UserModel UpdateUser(UserModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var user = UserFactory.ConvertUser(model); unitOfWork.UserRepository.UpdateUser(user); return(model); }
public static UserModel GetUserById(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var user = unitOfWork.UserRepository.GetUserId(Id); var model = UserModelFactory.ConvertUser(user); return(model); }
public void CreateCostumer() { UnitOfWorkRepository UnitOfWork = new UnitOfWorkRepository(); Customer costumer = new Customer { Id = Guid.NewGuid(), Name = "mickey", EmailAddress = "Test", Password = "******" }; //UnitOfWork.CustomerRepository.Add(costumer); }
public static PizzaModel GetPizza(Guid id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var pizzas = unitOfWork.PizzaRepository.GetPizzaId(id); var model = PizzaModelFactory.ConvertPizza(pizzas); return(model); }
public MessageController(IUnitOfWOrkRepositroy unitOfWOrkRepositroy, IMapper mapper, IUser userTo, IPost post, IMessage message) { _uow = (UnitOfWorkRepository)unitOfWOrkRepositroy; _mapper = mapper; _userTo = userTo; _post = post; _message = message; }
public static SauceModel GetSauce(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var sauce = unitOfWork.SauceRepository.GetSauceId(Id); var model = ConvertSauce(sauce); return(model); }
public static List <SauceModel> GetAllSauces() { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var sauces = unitOfWork.SauceRepository.GetAllSauce(); var models = SauceModelFactory.ConvertSauces(sauces); return(models); }
public static OrderModel GetOrderModel(Guid Id) { UnitOfWorkRepository unitofWork = new UnitOfWorkRepository(); var order = unitofWork.OrderRepository.GetOrderId(Id); var model = ConvertOrder(order); return(model); }
public OrderController(IUnitOfWOrkRepositroy unitOfWOrkRepositroy, IMapper mapper, IUser userTo, IProduct product, IPost post) { this._uow = (UnitOfWorkRepository)unitOfWOrkRepositroy; this._mapper = mapper; this._userTo = userTo; this._product = product; this._post = post; }
public static PizzaModel GetPizzaModel(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var pizza = unitOfWork.PizzaRepository.GetPizzaId(Id); var model = ConvertPizza(pizza); return(model); }
public static List <BottomModel> GetAllBottoms() { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var bottoms = unitOfWork.BottomRepository.GetAllBottoms(); var models = BottomModelFacotry.ConvertBottoms(bottoms); return(models); }
public static BottomModel AddBottom(BottomModel model) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); model.Id = Guid.NewGuid(); unitOfWork.BottomRepository.AddBottom(BottomFactory.ConvertBottom(model)); return(model); }
public static PizzaIngredientModel GetPizzaIngredientModel(Guid Id) { UnitOfWorkRepository unitOfWorkRepository = new UnitOfWorkRepository(); var pizIng = unitOfWorkRepository.PizzaIngredientRepository.GetPizza_Ingredient(Id); var model = ConvertPizzaIngredient(pizIng); return(model); }
public static UserModel GetUser(string username, string password) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var user = unitOfWork.UserRepository.GetUser(username, password); var model = UserModelFactory.ConvertUser(user); return(model); }
public static List <UserModel> GetUsers() { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var users = unitOfWork.UserRepository.GetUsers(); var models = UserModelFactory.ConvertUsers(users); return(models); }
public static BottomModel GetBottomModel(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var bottom = unitOfWork.BottomRepository.GetBottom(Id); var model = ConvertBottom(bottom); return(model); }
public static OrderRuleModel GetOrderRuleModel(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var orderrule = unitOfWork.OrderRuleRepository.GetOrderRule(Id); var model = ConvertOrderRule(orderrule); return(model); }
public static List <IngredientModel> GetIngredients() { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var ingredients = unitOfWork.IngredientRepository.GetAllIngredients(); var models = IngredientModelFactory.ConvertIngredients(ingredients); return(models); }
public static IngredientModel GetIngredient(Guid Id) { UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository(); var ingredient = unitOfWork.IngredientRepository.GetIngredient(Id); var model = IngredientModelFactory.ConvertIngredient(ingredient); return(model); }
public override void SetUp() { base.SetUp(); this.UnitOfWork = new UnitOfWorkRepository<IdTest>(this.Repository); }