Dear Sir
I have create Webservice.asmx but i need .ashx File. I am using VS 2019 .
How to create a .ashx File in asp.net C# Webform Application.
public class Consignment
{
public string BranchName { get; set; }
public DateTime CnsDate { get; set; }
}
[WebMethod]
public string ConsignmentTracking (string CnsNo)
{
str = "SELECT CNS.BRANCH_BRANCH_CODE,CNS.FROM_BRANCH_NAME,CNS.CNS_NO,TO_CHAR(CNS.CNS_DATE,'DD-Mon-yyyy')CNS_DATE, " +
"CNS.TOT_PKGS,CNS.CONSIGNOR_NAME,CNS.CNEE_NAME,CNS.TOT_FREIGHT,CNS.PICKUP_LOC,CNS.DELIVERY_LOC, " +
"CASE WHEN CLNDT.CLN_CHALLAN_NO IS NULL THEN 'DISPATCH PENDING' ELSE 'DISPATCH PREPARED' END DISP_STATUS, " +
"CLNDT.CLN_CHALLAN_NO,TO_CHAR(CLNDT.CLN_CHALLAN_DATE, 'DD-Mon-yyyy')CLN_CHALLAN_DATE,CLN.LORRY_REGIS_NO, " +
"CASE WHEN MR.MR_NO IS NULL THEN 'POD PENDING' ELSE 'POD RECEIVED' END POD_STATUS, " +
"MR.MR_NO POD_NO, TO_CHAR(MR.MR_DATE, 'DD-Mon-yyyy')POD_DATE, TO_CHAR(MR.ARRIVAL_DATE, 'DD-Mon-yyyy')DELIVERY_DATE " +
"FROM CT_CNS_PRINT CNS, CT_CLNDTL CLNDT ,CT_CLN CLN, CT_MR MR,CT_BILDTL BILDT, CT_LHC_PRINT LHC " +
"WHERE CNS.DIV_CODE = '1' AND CNS.DIV_CODE = CLNDT.CLN_DIV_CODE(+) AND CNS.BRANCH_BRANCH_CODE = CLNDT.CNS_BRANCH_BRANCH_CODE(+) " +
"AND CNS.CNS_NO = CLNDT.CNS_CNS_NO(+) AND CNS.CNS_DATE = CLNDT.CNS_CNS_DATE(+) " +
"AND CLNDT.CLN_DIV_CODE = CLN.DIV_CODE AND CLNDT.CLN_BRANCH_BRANCH_CODE = CLN.BRANCH_BRANCH_CODE AND CLNDT.CLN_CHALLAN_NO = CLN.CHALLAN_NO " +
"AND CLNDT.CLN_CHALLAN_DATE = CLN.CHALLAN_DATE " +
"AND CNS.DIV_CODE = MR.DIV_CODE(+) AND CNS.BRANCH_BRANCH_CODE = MR.CNS_BRANCH_BRANCH_CODE(+) AND CNS.CNS_NO = MR.CNS_CNS_NO(+) AND CNS.CNS_DATE = MR.CNS_CNS_DATE(+) " +
"AND CNS.DIV_CODE = BILDT.DIV_CODE(+) AND CNS.BRANCH_BRANCH_CODE = BILDT.CNS_BRANCH_BRANCH_CODE(+) AND CNS.CNS_NO = BILDT.CNS_CNS_NO(+) AND CNS.CNS_DATE = BILDT.CNS_CNS_DATE(+) " +
"AND CLN.DIV_CODE = LHC.DIV_CODE(+) AND CLN.LHC_BRANCH_BRANCH_CODE = LHC.BRANCH_BRANCH_CODE(+) AND CLN.LHC_LHC_NO = LHC.LHC_NO(+) AND CLN.LHC_LHC_DATE = LHC.LHC_DATE(+) " +
"AND CNS.CNS_NO='" + CnsNo.ToUpper().Trim() + "'";
ds = oper.DTSET(str);
if (ds.Tables[0].Rows.Count > 0)
{
Consignment Data = new Consignment();
Data.BranchName = ds.Tables[0].DefaultView[0].Row["FROM_BRANCH_NAME"].ToString();
Data.CnsDate = Convert.ToDateTime(ds.Tables[0].DefaultView[0].Row["CNS_DATE"].ToString());
return JsonConvert.SerializeObject(Data);
}
else
{
return null;
}
}