Example #1
0
        public ActionResult Medicine_Setup([Bind(Include = "medicineName,mg_ml")] medicine_tb aMedicineTb)
        {
            DataBase_Gateway aGateway = new DataBase_Gateway();

            try
            {
                if (ModelState.IsValid)
                {
                    aGateway.insert_data(aMedicineTb);
                    return(View("Index"));
                }
            }
            catch (DataException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("",
                                         "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }

            return(View("Medicine_Setup"));
        }
        public ActionResult DoctorEntry([Bind(Include = "doctorName,degree,specialization")] doctor_tb aDoctorTb)
        {
            DataBase_Gateway aGateway = new DataBase_Gateway();

            try
            {
                if (ModelState.IsValid)
                {
                    aDoctorTb.centerID   = (int)TempData["doc1"];
                    aDoctorTb.centerName = Convert.ToString(TempData["doc2"]);
                    aGateway.insert_data(aDoctorTb);
                    return(View("Center"));
                }
            }
            catch (DataException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }

            return(View("error1"));
        }
        public ActionResult treatment(string vid, string vname, string address, string age, string obs, string docid, string docname, string date, List <temp4> obj)
        {
            ViewBag.doc1 = aGateway.get_doctordata();
            ViewBag.Med1 = aGateway.get_medicinedata();
            ViewBag.dis1 = aGateway.get_diseasedata();
            int flag1 = 0;
            int vid1  = Convert.ToInt32(vid);
            List <treatment_tb> aTreatmentTbs = new List <treatment_tb>();
            List <patient_tb>   alisList      = aGateway.get_patientdata();

            if (alisList.Count > 0)
            {
                foreach (var match1 in alisList)
                {
                    if (match1.voterID == vid1)
                    {
                        patient_tb aPatientTb = new patient_tb();
                        aPatientTb.voterID        = match1.voterID;
                        aPatientTb.patientName    = match1.patientName;
                        aPatientTb.address        = match1.address;
                        aPatientTb.age            = match1.age;
                        aPatientTb.patientService = match1.patientService + 1;
                        aManualDb.get_update_pqury(aPatientTb);
                        flag1 = 1;
                    }
                    else
                    {
                    }
                }
                if (flag1 == 0)
                {
                    patient_tb aPatientTb = new patient_tb();
                    aPatientTb.voterID        = Convert.ToInt32(vid);
                    aPatientTb.patientName    = vname;
                    aPatientTb.address        = address;
                    aPatientTb.age            = Convert.ToInt32(age);
                    aPatientTb.patientService = 1;
                    aGateway.insert_data(aPatientTb);
                }
            }
            else
            {
                patient_tb aPatientTb = new patient_tb();
                aPatientTb.voterID        = Convert.ToInt32(vid);
                aPatientTb.patientName    = vname;
                aPatientTb.address        = address;
                aPatientTb.age            = Convert.ToInt32(age);
                aPatientTb.patientService = 1;
                aGateway.insert_data(aPatientTb);
            }
            int centerid = (int)TempData["doc1"];

            TempData["doc1"] = centerid;
            //int centerid = 6;
            string centerName = aGateway.getCenterNamebyCenterId(centerid);

            if (obj.Count > 0)
            {
                foreach (var VAR1 in obj)
                {
                    treatment_tb aTb = new treatment_tb();
                    aTb.patientID    = Convert.ToInt32(vid);
                    aTb.patientName  = vname;
                    aTb.doctorID     = Convert.ToInt32(docid);
                    aTb.doctorName   = docname;
                    aTb.centerID     = centerid;
                    aTb.centerName   = centerName;
                    aTb.observation  = obs;
                    aTb.date         = date;
                    aTb.diseaseID    = Convert.ToInt32(VAR1.id);
                    aTb.diseaseName  = VAR1.text1;
                    aTb.medicineID   = Convert.ToInt32(VAR1.text2);
                    aTb.medicineName = VAR1.text3;
                    aTb.dose         = Convert.ToInt32(VAR1.text4);
                    aTb.timeForTake  = VAR1.text5;
                    aTb.quantity     = Convert.ToInt32(VAR1.text6);
                    aTb.note         = VAR1.text7;

                    aTreatmentTbs.Add(aTb);
                }

                aGateway.insert_treatment_list(aTreatmentTbs);
                aManualDb.get_update_minusqury(aTreatmentTbs);
            }



            return(View());
        }