public InvoiceDTO GetInvoiceReport(InvoiceGetDTO objInvoiceGetDTO) { DataSet ds = new DataSet(); InvoiceDTO invoice = new InvoiceDTO(); try { using (DbLayer dbLayer = new DbLayer()) { SqlCommand SqlCmd = new SqlCommand("spInvoiceReportByCustomer"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@CustomerId", objInvoiceGetDTO.CustomerId); SqlCmd.Parameters.AddWithValue("@FromDate", objInvoiceGetDTO.FromDate); SqlCmd.Parameters.AddWithValue("@ToDate", objInvoiceGetDTO.ToDate); ds = dbLayer.fillDataSet(SqlCmd); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { invoice.CustomerInvoice = DataModel.Utilities.Utility.ConvertDataTableToEntityList <CustomerInvoiceDTO>(ds.Tables[0]).FirstOrDefault(); invoice.InvoiceList = DataModel.Utilities.Utility.ConvertDataTableToEntityList <InvoiceListDTO>(ds.Tables[1]); } else { invoice.CustomerInvoice = null; invoice.InvoiceList = null; } } } catch (Exception ex) { ErrorLog.LogFileWrite(ex.Message); }; return(invoice); }
public HttpResponseMessage GetInvoiceReport(InvoiceGetDTO invoice) { HttpResponseMessage message; try { InvoiceDataAccessLayer dal = new InvoiceDataAccessLayer(); var dynObj = new { result = dal.GetInvoiceReport(invoice) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" }); ErrorLog.CreateErrorMessage(ex, "Annexure", "GetAnnexureReport"); } return(message); }