public HttpResponseMessage GetInvoices(int numOfRecords, string regNumber, string docNumber, string from, string to, string company, decimal sum)
 {
     try {
         DateTime fromDateTime = new DateTime(2000, 1, 1), toDateTime = DateTime.Now;
         if (regNumber == null)
         {
             regNumber = "";
         }
         if (docNumber == null)
         {
             docNumber = "";
         }
         DateTime.TryParseExact(from, "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out fromDateTime);
         DateTime.TryParseExact(to, "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out toDateTime);
         if (company == null)
         {
             company = "";
         }
         return(Request.CreateResponse(HttpStatusCode.OK, _invoiceManagement.GetInvoices(numOfRecords, regNumber, docNumber, fromDateTime, toDateTime,
                                                                                         company, sum)));
     }
     catch (DbUpdateException e)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
Beispiel #2
0
        public HttpResponseMessage GetInvoices(int numOfRecords, int selectedCompany, string name, int selectedDate, string from, string to, string docNumber)
        {
            DateTime fromDateTime = new DateTime(2000, 1, 1), toDateTime = DateTime.Now;

            if (name == null)
            {
                name = "";
            }
            DateTime.TryParseExact(from, "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out fromDateTime);
            DateTime.TryParseExact(to, "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out toDateTime);
            if (docNumber == null)
            {
                docNumber = "";
            }
            return(Request.CreateResponse(HttpStatusCode.OK, _invoiceManagement.GetInvoices(numOfRecords, selectedCompany, name, selectedDate, fromDateTime, toDateTime, docNumber)));
        }