Esempio n. 1
0
        private FormOfPayment[] AddFormOfPayment()
        {
            List <FormOfPayment> payments = new List <FormOfPayment>();
            FormOfPayment        fop      = new FormOfPayment();

            fop.Key  = "jwt2mcK1Qp27I2xfpcCtAw==";//Key can be different
            fop.Type = "Cash";

            /*CreditCard cc = new CreditCard()
             * {
             *  BillingAddress = new typeStructuredAddress()
             *  {
             *      AddressName = "Home",
             *      Street = new string[] { "2914 N. Dakota Avenue" },
             *      City = "Denver",
             *      State = new State()
             *      {
             *          Value = "CO"
             *      },
             *      PostalCode = "80206",
             *      Country = "US"
             *  },
             *  ExpDate = DateTime.Now.AddYears(2).ToString("yyyy-MM"),
             *  Key = "GAJOYrVu4hGShsrlYIhwmw==",
             *  Number = "4111111111111111",
             *  BankCountryCode = "US",
             *  CVV = "123",
             *  Type = "VI"
             * };*/
            //fop.Item = cc;
            payments.Add(fop);
            return(payments.ToArray());
        }
 public JsonResult FinalizarPedido(FormOfPayment formaPagamento)
 {
     if (Session["MeuCarrinho"] != null)
     {
         var order = (Order)Session["MeuCarrinho"];
         order.FormOfPayment = (int)formaPagamento;
         var orderApplication = new OrderApplication(SessionManager.GetInstance());
         orderApplication.Save(order);
         Session["MeuCarrinho"] = null;
         return(Json(new { Resultado = "Sucesso" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { Resultado = "Erro" }, JsonRequestBehavior.AllowGet));
     }
 }
        public string GetFormOfPaymentDescription(int ParamFormOfPaymentID, string OtherFormOfPayment)
        {
            string FormOfPaymentDescription;
            int    FormOfPaymentID = ParamFormOfPaymentID;

            if (FormOfPaymentID == 3)
            {
                FormOfPaymentDescription = OtherFormOfPayment;
            }
            else
            {
                FormOfPayment FormOfPaymentObj = DBAccess.GetFormOfPayment(FormOfPaymentID);
                FormOfPaymentDescription = FormOfPaymentObj.FormOfPaymentDescription;
            }

            return(FormOfPaymentDescription);
        }
        public override bool IsValid(object value)
        {
            if (value is CallingCourier callingCourier)
            {
                FormOfPayment payment = _db.FormOfPayments.Find(callingCourier.FormOfPaymentId);
                if (payment == null || !payment.Name.Contains("Договор"))
                {
                    if (callingCourier.WhenPickUpShipment.Hours < 8 ||
                        callingCourier.WhenPickUpShipment.Hours > 22 ||
                        (callingCourier.WhenPickUpShipment.Hours == 22 && callingCourier.WhenPickUpShipment.Minutes > 0))
                    {
                        ErrorMessage = "Курьер может забрать посылку только с 8:00 до 22:00";
                        return(false);
                    }
                }

                if (_db.DepartureTypes.Find(callingCourier.DepartureTypeId).DepartureTypeName.Contains("Термогруз"))
                {
                    int[] almatyAndAstanaIdArray = _db.Cities.Where(w => w.CityName.Contains("Алматы") || w.CityName.Contains("Астана")).Select(s => s.CityId).ToArray();
                    if (!almatyAndAstanaIdArray.Contains(callingCourier.CityId))
                    {
                        ErrorMessage = "Тип отправления», выбранное как «Термогруз», доступно только для городов – Алматы, Астана";
                        return(false);
                    }
                }

                int?thermogramId = _db.TariffsViews.FirstOrDefault(f => f.TariffsViewName.Contains("Экспресс"))
                                   ?.TariffsViewId;
                if (thermogramId != null && thermogramId == callingCourier.TariffsViewId)
                {
                    if (callingCourier.Weight > 1000)
                    {
                        ErrorMessage = "доставка груза по данному тарифу возможна только до 1000 килограмм";
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                ErrorMessage = "Не удалось преобразоват объект к типу \'CallingCourier\'";
                return(false);
            }
        }
Esempio n. 5
0
        private void creditCardCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            FormOfPayment form = creditCardCombo.SelectedItem as FormOfPayment;

            if (form != null)
            {
                Font nvaFuente = new Font("Tahoma", 8.25F);
                creditCardTextBox.Text = String.Empty;
                creditCardTextBox.Properties.PasswordChar = new char();
                creditCardTextBox.Font = nvaFuente;

                if (form.Type == GenericFormOfPayment.Cash)
                {
                    this.EnabledCreditCardFieldsCash(false);
                }
                else if (form.Type == GenericFormOfPayment.Transfer || form.Type == GenericFormOfPayment.Check)
                {
                    this.EnabledCreditCardFieldsCheckAndTransfer(false);
                    WsMyCTS wsServ = new WsMyCTS();
                    MyCTS.Services.ValidateDKsAndCreditCards.GetTranferCheckNumber data = new MyCTS.Services.ValidateDKsAndCreditCards.GetTranferCheckNumber();
                    data = wsServ.GetTranferCheckNumberMyCTS(ucFirstValidations.Attribute1);
                    creditCardTextBox.Text = data.ct_banc_cbr;
                    Font nvaFuentePassword = new Font("Symbol", 9F);
                    creditCardTextBox.Properties.PasswordChar = '·';
                    creditCardTextBox.Font = nvaFuentePassword;
                    creditCardTextBox.Focus();
                }
                else
                {
                    this.EnabledCreditCardFieldsCash(true);
                    Font nvaFuentePassword = new Font("Symbol", 9F);
                    creditCardTextBox.Properties.PasswordChar = '·';
                    creditCardTextBox.Font = nvaFuentePassword;
                }
                creditCardTextBox.Focus();
            }
        }
 private FormOfPayment[] AddFormOfPayment(OFly.Models.FormOfPaymentInfo formOfPaymentInfo)
 {
     List<FormOfPayment> payments = new List<FormOfPayment>();
     FormOfPayment fop = new FormOfPayment();
     //fop.Key = "jwt2mcK1Qp27I2xfpcCtAw==";//Key can be different
     fop.Type = "Credit";
     fop.Type = formOfPaymentInfo.IsCreditCard;
     CreditCard cc = new CreditCard()
     {
         BillingAddress = new typeStructuredAddress()
         {
             AddressName = "Home",
             Street = new string[] { formOfPaymentInfo.Address },
             City = formOfPaymentInfo.City,
             State = new State()
             {
                 Value = formOfPaymentInfo.State
             },
             PostalCode = formOfPaymentInfo.PostalCode,
             Country = formOfPaymentInfo.Country
         },
         ExpDate = formOfPaymentInfo.CardExpirationYear + "-" + formOfPaymentInfo.CardExpirationMonth,
         //Key = "GAJOYrVu4hGShsrlYIhwmw==",
         Number = formOfPaymentInfo.CardNumber,
         //BankCountryCode = "US",
         CVV = formOfPaymentInfo.CvvOrCvc,
         Type = "VI"
     };
     fop.Item = cc;
     payments.Add(fop);
     return payments.ToArray();
 }
Esempio n. 7
0
 public AssignChargeOfServiceEventArgs()
 {
     FormOfPayment = new FormOfPayment();
 }
        private FormOfPayment[] AddFormOfPayment()
        {
            List<FormOfPayment> payments = new List<FormOfPayment>();

            FormOfPayment fop = new FormOfPayment();
            fop.Key = "jwt2mcK1Qp27I2xfpcCtAw==";//Key can be different
            fop.Type = "Credit";

            CreditCard cc = new CreditCard()
            {
                BillingAddress = new typeStructuredAddress()
                {
                    AddressName = "Home",
                    Street = new string[] { "2914 N. Dakota Avenue" },
                    City = "Denver",
                    State = new State()
                    {
                        Value = "CO"
                    },
                    PostalCode = "80206",
                    Country = "US"
                },
                ExpDate = DateTime.Now.AddYears(2).ToString("yyyy-MM"),
                Key = "GAJOYrVu4hGShsrlYIhwmw==",
                Number = "4111111111111111",
                BankCountryCode = "US",
                CVV = "123",
                Type = "VI"
            };

            fop.Item = cc;

            payments.Add(fop);

            return payments.ToArray();

        }
Esempio n. 9
0
 public bool InsertOrUpdate(FormOfPayment FormOfPayment)
 {
     return(_epr.InsertOrUpdate(FormOfPayment));
 }
        private async Task <string> SaveExpense(string place, string description, decimal value, DateTime date, string type, FormOfPayment selFormPayment)
        {
            var task = Task.Factory.StartNew(() => {
                using (var context = new FinanceModel())
                {
                    var formOfPayment = context.FormOfPayments.First(f => f.Id == selFormPayment.Id);
                    var balance       = context.Balances.First(b => b.Id == formOfPayment.Balance_Id);
                    var user          = context.Users.First(u => u.CPF == "39174716808");

                    var expense = new VariableExpense()
                    {
                        Place         = place,
                        Description   = description,
                        FormOfPayment = formOfPayment,
                        Value         = value,
                        Date          = date,
                        Type          = type,
                        CreatedAt     = DateTime.Now,
                        User          = user
                    };

                    if (type.Contains("Despesa"))
                    {
                        balance.Value    -= (double)expense.Value;
                        balance.UpdatedAt = DateTime.Now;
                    }
                    else
                    {
                        balance.Value += (double)expense.Value;
                    }

                    context.VariableExpenses.Add(expense);
                    context.SaveChanges();

                    return("Despesa inserida com sucesso!");
                }
            });

            return(await task);
        }
Esempio n. 11
0
 public bool Save(FormOfPayment FormOfPayment)
 {
     _FormOfPaymentApp.InsertOrUpdate(FormOfPayment);
     return(_connection.Save());
 }