Ejemplo n.º 1
0
        // método chamado quando o utilizador paga
        public IActionResult OnPostChoosedPayment()
        {
            TryUpdateModelAsync(this);

            // recebe todo o trabalho
            Work work;

            work = JsonConvert.DeserializeObject <Work>(TempData["tempWork"].ToString());

            // se for null, alguma coisa de errado aconteceu
            if (work == null)
            {
                return(Page());
            }

            // recebe o profissional anteriormente guardado e vai buscá-lo à BD
            Professional professional = dbContext.Professionals.FirstOrDefault(m => m.UserName.Equals(TempData["proUsername"]));

            // vai buscar o cliente à BD
            Client Client = dbContext.Clients.FirstOrDefault(m => m.UserName.Equals(User.Identity.Name));

            // define o pagamento
            if (PaymentType.Equals("money"))
            {
                work.Payment = "N";
            }

            if (PaymentType.Equals("card"))
            {
                work.Payment = "S";
            }

            work.Client       = Client;
            work.Professional = professional;

            // envia email
            Email  email       = new Email();
            string destination = professional.Email;
            string subject     = "GuguDadah - Oferta recebida";
            string body        = "Recebeu uma oferta de trabalho. Por favor, consulte o site.";

            email.SendEmail(destination, subject, body);

            // adiciona o novo trabalho
            dbContext.Works.Add(work);

            // guarda as alterações
            dbContext.SaveChanges();

            return(RedirectToPage("/UserArea", "ClientLoggedIn").WithSuccess("Agendamento", "efetuado com sucesso.", "3000"));
        }
Ejemplo n.º 2
0
        public LogiNextTransaction(string[] csvLineFields)
        {
            InitializeIndexDictionary();

            OrderNumber = NormalizeFieldValue(csvLineFields[indexDictionary["OrderNumber"]]);
            Destination = NormalizeFieldValue(csvLineFields[indexDictionary["Destination"]]);
            OrderStatus = NormalizeFieldValue(csvLineFields[indexDictionary["OrderStatus"]]);
            OrderDate   = NormalizeFieldValue(csvLineFields[indexDictionary["OrderDate"]]);
            PaymentType = NormalizeFieldValue(csvLineFields[indexDictionary["PaymentType"]]);
            actualCashAtDeliveryParsed  = NormalizeFieldValue(csvLineFields[indexDictionary["ActualCashAtDelivery"]]);
            plannedCashAtDeliveryParsed = NormalizeFieldValue(csvLineFields[indexDictionary["PlannedCashAtDelivery"]]);
            orderValueParsed            = NormalizeFieldValue(csvLineFields[indexDictionary["OrderValue"]]);
            PaymentSubType = NormalizeFieldValue(csvLineFields[indexDictionary["PaymentSubType"]]);
            TransactionID  = NormalizeFieldValue(csvLineFields[indexDictionary["TransactionID"]]);
            DriverName     = NormalizeFieldValue(csvLineFields[indexDictionary["Driver"]]);
            DriverID       = NormalizeFieldValue(csvLineFields[indexDictionary["DriverID"]]);
            TripNumber     = NormalizeFieldValue(csvLineFields[indexDictionary["TripNumber"]]);

            if (PaymentType.Equals("COD", StringComparison.InvariantCultureIgnoreCase) && (!PaymentSubType.Equals("CASH", StringComparison.InvariantCultureIgnoreCase) &&
                                                                                           !PaymentSubType.Equals("CARD_MANUAL", StringComparison.InvariantCultureIgnoreCase)))
            {
                PaymentSubType = "COD OTHER";
            }

            if (actualCashAtDeliveryParsed == "" || actualCashAtDeliveryParsed == "-")
            {
                actualCashAtDeliveryParsed = "0";
            }
            if (plannedCashAtDeliveryParsed == "" || plannedCashAtDeliveryParsed == "-")
            {
                plannedCashAtDeliveryParsed = "0";
            }
            if (orderValueParsed == "" || orderValueParsed == "-")
            {
                orderValueParsed = "0";
            }

            ActualCashAtDelivery  = Convert.ToDecimal(actualCashAtDeliveryParsed, System.Globalization.CultureInfo.InvariantCulture);
            PlannedCashAtDelivery = Convert.ToDecimal(plannedCashAtDeliveryParsed, System.Globalization.CultureInfo.InvariantCulture);
            OrderValue            = Convert.ToDecimal(orderValueParsed, System.Globalization.CultureInfo.InvariantCulture);
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLPayment)obj;

            //reference types
            if (!Object.Equals(m_comment, other.m_comment))
            {
                return(false);
            }
            if (!Object.Equals(m_customCode1, other.m_customCode1))
            {
                return(false);
            }
            if (!Object.Equals(m_customCode2, other.m_customCode2))
            {
                return(false);
            }
            //value types
            if (!m_paymentId.Equals(other.m_paymentId))
            {
                return(false);
            }
            if (!m_client.Equals(other.m_client))
            {
                return(false);
            }
            if (!m_paymentType.Equals(other.m_paymentType))
            {
                return(false);
            }
            if (!m_paymentDate.Equals(other.m_paymentDate))
            {
                return(false);
            }
            if (!m_isActive.Equals(other.m_isActive))
            {
                return(false);
            }
            if (!m_isTimeLimited.Equals(other.m_isTimeLimited))
            {
                return(false);
            }
            if (!m_validFromDt.Equals(other.m_validFromDt))
            {
                return(false);
            }
            if (!m_validToDt.Equals(other.m_validToDt))
            {
                return(false);
            }
            if (!m_creditType.Equals(other.m_creditType))
            {
                return(false);
            }
            if (!m_quantity.Equals(other.m_quantity))
            {
                return(false);
            }
            if (!m_quantityUsed.Equals(other.m_quantityUsed))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns true if Payment instances are equal
        /// </summary>
        /// <param name="other">Instance of Payment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaymentDetails other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     RequestedOn == other.RequestedOn ||
                     RequestedOn != null &&
                     RequestedOn.Equals(other.RequestedOn)
                 ) &&
                 (
                     Source == other.Source ||
                     Source != null &&
                     Source.Equals(other.Source)
                 ) &&
                 (
                     Destination == other.Destination ||
                     Destination != null &&
                     Destination.Equals(other.Destination)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     PaymentType == other.PaymentType ||
                     PaymentType != null &&
                     PaymentType.Equals(other.PaymentType)
                 ) &&
                 (
                     Reference == other.Reference ||
                     Reference != null &&
                     Reference.Equals(other.Reference)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Approved == other.Approved ||
                     Approved != null &&
                     Approved.Equals(other.Approved)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     ThreeDS == other.ThreeDS ||
                     ThreeDS != null &&
                     ThreeDS.Equals(other.ThreeDS)
                 ) &&
                 (
                     Risk == other.Risk ||
                     Risk != null &&
                     Risk.Equals(other.Risk)
                 ) &&
                 (
                     Customer == other.Customer ||
                     Customer != null &&
                     Customer.Equals(other.Customer)
                 ) &&
                 (
                     BillingDescriptor == other.BillingDescriptor ||
                     BillingDescriptor != null &&
                     BillingDescriptor.Equals(other.BillingDescriptor)
                 ) &&
                 (
                     Shipping == other.Shipping ||
                     Shipping != null &&
                     Shipping.Equals(other.Shipping)
                 ) &&
                 (
                     PaymentIp == other.PaymentIp ||
                     PaymentIp != null &&
                     PaymentIp.Equals(other.PaymentIp)
                 ) &&
                 (
                     Eci == other.Eci ||
                     Eci != null &&
                     Eci.Equals(other.Eci)
                 ) &&
                 (
                     SchemeId == other.SchemeId ||
                     SchemeId != null &&
                     SchemeId.Equals(other.SchemeId)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }
        /// <summary>
        /// Returns true if PaymentRequest instances are equal
        /// </summary>
        /// <param name="other">Instance of PaymentRequest to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaymentRequest <TPaymentSource> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Source == other.Source ||
                     Source != null &&
                     Source.Equals(other.Source)
                     ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     PaymentType == other.PaymentType ||
                     PaymentType != null &&
                     PaymentType.Equals(other.PaymentType)
                 ) &&
                 (
                     Reference == other.Reference ||
                     Reference != null &&
                     Reference.Equals(other.Reference)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Customer == other.Customer ||
                     Customer != null &&
                     Customer.Equals(other.Customer)
                 ) &&
                 (
                     BillingDescriptor == other.BillingDescriptor ||
                     BillingDescriptor != null &&
                     BillingDescriptor.Equals(other.BillingDescriptor)
                 ) &&
                 (
                     Shipping == other.Shipping ||
                     Shipping != null &&
                     Shipping.Equals(other.Shipping)
                 ) &&
                 (
                     ThreeDS == other.ThreeDS ||
                     ThreeDS != null &&
                     ThreeDS.Equals(other.ThreeDS)
                 ) &&
                 (
                     PreviousPaymentId == other.PreviousPaymentId ||
                     PreviousPaymentId != null &&
                     PreviousPaymentId.Equals(other.PreviousPaymentId)
                 ) &&
                 (
                     Risk == other.Risk ||
                     Risk != null &&
                     Risk.Equals(other.Risk)
                 ) &&
                 (
                     SuccessUrl == other.SuccessUrl ||
                     SuccessUrl != null &&
                     SuccessUrl.Equals(other.SuccessUrl)
                 ) &&
                 (
                     FailureUrl == other.FailureUrl ||
                     FailureUrl != null &&
                     FailureUrl.Equals(other.FailureUrl)
                 ) &&
                 (
                     PaymentIp == other.PaymentIp ||
                     PaymentIp != null &&
                     PaymentIp.Equals(other.PaymentIp)
                 ));
        }