protected void Page_Load(object sender, EventArgs e) { RestaurantObj currentRestaurant = (RestaurantObj)Session["currentRestaurant"]; string email = currentRestaurant.getEmail(); DisplayTransactions(email); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RestaurantObj currentRestaurant = (RestaurantObj)Session["currentRestaurant"]; lblWelcome.Text = "<h1>Welcome, " + currentRestaurant.getRestaurantName() + "! This is your main hub</h1>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RestaurantObj currentRestaurant = (RestaurantObj)Session["currentRestaurant"]; txtId.Text = currentRestaurant.getRestaurantId(); txtPassword.Text = currentRestaurant.getPassword(); txtEmail.Text = currentRestaurant.getEmail(); txtAddress.Text = currentRestaurant.getAddress(); txtPhone.Text = currentRestaurant.getPhone(); txtName.Text = currentRestaurant.getRestaurantName(); } }
protected void Login_Click(object sender, EventArgs e) { if (cbRememberLogin.Checked) { HttpCookie myCookie = new HttpCookie("myCookie"); myCookie["Username"] = txtUsrname.Text; myCookie["Password"] = txtPssword.Text; myCookie.Expires = new DateTime(2025, 1, 1); Response.Cookies.Add(myCookie); } int num = dbm.GetAccountTypeById(txtUsrname.Text); switch (num) { case 0: lblNoAccount.Visible = true; break; case 1: DataSet custData = dbm.GetCustomerByIdAndPassword(txtUsrname.Text, txtPssword.Text); try { DataRow dRow = custData.Tables[0].Rows[0]; String customerId = dRow.ItemArray.GetValue(0).ToString(); String password = dRow.ItemArray.GetValue(1).ToString(); String deliveryAddress = dRow.ItemArray.GetValue(2).ToString(); String billingAddress = dRow.ItemArray.GetValue(3).ToString(); String emailAddress = dRow.ItemArray.GetValue(4).ToString(); String name = dRow.ItemArray.GetValue(5).ToString(); CustomerObj customer = new CustomerObj(customerId, password, deliveryAddress, billingAddress, emailAddress, name); Session["currentCustomer"] = customer; Response.Redirect("../Customer/CustomerDashboard.aspx"); } catch (Exception) { Response.Write("error transferring data"); } break; case -1: DataSet restData = dbm.GetRestaurantByIdAndPassword(txtUsrname.Text, txtPssword.Text); try { DataRow dRow = restData.Tables[0].Rows[0]; String restaurantId = dRow.ItemArray.GetValue(0).ToString(); String password = dRow.ItemArray.GetValue(1).ToString(); String email = dRow.ItemArray.GetValue(2).ToString(); String address = dRow.ItemArray.GetValue(3).ToString(); String logo = dRow.ItemArray.GetValue(4).ToString(); String phone = dRow.ItemArray.GetValue(5).ToString(); String restaurantName = dRow.ItemArray.GetValue(6).ToString(); RestaurantObj restaurant = new RestaurantObj(restaurantId, password, email, address, logo, phone, restaurantName); Session["currentRestaurant"] = restaurant; Response.Redirect("../Restaurant/RestaurantMain.aspx"); } catch (Exception) { Response.Write("error transferring data"); } break; } }