Exemple #1
0
        public ActionResult GetLeftPayment(BiddingHotelsUpgrade objUpgrade)
        {
            try
            {
                var obj = new BiddingHotelsUpgrade();
                if (TempData["BIdUpgradeHotels"] != null)
                {
                    TempData.Keep(); obj = TempData["BIdUpgradeHotels"] as BiddingHotelsUpgrade;
                }

                var prop = obj.lstRoomsData.Where(u => u.iRoomId == objUpgrade.iRoomId).SingleOrDefault();

                var obj1 = new eBiddingHotelsUpgradeRoomsList();
                obj1 = prop as eBiddingHotelsUpgradeRoomsList;
                var result = BL_Bidding.UpdateUpgradeBidBookingUnfinished(Convert.ToInt64(objUpgrade.iBookingId), obj.iPropId, objUpgrade.iRoomId, obj1.TotalDifference, obj1.TaxDifference, objUpgrade.sAuthCode);
                if (result.Status == "Success")
                {
                    var bookingModel = BL_Booking.GetBooking(Convert.ToInt64(objUpgrade.iBookingId));

                    string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment.";
                    Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null));
                    Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status));
                    Session["Result"] = "Hotel selected successfully!";
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception E)
            {
                Session["Result"] = "There was an error selecting the hotel. Please try again.";
            }
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult UpdateBookingOnUpgrade(BiddingHotelsUpgrade obj)
        {
            try
            {
                TempData.Peek("BIdUpgradeHotels");
                TempData.Peek("BidSearchHotels");
                TempData.Peek("BidSearchData");
                int bookingId, PropId;
                PropId    = obj.iPropId;
                bookingId = obj.iBookingId;

                eBidBookingResult Robj = BL_Bidding.UpdateBidBooking(bookingId, PropId);
                if (Robj.Status == "Success")
                {
                    var bookingModel = BL_Booking.GetBooking(bookingId);

                    string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment.";
                    Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null));
                    Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status));
                    Session["Result"] = "Hotel selected successfully!";
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception E)
            {
                Session["Result"] = "There was an error selecting the hotel. Please try again.";
            }
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult NegotiationForHotelPending(long bookingId)
        {
            ViewBag.HeaderBarData = "Confirmation";
            var BookingModel = BL_Booking.GetBookingModifyDetails(bookingId);

            BookingModel.Symbol = "₹";
            return(View(BookingModel));
        }
Exemple #4
0
        //[HttpPost]
        public ActionResult SendMailAndUpdateTaxAffectedBookings(string selectedBookingIds)
        {
            try
            {
                if (!string.IsNullOrEmpty(selectedBookingIds))
                {
                    var userId = ((BL_Login.UserDetails)Session["UserDetails"]).iUserId;

                    List <string> deliveredBookingIdInEmail = new List <string>();

                    long[] bookingIdArr = selectedBookingIds.Split(',').Select(long.Parse).ToArray();

                    var affectedBoolingList = BL_Booking.GetTaxAffectedBookings(bookingIdArr);

                    bool isError = false;

                    foreach (var item in affectedBoolingList)
                    {
                        try
                        {
                            item.sCheckIn  = item.dtCheckIn.ToString("dd MMM yyyy");
                            item.sCheckOut = item.dtCheckOut.ToString("dd MMM yyyy");

                            var html_Customer = this.RenderViewToString("_TaxChangeBookingAlert", item);

                            //TO DO
                            var ccMail = string.Empty;
                            ccMail = "*****@*****.**";
                            MailComponent.SendEmail(item.sEmailOFR, ccMail, "", "OneFineRate! Confirmation No:" + item.iBookingId, html_Customer, null, null, true, null, null);
                            deliveredBookingIdInEmail.Add(item.iBookingId.ToString());
                        }
                        catch (Exception ex)
                        {
                            isError = true;
                        }
                    }

                    var result = BL_Booking.UpdateTaxAffectedBookings(deliveredBookingIdInEmail.ToArray(), userId);

                    if (isError)
                    {
                        return(Json(new { status = false, message = "An error occured occurred while sending email." }, JsonRequestBehavior.AllowGet));
                    }

                    return(Json(new { status = true, message = "Record updated and email sent to selected record successfully!" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { status = false, message = "Please select at least one booking." }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { status = false, message = "An error occurred while updating the record!" }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #5
0
        public ActionResult GotCounterOffer()
        {
            long?BookingId = 0;

            if (HttpContext.Request.Params["Id"] != null)
            {
                BookingId = Convert.ToInt32(HttpContext.Request.Params["Id"]);
            }
            ViewBag.HeaderBarData = "Preview";
            BalancePaymentModel model = new BalancePaymentModel();

            model = BL_Booking.GetNegotionTransactionDataForBooking(Convert.ToInt32(BookingId));
            ViewBag.StatusType = model.cBookingStatus;
            return(View("NegotiationCounterOffer", model));
        }
Exemple #6
0
 public string ReleaseInventory(int bookingId)
 {
     try
     {
         string s = BL_Booking.ReleaseInventory(bookingId, ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId);
         if (s == "")
         {
             return("{ \"st\" : 1 , \"Status\" : \"Inventory released successfully.\" }");
         }
         else
         {
             return("{ \"st\" : 0 , \"Status\" : \"" + s + "\" }");
         }
     }
     catch (Exception)
     {
         return("{ \"st\" : 0 , \"Status\" : \"Please try again.\" }");
     }
 }
        public ActionResult GetBidSearchedHotels(string bookingId)
        {
            int bookId = Convert.ToInt32(clsUtils.Decode(bookingId));


            //fetch the data of booking
            var booking = BL_Booking.GetBooking(bookId);

            if (booking.iPropId != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            eBidding objdata = new eBidding();

            objdata = BL_Bidding.GetSearchedBidHotelsListForUnfinished(bookId);

            if (objdata.lstBidRoomsData.Count > 0)
            {
                DataTable dtPropIds = new DataTable();
                dtPropIds.Columns.AddRange(new DataColumn[1]
                {
                    new DataColumn("Id", typeof(int))
                });

                foreach (var item in objdata.lstBidRoomsData)
                {
                    DataRow drpropid = dtPropIds.NewRow();
                    drpropid["Id"] = item.iPropId;
                    dtPropIds.Rows.Add(drpropid);
                }

                BL_PropDetails.UpdateViewForConversion("B", dtPropIds, bookId);
            }
            objdata.iBookingId               = bookId;
            objdata.BidSearchHotels          = "BidSearchHotels" + Guid.NewGuid().ToString();
            Session[objdata.BidSearchHotels] = objdata;
            return(View(objdata));
        }
Exemple #8
0
        public string ProvideFinalOffer(int BookingId, int FinalOffer, int Convert)
        {
            try
            {
                string s = BL_Booking.ProvideFinalOffer(BookingId, FinalOffer, ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId, Convert);
                if (s == "")
                {
                    var bookingDetails = BL_Booking.GetBookingModifyDetails_Notifications(BookingId);
                    var model          = new NegotiationEmailTempleteModel();
                    model.Status = "Progress! You have received a  counter offer! Please check the details by clicking the link below: ";

                    bookingDetails.dTaxes = System.Convert.ToDecimal(bookingDetails.sExtra2);
                    model.BookingModify   = bookingDetails;

                    var websiteBaseUrl = ConfigurationManager.AppSettings["OFRBaseUrl"].ToString();
                    model.CallbackUrl = websiteBaseUrl + "Negotiation/NegotiationStatus?bookingId=" + clsUtils.Encode(BookingId.ToString());

                    model.CallbackUrl = clsUtils.Shorten(model.CallbackUrl);
                    // string notifySMS_User = model.Status + Environment.NewLine + "<a href=\"" + model.CallbackUrl + "\"></a>";

                    var html      = this.RenderViewToString("_EmailTemplete", model);
                    var testEmail = "";

                    Task.Run(() => clsUtils.sendSMS(bookingDetails.MobileOFR, model.Status + model.CallbackUrl));
                    Task.Run(() => MailComponent.SendEmail(bookingDetails.EmailOFR, testEmail, "", "Bargain Status", html, null, null, true, null, null));

                    return("{ \"st\" : 1 , \"Status\" : \"Final offer provided successfully.\" }");
                }
                else
                {
                    return("{ \"st\" : 0 , \"Status\" : \"" + s + "\" }");
                }
            }
            catch (Exception)
            {
                return("{ \"st\" : 0 , \"Status\" : \"Please try again.\" }");
            }
        }
Exemple #9
0
        public ActionResult UnfinishedBalanceToBePaid(etblUnfinishedTransactionsToBePaid objprop)
        {
            etblUnfinishedTransactionsToBePaid objData = new etblUnfinishedTransactionsToBePaid();

            if (objprop.iBookingID != null)
            {
                objData = BL_UnfinishedTransactions.GetUnfinishedBalanceToBePaidData(objprop.iBookingID);
            }
            else
            {
                long BookingId = 0;
                if (HttpContext.Request.Params["Id"] != null)
                {
                    BookingId = Convert.ToInt32(HttpContext.Request.Params["Id"]);
                }
                //objData = BL_UnfinishedTransactions.GetUnfinishedBalanceToBePaidData(BookingId);
                var obj = BL_Booking.GetUnfinishedTransactionToSendRevenueManager(BookingId);
                obj.sBookType = "N";
                return(View("NegotiationAccepted", obj));
            }

            return(View("UnfinishedBalanceToBePaid", objData));
        }
Exemple #10
0
        public ActionResult Login(OneFineRateBLL.Entities.eLogin model, string returnUrl)
        {
            TempData["Error"] = null;
            if (ModelState.IsValid)
            {
                OneFineRateBLL.BL_Login.UserDetails eobj           = new OneFineRateBLL.BL_Login.UserDetails();
                OneFineRateBLL.BL_Login.UserDetails eobjActiveUser = new OneFineRateBLL.BL_Login.UserDetails();
                OneFineRateAppUtil.clsUtils.ConvertToObject(OneFineRateBLL.BL_Login.ValidateUser(model.UserName, model.Password), eobj);
                OneFineRateAppUtil.clsUtils.ConvertToObject(OneFineRateBLL.BL_Login.ActiveUser(model.UserName), eobjActiveUser);
                if (eobj.iUserId > 0 && eobjActiveUser.cStatus == "A")
                {
                    if (model.RememberMe)
                    {
                        Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30);
                        Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30);
                    }
                    else
                    {
                        Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1);
                    }
                    Response.Cookies["UserName"].Value = model.UserName.Trim();
                    Response.Cookies["Password"].Value = model.Password.Trim();


                    Session["UserDetails"] = eobj;
                    Session["MenuType"]    = "1";
                    //Session["Username"] = eobj.UserName;
                    //Session["FisrtName"] = eobj.FisrtName;
                    //Session["LastName"] = eobj.LastName;

                    string sPath = OneFineRateBLL.BL_Menu.GetHomePageByUserId(eobj.iUserId);
                    if (sPath != null)
                    {
                        FormsAuthentication.SetAuthCookie(model.UserName, true);

                        #region Redirect For Booking Confirmation

                        if (model.sBookingId != null)
                        {
                            var bookingIdDecoded = OneFineRateAppUtil.clsUtils.Decode(model.sBookingId);

                            var iPropId = BL_Booking.GetPropIdByBookingId(bookingIdDecoded);

                            if (iPropId.HasValue)
                            {
                                Session["MenuType"] = "2";
                                Session["PropId"]   = iPropId;

                                Session["CurrCode"] = BL_Currency.GetCurrencyByPropId(iPropId.Value);
                                //Session["Symbol"] = BL_Currency.GetSymbolByPropId(PropId);
                                Session["Flag"]     = BL_Currency.GetFlagByPropId(iPropId.Value);
                                Session["PropName"] = BL_PropDetails.GetPropertyName(iPropId.Value);

                                return(RedirectToRoute("BookingConfirmation", new { bookingId = model.sBookingId }));
                            }
                        }

                        #endregion Redirect For Pending Confirmation

                        #region Redirect For Pending Negotiation

                        if (model.sPropId != null)
                        {
                            int iPropId = 0;
                            try
                            {
                                iPropId = int.Parse(clsUtils.Decode(model.sPropId));
                            }
                            catch (Exception)
                            {
                            }

                            if (iPropId > 0)
                            {
                                Session["MenuType"] = "2";
                                Session["PropId"]   = iPropId;

                                Session["CurrCode"] = BL_Currency.GetCurrencyByPropId(iPropId);
                                //Session["Symbol"] = BL_Currency.GetSymbolByPropId(PropId);
                                Session["Flag"]     = BL_Currency.GetFlagByPropId(iPropId);
                                Session["PropName"] = BL_PropDetails.GetPropertyName(iPropId);

                                return(RedirectToAction("Index", "PendingNegotiations"));
                            }
                        }

                        #endregion

                        string[] Values = sPath.Split('/');
                        if (Values.Length == 2)
                        {
                            //FormsAuthentication.RedirectFromLoginPage(model.UserName, model.RememberMe);
                            return(RedirectToAction("Index", Values[1]));
                        }
                        else
                        {
                            //FormsAuthentication.RedirectFromLoginPage(model.UserName, model.RememberMe);
                            return(RedirectToAction(Values[2], Values[1]));
                        }
                    }
                    else
                    {
                        TempData["Error"] = "All the Groups are Inactive for this user.";
                    }
                }

                if (eobj.iUserId == 0)
                {
                    // ModelState.AddModelError("", "Incorrect username and/or password");
                    TempData["Error"] = "Incorrect username and/or password";
                }
                else if (eobjActiveUser.cStatus == "I")
                {
                    TempData["Error"] = "User has been diasbled by Administrator.";
                }
            }

            return(View(model));
        }
        //Save booking data in Database
        private int SaveBookingAndGetBookingId(PropDetailsM obj)
        {
            int result = 0;

            try
            {
                Decimal?ExchangeRate     = 1;
                Decimal?OriginalTotalAmt = 0;
                int?    Days             = 0;
                etblOriginalBookingPrice                    objOrgBook          = new etblOriginalBookingPrice();
                etblBookingNegotiationTx                    objNego             = new etblBookingNegotiationTx();
                etblBookingTrakerTx                         objTrck             = new etblBookingTrakerTx();
                List <etblBookingGuestMap>                  lst                 = new List <etblBookingGuestMap>();
                List <etblBookingDetailsTx>                 lstBookDetails      = new List <etblBookingDetailsTx>();
                List <etblBookingCancellationPolicyMap>     lstCancelPolicy     = new List <etblBookingCancellationPolicyMap>();
                List <etblBookedDayWiseTaxAmountDetails>    lstDayTaxes         = new List <etblBookedDayWiseTaxAmountDetails>();
                List <etblBookedDayWiseTaxAmountDetailsAll> lstDayTaxesDateWise = new List <etblBookedDayWiseTaxAmountDetailsAll>();

                obj.objBooking.iPropId     = obj.iPropId;
                obj.objBooking.iCustomerId = obj.iUserId;
                obj.objBooking.iGuestId    = obj.iGuestId;
                if (obj.iUserId == 0)
                {
                    obj.objBooking.iCustomerId = null;
                }
                if (obj.iGuestId == 0)
                {
                    obj.objBooking.iGuestId = null;
                }
                obj.objBooking.dtCheckIn           = obj.dtCheckIn;
                obj.objBooking.dtChekOut           = obj.dtCheckOut;
                obj.objBooking.dtReservationDate   = DateTime.Now;
                obj.objBooking.sTitleOFR           = obj.sUserTitle;
                obj.objBooking.sFirstNameOFR       = obj.sUserFirstName;
                obj.objBooking.sLastNameOFR        = obj.sUserLastName;
                obj.objBooking.sEmailOFR           = obj.sUserEmail;
                obj.objBooking.sMobileOFR          = obj.sUserMobileNo;
                obj.objBooking.sCountryPhoneCode   = obj.sCountryPhoneCode;
                obj.objBooking.dtActionDate        = DateTime.Now;
                obj.objBooking.BookingStatus       = "PP";
                obj.objBooking.PaymentStatus       = "P";
                obj.objBooking.sExtra3             = "Redeem";
                obj.objBooking.sExtra4             = obj.sTotalPoints;
                obj.objBooking.sCurrencyCode       = obj.Currency;
                obj.objBooking.dServiceCharge      = obj.TaxCharges.dOFRServiceCharge;
                obj.objBooking.dGSTOnServiceCharge = obj.TaxCharges.TaxOnServiceCharge;
                obj.objBooking.dGSTValue           = obj.TaxCharges.dGstValue;
                obj.objBooking.dGSTServiceType     = obj.TaxCharges.cGstValueType;


                if (obj.objBooking.sCurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", obj.objBooking.sCurrencyCode);
                    if (objExchange.dRate != 0)
                    {
                        ExchangeRate = 1 / objExchange.dRate;
                    }
                }

                Days = Convert.ToInt32((Convert.ToDateTime(obj.objBooking.dtChekOut) - Convert.ToDateTime(obj.objBooking.dtCheckIn)).TotalDays);

                obj.objBooking.dTotalAmount = obj.dSummaryRoomRate * ExchangeRate;


                decimal OFRServiceTax = obj.objBooking.dServiceCharge + obj.objBooking.dGSTOnServiceCharge;

                if (!String.IsNullOrEmpty(obj.objBooking.sExtra2))
                {
                    obj.objBooking.sExtra2 = (Convert.ToDecimal(obj.objBooking.sExtra2) * Convert.ToDecimal(ExchangeRate)).ToString();
                }
                obj.objBooking.dTaxes               = obj.dSummaryTaxes * ExchangeRate;
                obj.objBooking.dTaxesForHotel       = obj.dSummaryTaxes * ExchangeRate;
                obj.objBooking.dTotalExtraBedAmount = obj.dSummaryExtraBedCharges * ExchangeRate;

                obj.objBooking.dTaxesOriginal = obj.dSummaryTaxes * ExchangeRate;

                string  TimeZone = Session["TimeZone"] != null ? Session["TimeZone"].ToString() : "+5:30";
                decimal zone     = Convert.ToDecimal(TimeZone.Replace(":", ".").Replace("+", ""));
                obj.objBooking.iCountryOffset = zone;


                if (obj.objBooking.PromoCodeApplied == true)
                {
                    obj.objBooking.dDiscountedBidPrice = obj.objBooking.PromoCodeValue * ExchangeRate;
                }

                decimal Rate = obj.dCommissionRate;
                if (Rate != 0)
                {
                    decimal Comm = (obj.dSummaryRoomRate + obj.dSummaryExtraBedCharges) * Rate / 100;
                    obj.objBooking.dTotalComm         = Comm * ExchangeRate;
                    obj.objBooking.dTotalCommOriginal = Comm * ExchangeRate;
                }

                obj.objBooking.cBookingType = "R";

                objTrck.BookingStatus = "PP";
                objTrck.dtActionDate  = DateTime.Now;

                for (int i = 0; i < obj.lstetblRooms.Count; i++)
                {
                    for (int j = 0; j < obj.lstetblRooms[i].lstRatePlan.Count; j++)
                    {
                        for (int lstOcc = 0; lstOcc < obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy.Count; lstOcc++)
                        {
                            if (obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iNoOfRooms != 0)
                            {
                                for (int k = 0; k < obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iNoOfRooms; k++)
                                {
                                    int     extrabed        = obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].ExtraBeds;
                                    decimal extrabedcharges = Convert.ToDecimal(obj.lstetblRooms[i].ExtraBedCharges) * Convert.ToDecimal(ExchangeRate);
                                    decimal total           = extrabedcharges * extrabed;

                                    decimal?dPriceRP   = Convert.ToDecimal(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].dPriceRP) * Convert.ToDecimal(ExchangeRate);
                                    decimal?dBasePrice = Convert.ToDecimal(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].dBasePrice) * Convert.ToDecimal(ExchangeRate);
                                    if (dPriceRP > dBasePrice)
                                    {
                                        OriginalTotalAmt += dPriceRP * Days;
                                    }
                                    else
                                    {
                                        OriginalTotalAmt += dBasePrice * Days;
                                    }

                                    lstBookDetails.Add(new etblBookingDetailsTx()
                                    {
                                        iRoomId          = Convert.ToString(obj.lstetblRooms[i].iRoomId),
                                        iRPId            = Convert.ToString(obj.lstetblRooms[i].lstRatePlan[j].RPID),
                                        iRooms           = 1,
                                        sRoomName        = obj.lstetblRooms[i].sRoomName,
                                        sRPName          = obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].RatePlan,
                                        iOccupancy       = Convert.ToInt16(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iOccupancy),
                                        dRoomRate        = obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].dPrice * ExchangeRate,
                                        dExtraBedRate    = total,
                                        sAmenityRatePlan = obj.lstetblRooms[i].lstRatePlan[j].RateInclusion,
                                        iAdults          = Convert.ToInt16(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iAdults),
                                        iChildren        = Convert.ToInt16(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iChildrens),
                                        iExtraBeds       = Convert.ToInt16(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].ExtraBeds),
                                        sChildrenAge     = obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].ChildrenAge,
                                        dTaxes           = (obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].dTaxes * ExchangeRate) / Days,
                                        dTaxesForHotel   = ((obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].dTaxes) * ExchangeRate) / Days,
                                        dtActionDate     = DateTime.Now,
                                        iPromoType       = Convert.ToInt16(obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iPromoType)
                                    });
                                }

                                var lstTaxes = obj.lstTaxesDateWise_OfferReview.Where(u => u.RPID == obj.lstetblRooms[i].lstRatePlan[j].RPID && u.RoomID == obj.lstetblRooms[i].iRoomId && u.iOccupancy == obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iOccupancy).ToList();

                                for (int tax = 0; tax < lstTaxes.Count; tax++)
                                {
                                    lstDayTaxes.Add(new etblBookedDayWiseTaxAmountDetails()
                                    {
                                        dtStayDay  = Convert.ToDateTime(lstTaxes[tax].dtDate),
                                        dAmount    = Convert.ToDecimal(lstTaxes[tax].dBasePrice) * ExchangeRate,
                                        dTaxPerc   = Convert.ToDecimal(lstTaxes[tax].TaxPer),
                                        dTaxVal    = Convert.ToDecimal(lstTaxes[tax].TaxVal) * ExchangeRate,
                                        RoomID     = Convert.ToInt32(lstTaxes[tax].RoomID),
                                        RPID       = Convert.ToInt32(lstTaxes[tax].RPID),
                                        iOccupancy = Convert.ToInt32(lstTaxes[tax].iOccupancy),
                                        bIsPromo   = Convert.ToBoolean(lstTaxes[tax].bIsPromo)
                                    });
                                }
                                var lstTaxesDateWise = obj.lstTaxesDateWiseAll_OfferReview.Where(u => u.RPID == obj.lstetblRooms[i].lstRatePlan[j].RPID && u.iRoomId == obj.lstetblRooms[i].iRoomId && u.iOccupancy == obj.lstetblRooms[i].lstRatePlan[j].lstetblOccupancy[lstOcc].iOccupancy).ToList();

                                for (int tax = 0; tax < lstTaxesDateWise.Count; tax++)
                                {
                                    lstDayTaxesDateWise.Add(new etblBookedDayWiseTaxAmountDetailsAll()
                                    {
                                        dtStayDay  = Convert.ToDateTime(lstTaxesDateWise[tax].dtStay),
                                        dAmount    = Convert.ToDecimal(lstTaxesDateWise[tax].dPrice) * ExchangeRate,
                                        dTaxPerc   = Convert.ToDecimal(lstTaxesDateWise[tax].MaxTaxPer),
                                        dTaxVal    = Convert.ToDecimal(lstTaxesDateWise[tax].MaxTaxVal) * ExchangeRate,
                                        RoomID     = Convert.ToInt32(lstTaxesDateWise[tax].iRoomId),
                                        RPID       = Convert.ToInt32(lstTaxesDateWise[tax].RPID),
                                        iOccupancy = Convert.ToInt32(lstTaxesDateWise[tax].iOccupancy),
                                        iTaxId     = Convert.ToInt32(lstTaxesDateWise[tax].TaxId)
                                    });
                                }

                                for (int lstCancellation = 0; lstCancellation < obj.lstetblRooms[i].lstRatePlan[j].lstCancellationPolcy.Count; lstCancellation++)
                                {
                                    DateTime StarDate = obj.lstetblRooms[i].lstRatePlan[j].lstCancellationPolcy[lstCancellation].ValidFrom;
                                    DateTime EndDate  = obj.lstetblRooms[i].lstRatePlan[j].lstCancellationPolcy[lstCancellation].ValidTo;
                                    var      res      = new List <string>();
                                    for (var date = StarDate; date <= EndDate; date = date.AddDays(1))
                                    {
                                        res.Add(date.ToString());
                                    }
                                    foreach (var ddate in res)
                                    {
                                        lstCancelPolicy.Add(new etblBookingCancellationPolicyMap()
                                        {
                                            sPolicyName  = obj.lstetblRooms[i].lstRatePlan[j].lstCancellationPolcy[lstCancellation].PolicyName,
                                            dtDate       = Convert.ToDateTime(ddate),
                                            dtActionDate = DateTime.Now,
                                            iRPId        = obj.lstetblRooms[i].lstRatePlan[j].lstCancellationPolcy[lstCancellation].iRPId.ToString()
                                        });
                                    }
                                }
                            }
                        }
                    }
                }

                objOrgBook.dOriginalTotalAmount = OriginalTotalAmt;

                result = BL_Booking.AddBooking(obj, objNego, objTrck, lstBookDetails, lst, lstCancelPolicy, lstDayTaxes, objOrgBook, lstDayTaxesDateWise);
            }
            catch (Exception)
            {
                result = 0;
            }
            return(result);
        }
Exemple #12
0
        private Task SendInformation(string statusType, long bookingId)
        {
            try
            {
                //var bookingDetails = BL_Booking.GetBooking(bookingId);
                var bookingModel = BL_Booking.GetBookingModifyDetails_Notifications(bookingId);

                var    model = new NegotiationEmailTempleteModel();
                string notificationSMS_User = string.Empty;
                bool   Accepted             = true;
                switch (statusType) // Notification mail/SMS to customer. Conserve commission checked and managed.
                {
                case "HR":          // Hotel has rejected the negotiation. Conserve commission not applied.
                    var websiteBaseUrl1 = ConfigurationManager.AppSettings["OFRBaseUrl"].ToString();

                    string negoStatusUrl = websiteBaseUrl1 + "Negotiation/NegotiationStatus?bookingId=" + clsUtils.Encode(bookingId.ToString());

                    model.Status         = "Sorry! Your offer is rejected. Please Check the related offer details by clicking the link below:";
                    notificationSMS_User = "******";
                    Accepted             = false;
                    break;

                case "CO":     // Hotel has countered the negotiation.
                case "RR":     // Rate reduced for "Original rate" through conserve commission.
                case "CR":     // Rate reduced for Counter offer through conserve commission.
                    model.Status         = "Progress! You have received a  counter offer ! Please check the details by clicking the link below:";
                    notificationSMS_User = model.Status;
                    Accepted             = false;
                    break;

                case "BP":     // Hotel has accepted the negotiation.
                case "RA":     // Negotiation accepted by reducing conserve commission on "Original rate".
                case "CA":     // Negotiation accepted by reducing conserve commission on counter offer.
                    model.Status         = "Congratulations! Your offer is accepted! Please Check the details by clicking the link below:";
                    notificationSMS_User = model.Status;
                    break;
                }

                //bookingModel.dTaxes = Convert.ToDecimal(bookingModel.sExtra2);

                model.BookingModify = bookingModel;

                var websiteBaseUrl = ConfigurationManager.AppSettings["OFRBaseUrl"].ToString();
                if (!Accepted)
                {
                    model.CallbackUrl = websiteBaseUrl + "Negotiation/NegotiationStatus?bookingId=" + clsUtils.Encode(bookingId.ToString());
                }
                else
                {
                    model.CallbackUrl = websiteBaseUrl + "NegoConfirmed/" + clsUtils.Encode(bookingId.ToString());
                }


                var html = this.RenderViewToString("_EmailTemplete", model);

                var shortUrl = clsUtils.Shorten(model.CallbackUrl);

                var message = notificationSMS_User + shortUrl;

                //Task.Run(() => clsUtils.sendSMS("9560439101", model.Status + Environment.NewLine + model.CallbackUrl));
                clsUtils.sendSMS(bookingModel.MobileOFR, message);

                return(Task.Run(() => MailComponent.SendEmail(bookingModel.EmailOFR, "", "", "Offer from OneFineRate Confirmation No: " + bookingModel.BookingId, html, null, null, true, null, null)));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #13
0
        public ActionResult PayNow(eBiddingSearch obj)
        {
            try
            {
                Decimal?      ExchangeRate = 1;
                etblBookingTx bookobj      = new etblBookingTx();

                if (User.Identity.IsAuthenticated)
                {
                    var user = BL_WebsiteUser.GetSingleRecordById(User.Identity.GetUserId <long>());
                    bookobj.iCustomerId = user.Id;
                    bookobj.iGuestId    = 0;
                }
                else
                {
                    var stronglObject          = Session[obj.BidSearchData] as eBiddingSearch;
                    GuestUserDetails objDetail = new GuestUserDetails();
                    objDetail.Title       = obj.sUserTitle == "1" ? "Mr." : obj.sUserTitle == "2" ? "Ms." : "";
                    objDetail.FirstName   = obj.sUserFirstName;
                    objDetail.LastName    = obj.sUserLastName;
                    objDetail.Email       = obj.sUserEmail;
                    objDetail.PhoneNumber = obj.sUserMobileNo;
                    objDetail.iStateId    = stronglObject.iStateId;
                    int i = BL_Bidding.AddGuestDetailsRecord(objDetail);
                    if (i > 0)
                    {
                        bookobj.iGuestId = i;
                    }
                    else
                    {
                        return(View("BiddingInfo", obj));
                    }
                }

                string CurrencyCode = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";

                if (CurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", CurrencyCode);
                    if (objExchange.dRate != 0)
                    {
                        ExchangeRate = 1 / objExchange.dRate;
                    }
                }

                bookobj.dtCheckIn         = Convert.ToDateTime(obj.sCheckIn);;
                bookobj.dtChekOut         = Convert.ToDateTime(obj.sCheckOut);
                bookobj.dtReservationDate = DateTime.Now;
                bookobj.cBookingType      = "B";
                bookobj.sTitleOFR         = obj.sUserTitle;
                bookobj.sFirstNameOFR     = obj.sUserFirstName;
                bookobj.sLastNameOFR      = obj.sUserLastName;
                bookobj.sEmailOFR         = obj.sUserEmail;
                bookobj.sMobileOFR        = obj.sUserMobileNo;
                bookobj.dtActionDate      = DateTime.Now;
                bookobj.BookingStatus     = "PP";
                bookobj.PaymentStatus     = "P";
                bookobj.dBidAmount        = obj.dBidPrice * ExchangeRate;
                bookobj.dTotalAmount      = obj.dTotalPrice * ExchangeRate;
                bookobj.dTaxes            = obj.dTaxes * ExchangeRate;
                bookobj.dTaxesForHotel    = obj.dTaxes * ExchangeRate;
                bookobj.sCurrencyCode     = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";
                bookobj.iBidStarCategory  = Convert.ToInt16(obj.sStarRating);
                bookobj.sBidType          = obj.sLocalityType;
                bookobj.sIDs                = obj.sLocalityData.TrimEnd(',');
                bookobj.dServiceCharge      = Convert.ToDecimal(obj.sOFRServiceCharge);
                bookobj.dGSTOnServiceCharge = Convert.ToDecimal(obj.sTaxOnServiceCharge_Val);
                bookobj.dGSTServiceType     = obj.cGstValueType;
                bookobj.dGSTValue           = Convert.ToString(obj.dGSTValue);
                string  TimeZone = Session["TimeZone"] != null ? Session["TimeZone"].ToString() : "+5:30";
                decimal zone     = Convert.ToDecimal(TimeZone.Replace(":", ".").Replace("+", ""));
                bookobj.iCountryOffset = zone;

                #region FetchRoomData and bind in datatables

                var roomDataResult = new List <RoomData>();
                if (obj.sJsonRoomData != null)
                {
                    roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(obj.sJsonRoomData);
                }

                List <etblBIDRoomAdultsTx> lstBid = new List <etblBIDRoomAdultsTx>();

                foreach (var room in roomDataResult)
                {
                    etblBIDRoomAdultsTx RoomObj = new etblBIDRoomAdultsTx();
                    RoomObj.iRoomNo   = Convert.ToInt16(room.room);
                    RoomObj.iAdults   = Convert.ToInt16(room.adult);
                    RoomObj.iChildren = Convert.ToInt16(room.child);

                    System.Text.StringBuilder str = new System.Text.StringBuilder();
                    foreach (var child in room.ChildAge)
                    {
                        str.Append(child.Age);
                        str.Append(",");
                    }

                    string ChildAges = str.ToString().TrimEnd(',');
                    RoomObj.sChildAge = ChildAges;
                    lstBid.Add(RoomObj);
                }

                #endregion

                etblBookingTrakerTx trkobj = new etblBookingTrakerTx();
                trkobj.BookingStatus = "PP";
                trkobj.dtActionDate  = DateTime.Now;

                int j = BL_Booking.AddBookingForBid(bookobj, trkobj, lstBid);
                if (j > 0)
                {
                    obj.iBookingId             = j;
                    Session[obj.BidSearchData] = obj;
                    //  TempData.Keep();
                    return(RedirectToAction("PayNow", "Payment", new { bookingId = j }));
                }
                else
                {
                }
            }
            catch (Exception)
            {
            }

            Session[obj.BidSearchData] = obj;
            //  TempData.Keep();
            return(View("BiddingInfo", obj));
        }
Exemple #14
0
        public int SendCustAcceptReminderEmail(int bookingId)
        {
            try
            {
                string notificationSMS_User = string.Empty;
                var    bookingDetails       = BL_Booking.GetBookingModifyDetails(bookingId);
                string statusType           = bookingDetails.cBookingStatus;
                var    model = new NegotiationEmailTempleteModel();
                model.BookingModify = bookingDetails;
                var    websiteBaseUrl = ConfigurationManager.AppSettings["OFRBaseUrl"].ToString();
                string negoStatusUrl  = websiteBaseUrl + "Negotiation/NegotiationStatus?bookingId=" + clsUtils.Encode(bookingId.ToString());

                string shortNegoStatusUrl = clsUtils.Shorten(negoStatusUrl);

                //bool Accepted = true;
                switch (statusType) // Notification mail/SMS to customer. Conserve commission checked and managed.
                {
                case "HR":          // Hotel has rejected the negotiation. Conserve commission not applied.
                    //model.Status = "Sorry! Your Negotiation is Rejected. Please Check the related offer details by clicking the link below";
                    notificationSMS_User = "******" + shortNegoStatusUrl;
                    model.Status         = notificationSMS_User;
                    //Accepted = false;
                    break;

                case "CO":     // Hotel has countered the negotiation.
                case "RR":     // Rate reduced for "Original rate" through conserve commission.
                case "CR":     // Rate reduced for Counter offer through conserve commission.
                case "FO":     // Final Offer given.
                    model.Status         = "Progress! You have received a  counter offer ! Please check the details by clicking the link below: ";
                    notificationSMS_User = model.Status;
                    //Accepted = false;
                    break;

                case "BP":     // Hotel has accepted the negotiation.
                case "RA":     // Negotiation accepted by reducing conserve commission on "Original rate".
                case "NA":     // Negotiation accepted.
                    model.Status         = "Congratulations! Your offer is accepted! Please Check the details by clicking the link below: ";
                    notificationSMS_User = model.Status;
                    break;

                case "CA":     //  counter offer accepted.
                case "FA":     //  Final offer accepted.
                    model.Status         = "Counter offer was accepted by you! Please Check the details by clicking the link below: ";
                    notificationSMS_User = model.Status;
                    break;

                case "OA":     //  counter offer accepted.
                case "NS":     //  counter offer accepted.
                    model.Status         = "Please Check the details by clicking the link below: ";
                    notificationSMS_User = model.Status;
                    break;
                }

                // if (!Accepted)
                //  model.CallbackUrl = websiteBaseUrl + "Negotiation/NegotiationStatus?bookingId=" + clsUtils.Encode(bookingId.ToString());
                model.CallbackUrl = shortNegoStatusUrl;
                //else
                //  model.CallbackUrl = websiteBaseUrl + "NegoConfirmed/" + clsUtils.Encode(bookingId.ToString());

                var html = this.RenderViewToString("_EmailTemplete", model);

                Task.Run(() => clsUtils.sendSMS(bookingDetails.MobileOFR, notificationSMS_User + model.CallbackUrl));

                Task.Run(() => MailComponent.SendEmail(bookingDetails.EmailOFR, "", "", "Bargain Status", html, null, null, true, null, null));

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Exemple #15
0
        public int SendMailToRevenueManager(int bookingId)
        {
            try
            {
                var customerModel = new NegotiationEmailTempleteModel();
                // Added to show hotel Information in email template
                var bookingModel = BL_Booking.GetBookingModifyDetails_Notifications(bookingId);
                customerModel.BookingModify = bookingModel;


                Decimal?ExchangeRate = 1;
                // get from tblEmailSetting
                var revenueManagerDetail = BL_tblEmailSettingsM.GetRecord("RevenueManager");

                // get from propertyEdit page
                var pRevenueManager = BL_PropDetails.GetEmail_PhoneByPropId(bookingModel.PropId);

                string sPrimaryContactEmail;
                string sConfirmationContactEmail;
                string sRevenueManagerEmail;
                string sRevenueManagerContact;

                pRevenueManager.TryGetValue("sPrimaryContactEmail", out sPrimaryContactEmail);
                pRevenueManager.TryGetValue("sConfirmationContactEmail", out sConfirmationContactEmail);
                pRevenueManager.TryGetValue("sRevenueManagerEmail", out sRevenueManagerEmail);
                pRevenueManager.TryGetValue("sRevenueManagerContact", out sRevenueManagerContact);

                string emails = sRevenueManagerEmail + "," + sConfirmationContactEmail + "," + sPrimaryContactEmail;


                customerModel = new NegotiationEmailTempleteModel();
                customerModel.BookingModify = bookingModel;
                //customerModel.Status = "Thanks " + bookingModel.Booker + "! We have recieved your negotiation." + Environment.NewLine + "We will get back to you within 3 hours.";
                customerModel.Status = "Thank you " + bookingModel.Booker + "! We have recieved your bargain." + Environment.NewLine + bookingModel.sMessage;

                var revenuManagerModel = new NegotiationEmailTempleteModel();
                //revenuManagerModel.Status = "Hi " + revenueManageName +", Please take action for the following Negotiation Request.";
                revenuManagerModel.Status = "Hi, Please take action for the following bargain Request.";
                revenuManagerModel.IsRevenueManagerFormat = true;


                if (bookingModel.sCurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", bookingModel.sCurrencyCode);
                    if (objExchange.dRate != null)
                    {
                        ExchangeRate = 1 / objExchange.dRate;
                    }
                }
                bookingModel.dTotalNegotiateAmount = bookingModel.dTotalNegotiateAmount * ExchangeRate;
                bookingModel.dTaxes = Convert.ToDecimal(bookingModel.Tax) * Convert.ToDecimal(ExchangeRate);
                revenuManagerModel.BookingModify = bookingModel;

                string extranetUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "Account/Login?sPropId=" + clsUtils.Encode(bookingModel.PropId.ToString());

                string shortExtranetUrl = clsUtils.Shorten(extranetUrl);

                string notificationMsg_RevenueMgr = "You have received a new bargain offer. The guest has chosen your hotel! Click " + shortExtranetUrl + " to view the offer and process yet another reservation from OFR. This offer is valid for the next three hours.";

                var html_RevenueManager = this.RenderViewToString("_NegotiationEmailTemplete", revenuManagerModel);

                Task.Run(() => clsUtils.sendSMS(sRevenueManagerContact, notificationMsg_RevenueMgr));

                Task.Run(() => MailComponent.SendEmail(sRevenueManagerEmail, revenueManagerDetail.sEmail, "", "Reminder - New Bargain", html_RevenueManager, null, null, true, null, null));

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }