Ejemplo n.º 1
0
        public bool DeleteDocument(int id)
        {
            ITS_Document Document = Get(id);

            ITS_SupplierInvoice supInv = invService.Get(Document.SupplierInvoiceID);

            string FolderName = supInv.ITS_Submission.ITS_PurchaseOrder.PONumber;

            //Delete from Alfreasco first
            bool result = alfService.Delete(Document.DocumentName, FolderName);

            if (result)
            {
                try
                {
                    Delete(id);
                    SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex as Exception;
                }
            }

            return(result);
        }
        /*public IHttpActionResult Get(int id)
         * {
         *  try
         *  {
         *      return Util.Response(new UpdateSupplierInvoiceDTO( Service.Get(id)), HttpStatusCode.NotFound, string.Format("Supplier invoice with Id {0} not found.", id), Request.RequestUri.AbsoluteUri);
         *  }
         *  catch (Exception e)
         *  {
         *      return ExceptionMSG(e);
         *  }
         * }*/

        public IHttpActionResult Put([FromBody] ITS_SupplierInvoice invUpdate)
        {
            try
            {
                return(Util.Response(new UpdateSupplierInvoiceDTO(Service.Update(invUpdate)), HttpStatusCode.NotFound, string.Format("Could not update invoice {0}.", invUpdate.InvoiceNumber), Request.RequestUri.AbsoluteUri));
            }
            catch (Exception e)
            {
                return(ExceptionMSG(e));
            }
        }
 public SupplierInvoiceDTO(ITS_SupplierInvoice supplierInvoice)
 {
     ID            = supplierInvoice.ID;
     SubmissionID  = supplierInvoice.SubmissionID;
     Status        = supplierInvoice.Status;
     InvoiceNumber = supplierInvoice.InvoiceNumber;
     InvoiceAmount = supplierInvoice.InvoiceAmount;
     InvoiceDate   = supplierInvoice.InvoiceDate;
     Description   = supplierInvoice.Description;
     DateCreated   = supplierInvoice.DateCreated;
     UserCreated   = supplierInvoice.UserCreated;
     DateUpdated   = supplierInvoice.DateUpdated;
     UserUpdated   = supplierInvoice.UserUpdated;
 }
 public SupplierInvoiceDTO(ITS_SupplierInvoice supplierInvoice, bool AddExtra)
 {
     ID            = supplierInvoice.ID;
     SubmissionID  = supplierInvoice.SubmissionID;
     Status        = supplierInvoice.Status;
     InvoiceNumber = supplierInvoice.InvoiceNumber;
     InvoiceAmount = supplierInvoice.InvoiceAmount;
     InvoiceDate   = supplierInvoice.InvoiceDate;
     Description   = supplierInvoice.Description;
     DateCreated   = supplierInvoice.DateCreated;
     UserCreated   = supplierInvoice.UserCreated;
     DateUpdated   = supplierInvoice.DateUpdated;
     UserUpdated   = supplierInvoice.UserUpdated;
     if (AddExtra)
     {
         Supplier      = new SupplierDTO(supplierInvoice.ITS_Submission.ITS_Supplier, false);
         Submission    = MapService.MapOne <ITS_Submission, SubmissionDTO>(supplierInvoice.ITS_Submission);
         PurchaseOrder = new PODTO(supplierInvoice.ITS_Submission.ITS_PurchaseOrder);
     }
 }
Ejemplo n.º 5
0
        public int  SaveInvoices(SupplierInvoiceSubmissionDTO entity, int submissionid)
        {
            ITS_SupplierInvoice invoice = new ITS_SupplierInvoice();


            invoice.SubmissionID  = submissionid;
            invoice.Status        = EnumService.SubmissionStatus.Saved.ToString();
            invoice.InvoiceNumber = entity.InvoiceNumber;
            invoice.InvoiceAmount = entity.InvoiceAmount;
            invoice.InvoiceDate   = Convert.ToDateTime(entity.InvoiceDate);
            invoice.Description   = entity.Description;
            invoice.DateCreated   = System.DateTime.Now;
            invoice.UserCreated   = "Bongani"; //Get user from session
            invoice.UserUpdated   = 1;         //Get UserID
            invoice.DateUpdated   = System.DateTime.Now;


            var subInvoice = Add(invoice);

            SaveChanges();

            return(subInvoice.ID);
        }