public bool Save(TreatmentAdvice obj)
        {
            Connect();
            SqlCommand cmd = new SqlCommand("IUTreatmentAdvice", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);
            if (obj.TreatmentAdviceID == 0)
            {
                cmd.Parameters.AddWithValue("@TreatmentAdviceID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@TreatmentAdviceID", obj.TreatmentAdviceID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@TreatmentAdviceName", obj.TreatmentAdviceName);
            if (obj.ReferenceCode == null)
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", string.Empty);
            }
            else
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode);
            }
            if (obj.TreatmentAdviceDescription == null)
            {
                cmd.Parameters.AddWithValue("@TreatmentAdviceDescription", DBNull.Value);
            }
            else
            {
                cmd.Parameters.AddWithValue("@TreatmentAdviceDescription", obj.TreatmentAdviceDescription);
            }
            cmd.Parameters.AddWithValue("@CreationID", UserID);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 public ActionResult TreatmentAdvice(TreatmentAdvice objTreatmentAdvice)
 {
     try
     {
         if (obj.CheckTreatmentAdvice(objTreatmentAdvice.TreatmentAdviceID, objTreatmentAdvice.TreatmentAdviceName))
         {
             if (objTreatmentAdvice.TreatmentAdviceID > 0)
             {
                 if (obj.Save(objTreatmentAdvice))
                 {
                     if (objTreatmentAdvice.TreatmentAdviceID > 0)
                     {
                         ModelState.Clear();
                         TempData["msg"] = "Treatment Advice Updated Successfully";
                         return(RedirectToAction("TreatmentAdvice", "TreatmentAdvice"));
                     }
                     else
                     {
                         ModelState.Clear();
                         TempData["msg"] = "Treatment Advice Saved Successfully";
                         return(RedirectToAction("TreatmentAdvice", "TreatmentAdvice"));
                     }
                 }
             }
             else
             {
                 if (obj.Save(objTreatmentAdvice))
                 {
                     ModelState.Clear();
                     TempData["msg"] = "Treatment Advice Saved Successfully";
                 }
             }
         }
         else
         {
             TempData["msg"] = "TreatmentAdvice Already exist";
         }
         return(RedirectToAction("TreatmentAdvice", "TreatmentAdvice"));
     }
     catch (Exception Ex)
     {
         TempData["msg"] = Ex.Message;
         return(RedirectToAction("TreatmentAdvice", "TreatmentAdvice"));
     }
 }
Beispiel #3
0
        public ActionResult Treatment(FormCollection form, Treatment obj, string SubmitBtn, int tabindex)
        {
            try
            {
                ViewBag.tabindex = tabindex;
                int resetflag = 0;
                obj.CMD = SubmitBtn;

                obj.hid       = Convert.ToInt32(Session["hospital"]);
                obj.patientid = Convert.ToInt32(Session["PatientId"]);

                var doctorarr = form["doctor"].ToString().Split(':');
                obj.dfname = doctorarr[1];
                obj.dlname = doctorarr[2];



                //Medicines
                List <TreatmentMedicine> tm = new List <TreatmentMedicine>();
                if (Session["TreatmentMedicine"] != null)
                {
                    tm = (List <TreatmentMedicine>)Session["TreatmentMedicine"];
                }
                else
                {
                    tm = new List <TreatmentMedicine>();
                }

                //Complents
                List <TreatmentComplents> tc = new List <TreatmentComplents>();
                if (Session["TreatmentComplents"] != null)
                {
                    tc = (List <TreatmentComplents>)Session["TreatmentComplents"];
                }
                else
                {
                    tc = new List <TreatmentComplents>();
                }

                //Diagnosis
                List <TreatmentDiagnosis> td = new List <TreatmentDiagnosis>();
                if (Session["TreatmentDiagnosis"] != null)
                {
                    td = (List <TreatmentDiagnosis>)Session["TreatmentDiagnosis"];
                }
                else
                {
                    td = new List <TreatmentDiagnosis>();
                }

                //History
                List <TreatmentHistory> th = new List <TreatmentHistory>();
                if (Session["TreatmentHistory"] != null)
                {
                    th = (List <TreatmentHistory>)Session["TreatmentHistory"];
                }
                else
                {
                    th = new List <TreatmentHistory>();
                }

                //Checkup
                List <TreatmentCheckups> tch = new List <TreatmentCheckups>();
                if (Session["TreatmentCheckups"] != null)
                {
                    tch = (List <TreatmentCheckups>)Session["TreatmentCheckups"];
                }
                else
                {
                    tch = new List <TreatmentCheckups>();
                }

                //Fundus
                List <TreatmentFundus> tf = new List <TreatmentFundus>();
                if (Session["TreatmentFundus"] != null)
                {
                    tf = (List <TreatmentFundus>)Session["TreatmentFundus"];
                }
                else
                {
                    tf = new List <TreatmentFundus>();
                }

                //Advice
                List <TreatmentAdvice> ta = new List <TreatmentAdvice>();
                if (Session["TreatmentAdvice"] != null)
                {
                    ta = (List <TreatmentAdvice>)Session["TreatmentAdvice"];
                }
                else
                {
                    ta = new List <TreatmentAdvice>();
                }


                switch (SubmitBtn)
                {
                case "Continue":
                    TempData["CMD"] = SubmitBtn; return(RedirectToAction("Treatment", obj));

                case "addmedicine":
                    //Medicines
                    TreatmentMedicine t = new TreatmentMedicine();
                    t.a = obj.TreatMedicine.aischecked == true ? "A" : "";
                    t.m = obj.TreatMedicine.mischecked == true ? "M" : "";
                    t.e = obj.TreatMedicine.eischecked == true ? "E" : "";
                    t.n = obj.TreatMedicine.nischecked == true ? "N" : "";
                    var arr = form["particular"].ToString().Split(':');
                    t.medicineid = Convert.ToInt32(arr[0]);
                    t.particular = arr[1];
                    t.qty        = obj.TreatMedicine.qty;
                    t.srno       = obj.srno;
                    if (tm.Where(q => q.particular == t.particular).Count() >= 1)
                    {
                        ViewBag.msg = "Particular already added.";
                    }
                    else
                    {
                        tm.Add(t);
                    }
                    obj.TreatMedicineList        = tm;
                    Session["TreatmentMedicine"] = tm;

                    break;

                case "addcomplent":
                    //Complents
                    TreatmentComplents tcmp = new TreatmentComplents();
                    var complentarr         = form["complents"].ToString().Split(':');
                    tcmp.complentid   = Convert.ToInt32(complentarr[0]);
                    tcmp.complentname = complentarr[1];
                    tcmp.srno         = obj.srno;
                    if (tc.Where(q => q.complentname == tcmp.complentname).Count() >= 1)
                    {
                        ViewBag.complentmsg = "Complent already added.";
                    }
                    else
                    {
                        tc.Add(tcmp);
                    }

                    obj.TreatComplentsList        = tc;
                    Session["TreatmentComplents"] = tc;
                    ViewBag.tab = "tab1";
                    break;

                case "adddiagnosis":
                    //Diagnosis
                    TreatmentDiagnosis tdig = new TreatmentDiagnosis();
                    var diagnosisarr        = form["diagnosis"].ToString().Split(':');
                    tdig.diagnosisid   = Convert.ToInt32(diagnosisarr[0]);
                    tdig.diagnosisname = diagnosisarr[1];
                    tdig.srno          = obj.srno;
                    if (td.Where(q => q.diagnosisname == tdig.diagnosisname).Count() >= 1)
                    {
                        ViewBag.diagnosismsg = "Diagnosis already added.";
                    }
                    else
                    {
                        td.Add(tdig);
                    }

                    obj.TreatDiagnosisList        = td;
                    Session["TreatmentDiagnosis"] = td;
                    break;

                case "addhistory":
                    //Diagnosis
                    TreatmentHistory thistory = new TreatmentHistory();
                    var historyarr            = form["history"].ToString().Split(':');
                    thistory.historyid   = Convert.ToInt32(historyarr[0]);
                    thistory.historyname = historyarr[1];
                    thistory.from_dt     = obj.from_dt;
                    thistory.to_dt       = obj.to_dt;
                    thistory.srno        = obj.srno;
                    if (th.Where(q => q.historyname == thistory.historyname).Count() >= 1)
                    {
                        ViewBag.historymsg = "Disease already added.";
                    }
                    else
                    {
                        th.Add(thistory);
                    }

                    obj.TreatHistoryList        = th;
                    Session["TreatmentHistory"] = th;
                    ViewBag.tab = "tab2";
                    break;

                case "addcheckups":
                    //Diagnosis
                    TreatmentCheckups tcheckup = new TreatmentCheckups();
                    var checkuparr             = form["checkups"].ToString().Split(':');
                    tcheckup.checkupid   = Convert.ToInt32(checkuparr[0]);
                    tcheckup.checkupname = checkuparr[1];
                    tcheckup.srno        = obj.srno;
                    if (tch.Where(q => q.checkupname == tcheckup.checkupname).Count() >= 1)
                    {
                        ViewBag.checkupmsg = "Checkup already added.";
                    }
                    else
                    {
                        tch.Add(tcheckup);
                    }

                    obj.TreatCheckupList         = tch;
                    Session["TreatmentCheckups"] = tch;
                    break;

                case "addfundus":
                    //Diagnosis
                    TreatmentFundus tfundus   = new TreatmentFundus();
                    var             fundusarr = form["fundus"].ToString().Split(':');
                    tfundus.fundusid   = Convert.ToInt32(fundusarr[0]);
                    tfundus.fundusname = fundusarr[1];
                    tfundus.srno       = obj.srno;
                    if (tch.Where(q => q.checkupname == tfundus.fundusname).Count() >= 1)
                    {
                        ViewBag.fundusmsg = "Fundus already added.";
                    }
                    else
                    {
                        tf.Add(tfundus);
                    }

                    obj.TreatFundusList        = tf;
                    Session["TreatmentFundus"] = tf;
                    break;

                case "addadvice":
                    //Diagnosis
                    TreatmentAdvice tad   = new TreatmentAdvice();
                    var             adarr = form["advice"].ToString().Split(':');
                    tad.adviceid   = Convert.ToInt32(adarr[0]);
                    tad.advicename = adarr[1];
                    tad.srno       = obj.srno;
                    if (ta.Where(q => q.advicename == tad.advicename).Count() >= 1)
                    {
                        ViewBag.fundusmsg = "Advice already added.";
                    }
                    else
                    {
                        ta.Add(tad);
                    }
                    obj.TreatAdviceList        = ta;
                    Session["TreatmentAdvice"] = ta;
                    break;

                case "Delete":
                    //Medicines
                    int index = Convert.ToInt32(form["medicinesrno"]);
                    tm.RemoveAt(index);
                    Session["TreatmentMedicine"] = obj.TreatMedicineList = tm;
                    break;

                case "DeleteComplent":
                    //Complents
                    int complentsrno = Convert.ToInt32(form["complentsrno"]);
                    tc.RemoveAt(complentsrno);
                    Session["TreatmentComplents"] = obj.TreatComplentsList = tc;
                    break;

                case "DeleteDiagnosis":
                    //Diagnosis
                    int diagnosissrno = Convert.ToInt32(form["diagsrno"]);
                    td.RemoveAt(diagnosissrno);
                    Session["TreatmentDiagnosis"] = obj.TreatDiagnosisList = td;
                    break;

                case "DeleteHistory":
                    //History
                    int historysrno = Convert.ToInt32(form["historysrno"]);
                    th.RemoveAt(historysrno);
                    Session["TreatmentHistory"] = obj.TreatHistoryList = th;
                    break;

                case "DeleteCheckup":
                    //History
                    int checkupsrno = Convert.ToInt32(form["checkupsrno"]);
                    tch.RemoveAt(checkupsrno);
                    Session["TreatmentCheckup"] = obj.TreatCheckupList = tch;
                    break;

                case "DeleteFundus":
                    //History
                    int fundussrno = Convert.ToInt32(form["fundussrno"]);
                    tf.RemoveAt(fundussrno);
                    Session["TreatmentFundus"] = obj.TreatFundusList = tf;
                    break;

                case "DeleteAdvice":
                    //History
                    int advicesrno = Convert.ToInt32(form["advicesrno"]);
                    ta.RemoveAt(advicesrno);
                    Session["TreatmentAdvice"] = obj.TreatAdviceList = ta;
                    break;

                case "Reset":
                    resetflag = 1;
                    break;

                case "Save":

                    Session["TreatmentMedicine"]  = obj.TreatMedicineList = tm;
                    Session["TreatmentComplents"] = obj.TreatComplentsList = tc;
                    Session["TreatmentDiagnosis"] = obj.TreatDiagnosisList = td;
                    Session["TreatmentHistory"]   = obj.TreatHistoryList = th;
                    Session["TreatmentCheckups"]  = obj.TreatCheckupList = tch;
                    Session["TreatmentFundus"]    = obj.TreatFundusList = tf;
                    Session["treatmentAdvice"]    = obj.TreatAdviceList = ta;
                    string treatmentid = obj.PerformAction();
                    Session["treatmentid"] = treatmentid;
                    string str = PrintGenerator.GenerateTreatmentPDF();
                    TempData["Print"] = str;
                    return(RedirectToAction("Print", "Shared"));

                case "Update":
                    Session["TreatmentMedicine"]  = obj.TreatMedicineList = tm;
                    Session["TreatmentComplents"] = obj.TreatComplentsList = tc;
                    Session["TreatmentDiagnosis"] = obj.TreatDiagnosisList = td;
                    Session["TreatmentHistory"]   = obj.TreatHistoryList = th;
                    Session["TreatmentCheckups"]  = obj.TreatCheckupList = tch;
                    Session["TreatmentFundus"]    = obj.TreatFundusList = tf;
                    Session["treatmentAdvice"]    = obj.TreatAdviceList = ta;
                    string treatid = obj.PerformAction();
                    Session["treatmentid"] = treatid;
                    string str1 = PrintGenerator.GenerateTreatmentPDF();
                    TempData["Print"] = str1;
                    return(RedirectToAction("Print", "Shared"));
                }

                if (resetflag == 1)
                {
                    return(Redirect("/Patient/Treatment"));
                }


                if (obj.TreatInvestigationList != null)
                {
                    Session["TreatInvestigationList"] = obj.TreatInvestigationList;
                }
                else
                {
                    obj.TreatInvestigationList = (List <TreatmentInvestigation>)Session["TreatInvestigationList"];
                }
            }
            catch (Exception e)
            {
                string[] arr = new string[2] {
                    "danger", "Something Went Wrong! Try later." + e.Message
                };

                ViewBag.msgarr = arr;
            }

            return(View(obj));
        }