readHtmlData = constructHtmltoPdfRequestForm(dsAlj);
HtmlToPdf converter = new HtmlToPdf();
SelectPdf.PdfDocument doc = converter.ConvertHtmlString(readHtmlData);
string UploadFilePath = Path.Combine(Server.MapPath("~/FormsFolder/"));
string existFilePath = UploadFilePath + FileName;
if (System.IO.File.Exists(existFilePath))
{
System.IO.File.Delete(existFilePath);
}
doc.Save(UploadFilePath + FileName);
doc.Close();
public string constructHtmltoPdfRequestForm(DataSet dsAlj)
{
string format = string.Empty;
try
{
string UploadFilePath = Path.Combine(Server.MapPath("~/AppealTemplate/")) + "HtmpTemplate.html";
StreamReader sr = new StreamReader(UploadFilePath);
string body = sr.ReadToEnd();
sr.Close();
if (dsAlj.Tables[0]?.Rows.Count > 0)
{
string VisitId = Convert.ToString(dsAlj.Tables[0].Rows[0]["PAT_ACC_NO"]);
string PatientId = Convert.ToString(dsAlj.Tables[0].Rows[0]["PAT_ID"]);
string PartyName = Convert.ToString(dsAlj.Tables[0].Rows[0]["PARTY_NAME"]);
string StreetName = Convert.ToString(dsAlj.Tables[0].Rows[0]["STREET_NAME"]);
string CityName = Convert.ToString(dsAlj.Tables[0].Rows[0]["CITY_NAME"]);
string StateName = Convert.ToString(dsAlj.Tables[0].Rows[0]["STATE_NAME"]);
string ZipcodeNum = Convert.ToString(dsAlj.Tables[0].Rows[0]["ZIPCODE_NUM"]);
string TelephoneNumber = Convert.ToString(dsAlj.Tables[0].Rows[0]["TELEPHONE_NUM"]);
string AlternateTelephoneNumber = Convert.ToString(dsAlj.Tables[0].Rows[0]["ALTERNATE_TELE_NUM"]);
string FaxNumber = Convert.ToString(dsAlj.Tables[0].Rows[0]["FAX_NUM"]);
string EmailAddr = Convert.ToString(dsAlj.Tables[0].Rows[0]["EMAIL_ADDR"]);
string BeneficiaryName = Convert.ToString(dsAlj.Tables[0].Rows[0]["BENEFICIARY_NAME"]);
string HicNumber = Convert.ToString(dsAlj.Tables[0].Rows[0]["HIC_NUM"]);
string ProviderName = Convert.ToString(dsAlj.Tables[0].Rows[0]["PROVIDER_NAME"]);
string SubmissionFailedReason = Convert.ToString(dsAlj.Tables[0].Rows[0]["SUBMISSION_FAILED_REASON"]);
string TimeExtensionExpected = Convert.ToString(dsAlj.Tables[0].Rows[0]["TIME_EXTENSION_EXPECTED"]);
string PartySign = Convert.ToString(dsAlj.Tables[0].Rows[0]["PARTY_SIGN"]);
string SubmitDate = Convert.ToString(dsAlj.Tables[0].Rows[0]["SUBMIT_DATE"]);
string CreatedBy = Convert.ToString(dsAlj.Tables[0].Rows[0]["CREATED_BY"]);
body = body.Replace("#txtPartyName1#", PartyName);
body = body.Replace("#txtPartyStreet1#", StreetName);
body = body.Replace("#txtCity1#", CityName);
body = body.Replace("#txtState1#", StateName);
body = body.Replace("#txtZipcode1#", ZipcodeNum);
body = body.Replace("#txtTelephoneNumber1#", TelephoneNumber);
body = body.Replace("#txtAlternateNum1#", AlternateTelephoneNumber);
body = body.Replace("#txtFaxNum1#", FaxNumber);
body = body.Replace("#txtEmail1#", EmailAddr);
body = body.Replace("#txtBeneficiaryName1#", BeneficiaryName);
body = body.Replace("#txtClaimNum1#", HicNumber);
body = body.Replace("#txtProviderName1#", ProviderName);
body = body.Replace("#taSubmissionFailedReason1#", SubmissionFailedReason);
body = body.Replace("#txtTimeExtension1#", TimeExtensionExpected);
body = body.Replace("#txtPartySign1#", PartySign);
body = body.Replace("#txtDate1#", SubmitDate);
format = body;
}
}
catch (Exception ex)
{
Exceptions.TrackException(ex);
}
return format;
}