public DataSet SaveDoctorClaim(DoctorClaimRequest objDoctorRequestClaim) { //if (CheckIsPolicyMemberValid(objDoctorRequestClaim.PolicyNumber, objDoctorRequestClaim.MemberCode) == true) //{ objBLLDoctorClaim.SpType = 1; objBLLDoctorClaim.ClientId = objDoctorRequestClaim.ClientId; if (!string.IsNullOrEmpty(objDoctorRequestClaim.Token)) { objBLLDoctorClaim.Token = objDoctorRequestClaim.Token; } //else //{ // getDatatable(); // dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Token"; // return dt; //} if (!string.IsNullOrEmpty(objDoctorRequestClaim.IP)) { objBLLDoctorClaim.IP = objDoctorRequestClaim.IP; } objBLLDoctorClaim.PatientName = objDoctorRequestClaim.PatientName; objBLLDoctorClaim.MemberCode = objDoctorRequestClaim.MemberCode; if (!string.IsNullOrEmpty(objDoctorRequestClaim.PatientAddress)) { objBLLDoctorClaim.PatientAddress = objDoctorRequestClaim.PatientAddress; } if (!string.IsNullOrEmpty(objDoctorRequestClaim.PatientAge)) { objBLLDoctorClaim.PatientAddress = objDoctorRequestClaim.PatientAge; } objBLLDoctorClaim.PatientGender = objDoctorRequestClaim.PatientGender; objBLLDoctorClaim.PatientMobile = objDoctorRequestClaim.PatientMobile; //else if (phone(objDoctorRequestClaim.PatientMobile) == false) //{ // getDatatable(); // dt.Rows[0]["code"] = "-111"; dt.Rows[0]["Message"] = "Please Provide Valid Mobile Number"; // return dt; //} objBLLDoctorClaim.PolicyNumber = objDoctorRequestClaim.PolicyNumber; objBLLDoctorClaim.DC_Diagnosis = objDoctorRequestClaim.DC_Diagnosis; objBLLDoctorClaim.AppointmentDate = objDoctorRequestClaim.AppointmentDate; objBLLDoctorClaim.DoctorId = objDoctorRequestClaim.DoctorId; objBLLDoctorClaim.DoctorName = objDoctorRequestClaim.DoctorName; objBLLDoctorClaim.DC_ClaimedAmount = objDoctorRequestClaim.DC_ClaimedAmount; objBLLDoctorClaim.DCDocument = objDoctorRequestClaim.DCDocument; objBLLDoctorClaim.PharmacyDocument = objDoctorRequestClaim.PharmacyDocument; if (objDoctorRequestClaim.DocumentUrl != null) { if (objDoctorRequestClaim.DocumentUrl.Count > 0) { objBLLDoctorClaim.DC_DocumentUrl = ""; objBLLDoctorClaim.DC_DocumentName = ""; foreach (var item in objDoctorRequestClaim.DocumentUrl) { objBLLDoctorClaim.DC_DocumentUrl += item.DocumentUrl + "|"; //if (!string.IsNullOrEmpty(item.DocumentName)) objBLLDoctorClaim.DC_DocumentName += item.DocumentName + "|"; } } } DataSet objds = objBLLDoctorClaim.ExecuteDataset(objBLLDoctorClaim); DownloadPrescription(); return(objds); }
// GET api/<controller>/5 public HttpResponseMessage SaveDoctorClaim([FromBody] DoctorClaimRequest objDoctorClaimRequest) { int flag = 0; try { getDatatable(); objDoctorClaimRequest.Token = HttpContext.Current.Request.Headers["Token"].ToString(); objDoctorClaimRequest.IP = HttpContext.Current.Request.UserHostAddress; /// Client ID if (string.IsNullOrEmpty(objDoctorClaimRequest.ClientId)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide ClientId"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide ClientId", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } /// Policy Number else if (string.IsNullOrEmpty(objDoctorClaimRequest.PolicyNumber)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Policy Number"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Policy Number", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } //CheckIs Policy Valid else if (!objDoctorClaimService.CheckIsPolicyValid(objDoctorClaimRequest.PolicyNumber)) { flag = 1; dt.Rows[0]["code"] = "-100"; dt.Rows[0]["Message"] = "Invalid Policy"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-100", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Invalid Policy", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Client Id else if (!(objDoctorClaimService.GetClientCode(objDoctorClaimRequest.PolicyNumber) == objDoctorClaimRequest.ClientId)) { flag = 1; dt.Rows[0]["code"] = "-105"; dt.Rows[0]["Message"] = "Invalid Client Id"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-105", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Invalid Client Id", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } /// Member Code else if (string.IsNullOrEmpty(objDoctorClaimRequest.MemberCode)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Member Code"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Member Code", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } /// Patient Name else if (string.IsNullOrEmpty(objDoctorClaimRequest.PatientName)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Patient Name"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Patient Name", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Patient Age //else if (string.IsNullOrEmpty(objDoctorClaimRequest.PatientAge)) //{ // flag = 1; // jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Patient Age", Formatting.Indented) // + "," // + JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; //} //else if (Convert.ToInt32(objDoctorClaimRequest.PatientAge) > 150) //{ // flag = 1; // jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-112", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Age cannot be Greater than 150", Formatting.Indented) // + "," // + JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; //} ///Patient Gender else if (string.IsNullOrEmpty(objDoctorClaimRequest.PatientGender)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Gender"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Gender", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Patient Mobile else if (string.IsNullOrEmpty(objDoctorClaimRequest.PatientMobile)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Mobile Number"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Mobile Number", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Appointment Date else if (string.IsNullOrEmpty(objDoctorClaimRequest.AppointmentDate)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide AppointmentDate"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide AppointmentDate", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///DoctorId else if (string.IsNullOrEmpty(objDoctorClaimRequest.DoctorId)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide DoctorId"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide DoctorId", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Doctor Name else if (string.IsNullOrEmpty(objDoctorClaimRequest.DoctorName)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Doctor Name"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Doctor Name", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///DC_ClaimedAmount else if (string.IsNullOrEmpty(objDoctorClaimRequest.DC_ClaimedAmount)) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Claimed Amount"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Claimed Amount", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } else if (objDoctorClaimRequest.DC_ClaimedAmount == "0") { flag = 1; dt.Rows[0]["code"] = "-106"; dt.Rows[0]["Message"] = "Claimed Amount Cannot be 0"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-106", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Claimed Amount Cannot be 0", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } //DocumentUrl else if (objDoctorClaimRequest.DocumentUrl == null) { flag = 1; dt.Rows[0]["code"] = "-110"; dt.Rows[0]["Message"] = "Please Provide Document URL"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-110", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Please Provide Document URL", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } ///Check IsPolicy MemberValid else if (!objDoctorClaimService.CheckIsPolicyMemberValid(objDoctorClaimRequest.PolicyNumber, objDoctorClaimRequest.MemberCode)) { flag = 1; dt.Rows[0]["code"] = "-107"; dt.Rows[0]["Message"] = "Invalid Member Code"; //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-107", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Invalid Member Code", Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } // Success //if (flag == 0) //{ // objdt = objDoctorClaimService.SaveDoctorClaim(objDoctorClaimRequest); // jsonString = JsonConvert.SerializeObject(objdt, Formatting.Indented); // //jsonString = "{" // // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-200", Formatting.Indented) // // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject("Claim has been Submitted Successfully!", Formatting.Indented) // // + "," // // + JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; //} } catch (Exception ex) { flag = 1; dt.Rows[0]["code"] = "-500"; dt.Rows[0]["Message"] = ex.ToString(); //jsonString = "{ " // + JsonConvert.SerializeObject("code", Formatting.Indented) + ":" + JsonConvert.SerializeObject("-500", Formatting.Indented) // + "," + JsonConvert.SerializeObject("Message", Formatting.Indented) + ":" + JsonConvert.SerializeObject(ex.ToString(), Formatting.Indented) // + "," //+ JsonConvert.SerializeObject("Response", Formatting.Indented) + ":" + JsonConvert.SerializeObject(objdt, Formatting.Indented) + " }"; } if (flag == 0) { DataSet objds = objDoctorClaimService.SaveDoctorClaim(objDoctorClaimRequest); objds.Tables[0].TableName = "Claim"; var jsonString = JsonConvert.SerializeObject(objds.Tables[0]); jsonString = jsonString.Replace("[", string.Empty); jsonString = jsonString.Replace("]", string.Empty); var response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(jsonString, Encoding.UTF8, "application/json"); return(response); } else { var jsonString = JsonConvert.SerializeObject(dt); var response = Request.CreateResponse(HttpStatusCode.OK); jsonString = jsonString.Replace("[", string.Empty); jsonString = jsonString.Replace("]", string.Empty); response.Content = new StringContent(jsonString, Encoding.UTF8, "application/json"); return(response); } //return CommonFunction.DataTableToJSONWithStringBuilder(objdt); //return new HttpResponseMessage() //{ // Content = new StringContent(jsonString, System.Text.Encoding.UTF8, "application/json") //}; }