示例#1
0
        public ActionResult Create([Bind(Include = "PatientID,FirstName,LastName,DOB,Email,Phone,BloodGroup,Status,Photo,Gender,DoctorID")] Patient patient, HttpPostedFileBase postedFile, FormCollection fc)
        {
            string filename = System.IO.Path.GetFileName(postedFile.FileName);
            string filepath = "~/Uploads/PatientImages/" + filename;

            postedFile.SaveAs(Server.MapPath(filepath));
            // if (ModelState.IsValid)
            // {

            /* db.Patients.Add(new Patient
             * {
             *   FirstName=patient.FirstName,
             *   LastName=patient.LastName,
             *   DOB= patient.DOB.ToString("mm-dd-yyyy")),
             *   Email =patient.Email,
             *   Gender=fc["RbGender"],
             *   Phone=patient.Phone,
             *   BloodGroup=patient.BloodGroup,
             *   Status=patient.Status,
             *   Photo=filepath,
             *   DoctorID=patient.DoctorID
             * });*/
            patient.Gender = fc["RbGender"];
            patient.DOB.ToString("mm-dd-yyyy");
            patient.Photo = filepath;
            db.Patients.Add(patient);
            db.SaveChanges();
            return(RedirectToAction("Index", "Patients", new { l = 2 }));
            // }

            // return View(patient);
        }
示例#2
0
 public ActionResult Create([Bind(Include = "StaffID,FirstName,LastName,Email,Phone,SCategory")] Staff staff, FormCollection fc)
 {
     staff.SCategory = fc["Category"];
     db.Staffs.Add(staff);
     db.SaveChanges();
     return(RedirectToAction("Index"));
     //return View(staff);
 }
示例#3
0
        public ActionResult Create([Bind(Include = "DoctorID,FirstName,LastName,Email,Phone,Status")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                db.Doctors.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor));
        }
示例#4
0
        public ActionResult Create([Bind(Include = "PaymentID,PatientID,PayableAmount,PaymentDate,PaymentMethod,Status")] Payment payment, FormCollection fc)
        {
            //if (ModelState.IsValid)
            //{
            payment.PaymentMethod = fc["RbPM"];
            payment.Status        = fc["RbStatus"];
            payment.PaymentDate.ToString("mm-dd-yyyy");
            db.Payments.Add(payment);
            db.SaveChanges();
            return(RedirectToAction("PatientListAcc", "Payments", new { id = payment.PatientID, l = 3 }));
            //}

            //ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", payment.PatientID);
            //return View(payment);
        }
示例#5
0
        public void ExecuteSystemJob(SystemJob SystemJob)
        {
            var storedProcedure = SystemJob.StoredProcedure;

            db.Database.ExecuteSqlRaw("EXEC {0}", storedProcedure);
            SystemJob.LastRan = DateTime.Now;
            db.SystemJobs.Update(SystemJob);
            db.SaveChanges();
        }
示例#6
0
 public void AddPatient(Patient patient)
 {
     if (patient == null)
     {
         throw new ArgumentNullException(nameof(patient));
     }
     _context.Patients.Add(patient);
     _context.SaveChanges();
 }
 public ActionResult Edit([Bind(Include = "SID,FirstName,MiddleName,LastName,Phone,Email,Password,Status")] SuperAdmin superAdmin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(superAdmin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("DashSuper", "Home"));
     }
     return(View(superAdmin));
 }
        public ActionResult Create([Bind(Include = "TreatmentID,PatientID,CheckupDate,Symptoms,Diagnosis,Medicine,Doses,BeforeMeal,Advice")] Treatment treatment, FormCollection fc)
        {
            //if (ModelState.IsValid)
            //{
            treatment.Doses      = fc["Doses"];
            treatment.BeforeMeal = fc["RbBeforeMeal"];
            treatment.CheckupDate.ToString("mm-dd-yyyy");

            List <Patient> patient = db.Patients.ToList();
            var            result  = patient.Where(x => x.PatientID.Equals(treatment.PatientID)).Select(x => x.DoctorID);
            var            DocId   = result.ToList();

            db.Treatments.Add(treatment);
            db.SaveChanges();
            return(RedirectToAction("ExistingPatientReport", "Patients", new { id = treatment.PatientID, Did = DocId[0], l = 1 }));
            //}

            // ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", treatment.PatientID);
            //return View(treatment);
        }
示例#9
0
        public virtual TEntity Add(TEntity item)
        {
            using (var transaction = Context.Database.BeginTransaction()) {
                try {
                    var propertyInfo = item.GetType().GetProperty("LastModifiedDate");
                    if (propertyInfo != null)
                    {
                        propertyInfo.SetValue(item, DateTime.Now);
                    }

                    Context.Set <TEntity>().Add(item);
                    Context.SaveChanges();

                    transaction.Commit();
                    return(item);
                } catch (Exception ex) {
                    transaction.Rollback();
                    throw new Exception(ex.Message);
                }
            }
        }
 public ActionResult Register(Registration user)
 {
     if (ModelState.IsValid)
     {
         using (HMSDbContext db = new HMSDbContext())
         {
             //user.Category = fc["Category"];
             //var NewUser = db.Registrations.Create();
             //NewUser.Email = user.Email;
             //NewUser.Password = user.Password;
             db.Registrations.Add(user);
             db.SaveChanges();
             return(RedirectToAction("LogIn", "", new { s = "Registered Succesfully" }));
         }
     }
     return(View(user));
 }
示例#11
0
 public int AddDetail(room Room)
 {
     db.rooms.Add(Room);
     db.SaveChanges();
     return(Room.RoomNo);
 }
示例#12
0
 public int SaveChanges()
 {
     return(db.SaveChanges());
 }
示例#13
0
 public int AddDetail(booking Booking)
 {
     db.bookings.Add(Booking);
     db.SaveChanges();
     return(Booking.BookingNo);
 }
示例#14
0
 public string AddDetail(user boarder)
 {
     db.users.Add(boarder);
     db.SaveChanges();
     return(boarder.Emailid);
 }