How to use the dynamic connection parameters

0

Currently this code gives me an error when the session expires, because it loses the data, what I would need to be able to store the connection data, the variable that never loses the data and that is accessible to all controllers.

In the sessions I have how I connect to the BD, I can not put it in the web.config because the parameters are different, and I get it from a table depending on the URL of the web

This is my code.

 public ActionResult DashboardV1()
    {              
        UpcomingAppointment UA = new UpcomingAppointment();
        MedicationViewModel MVM = new MedicationViewModel();           
        List<UpcomingAppointment> list = UA.ReturnDataApppointment(Session["PatientCode"].ToString(), Session["server"].ToString(), Session["provider_database"].ToString(),
        Session["user_sql"].ToString(), Session["password_sql"].ToString());
        if (list.Count > 0)
        {
            ViewBag.Date = list[0].TransDate;
            ViewBag.Time = list[0].TimeIn;
        }
        ViewData["CurrentMedications"] = MVM.GetCurrentMedications(Session["PatientCode"].ToString(), Session["server"].ToString(), Session["provider_database"].ToString(),
        Session["user_sql"].ToString(), Session["password_sql"].ToString());                
        return View(list);
    }
    
asked by Raidel Fonseca 24.04.2018 в 18:49
source

0 answers