public void Delete()
        {
            using (var context = new MainContext())
            {
                var myRepo = new Repository<Core.Customer>(context);
                TotalCustomersBeforeTestRuns = myRepo.GetAll().Count();

                var allEntities = myRepo.GetAll().ToList();
                if (allEntities.Count > 0)
                {
                    //Find an entity to be removed.
                    var firstClientInTheDb = allEntities.FirstOrDefault();

                    //Check if there is an entity to be removed
                    if (firstClientInTheDb != null)
                    {
                        myRepo.Remove(firstClientInTheDb.Id);
                        myRepo.Save();

                        TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count();

                        // Check if the total number of entites was reduced by one.
                        Assert.AreEqual(TotalCustomersBeforeTestRuns - 1, TotalOfClientsAfterTheTestRuns);
                    }

                }
            }
        }
 public static List<UserLocationDO> GetAll()
 {
     Repository<vBO_UserLocation> rep = new Repository<vBO_UserLocation>(CheckoutDataContextProvider.Instance);
     List<vBO_UserLocation> rawLst = rep.GetAll().ToList();
     List<UserLocationDO> lst = Mapper.Map<List<vBO_UserLocation>, List<UserLocationDO>>(rawLst);
     return Mapper.Map<List<vBO_UserLocation>, List<UserLocationDO>>(rep.GetAll().ToList());
 }
 public void AddTest()
 {
     IRepository<Pacient> rep = new Repository<Pacient>(path);
     int i = rep.GetAll().Count();
     rep.Save(new Pacient() { Id = 10, FirstName = "2", LastName = "3" });
     Assert.AreEqual(i + 1, rep.GetAll().Count());
 }
        public void Insert()
        {
            using (var context = new MainContext())
            {
                var myRepo = new Repository<Address>(context);
                TotalAdresssBeforeTestRuns = myRepo.GetAll().Count();

                //Have to provide a valid name and e-mail address
                MyNewAddress = new Address
                {
                    AddressLine1 = "Barão de Mesquita Street",
                    AddressLine2 = "Tijuca",
                    Country = MyCountryTest,
                    State = "RJ",
                    Zip = "20540-156"
                };

                myRepo.Add(MyNewAddress);
                myRepo.Save();

                TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count();

                //Assert that the number of clients increase by 1
                Assert.AreEqual(TotalAdresssBeforeTestRuns + 1, TotalOfClientsAfterTheTestRuns);
            }
        }
Example #5
0
        public void GetAll()
        {
            Repository repository = new Repository();

            List<UserModel> userList = repository.GetAll<UserModel>();
            List<ProjectModel> projects = repository.GetAll<ProjectModel>();
            List<ActivityModel> activities = repository.GetAll<ActivityModel>();
            List<ProjectUser> projectsUsers = repository.GetAll<ProjectUser>();
        }
        public void BasicCrud()
        {
            using (var trans = DataSource.BeginTransaction())
            {

                var repo = new Repository<Employee, int>(trans, EmployeeTableName);

                var emp1 = new Employee() { FirstName = "Tom", LastName = "Jones", Title = "President" };
                var echo1 = repo.Insert(emp1);

                Assert.AreNotEqual(0, echo1.EmployeeKey, "EmployeeKey was not set");
                Assert.AreEqual(emp1.FirstName, echo1.FirstName, "FirstName");
                Assert.AreEqual(emp1.LastName, echo1.LastName, "LastName");
                Assert.AreEqual(emp1.Title, echo1.Title, "Title");

                echo1.MiddleName = "G";
                repo.Update(echo1);

                var emp2 = new Employee() { FirstName = "Lisa", LastName = "Green", Title = "VP Transportation", ManagerKey = echo1.EmployeeKey };
                var echo2 = repo.Insert(emp2);
                Assert.AreNotEqual(0, echo2.EmployeeKey, "EmployeeKey was not set");
                Assert.AreEqual(emp2.FirstName, echo2.FirstName, "FirstName");
                Assert.AreEqual(emp2.LastName, echo2.LastName, "LastName");
                Assert.AreEqual(emp2.Title, echo2.Title, "Title");
                Assert.AreEqual(emp2.ManagerKey, echo2.ManagerKey, "ManagerKey");

                var list = repo.GetAll();
                Assert.IsTrue(list.Any(e => e.EmployeeKey == echo1.EmployeeKey), "Employee 1 is missing");
                Assert.IsTrue(list.Any(e => e.EmployeeKey == echo2.EmployeeKey), "Employee 2 is missing");

                var get1 = repo.Get(echo1.EmployeeKey.Value);
                Assert.AreEqual(echo1.EmployeeKey, get1.EmployeeKey);



                var whereSearch1 = repo.Query("FirstName = @FN", new { FN = "Tom" });
                Assert.IsTrue(whereSearch1.Any(x => x.EmployeeKey == echo1.EmployeeKey), "Emp1 should have been returned");
                Assert.IsTrue(whereSearch1.All(x => x.FirstName == "Tom"), "Checking for incorrect return values");

                var whereSearch2 = repo.Query(new { FirstName = "Tom" });
                Assert.IsTrue(whereSearch2.Any(x => x.EmployeeKey == echo1.EmployeeKey), "Emp1 should have been returned");
                Assert.IsTrue(whereSearch2.All(x => x.FirstName == "Tom"), "Checking for incorrect return values");


                repo.Delete(echo2.EmployeeKey.Value);
                repo.Delete(echo1.EmployeeKey.Value);

                var list2 = repo.GetAll();
                Assert.AreEqual(list.Count - 2, list2.Count);

                trans.Commit();
            }

        }
 public void DeleteTest()
 {
     IRepository<Pacient> rep = new Repository<Pacient>(path);
     int i = rep.GetAll().Count();
     rep.Remove(10);
     if (i > 0)
     {
         i--;
     }
     else
     {
         i = 0;
     }
     Assert.AreEqual(rep.GetAll().Count(), i);
 }
Example #8
0
        public List<player> findAll()
        {
            Repository<player> players = new Repository<player>();
            List<player> list = (List<player>)players.GetAll().ToList();

            return list;
        }
        public UserControl Initialize(ActionBarView actionBar, string databaseName)
        {
            mDatabaseName = databaseName;
            UserControl view = new ArtikelverwaltungView();

            mArticleRepository =
                new Repository<Article>(
                    databaseName);

            mViewModel = new ArtikelverwaltungViewModel()
            {
                Articles = new ObservableCollection<Article>(mArticleRepository.GetAll()),
                SelectedArticle = null
            };
            view.DataContext = mViewModel;

            actionBar.DataContext = new ActionBarViewModel
            {
                Command1 = new RelayCommand(AddCommandExecute),
                Command2 = new RelayCommand(DeleteCommandExecute, DeleteCommandCanExecute),
                Command3 = new RelayCommand(SaveCommandExecute, SaveCommandCanExecute),
                Command4 = new RelayCommand(ImportCommandExecute),
                Command1Text = "Neu",
                Command2Text = "Löschen",
                Command3Text = "Speichern",
                Command4Text = "Importieren"
            };

            return view;
        }
 public void GivenAnExistingProductFile_WhenRepositoryIsCreated_ProductsShouldBeLoaded()
 {
     var repository = new Repository<Product>(@"Products.json");
     var products = repository.GetAll();
     Assert.IsNotNull(products);
     Assert.IsTrue(products.Count == 7);
 }
        public static List<LocationDO> GetAllLocations()
        {
            Repository<Location> rep = new Repository<Location>(CheckoutDataContextProvider.Instance);
            List<LocationDO> lst = Mapper.Map<List<Location>, List<LocationDO>>(rep.GetAll().ToList());

            return lst;
        }
        //private Repository<Address> mAddressRepository;

        public UserControl Initialize(ActionBarView actionBar, string databaseName)
        {
            mDatabaseName = databaseName;
            UserControl view = new KundenverwaltungView();

            mCustomerRepository =
                new Repository<Customer>(
                    mDatabaseName);
            mViewModel = new KundenverwaltungViewModel
            {
                Models = new ObservableCollection<Customer>(mCustomerRepository.GetAll()),
                SelectedModel = null
            };
            view.DataContext = mViewModel;

            mActionBarViewModel = new ActionBarViewModel
            {
                Command1 = new RelayCommand(AddCommandExecute),
                Command2 = new RelayCommand(DeleteCommandExecute, DeleteCommandCanExecute),
                Command3 = new RelayCommand(SaveCommandExecute, SaveCommandCanExecute),
                Command1Text = "Neu",
                Command2Text = "Löschen",
                Command3Text = "Speichern"
            };
            actionBar.DataContext = mActionBarViewModel;
            return view;
        }
 private void SaveCommandExecute(object obj)
 {
     var mModel = mViewModel.SelectedModel;
     var adressen = new List<Address>();
     //string fehler = "";
     var addressRepository = new Repository<Address>(mDatabaseName);
     adressen = addressRepository.GetAll();
     try
     {
         mModel.Address = Address.KontrolliereMitDatenbank(mModel.Address, adressen);
         try
         {
             mCustomerRepository.Save(mModel);
         }
         catch (Exception)
         {
             MessageBox.Show("Kundennummer ist bereits vorhanden");
         }
     }
     catch (WrongCityPostalCodeCombination excp)
     {
         //fehler = "Fehler: Die Kombination aus Postleitzahl und Städtenamen ist nicht korrekt";
         MessageBox.Show("Fehler: Die Kombination aus Postleitzahl und Städtenamen ist nicht korrekt!\n" + excp.Message);
     }
 }
 public async Task<Questionary[]> Get()
 {
     using (var repository = new Repository<Questionary>())
     {
         return await repository.GetAll().ToArrayAsync();
     }
 }
Example #15
0
		internal static void CorrectStates()
		{
			int c = 0;
			Console.ForegroundColor = ConsoleColor.Yellow;
			Console.WriteLine("4. Fix all missing mainProduct refs in all states in db");
			Console.ForegroundColor = ConsoleColor.DarkGray;

			//actual db shit
			using (var ctx = new SoheilEdmContext())
			{
				var repo = new Repository<FPC>(ctx);
				var all = repo.GetAll();
				foreach (var fpc in all)
				{
					foreach (var state in fpc.States.Where(x => x.StateType == Soheil.Common.StateType.Mid))
					{
						if (state.OnProductRework == null)
						{
							state.OnProductRework = fpc.Product.MainProductRework;
							c++;
							Console.WriteLine(string.Format("FPC with ID {0} : State with ID {1} corrected.", fpc.Id, state.Id));
						}
					}
				}
				ctx.Commit();
			}

			//result
			Console.ForegroundColor = ConsoleColor.Green;
			Console.WriteLine(string.Format("{0} States corrected successfully.", c));
		}
 private void AktualisiereAnzeige()
 {
     mOrderRepository = new Repository<Order>(mDatabaseName);
     mOrderlineRepository = new Repository<OrderLine>(mDatabaseName);
     mCompleteOrders = CompleteOrder.GeneriereOrders(mOrderRepository.GetAll(), mOrderlineRepository.GetAll());
     Anzeigen(mCompleteOrders);
 }
 private static List<LocationDO> GetAllLocation()
 {
     Repository<vStore_Location> rep = new Repository<vStore_Location>(CheckoutDataContextProvider.Instance);
     List<vStore_Location> list = rep.GetAll().ToList();
     list.ForEach(x => x.Code = x.Code.Trim());
     return Mapper.Map<List<vStore_Location>, List<LocationDO>>(list);
 }
 public List<Tweets> ReadAll()
 {
     using (Repository<Tweets> DataAccessHelper = new Repository<Tweets>())
     {
         return DataAccessHelper.GetAll().ToList();
     }
 }
        public UserControl Initialize(ActionBarView actionBar, string databaseName)
        {
            mDatabaseName = databaseName;

            UserControl view = new MitarbeiterverwaltungView();
            
            mEmployeeRepository =
                new Repository<Employee>(
                    mDatabaseName);
                //TODO: hier den absoluten Verweis ersetzen
            //mAddressRepository = new Repository<Address>(databaseName);
            mViewModel = new MitarbeiterverwaltungViewModel
                             {
                                 Models = new ObservableCollection<Employee>(mEmployeeRepository.GetAll()),
                                 SelectedModel = null
                             };
            view.DataContext = mViewModel;

            mActionBarViewModel = new ActionBarViewModel
                                      {
                                          Command1 = new RelayCommand(AddCommandExecute),
                                          Command2 = new RelayCommand(DeleteCommandExecute, DeleteCommandCanExecute),
                                          Command3 = new RelayCommand(SaveCommandExecute, SaveCommandCanExecute),
                                          Command1Text = "Neu",
                                          Command2Text = "Löschen",
                                          Command3Text = "Speichern"
                                      };
            actionBar.DataContext = mActionBarViewModel;
            return view;
        }
Example #20
0
        private static void SetScheduledJobs(QuartzServer server, IList<Type> implementedJobs)
        {
            var jobConfigDetailsRepository = new Repository<JobConfigurationDetails>();
            foreach (var implementedJob in implementedJobs)
            {
                var jobConfiguration = jobConfigDetailsRepository.GetAll().FirstOrDefault(x => x.Name == implementedJob.Name);
                if (jobConfiguration != null)
                {
                    IJobDetail job = JobBuilder.Create(implementedJob).WithIdentity(implementedJob.Name, "group1").Build();
                    ITrigger trigger = TriggerBuilder.Create()
                        .WithIdentity(implementedJob.Name + "trigger", "group1")
                        .StartNow()
                        .WithSimpleSchedule(x => x
                                                     .WithIntervalInSeconds((int)jobConfiguration.TriggerTimeInSec)
                                                     .RepeatForever())
                        .Build();

                    server.Scheduler.ScheduleJob(job, trigger);
                }
                else
                {
                    _log.DebugFormat("Job was not configured in db. JobName={0}", implementedJob.Name);
                }
            }
        }
 public async Task<IHttpActionResult> ExcelDownloadAll()
 {
     using (var repository = new Repository<Questionary>())
     {
         var data = await repository.GetAll().ToArrayAsync();
         return new QuestionaryExcelFileActionResult(data, "all.xlsx");
     }
 }
Example #22
0
 public void GearMap_Simple_Test()
 {
     UnitOfWork unitOfWork = new UnitOfWork(NHibernateHelper.SessionFactory);
     Repository repo = new Repository(unitOfWork.Session);
     List<Gear> list = repo.GetAll<Gear>().ToList();
     Assert.AreEqual(6, list.Count);
     unitOfWork.Rollback();
 }
        public void Should_return_a_enumerable_with_records()
        {
            using (var context = new RepositoryTest())
            {
                var repo = new Repository<Order>(context);

                CollectionAssert.IsNotEmpty(repo.GetAll());
            }
        }
Example #24
0
        public void TestVesselCount()
        {
            UnitOfWork unitOfWork = new UnitOfWork(NHibernateHelper.SessionFactory);
            Repository repo = new Repository(unitOfWork.Session);

            List<TUFMAN.Domain.Ves.Vessels> list = repo.GetAll<TUFMAN.Domain.Ves.Vessels>().ToList();
            Assert.IsTrue(list.Count > 0);
            unitOfWork.Rollback();
        }
Example #25
0
        private async void LoadList()
        {
            _repo = new PainRepository();
            PainList = await _repo.GetAll();
            //if (PainList == null || !PainList.Any())
            //    MockPainList();

            AllElements.Initialize(PainList);
        }
        public void Insert()
        {
            using (var context = new MainContext())
            {
                var myRepo = new Repository<Customer>(context);
                TotalCustomersBeforeTestRuns = myRepo.GetAll().Count();

                //Have to provide a valid name and e-mail address
                MyNewCustomer = new Customer {Name = "Rafael", Email = "*****@*****.**"};
                myRepo.Add(MyNewCustomer);
                myRepo.Save();

                TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count();

                //Assert that the number of clients increase by 1
                Assert.AreEqual(TotalCustomersBeforeTestRuns + 1, TotalOfClientsAfterTheTestRuns);
            }
        }
        public void Should_correct_number_of_records()
        {
            using (var context = new RepositoryTest())
            {
                var repo = new Repository<Order>(context);

                Assert.AreEqual(100, repo.GetAll().Count());
            }
        }
 public void Simple_Map_Test()
 {
     UnitOfWork unitOfWork = new UnitOfWork(NHibernateHelper.SessionFactory);
     Repository repo = new Repository(unitOfWork.Session);
     List<TufmanCountry> list = repo.GetAll<TufmanCountry>().ToList();
     Assert.AreEqual(16, list.Count);
     unitOfWork.Rollback();
     unitOfWork.Dispose();
 }
 public void SetUp()
 {
     //_repository = A.Fake<IRepository<Category>>();
     _repository = new Repository<Category>(() => new JudgifyContext());
     foreach (var category in _repository.GetAll())
     {
         _repository.Delete(category);
     }
 }
        //
        // GET: /Publish/
        public ActionResult Index()
        {
            IEnumerable<Pet> pets = new List<Pet>();
            var repo = new Repository<Pet>();
            pets = repo.GetAll();

            //return View();
            return View(pets);
        }
Example #31
0
        /// <summary>
        /// 获取所有流程记录
        /// </summary>
        /// <returns></returns>
        public List <ProcessEntity> GetAll()
        {
            var list = Repository.GetAll <ProcessEntity>().ToList <ProcessEntity>();

            return(list);
        }
Example #32
0
        public virtual IEnumerable <TDto> GetAll(OptionsFilter options = null)
        {
            var response = Repository.GetAll(options).ToList();

            return(Mapper.Map <IEnumerable <TDto> >(response));
        }
Example #33
0
 public static List <News> GetAllNews(Repository <News> _repo) => _repo.GetAll().ToList();
Example #34
0
 public IEnumerable <data.BaTranDiario> GetAll()
 {
     return(_repository.GetAll());
 }
 public IEnumerable <Cart> GetCarts()
 {
     return(repository.GetAll());
 }
Example #36
0
 public List <Room> GetRooms()
 {
     return(_roomRepository.GetAll().Take(7).ToList());
 }
 public List <Models.Event> GetEvents()
 {
     return(_Map(_respository.GetAll <Data.Event>()));
 }
 public ActionResult Index()
 {
     ViewBag.Post = repoP.GetAll(x => x.IsDeleted == false).Reverse();  //Ana ekranda bütün postların tarihe göre sıralı görüntülenmesi
     return(View());
 }
Example #39
0
 public async Task <IEnumerable <Address> > GetAll()
 {
     return(await AddressDaoRepository.GetAll());
 }
Example #40
0
 public List <Models.Food> GetFoods()
 {
     return(_Map(_respository.GetAll <Data.Food>()));
 }
Example #41
0
        public IActionResult CoursesSort(int id, string sortOrder, string currentFilter, string searchString, int?pageNumber)
        {
            ViewData["CurrentSort"]  = sortOrder;
            ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "Score" : "";
            ViewData["DateSortParm"] = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.catid            = id;
            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewData["CurrentFilter"] = searchString;
            List <Course> courses = new List <Course>();

            if (User.Identity.IsAuthenticated && User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Role).Value == "uye")
            {
                string uyeid = User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Sid).Value;
                List <CourseMember> courseMembers = rCourseMember.GetAll(x => x.MemberId == Convert.ToInt32(uyeid)).ToList();
                List <int>          courseInt     = new List <int>();
                foreach (Course item in rCourse.GetAll(x => x.CategoryID == id).ToList())
                {
                    courseInt.Add(item.Id);
                }

                List <int> courseMemberInt = new List <int>();
                foreach (CourseMember item in courseMembers)
                {
                    courseMemberInt.Add((int)item.CourseId);
                }
                IEnumerable <int> fark = new List <int>();
                fark = courseInt.Except(courseMemberInt);


                foreach (var item in fark)
                {
                    Course c = myContext.Course.FirstOrDefault(x => x.Id == item && x.State == true);
                    if (c != null)
                    {
                        courses.Add(c);
                    }
                }
            }
            else
            {
                courses = rCourse.GetAll(x => x.CategoryID == id).ToList();
            }
            if (!String.IsNullOrEmpty(searchString))
            {
                courses = courses.Where(s => s.Name.ToUpper().Contains(searchString.ToUpper()) ||
                                        s.Title.ToUpper().Contains(searchString.ToUpper()) || s.Description.ToUpper().Contains(searchString.ToUpper())).ToList();
            }
            switch (sortOrder)
            {
            case "Score":
                courses = courses.OrderByDescending(s => s.Score).ToList();    //En çok Puan
                break;

            case "Student":
                courses = courses.OrderByDescending(s => s.NumberOfStudent).ToList();    //En çok öğrenci
                break;

            case "Date":
                courses = courses.OrderBy(s => s.Duration).ToList();     // En yeni
                break;

            case "date_desc":
                courses = courses.OrderByDescending(s => s.Duration).ToList();    // En eski
                break;

            default:
                courses = courses.OrderBy(s => s.Name).ToList();    //İsim
                break;
            }
            int pageSize = 2;

            ViewBag.dgr = pageNumber;

            CourseCategoryVM courcat = new CourseCategoryVM()
            {
                CourseList = PaginatedList <Course> .Create(courses, pageNumber ?? 1, pageSize),
                Tags       = rTag.GetAll(x => x.CategoryId == id).ToList(),
                Categories = myContext.Category.Include(x => x.SubCategories).ToList()
            };

            return(View(courcat));
        }
Example #42
0
 public List <PayType> GetAllPayTypes()
 {
     return(_PaytypeRepository.GetAll());
 }
Example #43
0
 protected override IEnumerable <Rule> GetAll() => Repository.GetAll();
Example #44
0
 public IQueryable <ContratoEmpresa> ListarTodos()
 {
     return(repoContratoEmpresa.GetAll());
 }
 public List <Models.Registration> GetRegistrations()
 {
     return(_Map(_respository.GetAll <Data.Registration>()));
 }
Example #46
0
        public bool Subir(List <PurchaseSubir> detalle, long IdFactura)
        {
            bool Resul = true;

            var pResp = detalle.FindAll(x => x.Nivel == 1);
            var hResp = detalle.FindAll(x => x.Nivel == 2);


            #region clonamos solo las cabezas
            var lista = new List <CellarCore>();
            foreach (var row in pResp)
            {
                var item = new Repository <MedidaMetrica>().GetAll().Find(x => x.Name == row.En);
                lista.Add(new CellarCore
                {
                    IDProducto       = Convert.ToInt32(row.IdProducto),
                    IDFactura        = IdFactura,
                    PorMayor         = row.Cantidad,
                    PrPorMayor       = row.PrecioPorMayor,
                    IdPorMayorMedida = item.IdMedidaMetrica,
                    Medida           = item.Name,
                    Sate             = true
                });
            }
            #endregion
            //aniadimos los hijos
            foreach (var row in hResp)
            {
                var item = new Repository <MedidaMetrica>().GetAll().Find(x => x.Name == row.En);
                var aux  = lista.Find(x => x.IDProducto == row.IdProducto);
                aux.PorMenor         = row.Cantidad;
                aux.PrPorMenor       = row.PrecioPorMayor;
                aux.IdPorMenorMedida = item.IdMedidaMetrica;
            }

            //proceso de grabado
            using (var item = new Repository <Cellar>())
            {
                foreach (var aux in lista)
                {
                    var exi = item.Find(x => x.IDFactura == aux.IDFactura && x.IDProducto == aux.IDProducto);

                    if (exi == null)
                    {
                        var resp = item.GetAll().Count;
                        resp++;
                        if (item.Create(new Cellar
                        {
                            IdCellar = resp,
                            IDProducto = aux.IDProducto,
                            IDFactura = aux.IDFactura,
                            Sate = true,
                            PorMayor = aux.PorMayor,
                            PorMenor = aux.PorMenor,
                            PrPorMayor = aux.PrPorMayor,
                            PrPorMenor = aux.PrPorMenor,
                            IdPorMayorMedida = aux.IdPorMayorMedida,
                            IdPorMenorMedida = aux.IdPorMenorMedida,
                            PVentaMayor = aux.PVentaMayor,
                            PVentaMenor = aux.PVentaMenor
                        }) == null)
                        {
                            Error = item.Error;
                            Resul = false;
                            break;
                        }
                    }
                    else
                    {
                        Sate = true;
                        //exi.PrPorMayor = aux.PrPorMayor;
                        //exi.PrPorMenor = aux.PrPorMenor;
                        exi.PVentaMayor = aux.PrPorMayor;
                        exi.PVentaMenor = aux.PrPorMenor;
                        if (!item.Update(exi))
                        {
                            Error = item.Error;
                            Resul = false;
                            break;
                        }
                    }
                }
            }

            return(Resul);
        }
Example #47
0
 public ActionResult Classroom(int ClassId)
 {
     return(View(SrRepo.GetAll(s => s.ClassId == ClassId && s.IsDeleted == false)));
 }
Example #48
0
 public IList <BorSection> SelectAllBorSection()
 {
     return(_borSectionDal.GetAll().Entities.ToList());
 }
Example #49
0
 protected override IQueryable <CreditCity> CreateFilteredQuery(PagedCreditCityResultRequestDto input)
 {
     return(Repository.GetAll().WhereIf(input.ProvinceCode.HasValue, x => x.ProvinceId == input.ProvinceCode));
 }
        public string Get()
        {
            var allProductTypes = _repository.GetAll <ProductType>();

            return(JsonConvert.SerializeObject(allProductTypes, Formatting.Indented));
        }
Example #51
0
 public new IEnumerable <Article> GetAll()
 {
     return(Repository.GetAll());
 }
Example #52
0
 public static List <TEntity> GetAll(Expression <Func <TEntity, bool> > filter = null)
 {
     return(db.GetAll(filter));
 }
Example #53
0
 public IEnumerable <data.Pai> GetAll()
 {
     return(_repository.GetAll());
 }
 public async Task <List <MpAccountDto> > GetList()
 {
     return((await AsyncQueryableExecuter.ToListAsync(Repository.GetAll().Where(m => m.IsDeleted == false)))
            .Select(MapToEntityDto).ToList());
 }
Example #55
0
        public ModuloDto Get(string codigo)
        {
            var rol = Repository.GetAll().Where(r => r.Codigo == codigo).SingleOrDefault();

            return(MapToEntityDto(rol));
        }
 protected override IEnumerable <KPIComparisonConfig> GetAll()
 {
     return(Repository.GetAll());
 }
Example #57
0
 protected override IQueryable <Tenant> CreateFilteredQuery(PagedTenantResultRequestDto input)
 {
     return(Repository.GetAll()
            .WhereIf(!input.Keyword.IsNullOrWhiteSpace(), x => x.TenancyName.Contains(input.Keyword) || x.Name.Contains(input.Keyword))
            .WhereIf(input.IsActive.HasValue, x => x.IsActive == input.IsActive));
 }
        public ActionResult CreatEtudiant(Etudiant _etudiant)
        {
            try
            {
                List <Niveau>         niveau     = repNiveau.GetAll(null, false).ToList();
                List <Formation>      formation  = repFor.GetAll(null, false).ToList();
                List <TypeSpecialite> specilaite = repSpec.GetAll(null, false).ToList();


                Repository <UserProfile> repuser = new Repository <UserProfile>(AppConfig.DbConnexionString);



                Repository <Etudiant> repetudiant = new Repository <Etudiant>(AppConfig.DbConnexionString);
                //   if (ModelState.IsValid)
                {
                    WebSecurity.CreateUserAndAccount(_etudiant.NCin + "-" + _etudiant.Prenom, _etudiant.MotdePasse);



                    int    userid   = repuser.GetSingle(v => v.UserName == _etudiant.NCin + "-" + _etudiant.Prenom, false).UserId;
                    string username = repuser.GetSingle(v => v.UserName == _etudiant.NCin + "-" + _etudiant.Prenom, false).UserName;
                    Roles.AddUserToRole(username, "Etudiant");
                    string pwd = _etudiant.MotdePasse;
                    _etudiant.UserId = userid;

                    repetudiant.Add(_etudiant);

                    string smtpAddress = "smtp.live.com";
                    int    portNumber  = 587;
                    bool   enableSSL   = true;

                    string emailFrom = "*****@*****.**";
                    string password  = "******";
                    string emailTo   = _etudiant.Email;
                    string subject   = "Hello";
                    string body      = "Votre mot de passe et :" + _etudiant.MotdePasse + "Votre login est :" + _etudiant.NCin + "-" + _etudiant.Prenom;

                    using (MailMessage mail = new MailMessage())
                    {
                        mail.From = new MailAddress(emailFrom);
                        mail.To.Add(emailTo);
                        mail.Subject    = subject;
                        mail.Body       = body;
                        mail.IsBodyHtml = true;


                        using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                        {
                            smtp.Credentials = new NetworkCredential(emailFrom, password);


                            smtp.EnableSsl = enableSSL;
                            smtp.Send(mail);
                            return(RedirectToAction("Index"));
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                log.Info("erreur create etudiant: " + ex.Message);
                return(RedirectToAction("CreatEtudiant"));
            }

            /* ViewBag.IdNiveau = new SelectList(niveau, "IdNiveau", "Libelle", _etudiant.Niveau);
             * ViewBag.IdFormation = new SelectList(formation, "IdFormation", "LibelleFormation", _etudiant.IdNiveauFormation);
             * ViewBag.IdSpecialite = new SelectList(specilaite, "IdSpecialite", "LibelleSpecialite", _etudiant.IdSpetialite);
             * return View(_etudiant);*/
        }
Example #59
0
 public IEnumerable <tblGenderMaster> GetAll()
 {
     return(_GenderRepository.GetAll());
 }
Example #60
0
 public async Task <IEnumerable <PurchaseOrderDetail> > GetAll()
 {
     return(await PurchaseOrderDetailDaoRepository.GetAll());
 }