Beispiel #1
0
    protected void btnLogin_Click(object sender, EventArgs e)

    {
        string user = tbclient.Text;
        string pass = tbcliPass.Text;


#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
        if (Session["user"] != user)
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast

        {
            if (Cilantro.CheckIfBuildingExists(user))
            {
                if (Cilantro.CheckIfBPassMatches(user, pass))

                {
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                    Session["user"] = user; Session["Password"] = pass;
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
                    {
                        UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;


                        List <string> buildings = Cilantro.GetBuildings(user);

                        foreach (string audit in buildings)
                        {
                            Response.Write(audit + "<br/>");
                        }


                        lblMsg.Text = "You can save up to 30% off your entire energy bill according to ASHRAE, " +
                                      "the American Society of Heating Refrigeration and AirConditioning Engineers, " +
                                      "by replacing your old furnace, optimizing or replacing lighting controls, or replacing Transformers and Hot Water Heaters! " +
                                      "Our experts will contact you without obligation about your needs";
                    }
                }

                else
                {
                    lblmes.Text = "Bad Password";
                }
            }


            else
            {
                lblmes.Text = "No such user exists";
            }
        }
    }
Beispiel #2
0
#pragma warning disable CS8321 // Local function is declared but never used
    protected void btnLogout_Click(object sender, EventArgs e)
#pragma warning restore CS8321 // Local function is declared but never used
    {
        string user = ("Comm_Con.aspx.tbclient");

        string pass = ("Comm_Con.aspx.tbcliPass");

        {
            if (Cilantro.CheckIfPassMatches(user, pass))
            {
                Session["client"] = null;
                Response.Redirect("Comm_Con.aspx");
            }
            Session["client"] = null;    // logout by  removing session variable
            Session.Abandon();

            logoutJustOccurred = true;
            Response.Redirect("Comm_Con.aspx.aspx");
        }
    }
Beispiel #3
0
    protected void btnLogin_Click(object sender, EventArgs e)

    {
        string user = tbclient.Text;
        string pass = tbcliPass.Text;


#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
        if (Session["user"] != user)
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast

        {
            if (Cilantro.CheckIfUserExists(user))
            {
                if (Cilantro.CheckIfPassMatches(user, pass))

                {
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                    Session["user"] = user; Session["Password"] = pass;
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
                    {
                        Response.Redirect("Building.aspx");
                    }
                }

                else
                {
                    lblmes.Text = "Bad Password";
                }
            }


            else
            {
                lblmes.Text = "No such user exists";
            }
        }
    }
        public void AddToppings(IOrderable pizza, string type)
        {
            switch (type)
            {
            case "1":
                IOrderable artichoke = new Artichoke(pizza);
                AddToppingsMenu(artichoke);
                return;

            case "2":
                IOrderable cilantro = new Cilantro(pizza);
                AddToppingsMenu(cilantro);
                return;

            case "3":
                IOrderable ham = new Ham(pizza);
                AddToppingsMenu(ham);
                return;

            case "4":
                IOrderable kebab = new Kebab(pizza);
                AddToppingsMenu(kebab);
                return;

            case "5":
                IOrderable kebabsauce = new Kebabsauce(pizza);
                AddToppingsMenu(kebabsauce);
                return;

            case "6":
                IOrderable mushroom = new Mushroom(pizza);
                AddToppingsMenu(mushroom);
                return;

            case "7":
                IOrderable mussels = new Mussels(pizza);
                AddToppingsMenu(mussels);
                return;

            case "8":
                IOrderable onion = new Onion(pizza);
                AddToppingsMenu(onion);
                return;

            case "9":
                IOrderable pineapple = new Pinapple(pizza);
                AddToppingsMenu(pineapple);
                return;

            case "10":
                IOrderable shrimp = new Shrimp(pizza);
                AddToppingsMenu(shrimp);
                return;

            case "y":
                currentOrder.ItemsOrdered.Add(pizza);
                PlaceOrderMenu();
                return;

            default:
                Console.WriteLine("Please write the number of the topping you want.");
                AddToppingsMenu(pizza);
                return;
            }
        }