Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_Rx tbl_Rx = db.tbl_Rx.Find(id);

            db.tbl_Rx.Remove(tbl_Rx);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,MajorAreaId,Rx,PatientId,NextVisit,EntryDate")] tbl_Rx tbl_Rx)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_Rx).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MajorAreaId = new SelectList(db.tbl_MajorArea, "Id", "Name", tbl_Rx.MajorAreaId);
     ViewBag.PatientId   = new SelectList(db.tbl_Patient, "Id", "Name", tbl_Rx.PatientId);
     return(View(tbl_Rx));
 }
Ejemplo n.º 3
0
        // GET: tbl_Rx/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Rx tbl_Rx = db.tbl_Rx.Find(id);

            if (tbl_Rx == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_Rx));
        }
Ejemplo n.º 4
0
        // GET: tbl_Rx/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Rx tbl_Rx = db.tbl_Rx.Find(id);

            if (tbl_Rx == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MajorAreaId = new SelectList(db.tbl_MajorArea, "Id", "Name", tbl_Rx.MajorAreaId);
            ViewBag.PatientId   = new SelectList(db.tbl_Patient, "Id", "Name", tbl_Rx.PatientId);
            return(View(tbl_Rx));
        }
Ejemplo n.º 5
0
        public Prescription FillMainPrescription(int id)
        {
            Prescription obj  = new Prescription();
            tbl_Rx       cust = db.tbl_Rx.Find(id);

            obj.Id            = cust.Id;
            obj.MajorAreaId   = cust.MajorAreaId;
            obj.MajorAreaName = cust.tbl_MajorArea.Name;
            obj.Rx            = cust.Rx;
            obj.PatientId     = cust.PatientId;

            obj.Mrno    = cust.tbl_Patient.Mrno;
            obj.Name    = cust.tbl_Patient.Name;
            obj.Address = cust.tbl_Patient.Address;
            obj.Age     = cust.tbl_Patient.Age;



            obj.NextVisit = cust.NextVisit;
            obj.EntryDate = cust.EntryDate;

            obj.VisualAcuityLeftEye      = cust.VisualAcuityLeftEye;
            obj.VisualAcuityLeftEyeType  = cust.VisualAcuityLeftEyeType ?? 0;
            obj.VisualAcuityRightEye     = cust.VisualAcuityRightEye;
            obj.VisualAcuityRightEyeType = cust.VisualAcuityRightEyeType;

            tbl_VisualAcuityType leftVisual = db.tbl_VisualAcuityType.Find(obj.VisualAcuityLeftEyeType);

            obj.VisualAcuityLeftEyeTypeValue = leftVisual.Name;

            tbl_VisualAcuityType rightVisual = db.tbl_VisualAcuityType.Find(obj.VisualAcuityRightEyeType);

            obj.VisualAcuityRightEyeTypeValue = rightVisual.Name;

            obj.RxDrugList = new List <RxDrug>();
            obj.RxDrugList = GetPrescribrDrugList(id);

            obj.RxDropList = new List <RxDrop>();
            obj.RxDropList = GetPrescribrDropList(id);

            obj.RxInvestigationList = new List <RxInvestigation>();
            obj.RxInvestigationList = GetPrescribrInvestigationList(id);

            return(obj);
        }
Ejemplo n.º 6
0
        internal DataReturn SaveMainData(Prescription prescriptionObj)
        {
            DataReturn model = new DataReturn();

            try
            {
                tbl_Rx ent = new tbl_Rx();
                // ent.Id = prescriptionObj.Id;
                ent.MajorAreaId = prescriptionObj.MajorAreaId;
                ent.Rx          = prescriptionObj.Rx;
                ent.PatientId   = prescriptionObj.PatientId;
                ent.NextVisit   = prescriptionObj.NextVisit;
                ent.EntryDate   = DateTime.Now;

                ent.VisualAcuityLeftEye      = prescriptionObj.VisualAcuityLeftEye;
                ent.VisualAcuityLeftEyeType  = prescriptionObj.VisualAcuityLeftEyeType;
                ent.VisualAcuityRightEye     = prescriptionObj.VisualAcuityRightEye;
                ent.VisualAcuityRightEyeType = prescriptionObj.VisualAcuityRightEyeType;


                db.tbl_Rx.Add(ent);
                db.SaveChanges();

                model.Pkey = ent.Id;

                foreach (var drug in GlobalClass.DragList)
                {
                    tbl_RxDrug drugEnt = new tbl_RxDrug();
                    drugEnt.DrugId      = drug.DrugId;
                    drugEnt.RxId        = model.Pkey;
                    drugEnt.Instruction = drug.Instruction;

                    db.tbl_RxDrug.Add(drugEnt);
                    db.SaveChanges();
                }

                foreach (var drop in GlobalClass.DropList)
                {
                    tbl_RxDrop dropEnt = new tbl_RxDrop();
                    dropEnt.DropId      = drop.DropId;
                    dropEnt.RxId        = model.Pkey;
                    dropEnt.Instruction = drop.Instruction;

                    db.tbl_RxDrop.Add(dropEnt);
                    db.SaveChanges();
                }

                foreach (var invest in GlobalClass.InvestigationList)
                {
                    tbl_RxInvestigation investEnt = new tbl_RxInvestigation();
                    investEnt.InvestigationId = invest.InvestigationId;
                    investEnt.RxId            = model.Pkey;
                    investEnt.Instruction     = invest.Instruction;

                    db.tbl_RxInvestigation.Add(investEnt);
                    db.SaveChanges();
                }



                model.flag = 1;
                model.mess = "Data has been saved successfully.";
            }
            catch (Exception ex)
            {
                model.flag = 0;
                model.mess = ex.Message.ToString();
            }


            return(model);
        }