/// <summary> /// Retrives the chemists for given regions. /// searchWord parameter is empty, returns all chemist. /// searchWord parameter length > 0, returns relevant chemists. /// </summary> /// <param name="searchWord"></param> /// <param name="showAccChemist"></param> /// <param name="accRegions"></param> /// <returns></returns> public JsonResult GetChemists(string searchWord, string showAccChemist, string accRegions) { // Execute the Query and returns the DataSet. DataSet dsChemist = new DataSet(); string companyCode = _objcurrentInfo.GetCompanyCode(); string userCode = _objcurrentInfo.GetCompanyCode(); string regionCode = _objcurrentInfo.GetRegionCode(); string regions = GetAccRegions(accRegions, showAccChemist, CHEMIST_ENTITY, regionCode); List <DCRChemistVisitModel> lstChemist = new List <DCRChemistVisitModel>(); // Call the DAL and Retrieves the DataSet. dsChemist = _objSPData.GetSelectedChemists(companyCode, regions, regionCode); // Convert the DataTable to list. if (dsChemist != null && dsChemist.Tables != null && dsChemist.Tables.Count > 0) { DataTable dtChemist = dsChemist.Tables[0]; lstChemist = (from Chemists in dtChemist.AsEnumerable() select new DCRChemistVisitModel { label = Chemists["Customer_Name"].ToString(), value = Chemists["Customer_Code"].ToString(), Is_Acc_Chemist = Chemists["Is_Acc_Chemist"].ToString() }).ToList <DCRChemistVisitModel>(); } // returns the list. _totalListCount += lstChemist.Count; return(Json(lstChemist, JsonRequestBehavior.AllowGet)); }