Exemple #1
0
 public override decimal determineTransferFeeReverse(decimal expectedAmount, TypeOfPayment typeOfPayment)
 {
     if (typeOfPayment == TypeOfPayment.BankTransfer || typeOfPayment == TypeOfPayment.Cash)
     {
         return(0);
     }
     else
     {
         var fee = expectedAmount * Convert.ToDecimal(0.011);
         return(Math.Round(fee, 0));
     }
 }
        public void Add(string last, string first, string middle, TypeOfPayment payment, int sum)
        {
            Employee result = new Employee();

            result.FirstName     = first;
            result.LastName      = last;
            result.MiddleName    = middle;
            result.PaymentTypeId = payment;
            result.PaymentSum    = sum;
            this._employees.Add(result);
            this._db.AddEmployee(result);
        }
Exemple #3
0
        public bool Delete(int id)
        {
            bool          isDeleted = false;
            TypeOfPayment entity    = context.TypesOfPayments.FirstOrDefault(p => p.Id == id);

            if (entity != null)
            {
                context.TypesOfPayments.Remove(entity);
                context.SaveChanges();
                isDeleted = true;
            }
            return(isDeleted);
        }
Exemple #4
0
        public bool Update(TypeOfPayment item)
        {
            bool          isUpdated = false;
            TypeOfPayment entity    = context.TypesOfPayments.FirstOrDefault(p => p.Id == item.Id);

            if (entity != null)
            {
                entity.Code  = item.Code;
                entity.Title = item.Title;
                context.SaveChanges();
                isUpdated = true;
            }
            return(isUpdated);
        }
Exemple #5
0
        public static void OrderVegetables(int VegID, TypeOfPayment payment, decimal vegQty, string emailID, string address)
        {
            var vegbyID = GetVegetablePricesByID(VegID);

            var customerOrder = new Customer
            {
                OrderDate        = DateTime.UtcNow,
                TypeOfOrder      = OrderType.Created,
                Quantity         = vegQty,
                EmailAddress     = emailID,
                AddressToDeliver = address,
                TotalAmount      = vegbyID.Price * vegQty,
                VegetableID      = vegbyID.VegetableID
            };

            db.Customers.Add(customerOrder);
            db.SaveChanges();
        }
Exemple #6
0
        public virtual bool UpdatePaymentTransferFee(string paymentId, decimal TransferFee, TypeOfPayment typeOfPayment)
        {
            var sSQL = @"UPDATE tblPayment SET TypeOfPayment = @TypeOfPayment,TransferFee = @TransferFee WHERE PaymentID = @paymentId";

            SqlParameter[] parameters =
            {
                new SqlParameter("@paymentId",     paymentId),
                new SqlParameter("@TransferFee",   TransferFee),
                new SqlParameter("@TypeOfPayment", Enum.GetName(typeof(TypeOfPayment), typeOfPayment))
            };

            try
            {
                dh.Execute(sSQL, parameters, CommandType.Text);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #7
0
 public virtual decimal determineTransferFee(decimal expectedAmount, TypeOfPayment typeOfPayment)
 {
     return(0);
 }
        /// <summary>
        /// Generates a string to print
        /// </summary>
        /// <returns>stringbuilder with all of order details</returns>
        public string ReceiptBuilder()
        {
            StringBuilder receipt           = new StringBuilder();
            int           printCharacterMax = 60;
            double        TaxRate           = 0.16;
            uint          orderNumber       = current.Order.OrderNumber;
            DateTime      dateTime          = DateTime.Now;
            double        subtotal          = current.Order.Subtotal;
            double        total             = current.Total;
            double        tax           = Math.Round((subtotal * TaxRate), 2);
            TypeOfPayment formOfPayment = current.payment;
            double        amountPaid    = current.AmountPaid;
            double        change        = current.AmountPaid - current.Total;

            receipt.AppendLine("Cowboy Cafe");
            receipt.AppendLine($"Order: {orderNumber}");
            receipt.AppendLine(dateTime.ToString());
            receipt.Append('-', printCharacterMax); receipt.AppendLine();
            receipt.AppendLine("Items:");

            foreach (IOrderItem item in current.Order.Items)
            {
                string itemName = item.ToString();
                string price    = item.Price.ToString("C");
                if (itemName.Length + price.Length + 1 > printCharacterMax)
                {
                    receipt.Append(itemName, 0, printCharacterMax - price.Length - 1);
                    receipt.Append(" ");
                    receipt.Append(price);
                }
                else
                {
                    receipt.Append(itemName);
                    receipt.Append(' ', printCharacterMax - itemName.Length - price.Length);
                    receipt.Append(price);
                }
                receipt.AppendLine();

                if (item.SpecialInstructions != null)
                {
                    foreach (string instruction in item.SpecialInstructions)
                    {
                        receipt.Append(' ', 5);
                        receipt.Append(instruction);
                        receipt.AppendLine();
                    }
                }
            }

            receipt.Append('-', printCharacterMax); receipt.AppendLine();

            receipt.Append(' ', printCharacterMax - 15 - 9);
            receipt.Append("Subtotal:");
            receipt.Append(' ', 15 - subtotal.ToString("C").Length);
            receipt.AppendLine(subtotal.ToString("C"));

            receipt.Append(' ', printCharacterMax - 15 - 4);
            receipt.Append("Tax:");
            receipt.Append(' ', 15 - tax.ToString("C").Length);
            receipt.AppendLine(tax.ToString("C"));

            receipt.Append('-', printCharacterMax); receipt.AppendLine();

            receipt.Append(' ', printCharacterMax - 15 - 6);
            receipt.Append("Total:");
            receipt.Append(' ', 15 - total.ToString("C").Length);
            receipt.AppendLine(total.ToString("C"));

            receipt.Append('-', printCharacterMax); receipt.AppendLine();

            receipt.Append("Payment Type:" + formOfPayment.ToString());

            if (formOfPayment == TypeOfPayment.Credit)
            {
                receipt.Append(' ', 19 - amountPaid.ToString("C").Length);
            }
            else
            {
                receipt.Append(' ', 21 - amountPaid.ToString("C").Length);
            }

            receipt.Append("Amount Paid:          " + amountPaid.ToString("C"));
            receipt.AppendLine(); receipt.AppendLine();

            receipt.Append(' ', printCharacterMax - 15 - 8);
            receipt.Append(" Change:");
            receipt.Append(' ', 15 - tax.ToString("C").Length);
            receipt.AppendLine(change.ToString("C"));
            receipt.AppendLine(); receipt.AppendLine(); receipt.AppendLine(); receipt.AppendLine();

            return(receipt.ToString());
        }
Exemple #9
0
 public void Add(TypeOfPayment item)
 {
     context.TypesOfPayments.Add(item);
     context.SaveChanges();
 }