コード例 #1
0
        public bool EnviarTicket(string mail, List <ProductoCLS> lista, int nOrden)
        {
            MailCLS oMailCLS = new MailCLS();

            try
            {
                MailMessage correo = new MailMessage();
                correo.From = new MailAddress("*****@*****.**");
                correo.To.Add(mail);
                correo.Subject    = "Ticket de Compra - Los Golosos";
                correo.Body       = oMailCLS.GenerarTicket(lista, nOrden);
                correo.IsBodyHtml = true;
                correo.Priority   = MailPriority.Normal;


                //Configuración del servidor SMTP
                using (SmtpClient client = new SmtpClient())
                {
                    client.EnableSsl             = true;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new NetworkCredential("*****@*****.**", "?Ki_l-5>*");
                    client.Host           = "smtp.gmail.com";
                    client.Port           = 587;
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;

                    client.Send(correo);
                }
            }
            catch {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        public ActionResult Contact(MailCLS oMailCLS)
        {
            try
            {
                MailMessage correo = new MailMessage();
                correo.From = new MailAddress(oMailCLS.desde);
                correo.To.Add("*****@*****.**");
                correo.Subject    = "Formulario de contácto - Los Golosos";
                correo.Body       = oMailCLS.GenerarContacto();
                correo.IsBodyHtml = true;
                correo.Priority   = MailPriority.Normal;


                //Configuración del servidor SMTP
                using (SmtpClient client = new SmtpClient())
                {
                    client.EnableSsl             = true;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new NetworkCredential("*****@*****.**", "?Ki_l-5>*");
                    client.Host           = "smtp.gmail.com";
                    client.Port           = 587;
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;

                    client.Send(correo);
                }
            }
            catch (Exception ex)
            {
                return(View(oMailCLS));
            }

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public IHttpActionResult HotelsConformation(string sid, string bookingNum, string tok)
        {
            ValidatingPaymentModel validating;

            validating = null;
            NotificationCls notification = new NotificationCls();
            BookingStatus   value = new BookingStatus();
            MailObj         mailVal = new MailObj();
            string          Notstatus = ""; string Mess = "";

            //[FromBody] BookingStatus value
            try
            {
                HotelBookingCls hotelBooking = new HotelBookingCls();
                value.BookingNum = bookingNum;
                value.Sid        = sid;
                value.Status     = "";
                LoggingHelper.WriteToFile("SaveBookingConfirmationController/ConfirmHotelStatusapi/", "ConfirmedstatusController" + "INController" + value.Sid, "InComingData", "sid" + value.Sid + " , BookingNum" + value.BookingNum);
                // call payment Transaction
                var payResult = Pay.GetPaymentTransactionAsync(tok, bookingNum, sid).Result;
                if (payResult != null)
                {
                    if (payResult.HGResponseCode == "100" || payResult.HGResponseCode == "000")
                    {
                        validating   = new ValidatingPaymentModel();
                        value.Status = payResult.FraudStatus;
                        if (payResult.FraudStatus.ToLower() == "approved")
                        {
                            hotelBooking.addBookingStatus("Payment Done", bookingNum);
                            validating.Status = 0;
                        }
                        else if (payResult.FraudStatus.ToLower() == "refused")
                        {
                            hotelBooking.addBookingStatus("Payment Refused", bookingNum);
                            validating.Status = 2;
                        }
                        else if (payResult.FraudStatus.ToLower() == "suspected")
                        {
                            hotelBooking.addBookingStatus("Payment Suspected", bookingNum);
                            validating.Status = 2;
                        }
                    }
                    else
                    {
                        hotelBooking.addBookingStatus("Payment Failed", bookingNum);
                        validating        = new ValidatingPaymentModel();
                        validating.Status = 1;
                        Mess = "Some thing wrong Please Search again";

                        notification.sendnotification(value, bookingNum, validating.Status.ToString(), sid, Mess, mailVal);
                        return(Ok(validating));
                    }
                    // add status
                    if (validating.Status == 0)
                    {
                        var Confirm = ConfirmationBooking.GetConfirmationBooking(sid, bookingNum);
                        // if(Confirm)
                        if (Confirm.status == 0)
                        {
                            validating.Status = 0;
                            value.Status      = "Booking Confirmed";
                            hotelBooking.addBookingStatus("Booking Confirmed", bookingNum);
                            ConfirmationBLL confirmation = new ConfirmationBLL();
                            var             data         = confirmation.GetConfirmationData(sid, bookingNum);
                            LoggingHelper.WriteToFile("SendMailobject/", "INController" + value.Sid, "InComingData", JsonConvert.SerializeObject(data));

                            MailCLS mail = new MailCLS();
                            mailVal = mail.SendMail(data).Result;
                        }
                        else if (Confirm.status == 1)
                        {
                            validating.Status = 2;
                            value.Status      = "Missing";
                            hotelBooking.addBookingStatus("Missing", bookingNum);
                            Mess = "Some thing wrong Please Call Our Call Center";
                        }
                        else if (Confirm.status == 2)
                        {
                            validating.Status = 2;
                            value.Status      = "Booking Not Confirmed";
                            hotelBooking.addBookingStatus("Booking Not Confirmed", bookingNum);
                            Mess = "Some thing wrong Please Call Our Call Center";
                        }
                        else if (Confirm.status == 3)
                        {
                            validating.Status = 0;
                            value.Status      = "Booking Confirmed";
                        }
                        // var result = hotelBooking.ChangeBookingstatus(value);

                        notification.sendnotification(value, bookingNum, sid, validating.Status.ToString(), Mess, mailVal);
                        //validating.Status = 0;
                        return(Ok(validating));
                    }
                    Mess = "Some thing wrong Please Search again";
                    notification.sendnotification(value, bookingNum, validating.Status.ToString(), sid, Mess, mailVal);

                    return(Ok(validating));
                }
                validating.Status = 1;
                Mess = "Some thing wrong Please Search again";

                notification.sendnotification(value, bookingNum, validating.Status.ToString(), sid, Mess, mailVal);

                return(Ok(validating));
            }
            catch (Exception ex)
            {
                LoggingHelper.WriteToFile("SaveBookingConfirmationController/Errors/", "ConfirmedStautsController" + "INController" + value.Sid, ex.InnerException?.Message, ex.Message + ex.StackTrace);
                if (validating == null)
                {
                    Mess = "Some thing wrong Please Search again";
                    notification.sendnotification(value, bookingNum, "3", sid, Mess, mailVal);

                    return(BadRequest(ex.Message));
                }
                else
                {
                    if (validating.Status == 1)
                    {
                        Mess = "Some thing wrong Please Search again";

                        notification.sendnotification(value, bookingNum, validating.Status.ToString(), sid, Mess, mailVal);
                        return(Ok(validating));
                    }
                    validating.Status = 2;
                    Mess = "Some thing wrong Please call our Call center";

                    notification.sendnotification(value, bookingNum, validating.Status.ToString(), sid, Mess, mailVal);
                    return(Ok(validating));
                }
            }
        }