//public JsonResult Getservicename(string type) //{ // BL_Report obj = new BL_Report(); // return new JsonResult { Data = obj.Getservicename(type), JsonRequestBehavior = JsonRequestBehavior.AllowGet }; //} public JsonResult Getservicename(string type) { BL_MISConsultantDrService obj = new BL_MISConsultantDrService(); List <MISConsultantDrService> searchlist = new List <MISConsultantDrService>(); DataSet ds = obj.Getservicename(type); if (ds.Tables.Count >= 0) { foreach (DataRow dr in ds.Tables[0].Rows) { searchlist.Add(new MISConsultantDrService { ServiceID = (dr["ServiceID"]).ToString(), ServiceName = Convert.ToString(dr["ServiceName"].ToString()), PatientType = dr["ServiceType"].ToString(), ServiceType = dr["ServiceType"].ToString(), }); } } return(new JsonResult { Data = searchlist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Save(string servicename, string id, string type) { string message = ""; try { BL_MISConsultantDrService obj = new BL_MISConsultantDrService(); MISConsultantDrService ConSer = new MISConsultantDrService(); //objReschedule.HospitalID = HospitalID; //objReschedule.LocationID = LocationID; ConSer.HospitalID = Convert.ToInt32(Session["HospitalID"]); ConSer.LocationID = Convert.ToInt32(Session["LocationID"]); int UserID = Convert.ToInt32(Session["UserID"]); ConSer.ServiceID = id; ConSer.ServiceName = servicename; ConSer.ServiceType = type; ConSer.Mode = "Add"; DataSet ds = obj.Getservicename(type); if (ds.Tables[0].Rows.Count > 0) { if (ConSer.Mode == "Add") { string ServiceType = ds.Tables[0].Rows[0]["ServiceType"].ToString(); Connect(); SqlCommand cmd = new SqlCommand("Delete from Getservicename where ServiceType like '" + ServiceType + '%' + "'", con); con.Open(); int a = cmd.ExecuteNonQuery(); con.Close(); } } if (obj.IUGetServices(ConSer)) { TempData["msg"] = "Successfully"; } //return RedirectToAction("MISConsultantDrService", "MISConsultantDrService"); return(new JsonResult { Data = "Successfully", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception ex) { message = ex.Message; } //return RedirectToAction("MISConsultantDrService", "MISConsultantDrService"); return(new JsonResult { Data = "Successfully", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }