protected void Page_Load(object sender, EventArgs e) { if (Request.Params.Get("acceptoffer") != null) { EmptyLegOffer elo = BookRequestDAO.FindEmptyLegOfferByID(Int64.Parse(Request.Params.Get("eloid"))); elo.EmptyLeg.AcceptedOffer = elo; BookRequestDAO.MakePersistent(elo.EmptyLeg); EmailBO em = new EmailBO("EmptyLegAcceptedOfferNotificationToCustomer", Session["Country"].ToString()); if (elo.IsAgent) { em.SendEmailToAgent(elo.Agent); } else { em.SendEmailToCustomer(elo.Customer); } Response.Redirect("ShowEmptyLegs.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { Customer c = CustomerBO.GetLoggedInCustomer(); if (Request.Params.Get("withdrawbid") != null) { EmptyLegOffer elo = BookRequestDAO.FindEmptyLegOfferByID(Int64.Parse(Request.Params.Get("eloid"))); if (elo.Customer.Equals(c)) { elo.Status = 2; BookRequestDAO.MakePersistent(elo); EmailBO em = new EmailBO("EmptyLegOfferWithdrawNotificationToOperator", Session["Country"].ToString()); em.SendEmailToOperator(elo.EmptyLeg.Aircraft.Vendor); Response.Redirect("EmptyLeg.aspx?eid=" + elo.EmptyLeg.ID); } } if (Request.Params.Get("withdrawaccepted") != null) { EmptyLeg el = BookRequestDAO.FindEmptyLegByID(Int64.Parse(Request.Params.Get("eid"))); if (el.AcceptedOffer.Customer.Equals(c)) { el.AcceptedOffer.Status = 2; BookRequestDAO.MakePersistent(el.AcceptedOffer); el.AcceptedOffer = null; BookRequestDAO.MakePersistent(el); EmailBO em = new EmailBO("EmptyLegAcceptedWithdrawNotificationToOperator", Session["Country"].ToString()); em.SendEmailToOperator(el.Aircraft.Vendor); Response.Redirect("EmptyLeg.aspx?eid=" + el.ID); } } if (Request.Params.Get("acceptoffer") != null) { EmptyLeg el = BookRequestDAO.FindEmptyLegByID(Int64.Parse(Request.Params.Get("eid"))); if (el.AcceptedOffer == null) { EmptyLegOffer elo = new EmptyLegOffer(); elo.EmptyLeg = el; elo.Currency = el.Currency; elo.Status = 1; elo.TimeOfOffer = DateTime.Now; el.AcceptedOffer = elo; elo.IsAgent = false; elo.Customer = CustomerBO.GetLoggedInCustomer(); elo.BidAmount = el.OfferPrice; elo.Agent = null; BookRequestDAO.MakePersistent(elo); BookRequestDAO.MakePersistent(el); EmailBO em = new EmailBO("EmptyLegAcceptedOfferNotificationToOperator", Session["Country"].ToString()); em.SendEmailToOperator(el.Aircraft.Vendor); Response.Redirect("EmptyLeg.aspx?eid=" + el.ID); } else { Error.InnerHtml = "* Sorry this empty leg offer have already been accepted."; } } else if (Request.Params.Get("savebidbtn") != null) { EmptyLeg el = BookRequestDAO.FindEmptyLegByID(Int64.Parse(Request.Params.Get("eid"))); if (el.OfferPrice <= Double.Parse(Request.Params.Get("bidamount"))) { Error.InnerHtml = "* Bid amount should be less than operator offered price."; } else if (el.AcceptedOffer != null) { Error.InnerHtml = "* Sorry this empty leg offer have already been accepted."; } else { EmptyLegOffer elo = new EmptyLegOffer(); elo.EmptyLeg = el; elo.Currency = el.Currency; elo.Status = 1; elo.TimeOfOffer = DateTime.Now; elo.IsAgent = false; elo.Customer = c; elo.BidAmount = Double.Parse(Request.Params.Get("bidamount")); elo.Agent = null; BookRequestDAO.MakePersistent(elo); EmailBO em = new EmailBO("EmptyLegOfferNotificationToOperator", Session["Country"].ToString()); em.SendEmailToOperator(el.Aircraft.Vendor); em = new EmailBO("EmptyLegOfferThanksToCustomer", Session["Country"].ToString()); if (!elo.IsAgent) { em.SendEmailToCustomer(elo.Customer); } ListSet othercust = new ListSet(); foreach (EmptyLegOffer eloc in BookRequestDAO.GetEmptyLegBids(el)) { if (eloc.IsAgent) { othercust.Add(eloc.Agent.Email.Trim()); } else { othercust.Add(eloc.Customer.Email.Trim()); } } if (elo.IsAgent) { othercust.Remove(elo.Agent.Email.Trim()); } else { othercust.Remove(elo.Customer.Email.Trim()); } ArrayList tempemail = new ArrayList(othercust); if (tempemail.Count > 0) { em = new EmailBO("EmptyLegOfferNotificationToOtherCustomers", Session["Country"].ToString()); em.SendEmailToList(tempemail); } Response.Redirect("EmptyLeg.aspx?eid=" + el.ID); } } }
public static EmptyLegOffer MakePersistent(EmptyLegOffer elo) { NHibernateHelper.GetCurrentSession().SaveOrUpdate(elo); return(elo); }