Ejemplo n.º 1
0
        public ActionResult Filter(Models.OfflinePaymentModel data)
        {
            if (data.SearchString == null)
            {
                data.SearchString = " ";
            }
            if (data.SearchString == " ")
            {
                data.SearchValue = 0;
            }
            List <CLayer.OfflinePayment> users = BLayer.OfflinePayment.ReportOfflinePayment_GetAll((int)CLayer.ObjectStatus.BookingStatus.CheckOut, data.SearchString, data.SearchValue, 0, 25);

            ViewBag.Filter = new Models.TransactionsModel();
            Models.OfflinePaymentModel forPager = new Models.OfflinePaymentModel()
            {
                Status       = data.Status,
                SearchString = data.SearchString,
                SearchValue  = data.SearchValue,
                TotalRows    = 0,
                Limit        = 25,
                currentPage  = 1
            };
            if (users.Count > 0)
            {
                forPager.TotalRows = users[0].TotalRows;
            }
            ViewBag.Filter = forPager;
            return(PartialView("_List", users));
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            Models.OfflinePaymentModel   search = new Models.OfflinePaymentModel();
            List <CLayer.OfflinePayment> users  = BLayer.OfflinePayment.ReportOfflinePayment_GetAll((int)CLayer.ObjectStatus.BookingStatus.CheckOut, "", 0, 0, 25);

            search.SearchString   = "";
            search.SearchValue    = 1;
            search.TotalRows      = 0;
            search.OfflinePayList = users;
            if (users.Count > 0)
            {
                search.TotalRows = users[0].TotalRows;
            }
            search.Limit       = 25;
            search.currentPage = 1;
            ViewBag.Filter     = search;
            return(View(search));
        }
Ejemplo n.º 3
0
        public async Task <string> CustomerInvoiceEmail()
        {
            WebClient wc = new WebClient();

            try
            {
                Models.OfflinePaymentModel   data = new Models.OfflinePaymentModel();
                List <CLayer.OfflineBooking> dt   = BLayer.OfflineBooking.GetBookingDetailsAfterSubmitForCustomer();
                long        OfflineBookingId      = 0;
                MailMessage mm = new MailMessage();

                string BccEmailsforcususer = BLayer.Settings.GetValue(CLayer.Settings.CC_CUSTOMERCOMMUNICATION);
                if (BccEmailsforcususer != "")
                {
                    string[] emails = BccEmailsforcususer.Split(',');
                    for (int i = 0; i < emails.Length; ++i)
                    {
                        mm.Bcc.Add(emails[i]);
                    }
                }


                mm.From = new MailAddress(ConfigurationManager.AppSettings.Get("CustomerCareMail"));
                Common.Mailer mlr = new Common.Mailer();
                mm.IsBodyHtml = true;
                mm.Subject    = "Invoice";
                foreach (CLayer.OfflineBooking offbook in dt)
                {
                    OfflineBookingId = offbook.OfflineBookingId;
                    string result = await GetMailBody(OfflineBookingId);

                    mm.To.Clear();
                    mm.To.Add(offbook.CustomerEmail);
                    mm.Body = result;
                    await mlr.SendMailAsyncWithoutFields(mm);
                }
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return("false");
            }
            return("true");
        }
        public ActionResult SaveOfflinePay(Models.OfflinePaymentModel data)
        {
            try
            {
                long UserId = GetUserId();
                CLayer.OfflinePayment dt = new CLayer.OfflinePayment();
                dt.Name            = data.Name;
                dt.Amount          = data.Amount;
                dt.ReferenceNumber = data.ReferenceNumber;
                dt.Message         = data.Message;
                dt.UserId          = UserId;
                dt.Address         = data.Address;
                dt.CountryId       = data.CountryId;
                dt.StateId         = data.State;
                dt.CityId          = data.CityId;
                if (data.City != null && data.City != "")
                {
                    dt.City = data.City;
                }
                if (data.CityId > 0)
                {
                    dt.City = BLayer.City.Get(data.CityId).Name;
                }
                dt.Email   = data.Email;
                dt.Mobile  = data.Mobile;
                dt.ZipCode = data.ZipCode;

                dt.Gatewaytype = (int)CLayer.ObjectStatus.Gateway.EBS;
                CLayer.Role.Roles rle   = BLayer.User.GetRole(UserId);
                long   OfflinePaymentId = BLayer.OfflinePayment.SaveInitialPaymentData(dt);
                string PaymentRefNo     = " ";
                long   OffPayId         = BLayer.OfflinePayment.SetPaymentRefNo(OfflinePaymentId, rle, PaymentRefNo);
                return(RedirectToAction("Index", "OfflinePaymentProcess", new { OfflinePaymentId = OfflinePaymentId }));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(RedirectToAction("Index", "Home"));
            }
        }
        public RedirectResult SaveOfflinePaybyPaypal(Models.OfflinePaymentModel data)
        {
            string errorPage = System.Configuration.ConfigurationManager.AppSettings.Get(PAYMENT_FAILED_LINK);

            try
            {
                long UserId = GetUserId();
                CLayer.OfflinePayment dt = new CLayer.OfflinePayment();
                dt.Name            = data.Name;
                dt.Amount          = data.Amount;
                dt.ReferenceNumber = data.ReferenceNumber;
                dt.Message         = data.Message;
                dt.UserId          = UserId;
                dt.Address         = data.Address;
                dt.CountryId       = data.CountryId;
                dt.StateId         = data.State;
                dt.CityId          = data.CityId;
                if (data.City != null && data.City != "")
                {
                    dt.City = data.City;
                }
                if (data.CityId > 0)
                {
                    dt.City = BLayer.City.Get(data.CityId).Name;
                }
                dt.Email       = data.Email;
                dt.Mobile      = data.Mobile;
                dt.ZipCode     = data.ZipCode;
                dt.Gatewaytype = (int)CLayer.ObjectStatus.Gateway.PayPal;
                CLayer.Role.Roles rle   = BLayer.User.GetRole(UserId);
                long   OfflinePaymentId = BLayer.OfflinePayment.SaveInitialPaymentData(dt);
                string PaymentRefNo     = " ";

                string token = "";

                try
                {
                    //load paypal url from settings
                    string     url  = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_TOKEN_URL);
                    WebRequest rqst = HttpWebRequest.Create(url);

                    rqst.Method = "POST";
                    string user, pwd, signature, returnurl, cancelurl;
                    user      = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_USER);
                    pwd       = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_PWD);
                    signature = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_SIGNAUTRE);
                    returnurl = BLayer.Settings.GetValue(CLayer.Settings.OFFLINE_PAYPAL_RETURN_URL);
                    cancelurl = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_CANCELURL);

                    CLayer.Currency cur = BLayer.Currency.Get("USD");
                    if (cur == null)
                    {
                        throw new Exception("Cannot find USD conversion rate for Paypal booking");
                    }
                    decimal amount = data.Amount;
                    amount = Math.Round(amount * cur.ConversionRate, 2, MidpointRounding.AwayFromZero);

                    string ProBookDes = data.Message;
                    string postdata   = "METHOD=SetExpressCheckout&VERSION=109.0";
                    postdata = postdata + "&USER="******"&PWD=" + pwd + "&SIGNATURE=" + signature;
                    postdata = postdata + "&PAYMENTREQUEST_0_AMT=" + amount.ToString("F2") + "&PAYMENTREQUEST_0_CURRENCYCODE=USD" + "&PAYMENTREQUEST_0_DESC=" + ProBookDes;
                    postdata = postdata + "&RETURNURL=" + Server.UrlEncode(returnurl);
                    postdata = postdata + "&CANCELURL=" + Server.UrlEncode(cancelurl);
                    postdata = postdata + "&PAYMENTREQUEST_0_PAYMENTACTION=Sale";

                    if (!String.IsNullOrEmpty(postdata))
                    {
                        rqst.ContentType = "application/x-www-form-urlencoded";
                        byte[] byteData = UTF8Encoding.UTF8.GetBytes(postdata);
                        rqst.ContentLength = byteData.Length;
                        using (Stream postStream = rqst.GetRequestStream())
                        {
                            postStream.Write(byteData, 0, byteData.Length);
                            postStream.Close();
                        }
                    }
                    ((HttpWebRequest)rqst).KeepAlive = false;
                    StreamReader rsps    = new StreamReader(rqst.GetResponse().GetResponseStream());
                    string       strRsps = rsps.ReadToEnd();
                    Debug.WriteLine(strRsps);
                    token = PaymentController.GetToken(strRsps);
                    if (token == "")
                    {
                        //(int)CLayer.ObjectStatus.OfflinePyamentStatus.Processing
                        BLayer.OfflinePayment.SetStatus((int)CLayer.ObjectStatus.OfflinePyamentStatus.failed, OfflinePaymentId);
                        return(Redirect(errorPage));
                    }
                }
                catch (Exception ex)
                {
                    Common.LogHandler.HandleError(ex);
                    BLayer.OfflinePayment.SetStatus((int)CLayer.ObjectStatus.OfflinePyamentStatus.failed, OfflinePaymentId);
                    return(Redirect(errorPage));
                }

                string red = BLayer.Settings.GetValue(CLayer.Settings.PAYPAL_REQUEST_URL) + token;

                token = Server.UrlDecode(token);
                //save to database
                PaymentRefNo = token;
                long OffPayId = BLayer.OfflinePayment.SetPaymentRefNo(OfflinePaymentId, rle, PaymentRefNo);
                BLayer.OfflinePayment.SetStatus((int)CLayer.ObjectStatus.OfflinePyamentStatus.Processing, OfflinePaymentId);
                return(Redirect(red));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect(errorPage));
            }
        }
Ejemplo n.º 6
0
        public async Task <string> SupplierPaymentEmail()
        {
            WebClient wc = new WebClient();

            try
            {
                Models.OfflinePaymentModel   data = new Models.OfflinePaymentModel();
                List <CLayer.OfflineBooking> dt   = BLayer.OfflineBooking.GetAllOfflineDetails();
                long        OfflineBookingId      = 0;
                MailMessage mm = new MailMessage();

                string BccEmailsforcususer = BLayer.Settings.GetValue(CLayer.Settings.SUPPLIERPAYMENTSCHEDULEEMAIL);
                if (BccEmailsforcususer != "")
                {
                    mm.To.Clear();
                    string[] emails = BccEmailsforcususer.Split(',');
                    for (int i = 0; i < emails.Length; ++i)
                    {
                        mm.To.Add(emails[i]);
                    }
                }


                mm.From = new MailAddress(ConfigurationManager.AppSettings.Get("CustomerCareMail"));
                Common.Mailer mlr = new Common.Mailer();
                mm.IsBodyHtml = true;


                foreach (CLayer.OfflineBooking offbook in dt)
                {
                    CLayer.OfflineBooking offedit = BLayer.OfflineBooking.GetAllDetailsById(offbook.OfflineBookingId);

                    if (offedit.IsSupplierPaymentMailSend)
                    {
                        mm.Subject = "SUPPLIER PAYMENT SCHEDULE EMAIL [Revised]";
                    }
                    else
                    {
                        mm.Subject = "SUPPLIER PAYMENT SCHEDULE EMAIL";
                    }


                    if (offbook.SupplierPaymentScheduleList.Count > 0)
                    {
                        int exit = 0;
                        foreach (var schedule in offbook.SupplierPaymentScheduleList)
                        {
                            if (schedule.SupplierPaymentMode == (int)CLayer.OfflineBooking.SupplierPaymentModelist.OnInstalments)
                            {
                                foreach (var date in offbook.SupplierPaymentScheduleList)
                                {
                                    if (date.SupplierPaymentModeDate.ToShortDateString() == System.DateTime.Now.ToShortDateString() && exit == 0)
                                    {
                                        OfflineBookingId = offbook.OfflineBookingId;
                                        string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflinebookingSupplierPaymentSchedule") + OfflineBookingId.ToString();
                                        //for normal user mail body
                                        string result = await Common.Mailer.MessageFromHtml(link);


                                        mm.Body = result;
                                        await mlr.SendMailAsyncWithoutFields(mm);

                                        //Update supplier payment mail send data
                                        BLayer.OfflineBooking.UpdateSupplierPaymentmailsendData(OfflineBookingId);
                                        exit = 1;
                                        break;
                                    }
                                }
                            }
                            if (schedule.SupplierPaymentMode == (int)CLayer.OfflineBooking.SupplierPaymentModelist.Credit)
                            {
                                DateTime dtDate = offbook.CheckOut.AddDays(schedule.SupplierCreditDays);
                                if (dtDate.ToShortDateString() == System.DateTime.Now.ToShortDateString())
                                {
                                    OfflineBookingId = offbook.OfflineBookingId;
                                    string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflinebookingSupplierPaymentSchedule") + OfflineBookingId.ToString();
                                    //for normal user mail body
                                    string result = await Common.Mailer.MessageFromHtml(link);


                                    mm.Body = result;
                                    await mlr.SendMailAsyncWithoutFields(mm);

                                    //Update supplier payment mail send data
                                    BLayer.OfflineBooking.UpdateSupplierPaymentmailsendData(OfflineBookingId);
                                }
                            }
                            if (schedule.SupplierPaymentMode == (int)CLayer.OfflineBooking.SupplierPaymentModelist.FullAmountBeforeCheckin)
                            {
                                if (offbook.CheckIn.ToShortDateString() == System.DateTime.Now.ToShortDateString())
                                {
                                    OfflineBookingId = offbook.OfflineBookingId;
                                    string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflinebookingSupplierPaymentSchedule") + OfflineBookingId.ToString();
                                    //for normal user mail body
                                    string result = await Common.Mailer.MessageFromHtml(link);


                                    mm.Body = result;
                                    await mlr.SendMailAsyncWithoutFields(mm);

                                    //Update supplier payment mail send data
                                    BLayer.OfflineBooking.UpdateSupplierPaymentmailsendData(OfflineBookingId);
                                }
                            }
                            if (schedule.SupplierPaymentMode == (int)CLayer.OfflineBooking.SupplierPaymentModelist.FullAmountBeforeCheckout)
                            {
                                if (offbook.CheckOut.ToShortDateString() == System.DateTime.Now.ToShortDateString())
                                {
                                    OfflineBookingId = offbook.OfflineBookingId;
                                    string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflinebookingSupplierPaymentSchedule") + OfflineBookingId.ToString();
                                    //for normal user mail body
                                    string result = await Common.Mailer.MessageFromHtml(link);


                                    mm.Body = result;
                                    await mlr.SendMailAsyncWithoutFields(mm);

                                    //Update supplier payment mail send data
                                    BLayer.OfflineBooking.UpdateSupplierPaymentmailsendData(OfflineBookingId);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return("false");
            }
            return("true");
        }
Ejemplo n.º 7
0
        public async Task <string> InvoicePendingEmail()
        {
            WebClient wc = new WebClient();

            try
            {
                Models.OfflinePaymentModel data = new Models.OfflinePaymentModel();
                List <CLayer.Invoice>      dt   = BLayer.OfflineBooking.GetDetailsNotSubmittedandGenerated();
                MailMessage mm = new MailMessage();

                string Toemailids = ConfigurationManager.AppSettings.Get("InvoicePendingListSendToMailids");
                if (Toemailids != "")
                {
                    string[] emails = Toemailids.Split(',');
                    for (int i = 0; i < emails.Length; ++i)
                    {
                        mm.To.Add(emails[i]);
                    }
                }

                string Ccemailids = ConfigurationManager.AppSettings.Get("InvoicePendingListSendCcMailids");
                if (Ccemailids != "")
                {
                    string[] emails = Ccemailids.Split(',');
                    for (int i = 0; i < emails.Length; ++i)
                    {
                        mm.CC.Add(emails[i]);
                    }
                }


                //string BccEmailsforcususer = BLayer.Settings.GetValue(CLayer.Settings.CC_CUSTOMERCOMMUNICATION);
                //if (BccEmailsforcususer != "")
                //{
                //    string[] emails = BccEmailsforcususer.Split(',');
                //    for (int i = 0; i < emails.Length; ++i)
                //    {
                //        mm.Bcc.Add(emails[i]);
                //    }
                //}

                //mm.To.Add(BLayer.Settings.GetValue(CLayer.Settings.SUPPORT_EMAIL));



                mm.From = new MailAddress(ConfigurationManager.AppSettings.Get("CustomerCareMail"));
                Common.Mailer mlr = new Common.Mailer();
                mm.IsBodyHtml = true;
                mm.Subject    = "Invoice Pending";
                string result = await GetMailBodyForNotSubmittedandGeneratedList();

                mm.Body = result;

                if (dt != null)
                {
                    if (dt.Count > 0)
                    {
                        await mlr.SendMailAsyncWithoutFields(mm);
                    }
                }
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return("false");
            }
            return("true");
        }