Example #1
0
        // GET: Genders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var gender = Service.GetById(id.GetValueOrDefault());

            if (gender == null)
            {
                return(HttpNotFound());
            }
            return(View(gender));
        }
Example #2
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new GenderRepository(context);
            var service    = new GenderService(repository);

            // Act
            GenderModel result = service.GetById(4);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Id);
        }
Example #3
0
        public ActionResult AddPatient(PatientModel model)
        {
            #region temp code this must be removed
            //PatientPaymentServices.AddPayType(new PayType
            //{
            //    Description = "Card"
            //});
            //PatientPaymentServices.AddPayType(new PayType
            //{
            //    Description = "Cash"
            //});
            #endregion
            #region testing code should be delete
            //var model=new PatientModel(){
            //    BranchId=1,
            //    Name="firstTestPatient",
            //    Email="*****@*****.**",
            //    GenderId=1,
            //    DateofBirth=DateTime.Now,
            //    PhoneNumber="987987697",
            //    ReferredId=-1
            //};
            #endregion

            if (model.PatientTestIds.Count > 0)
            {
                int UserId = Convert.ToInt32(Session["loginuser"].ToString());
                var branch = UserServices.GetUserBranch(UserId);
                model.BranchId = branch.Id;
                model.Age      = (DateTime.Now.Year - model.DateofBirth.Year).ToString();

                PatientServices.Add(model);
                List <TestSubcategory> selectedTests = new List <TestSubcategory>();
                double netAmount = 0;
                foreach (var TestId in model.PatientTestIds)
                {
                    PatientTestService.Add(new PatientTest
                    {
                        PatientId         = model.Id,
                        TestSubcategoryId = TestId
                    });
                    var test = TestSubCategoryServices.getById(TestId);
                    selectedTests.Add(test);
                    netAmount = netAmount + test.Rate;
                }

                if (model.Discount > 0)
                {
                    netAmount = netAmount - model.Discount;
                }

                PatientPaymentServices.Add(new Payment
                {
                    PatientId   = model.Id,
                    PatientName = model.Name,
                    PaidAmount  = model.PaidAmount,
                    Discount    = model.Discount,
                    NetAmount   = netAmount,
                    Balance     = netAmount - model.PaidAmount,
                    PayTypeId   = model.PayId
                });

                var gender = GenderServices.GetById(model.GenderId);

                model.Genders.Add(new SelectListItem
                {
                    Text = gender.GenderDescription
                });

                var referdoctor = ReferDoctorsServices.GetReferDoctorById(model.ReferredId);

                model.ReferredDoctors.Add(new SelectListItem
                {
                    Text = referdoctor.ReferredDoctorName
                });
                var branchContact = BranchServices.GetBranchContact(branch.Id);
                GeneratePatientRecipt(model, gender, selectedTests, branch, branchContact);

                return(Json("SuccessFully Added Patient", JsonRequestBehavior.AllowGet));
            }
            return(Json("Please assign tests to patients", JsonRequestBehavior.AllowGet));
        }
 public async Task <IActionResult> GetGenderById(Guid id)
 {
     return(Ok(await genderService.GetById(id)));
 }