コード例 #1
0
        /// <summary>
        /// Retrives the TP or CP Doctors.
        /// </summary>
        /// <param name="tpname"></param>
        /// <param name="cpname"></param>
        /// <param name="month"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        public JsonResult GetCPDoctors(string tpname, string cpname, string month, string year)
        {
            cpname = cpname.Replace('~', '&');
            List <JsonResult> lstJsonResult = new List <JsonResult>();
            string            userCode      = _objcurrentInfo.GetUserCode();

            DataSet dsCPDoctors = _objSPData.GetCPDoctors(tpname, cpname, userCode, month, year);

            List <DCRDoctorVisitModel>    lstDoctorVisit    = new List <DCRDoctorVisitModel>();
            List <DCRProductDetailsModel> lstProductDetails = new List <DCRProductDetailsModel>();
            List <DCRChemistVisitModel>   lstChemistDetails = new List <DCRChemistVisitModel>();
            List <DCRRCPADetailsModel>    lstRCPADetails    = new List <DCRRCPADetailsModel>();

            if (dsCPDoctors.Tables != null && dsCPDoctors.Tables.Count > 0 && dsCPDoctors.Tables[0].Rows != null && dsCPDoctors.Tables[0].Rows.Count > 0)
            {
                DataTable dtCPDoctors = dsCPDoctors.Tables[0];

                // Convert the DataTable to list.
                lstDoctorVisit = (from cp_doctors in dtCPDoctors.AsEnumerable()
                                  select new DCRDoctorVisitModel
                {
                    Doctor_Name = cp_doctors["Doctor_Name"].ToString() + "_" + cp_doctors["MDL"].ToString() + "_" + cp_doctors["Speciality_Name"].ToString() + "_" + cp_doctors["Region_Name"].ToString(),
                    Doctor_Code = cp_doctors["Doctor_Code"].ToString(),
                    //Speciality_Code = Doctor_Visit_Data["Speciality_Code"].ToString(),
                    Is_CPDoc = "1",
                    Speciality_Name = cp_doctors["Speciality_Name"].ToString(),
                    Doctor_Region_Code = cp_doctors["Doctor_Region_Code"].ToString(),
                    Unique_Doctor_Code = cp_doctors["Doctor_Code"].ToString() + "_" + cp_doctors["Doctor_Region_Code"].ToString()
                }).ToList <DCRDoctorVisitModel>();
                if (dsCPDoctors.Tables.Count == 2)
                {
                    DataTable dtTPProducts = dsCPDoctors.Tables[1];
                    // Convert the DataTable to list.
                    lstProductDetails = (from Product_Details in dtTPProducts.AsEnumerable()
                                         select new DCRProductDetailsModel
                    {
                        Doctor_Code = Product_Details["Doctor_Code"].ToString(),
                        Product_Name = Product_Details["Product_Name"].ToString(),
                        Product_Code = Product_Details["Product_Code"].ToString(),
                        //Speciality_Code = Product_Details["Speciality_Code"].ToString(),
                        Quantity_Provided = Product_Details["Quantity_Provided"].ToString(),
                        Doctor_Region_Code = Product_Details["Doctor_Region_Code"].ToString(),
                        Unique_Doctor_Code = Product_Details["Doctor_Code"].ToString() + "_" + Product_Details["Doctor_Region_Code"].ToString()
                    }).ToList <DCRProductDetailsModel>();
                }

                lstJsonResult.Add(Json(lstDoctorVisit));
                lstJsonResult.Add(Json(lstProductDetails));
                lstJsonResult.Add(Json(lstChemistDetails));
                lstJsonResult.Add(Json(lstRCPADetails));
            }
            return(Json(lstJsonResult));
        }