コード例 #1
0
        public ActionResult Receivable()
        {
            Session["Payments"] = null;
            var model =
                new ViewReceivableCreateModel
            {
                PaymentTypes     = _iCommonManager.GetAllPaymentTypes(),
                TransactionTypes = _iCommonManager.GetAllTransactionTypes()
            };

            return(View(model));
        }
コード例 #2
0
        public ActionResult Receivable(FormCollection collection)
        {
            var model =
                new ViewReceivableCreateModel
            {
                PaymentTypes     = _iCommonManager.GetAllPaymentTypes(),
                TransactionTypes = _iCommonManager.GetAllTransactionTypes()
            };

            try
            {
                int paymentTypeId  = Convert.ToInt32(collection["PaymentTypeId"]);
                var bankBranchName = collection["SourceBankName"];
                var chequeNo       = collection["ChequeNo"];
                var amount         = Convert.ToDecimal(collection["Amount"]);
                var date           = Convert.ToDateTime(collection["Date"]);
                var aPayment       = new Payment
                {
                    ChequeAmount   = amount,
                    BankBranchName = bankBranchName,
                    BankAccountNo  = collection["BankAccountNo"],
                    SourceBankName = collection["SourceBankName"],
                    ChequeNo       = chequeNo,
                    ChequeDate     = date,
                    PaymentTypeId  = paymentTypeId
                };

                var filePath    = GetTempReceivableXmlFilePath();
                var id          = aPayment.PaymentId.ToString("D2") + "_" + Guid.NewGuid();
                var xmlDocument = XDocument.Load(filePath);
                xmlDocument.Element("Payments")?.Add(
                    new XElement("Payment", new XAttribute("Id", id),
                                 new XElement("ChequeAmount", aPayment.ChequeAmount),
                                 new XElement("BankBranchName", aPayment.BankBranchName),
                                 new XElement("BankAccountNo", aPayment.BankAccountNo),
                                 new XElement("SourceBankName", aPayment.SourceBankName),
                                 new XElement("ChequeNo", aPayment.ChequeNo),
                                 new XElement("ChequeDate", aPayment.ChequeDate),
                                 new XElement("PaymentTypeId", aPayment.PaymentTypeId)
                                 ));
                xmlDocument.Save(filePath);
                return(View(model));
            }
            catch (Exception exception)
            {
                TempData["Error"] = $"{exception.Message} <br>System Error : {exception.InnerException?.Message}";
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }
コード例 #3
0
        public ActionResult Receivable(FormCollection collection)
        {
            var model =
                new ViewReceivableCreateModel
            {
                PaymentTypes     = _iCommonManager.GetAllPaymentTypes(),
                TransactionTypes = _iCommonManager.GetAllTransactionTypes()
            };

            try
            {
                int paymentTypeId  = Convert.ToInt32(collection["PaymentTypeId"]);
                var bankBranchName = collection["SourceBankName"];
                var chequeNo       = collection["ChequeNo"];
                var amount         = Convert.ToDecimal(collection["Amount"]);
                var date           = Convert.ToDateTime(collection["Date"]);
                var aPayment       = new Payment
                {
                    ChequeAmount   = amount,
                    BankBranchName = bankBranchName,
                    ChequeNo       = chequeNo,
                    ChequeDate     = date,
                    PaymentTypeId  = paymentTypeId,
                    BankAccountNo  = collection["BankAccountNo"],
                    SourceBankName = collection["SourceBankName"]
                };
                List <Payment> payments = (List <Payment>)Session["Payments"];
                if (payments != null)
                {
                    payments.Add(aPayment);
                }
                else
                {
                    payments = new List <Payment> {
                        aPayment
                    };
                    Session["Payments"] = payments;
                    ViewBag.Payments    = payments;
                }
                return(View(model));
            }
            catch (Exception exception)
            {
                TempData["Error"] = $"{exception.Message} <br>System Error : {exception.InnerException?.Message}";
                return(View(model));
            }
        }
コード例 #4
0
        public ActionResult Receivable()
        {
            try
            {
                RemoveAll();
                CreateTempReceivableXmlFile();
                var model =
                    new ViewReceivableCreateModel
                {
                    PaymentTypes     = _iCommonManager.GetAllPaymentTypes(),
                    TransactionTypes = _iCommonManager.GetAllTransactionTypes()
                };

                return(View(model));
            }
            catch (Exception exception)
            {
                Log.WriteErrorLog(exception);
                return(PartialView("_ErrorPartial", exception));
            }
        }