Exemplo n.º 1
0
        public void WhenIncludingBackouts_AllActiveRecordsInResults()
        {
            var context = this.context;

            var repository = new TransactionTypeRepository(context);

            var allTypes = repository.GetAll(excludeBackouts: false);

            Assert.Equal(2, allTypes.Count());
        }
Exemplo n.º 2
0
        public void BasicUsage()
        {
            var context = this.context;

            var repository = new TransactionTypeRepository(context);

            var allTypes = repository.GetAll();

            Assert.Equal(1, allTypes.Count());
        }
Exemplo n.º 3
0
        public void WhenIncludingBackouts_AllActiveRecordsInResults()
        {
            var context = this.factory.Create();

            context.Database.Log = this.output.WriteLine;

            var repository = new TransactionTypeRepository(context);

            var allTypes = repository.GetAll(excludeBackouts: false);

            context.Dispose();

            Assert.Equal(4, allTypes.Count());
        }
Exemplo n.º 4
0
        public void BasicUsage()
        {
            var context = this.factory.Create();

            context.Database.Log = this.output.WriteLine;

            var repository = new TransactionTypeRepository(context);

            var allTypes = repository.GetAll();

            context.Dispose();

            Assert.Equal(2, allTypes.Count());
        }
Exemplo n.º 5
0
        public JsonResult ShowStudentCreate(int studentId, string isEnrollment)
        {
            var controlToLoad = isEnrollment == "N"? "_addStudent.cshtml": "_enrollment.cshtml";

            try
            {
                var allowedStattus = new[] { 1, 3 };
                ViewBag.Period = _periodRepository.GetAll().Data
                                 .Where(m => allowedStattus.Contains(m.PeriodStatusTypeModel.PeriodStatusTypeId))
                                 .Select(i => new SelectListItem()
                {
                    Text  = i.YearFrom + ' ' + i.YearTo,
                    Value = i.PeriodId.ToString()
                });

                ViewBag.Grade = _gradeRepository.GetAll(0).Data
                                .Select(i => new SelectListItem()
                {
                    Text  = i.GradeDescription,
                    Value = i.GradeId.ToString()
                });



                ViewBag.TransactionType = _transactionTypeRepository.GetAll().Data;


                if (isEnrollment == "N")
                {
                    ViewBag.Cities = _cityRepository.GetAll().Data
                                     .Select(i => new SelectListItem()
                    {
                        Text  = i.CityDescription,
                        Value = i.CityId.ToString()
                    });

                    ViewBag.Gender = _genderRepository.GetAll().Data
                                     .Select(i => new SelectListItem()
                    {
                        Text  = i.GenderDescription,
                        Value = i.GenderId.ToString()
                    });
                }


                // Get Student Info
                var studentResponse = new ServiceResponseModel <StudentModel>();
                if (studentId != 0)
                {
                    studentResponse = _studentRepository.GetById(studentId);

                    if (studentResponse.Response == Model.Enumerator.Enum.ServiceResponses.Failure)
                    {
                        throw new Exception(studentResponse.Reason);
                    }
                }

                return(Json(new
                {
                    //Html = RenderPartial.RenderPartialView(this, "~/Views/Student/_addStudent.cshtml", studentResponse.Model),
                    Html = RenderPartial.RenderPartialView(this, "~/Views/Student/" + controlToLoad, studentResponse.Model),
                    Message = "",
                    Status = "OK"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    Message = ex.Message,
                    Status = "ERROR"
                }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            var getList = Repo.GetAll();

            return(View(getList == null ? new List <TransactionType>() : getList));
        }
Exemplo n.º 7
0
 public ICollection<TransactionType> GetTransactionTypes()
 {
     var repository = new TransactionTypeRepository(_db);
     return repository.GetAll().ToList();
 }