Exemple #1
0
        public ActionResult MakePayment()
        {
            db.Configuration.ProxyCreationEnabled = false;
            BankingDetail bd = db.BankingDetails.FirstOrDefault();

            ViewBag.OrderNumber = Session["OrderID"];
            return(View(bd));
        }
        public ActionResult AddorEdit(BankingDetail emp)
        {
            HttpResponseMessage response = GlobalVariables.WebAPIClient.PutAsJsonAsync("BankingDetail/" + emp.BankingID, emp).Result;

            TempData["SuccessMessage"] = "Updated Successfully";
            n.DateAccessed             = DateTime.Now;
            n.TableAccessed            = "Banking Details";
            n.ChangesMade    = "Updated Banking Details";
            n.AuditLogTypeID = 3;
            //n.UserID = eqp.user.UserID;
            db.AuditLogs.Add(n);
            return(RedirectToAction("AdminDashboard", "Home"));
        }
        protected override OpResult _Store(BankingDetail _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "BankingDetail object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
Exemple #4
0
        /// <summary>
        /// Retrieve a bank/credit card account for editing
        /// </summary>
        public void Detail(int id)
        {
            BankingDetail record = Database.QueryOne <BankingDetail>("Account.*, AcctType, SUM(Amount) AS Balance",
                                                                     "WHERE idAccount = " + id,
                                                                     "Account", "Journal");

            // Subtract future transactions to get current balance
            record.CurrentBalance = record.Balance - Database.QueryOne("SELECT SUM(Amount) AS Future FROM Journal JOIN Document ON idDocument = DocumentId WHERE AccountId = "
                                                                       + id + " AND DocumentDate > " + Database.Quote(Utils.Today)).AsDecimal("Future");
            if (record.Id != null)
            {
                checkAcctType(record.AccountTypeId, AcctType.Bank, AcctType.CreditCard,
                              AcctType.OtherAsset, AcctType.OtherLiability);
                Title += " - " + record.AccountName;
            }
            JObject r = record.ToJObject();

            addMenuOptionstoRecord(r, record);
            Record = r;
        }
        public void OrderConfrimed(ProductOrder po)
        {
            double temp  = 0;
            double total = 0;

            db.Configuration.ProxyCreationEnabled = false;
            if (ModelState.IsValid)
            {
                //po.Location.Client.User.UserEmail
                var senderEmail   = new MailAddress("*****@*****.**", "Spartan Fire");
                var receiverEmail = new MailAddress(po.Location.Client.User.UserEmail, "Receiver");
                var password      = "******";
                var sub           = "Spartan Fire - New Order - " + DateTime.Now.ToString("yyyy/MM/dd");

                string body = "Dear " + po.Location.Client.ClientName + " " + po.Location.Client.ClientSurname + "<br> <h1>Your Order has been placed! </h1><h3> Order Number: " + po.ProductOrderID + " </h3> <br/>" +
                              "<h3> Order Details </h3>" +
                              "<table> <tr> " +
                              "<td> Product </td> " +
                              "<td> Quantity </td>" +
                              "<td> Price each </td>" +
                              "<td> Subtotal </td>" +
                              "</tr>";

                foreach (ProductOrderLine sol in po.ProductOrderLines)
                {
                    temp   = sol.Product.SellingPrice * sol.QuantityOrdered;
                    total += temp;
                    body  += "<tr> <td> " +
                             sol.Product.Name +
                             " </td> <td>" +
                             sol.QuantityOrdered +
                             "</td> <td>" +
                             sol.Product.SellingPrice.ToString("C2") +
                             "</td> <td>" +
                             temp.ToString("C2") +
                             " </td> </tr> ";
                }
                VAT    vt        = db.VATs.OrderByDescending(v => v.VATID).FirstOrDefault();
                double vatamount = total * (vt.VATRate / 100);
                body += "<tr><td></td><td></td><td>VAT (" +
                        vt.VATRate +
                        "%)</td><td>" +
                        vatamount.ToString("C2") +
                        "</td></tr>";

                body += "<tr><td></td><td></td><td>Total</td><td>" +
                        total.ToString("C2") +
                        "</td> </tr></table>" +
                        "<br/><br/>";


                BankingDetail bd = db.BankingDetails.FirstOrDefault();
                body +=
                    "<h3>Payment information</h3>" +
                    "<table>" +
                    "<tr> <td> Account number: </td> <td> " + bd.BankAccountNumber +
                    "</tr>" +
                    "<tr> <td> Bank: </td> <td> " + bd.BankName +
                    "</tr>" +
                    "<tr> <td> Branch code: </td> <td> " + bd.BranchCode +
                    "</tr>" +
                    "<tr> <td> Account type: </td> <td> " + bd.AccountType +
                    "</tr>" +
                    "</table>";


                body += "<p style='text-align:center;'>Please make the details of your EFT the order number. <br />Please note that your order will not be schedueled untill the order has been payed for. <br /> It might take up to three more days thereafter for the order to be delivered.</p>";

                body += "<br/> For any queries please phone 081 366 9566 <br/> Regards Spartan Fire";
                var smtp = new SmtpClient
                {
                    Host                  = "smtp.gmail.com",
                    Port                  = 587,
                    EnableSsl             = true,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials           = new NetworkCredential(senderEmail.Address, password)
                };
                MailMessage mess = new MailMessage(senderEmail, receiverEmail);
                mess.IsBodyHtml = true;
                mess.Subject    = sub;
                mess.Body       = body;
                {
                    smtp.Send(mess);
                }
            }
        }
 private DbUpdateStatement GetQuery_UpdateQuery(BankingDetail _obj)
 {
     return(DbMgr.CreateUpdateClause("BankingDetails", GetFields(_obj), "BankingDetailsID", _obj.BankingDetailID));
 }
        private DbInsertStatement GetQuery_InsertQuery(BankingDetail _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("BankingDetails", fields));
        }