Ejemplo n.º 1
0
        public ActionResult AddInvoice(Invoice invoice, InvoiceAdjustment invoiceAdjustment)
        {
            string path     = GlobalConst.ConstantChar.Blank;
            string filename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
            int    _InvID;
            var    _depID = 0;

            if (invoice.InvoiceID == 0)
            {
                if (invoice.DepartmentId == 5)
                {
                    _depID = GlobalConst.CommonValues.Five;
                }
                else
                {
                    _depID = GlobalConst.CommonValues.One;
                }

                if (invoice.DepartmentId == 5 && invoice.UploadFile != null)
                {
                    filename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
                    invoice.InvoiceFileName = filename;
                    string _dueDateString = _paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID);
                    invoice.InvoiceDueDate = Convert.ToDateTime(_dueDateString);
                    _InvID = _invoice.AddInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                    path   = _storageServices.CreateInvoiceICFolder(_InvID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                    path   = path + GlobalConst.ConstantChar.SingleQouteDoubleSlash + filename;
                    invoice.UploadFile.SaveAs(path);
                }
                else
                {
                    invoice.InvoiceDueDate = Convert.ToDateTime(_paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID));
                    _InvID = _invoice.AddInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                }
                invoiceAdjustment.InvoiceID = _InvID;
                if (_InvID != 0)
                {
                    int InvAdjID = _invoice.AddInvoiceAdjustment(Mapper.Map <LMGEDI.Core.Data.Model.InvoiceAdjustment>(invoiceAdjustment));
                }
                return(Json(_InvID, GlobalConst.ContentTypes.TextHtml));
            }
            else
            {
                if (invoice.DepartmentId == 5 && invoice.UploadFile != null)
                {
                    path = _storageServices.CreateInvoiceICFolder(invoice.InvoiceID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                    path = path + GlobalConst.ConstantChar.SingleQouteDoubleSlash + filename;
                    invoice.UploadFile.SaveAs(path);
                    invoice.InvoiceFileName = filename;
                }


                if (invoice.DepartmentId == 5)
                {
                    _depID = GlobalConst.CommonValues.Five;
                }
                else
                {
                    _depID = GlobalConst.CommonValues.One;
                }


                invoice.InvoiceDueDate = Convert.ToDateTime(_paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID));
                _InvID = _invoice.UpdateInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                invoiceAdjustment.InvoiceID = invoice.InvoiceID;
                int InvAdjID = _invoice.AddInvoiceAdjustment(Mapper.Map <LMGEDI.Core.Data.Model.InvoiceAdjustment>(invoiceAdjustment));

                return(Json(invoice.InvoiceID, GlobalConst.ContentTypes.TextHtml));
            }
        }
Ejemplo n.º 2
0
        public void Get_GetNetworkingDays()
        {
            var getAllPayments = _IPaymentRefundImplBL.GetNetworkingDays("01/01/2016", 2);

            Assert.IsTrue(getAllPayments != null, "Unable to find");
        }