Ejemplo n.º 1
0
        public int AddCoordinatingPerson(CoordinatingPerson coordinatingPerson)
        {
            using (var ctx = new MedicalStoreDBEntities())
            {
                ctx.CoordinatingPersons.Add(coordinatingPerson);
                ctx.SaveChanges();

                return(coordinatingPerson.CoordinatingPersonId);
            }
        }
Ejemplo n.º 2
0
        public PatientDetail AddPatient(PatientDetail patientDetail)
        {
            using (var ctx = new MedicalStoreDBEntities())
            {
                var patient = new DBEntities.Entities.PatientDetail()
                {
                    PatientName   = patientDetail.PatientName,
                    Gender        = patientDetail.Gender,
                    Age           = patientDetail.Age,
                    MobileNumber  = patientDetail.MobileNumber,
                    Email         = patientDetail.Email,
                    VisitedDate   = patientDetail.VisitedDate,
                    Remark        = patientDetail.Remark,
                    IsActive      = true,
                    CreatedOn     = patientDetail.CreatedOn,
                    CreatedBy     = patientDetail.CreatedBy,
                    ConsultDoctor = patientDetail.ConsultDoctor,
                    Category      = patientDetail.Category,
                    IsPoliceVerificationRequired = patientDetail.IsPoliceVerificationRequired,
                    CoordinatingPersonId         = patientDetail.CoordinatingPersonId
                };
                ctx.PatientDetails.Add(patient);
                ctx.SaveChanges();


                foreach (var prescription in patientDetail.Prescriptions)
                {
                    prescription.PatientId = patient.PatientId;
                    ctx.Prescriptions.Add(prescription);
                }
                ctx.SaveChanges();

                //ctx.CoordinatingPersons.Add(new CoordinatingPerson
                //{
                //    Name = patientDetail.co
                //})

                patientDetail.PatientId = patient.PatientId;

                return(patientDetail);
            }
        }
Ejemplo n.º 3
0
 public List <Prescription> UpdateMedicineStatus(List <Prescription> lstPresription)
 {
     using (var ctx = new MedicalStoreDBEntities())
     {
         foreach (var prescription in lstPresription)
         {
             var prescriptionDetails = ctx.Prescriptions.Where(pre => pre.PrescriptionId == prescription.PrescriptionId).SingleOrDefault();
             if (prescriptionDetails != null)
             {
                 prescriptionDetails.IsDelivered = true;
             }
             ctx.SaveChanges();
         }
         lstPresription.ForEach(pre => pre.IsDelivered = true);
         return(lstPresription);
     }
 }
        public int SignUp(UserDetail userDetail)
        {
            using (var ctx = new MedicalStoreDBEntities())
            {
                ctx.UserDetails.Add(new DBEntities.Entities.UserDetail()
                {
                    UserName     = userDetail.UserName,
                    Password     = userDetail.Password,
                    MobileNumber = userDetail.MobileNumber,
                    Email        = userDetail.Email,
                    IsSuperAdmin = userDetail.IsSuperAdmin,
                    CreatedOn    = userDetail.CreatedOn
                });

                ctx.SaveChanges();
                int id = ctx.UserDetails.SingleOrDefault(u => u.UserName.ToLower() == userDetail.UserName.ToLower()).Id;
                return(id);
            }
        }