Ejemplo n.º 1
0
        public void Update_PaymentRefundRecord()
        {
            DLModel.PaymentRefundID = 1;
            DLModel.InvoiceId       = 92;
            DLModel.RefundAmount    = 200;
            DLModel.RefundReceived  = System.DateTime.Now;
            DLModel.CheckNumber     = "8000974";
            DLModel.CheckUploadName = "check21.pdf";
            int paymentId = _IPaymentRefundImplBL.UpdatePaymentRefundRecord(DLModel);

            Assert.IsTrue(true, "Unable to find");
        }
Ejemplo n.º 2
0
        public ActionResult SavePaymentRefundRecord(PaymentRefund _paymentRF)
        {
            try
            {
                string[] extension    = null;
                string   path         = GlobalConst.ConstantChar.Blank;
                string   DownloadPath = GlobalConst.ConstantChar.Blank;
                string   filename     = GlobalConst.ConstantChar.Blank;
                if (_paymentRF.CheckUploadName1 != null)
                {
                    filename  = _paymentRF.CheckUploadName1.FileName;
                    filename  = filename.Substring(filename.LastIndexOf(GlobalConst.ConstantChar.SingleQouteDoubleSlash) + 1);
                    extension = filename.Split(GlobalConst.ConstantChar.SingleQouteDot);
                }
                if (_paymentRF.PaymentRefundID == 0)
                {
                    if (extension != null)
                    {
                        _paymentRF.CheckUploadName = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
                    }
                    _paymentRF.PaymentRefundID = _paymentRefund.AddPaymentRefundRecord(Mapper.Map <LMGEDI.Core.Data.Model.PaymentRefund>(_paymentRF));
                    _paymentRF.flag            = true;
                    if (_paymentRF.PaymentRefundID == -1)
                    {
                        _paymentRF.IsPaymentGreater = true;
                    }
                    if (extension != null && _paymentRF.PaymentRefundID != 0 && _paymentRF.PaymentRefundID != -1)
                    {
                        bool s = _storageServices.CreatePaymentRefundCheckFolder(_paymentRF.FileID, _paymentRF.InvoiceId, _paymentRF.PaymentRefundID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                        path         = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]), _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString());
                        DownloadPath = Path.Combine(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath], _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString());
                        _paymentRF.CheckUploadName1.SaveAs(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName);
                        _paymentRF.CheckDownloadPath = DownloadPath + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName;
                    }
                }
                else
                {
                    string filename1 = GlobalConst.ConstantChar.Blank;
                    if (extension != null)
                    {
                        filename1 = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF; //DateTime.Now.ToString(GlobalConst.ConstantChar.ddMMyyyyss) + GlobalConst.ConstantChar.Dot + extension[1];
                    }
                    path         = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]), _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString());
                    DownloadPath = Path.Combine(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath], _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString());
                    if (extension != null)
                    {
                        bool s      = _storageServices.CreatePaymentRefundCheckFolder(_paymentRF.FileID, _paymentRF.InvoiceId, _paymentRF.PaymentRefundID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                        bool result = System.IO.File.Exists(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName);
                        if (result)
                        {
                            System.IO.File.Delete(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName);
                        }
                        _paymentRF.CheckUploadName = filename1;
                    }
                    if (_paymentRF.CheckUploadName1 == null)
                    {
                        if (System.IO.File.Exists(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName))
                        {
                            string uploadedfilename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
                            System.IO.File.Move(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName, path + GlobalConst.ConstantChar.DoubleSlash + uploadedfilename);
                            _paymentRF.CheckUploadName = uploadedfilename;
                        }
                    }
                    int PaymentRefundID = _paymentRefund.UpdatePaymentRefundRecord(Mapper.Map <LMGEDI.Core.Data.Model.PaymentRefund>(_paymentRF));
                    if (PaymentRefundID == -1)
                    {
                        _paymentRF.IsPaymentGreater = true;
                    }

                    if ((PaymentRefundID != -1 && PaymentRefundID != 0) && _paymentRF.CheckUploadName1 != null)
                    {
                        _paymentRF.CheckUploadName1.SaveAs(path + GlobalConst.ConstantChar.DoubleSlash + filename1);
                    }

                    _paymentRF.flag = false;
                    _paymentRF.CheckDownloadPath = DownloadPath + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName;
                }
                _paymentRF.CheckUploadName1 = null;
                return(Json(_paymentRF, GlobalConst.ContentTypes.TextHtml));
            }
            catch (Exception ex)
            {
                _arCommonService.CreateErrorLog(ex.Message, ex.StackTrace);
                return(View());
            }
        }