Example #1
0
 public static App_PatientLab GetPatientByMrNo(string mrNo)
 {
     using (var dbContext = new HMSEntities())
     {
         var pdata = dbContext.OPDs.Where(o => o.PatientNo == mrNo);
         if (pdata.Any())
         {
             var source = pdata.First();
             var obj    = new App_PatientLab
             {
                 Id            = 0,
                 Name          = source.Name,
                 PatientNo     = source.PatientNo,
                 RequestedOn   = DateTime.Now.ToString(),
                 Address       = source.Address,
                 Phone         = source.Phone,
                 Age           = source.Age,
                 Gender        = source.Gender,
                 GuardianName  = source.GuardianName,
                 MaritalStatus = source.MartialStatus
             };
             return(obj);
         }
     }
     return(new App_PatientLab());
 }
Example #2
0
        public static bool UpdatePatientToLab(App_PatientLab source)
        {
            using (var dbContext = new HMSEntities())
            {
                var dbtest = dbContext.PatientLabs.FirstOrDefault(t => t.Id == source.Id);

                if (source.Discount != null && source.Discount > 0)
                {
                    if (dbtest == null || dbtest.Amount == null || source.Discount > dbtest.Amount)
                    {
                        return(false);
                    }
                }


                if (dbtest != null)
                {
                    dbtest.Address       = source.Address;
                    dbtest.Age           = source.Age;
                    dbtest.BloodGroup    = source.BloodGroup;
                    dbtest.Gender        = source.Gender;
                    dbtest.GuardianName  = source.GuardianName;
                    dbtest.Name          = source.Name;
                    dbtest.PerformedBy   = source.PerformedBy;
                    dbtest.Phone         = source.Phone;
                    dbtest.RegisteredBy  = source.RegisteredBy;
                    dbtest.MaritalStatus = source.MaritalStatus;
                    dbtest.Gender        = source.Gender;
                    dbtest.Discount      = source.Discount;
                    dbtest.DiscountBy    = source.DiscountBy;
                }
                dbContext.SaveChanges();
                return(true);
            }
        }
Example #3
0
 public static long AddPatientToLab(App_PatientLab PatientInfo)
 {
     using (var dbContext = new HMSEntities())
     {
         var pat     = PatientInfo;
         var patient = new PatientLab
         {
             PatientNo     = pat.PatientNo,
             Name          = pat.Name,
             Age           = pat.Age,
             Gender        = pat.Gender,
             RegisteredBy  = pat.RegisteredBy,
             PerformedBy   = pat.PerformedBy,
             Requested     = DateTime.Now,
             Reported      = null,
             BloodGroup    = pat.BloodGroup,
             GuardianName  = pat.GuardianName,
             Phone         = pat.Phone,
             Address       = pat.Address,
             MaritalStatus = pat.MaritalStatus,
         };
         dbContext.PatientLabs.Add(patient);
         dbContext.SaveChanges();
         return(patient.Id);
     }
 }
Example #4
0
        public JsonResult UpdatePatientToLab(App_PatientLab model)
        {
            var response = LabService.UpdatePatientToLab(model);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public JsonResult AddNewPatientToLab(App_PatientLab model)
        {
            var patientlabId = LabService.AddPatientToLab(model);

            return(Json(patientlabId, JsonRequestBehavior.AllowGet));
        }