protected void Button1_Click(object sender, EventArgs e) { if (acces.SelectedValue.ToString().Equals("bo")) { AgentBO agent = LoginService.loginAgentBO(user.Text.ToString(), mdp.Text.ToString()); if (agent != null) { result.Text = agent.getId() + " " + agent.getNom() + " " + agent.getPrenom(); Session["type"] = "BO"; Session["user"] = agent; Response.Redirect("index.aspx"); } else { result.Text = "Identifiants incorrectes"; } } else { AgentUA agent = LoginService.loginAgentUA(user.Text.ToString(), mdp.Text.ToString()); if (agent != null) { result.Text = agent.getId() + " " + agent.getNom() + " " + agent.getPrenom(); Session["type"] = "UA"; Session["user"] = agent; Response.Redirect("index.aspx"); } else { result.Text = "Identifiants incorrectes"; } } }
public static ICriteria GetCriteriaForBookRequests(NameValueCollection pars) { Agent a = AgentBO.GetLoggedInAgent(); Customer c = CustomerBO.GetLoggedInCustomer(); ICriteria cr = NHibernateHelper.GetCurrentSession().CreateCriteria(typeof(BookRequest)); cr.AddOrder(new Order("TimeofCreation", false)); if (pars.Get("triptype") != null) { cr.Add(Restrictions.Eq("TripType", pars.Get("triptype"))); } if (pars.Get("name") != null) { cr.Add(Restrictions.Eq("ContactDetails.Name", pars.Get("name"))); } if (pars.Get("email") != null) { cr.Add(Restrictions.Eq("ContactDetails.Email", pars.Get("email"))); } if (pars.Get("agentid") != null) { cr.Add(Restrictions.Eq("Agent", AgentDAO.FindAgentByID(Int64.Parse(pars.Get("agentid"))))); } if (a != null) { cr.Add(Restrictions.Eq("Agent", a)); } if (c != null) { cr.Add(Restrictions.Eq("ContactDetails.Email", c.Email)); } if (pars.Get("status") != null) { cr.Add(Restrictions.Eq("Status", Int16.Parse(pars.Get("status")))); } else { cr.Add(Restrictions.Eq("Status", (short)0)); } if (pars.Get("aircrafttype") != null) { cr.Add(Restrictions.Eq("PlaneType", OperatorDAO.FindAircraftTypeByID(pars.Get("aircrafttype")))); } return(cr); }
public DataTable FindAgent(AgentBO oAgentBO) { try { return oAgentDAL.FindAgent(oAgentBO); } catch { throw; } }
protected void Page_Load(object sender, EventArgs e) { Agent a = AgentBO.CheckAgentCode(Request.Params.Get("Agent")); if (a != null) { Session.Add("AgentID", a.AgentID); Session.Timeout = 60; Response.Redirect("QuickQuote.aspx"); } else { Response.Write("Authentication failed."); } }
public static AgentBO loginAgentBO(string login, string password) { SqlConnection cnx = new SqlConnection(ConfigurationManager.AppSettings["cnx"].ToString()); cnx.Open(); SqlCommand cmd = new SqlCommand(String.Format("select id_agent,nom,prenom from agent_bo where login='******' and password='******'", login, password), cnx); SqlDataReader dr = cmd.ExecuteReader(); if (dr != null && dr.HasRows) { dr.Read(); AgentBO agent = new AgentBO(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); return(agent); } return(null); }
public static ICriteria GetCriteriaForBids(NameValueCollection pars) { Agent a = AgentBO.GetLoggedInAgent(); Customer c = CustomerBO.GetLoggedInCustomer(); ICriteria cr = NHibernateHelper.GetCurrentSession().CreateCriteria(typeof(OperatorBid)); cr.Add(Restrictions.Eq("Status", (short)1)); if (a != null) { cr.CreateCriteria("Request").Add(Restrictions.Eq("Agent", a)); } if (c != null) { cr.CreateCriteria("Request").Add(Restrictions.Eq("ContactDetails.Email", c.Email)); } if (pars.Get("bookrequest") != null) { cr.Add(Restrictions.Eq("Request", BookRequestDAO.FindBookRequestByID(Int64.Parse(pars.Get("bookrequest"))))); } if (pars.Get("sortby") != null) { if (pars.Get("sortby") == "time") { cr.AddOrder(new Order("TimeOfBid", false)); } if (pars.Get("sortby") == "amount") { cr.AddOrder(new Order("BidAmount", true)); } } else { cr.AddOrder(new Order("TimeOfBid", false)); } return(cr); }
protected void Page_Load(object sender, EventArgs e) { Agent a = AgentDAO.FindAgentByID(Int64.Parse(Request.Params.Get("aid"))); if (Request.Params.Get("generatepassword") != null) { a.Password = AgentBO.GeneratePassword(); AgentDAO.MakePersistent(a); Session["done"] = "1"; } if (Request.Params.Get("generatecode") != null) { a.CalculateAgentCode(); AgentDAO.MakePersistent(a); Session["done"] = "1"; } if (Request.Params.Get("emaillink") != null) { Session["done"] = "1"; EmailBO em = new EmailBO("AgentPersonalDetails", a.Domain); em.SendEmailToAgent(a); } }
public DataTable FindAgent(AgentBO oAgentBO) { try { query = "SELECT name, business, phone FROM Agent WHERE email = @email"; dad = new SqlDataAdapter(query, con); if (con.State == ConnectionState.Closed) { con.Open(); } dad.SelectCommand.Parameters.AddWithValue("@email", oAgentBO.email); dt = new DataTable(); dad.Fill(dt); return dt; } catch { throw; } finally { con.Close(); } }
public DataTable InsertProperty(PropertyBO oPropertyBO, PropertyImageBO oPropertyImageBO, AgentBO oAgentBO) { try { return oPropertyDAL.InsertProperty(oPropertyBO, oPropertyImageBO, oAgentBO); } catch { throw; } }
protected void Page_Load(object sender, EventArgs e) { Agent a = AgentBO.GetLoggedInAgent(); if (Request.Params.Get("withdrawbid") != null) { EmptyLegOffer elo = BookRequestDAO.FindEmptyLegOfferByID(Int64.Parse(Request.Params.Get("eloid"))); if (elo.Agent.Equals(a)) { 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.Agent.Equals(a)) { 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 = true; elo.Customer = null; elo.BidAmount = el.OfferPrice; elo.Agent = a; 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 = true; elo.Customer = null; elo.BidAmount = Double.Parse(Request.Params.Get("bidamount")); elo.Agent = a; 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.SendEmailToAgent(elo.Agent); } 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); } } }
protected void Page_Load(object sender, EventArgs e) { try { Int32 nooflegs = Int32.Parse(Request.Params.Get("nooflegs")); BookRequest b = new BookRequest(); Customer check = CustomerBO.GetLoggedInCustomer(); Agent agentcheck = AgentBO.GetLoggedInAgent(); b.IsAgent = false; Contact c = new Contact(); if (check != null) { c.Name = check.Name; c.Email = check.Email; c.Phone = check.ContactNo; } else { c.Name = Request.Params.Get("Name"); c.Email = Request.Params.Get("Email"); c.Phone = Request.Params.Get("ContactNo"); if (agentcheck != null) { b.IsAgent = true; b.Agent = agentcheck; } else if (Session["AgentID"] != null) { b.IsAgent = true; Agent a = AgentDAO.FindAgentByID((long)Session["AgentID"]); b.Agent = a; } else { Customer custemail = CustomerDAO.CheckCustomerByEmail(Request.Params.Get("Email")); if (custemail == null) { Customer cust = new Customer(); cust.Email = Request.Params.Get("Email");; cust.ContactNo = Request.Params.Get("ContactNo"); cust.Name = Request.Params.Get("Name"); cust.Password = CustomerBO.GeneratePassword(); cust.Status = 1; CustomerDAO.MakePersistent(cust); check = cust; EmailBO em = new EmailBO("NewCustomer", Session["Country"].ToString()); em.SendEmailToCustomer(check); } else { check = custemail; } } } if (Request.Params.Get("fixedpricecharter") != null) { FixedPriceCharter el = BookRequestDAO.FindFixedPriceCharterByID(Int64.Parse(Request.Params.Get("fixedpricecharter"))); b.FixedPriceCharter = el; } c.Description = Request.Params.Get("OtherDetails"); b.PAX = Int32.Parse(Request.Params.Get("PAX")); b.Budget = Double.Parse(Request.Params.Get("budget")); b.FinalBudget = BookRequestBO.GetFinalBudget(b.Budget, AdminBO.GetCountry()); b.ContactDetails = c; b.TimeofCreation = DateTime.Now; b.TripType = Request.Params.Get("TripType"); AirplaneType apt = OperatorDAO.FindAircraftTypeByID(Request.Params.Get("aircrafttype")); b.PlaneType = apt; b.Status = 0; b.Domain = AdminDAO.GetCountryByID(Session["Country"].ToString()); for (int i = 1; i <= nooflegs; i++) { Leg l = new Leg(); l.Sequence = i; ListSet fromairfields = AirfieldBO.GetAirfields(Request.Params.Get("fromleg" + i)); ListSet toairfields = AirfieldBO.GetAirfields(Request.Params.Get("toleg" + i)); foreach (Airfield a in fromairfields) { if (l.Source == null) { l.Source = a; } } if (l.Source.IsTemporary()) { l.Source = AirfieldBO.SaveAirfield(l.Source); } foreach (Airfield a in toairfields) { if (l.Destination == null) { l.Destination = a; } } if (l.Destination.IsTemporary()) { l.Destination = AirfieldBO.SaveAirfield(l.Destination); } l.Date = DateTime.Parse(Request.Params.Get("dateleg" + i) + " " + Request.Params.Get("timeleg" + i)); b.AddLeg(l); } b = BookRequestBO.AcceptBookRequest(b); if (b.FixedPriceCharter == null) { OperatorResolver opr = new OperatorResolver(OperatorBO.OperatorResolve); opr.BeginInvoke(b, null, null); } else { EmailBO em = new EmailBO("FixedPriceCharterNotificationToOperator", Session["Country"].ToString()); em.SendEmailToOperator(b.FixedPriceCharter.Aircraft.Vendor); } if (b.IsAgent) { EmailBO em = new EmailBO("AgentThanksRequest", Session["Country"].ToString()); em.SendEmailToAgent(b.Agent); } else { EmailBO em = new EmailBO("CustomerThanksRequest", Session["Country"].ToString()); em.SendEmailToCustomer(check); } Session.Add("bid", b.BookID); } catch (AifieldNotFoundException ax) { Response.Redirect(Request.UrlReferrer.OriginalString + "?" + Serialize(Request.QueryString)); } catch (Exception ex) { Response.Redirect("QuickQuote.aspx"); } Response.Redirect("RequestSent.aspx"); }
public DataTable InsertProperty(PropertyBO oPropertyBO, PropertyImageBO oPropertyImageBO, AgentBO oAgentBO) { try { cmd = new SqlCommand("InsertProperty", con); cmd.CommandType = CommandType.StoredProcedure; if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Parameters.AddWithValue("@pName", oPropertyBO.name); cmd.Parameters.AddWithValue("@description", oPropertyBO.description); cmd.Parameters.AddWithValue("@address", oPropertyBO.address); cmd.Parameters.AddWithValue("@city", oPropertyBO.city); cmd.Parameters.AddWithValue("@neighborhood", oPropertyBO.neighborhood); cmd.Parameters.AddWithValue("@latitude", oPropertyBO.latitude); cmd.Parameters.AddWithValue("@longitude", oPropertyBO.longitude); cmd.Parameters.AddWithValue("@zipCode", oPropertyBO.zipCode); cmd.Parameters.AddWithValue("@type", oPropertyBO.type); cmd.Parameters.AddWithValue("@buyorrent", oPropertyBO.buyorrent); cmd.Parameters.AddWithValue("@size", oPropertyBO.size); cmd.Parameters.AddWithValue("@rate", oPropertyBO.rate); cmd.Parameters.AddWithValue("@totalImages", oPropertyBO.totalImages); cmd.Parameters.AddWithValue("@parkings", oPropertyBO.parkings); cmd.Parameters.AddWithValue("@toilets", oPropertyBO.toilets); cmd.Parameters.AddWithValue("@kitchens", oPropertyBO.kitchens); cmd.Parameters.AddWithValue("@hasReception", oPropertyBO.hasReception); cmd.Parameters.AddWithValue("@isFurnished", oPropertyBO.isFurnished); cmd.Parameters.AddWithValue("@image", oPropertyImageBO.image); cmd.Parameters.AddWithValue("@name", oAgentBO.name); cmd.Parameters.AddWithValue("@business", oAgentBO.business); cmd.Parameters.AddWithValue("@email", oAgentBO.email); cmd.Parameters.AddWithValue("@phone", oAgentBO.phone); cmd.Parameters.AddWithValue("@status", oAgentBO.status); dad = new SqlDataAdapter(cmd); dt = new DataTable(); dad.Fill(dt); return dt; } catch { throw; } finally { con.Close(); } }