public ActionResult TestForMultiple(string LabFormultiple, string testidformultiple, string TestTypeformultiple) { Boolean check; PatientLabReportPrint obj = new Models.Laboratory.PatientLabReportPrint(); //check = obj.GetRptPatientLabReports(HospitalID, LocationID, LaboratoryNo, ID, Convert.ToBoolean(chk3), print); // check = obj.GetRptPatientLabReports(HospitalID, LocationID, Convert.ToInt32(Labid), TestIDNo, Convert.ToBoolean(CheckB), print); // string ch = check.ToString(); HospitlLocationID(); Connect(); SqlCommand cmd = new SqlCommand("RptPatientLabReports", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); cmd.Parameters.AddWithValue("@LabNo", LabFormultiple); cmd.Parameters.AddWithValue("@TestID", testidformultiple); // Session["HospitalIDReport"] = HospitalID; // Session["LocationIDReport"] = LocationID; // Session["LabNo"] = LabNo; // Session["TestID"] = TestIDNo; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); // con.Open(); da.Fill(ds); DataTable table = Session["Table"] as DataTable; DataTable table1 = Session["Table1"] as DataTable; DataTable table2 = Session["Table2"] as DataTable; DataTable table3 = Session["Table3"] as DataTable; //DataTable table4 = Session["table4"] as DataTable; //DataTable table5 = Session["table5"] as DataTable; if (table != null) { DataTable dtCopy = table.Copy(); dsMultipleTest.Tables.Add(dtCopy); } if (table1 != null) { DataTable dtCopy = table1.Copy(); dsMultipleTest.Tables.Add(dtCopy); } if (table2 != null) { DataTable dtCopy = table2.Copy(); dsMultipleTest.Tables.Add(dtCopy); } if (table3 != null) { DataTable dtCopy = table3.Copy(); dsMultipleTest.Tables.Add(dtCopy); } //if (table4 != null) //{ // DataTable dtCopy = table4.Copy(); // dsMultipleTest.Tables.Add(dtCopy); //} //if (table5 != null) //{ // DataTable dtCopy = table5.Copy(); // dsMultipleTest.Tables.Add(dtCopy); //} if (dsMultipleTest.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[2].Rows) { dsMultipleTest.Tables[2].ImportRow(dr); } Session["Table"] = dsMultipleTest.Tables[0]; Session["Table1"] = dsMultipleTest.Tables[1]; Session["Table2"] = dsMultipleTest.Tables[2]; Session["Table3"] = dsMultipleTest.Tables[3]; // Session["table4"] = dsMultipleTest.Tables[4]; // Session["table5"] = dsMultipleTest.Tables[5]; } else { dsMultipleTest = ds.Copy(); Session["Table"] = dsMultipleTest.Tables[0]; Session["Table1"] = dsMultipleTest.Tables[1]; Session["Table2"] = dsMultipleTest.Tables[2]; Session["Table3"] = dsMultipleTest.Tables[3]; //Session["table4"] = dsMultipleTest.Tables[4]; //Session["table5"] = dsMultipleTest.Tables[5]; // DataTable table = Session["table"] as DataTable; // ds = dsMultipleTest.Copy(); } return(Json("", JsonRequestBehavior.AllowGet)); }
public ActionResult Test(string LabNo, string TestIDNo, string TestType, string chkgrp, string chknotgrp) { DataSet ds = new DataSet(); string ResultValue = "0"; if (chkgrp == "true") { Session["chkgrp"] = chkgrp; ResultValue = "1"; } else { Session["chkgrp"] = false; } if (chknotgrp == "true") { Session["chknotgrp"] = chknotgrp; Boolean check; PatientLabReportPrint obj = new Models.Laboratory.PatientLabReportPrint(); //check = obj.GetRptPatientLabReports(HospitalID, LocationID, LaboratoryNo, ID, Convert.ToBoolean(chk3), print); // check = obj.GetRptPatientLabReports(HospitalID, LocationID, Convert.ToInt32(Labid), TestIDNo, Convert.ToBoolean(CheckB), print); // string ch = check.ToString(); HospitlLocationID(); string[] TestID1 = TestIDNo.Split(','); TestID1 = TestID1.Where(name => !string.IsNullOrEmpty(name)).ToArray(); Connect(); for (int i = 0; i < TestID1.Length; i++) { SqlCommand cmd = new SqlCommand("RptPatientLabReports", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); cmd.Parameters.AddWithValue("@LabNo", LabNo); cmd.Parameters.AddWithValue("@TestID", TestID1[i]); Session["HospitalIDReport"] = HospitalID; Session["LocationIDReport"] = LocationID; Session["LabNo"] = LabNo; Session["TestID"] = TestIDNo; SqlDataAdapter da = new SqlDataAdapter(cmd); // con.Open(); da.Fill(ds); ResultValue = "1"; } } else { Session["chknotgrp"] = false; } //if (ds.Tables[2].Rows.Count != 0) //{ // string ResultValue = "0"; // foreach (DataRow dr in ds.Tables[2].Rows) // { // // ResultValue = "0"; // if (dr["ResultValue"].ToString() != "") // { // ResultValue = "1"; // } // } // // return RedirectToAction("RptPatientLabReports"); // // return RedirectToAction("RptPatientLabReports"); // // var redirectUrl = new UrlHelper(Request.RequestContext).Action("RptPatientLabReports", "Patient_Lab_Advance_Search"); // // return Json(new { Url = redirectUrl }); if (ResultValue == "1") { // var redirectUrl = new UrlHelper(Request.RequestContext).Action("RptPatientLabReports", "PatientReport"); return(Json("1", JsonRequestBehavior.AllowGet)); // string ch = redirectUrl; // return Json(ch, JsonRequestBehavior.AllowGet); } else { return(Json("Blank", JsonRequestBehavior.AllowGet)); } // } // else // { // return Json("Blank", JsonRequestBehavior.AllowGet); // } }