protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (tbEmail.Text == "*****@*****.**")
                {
                    Session["admin"] = true;
                    Response.Redirect("IndexAdmin.aspx");
                    return;
                }

                try
                {
                    TourGuide user = TourGuideDAO.SelectTourGuideByEmail(tbEmail.Text);
                    Session["tourguide_id"] = user.TourGuideId.ToString();
                }
                catch (Exception)
                {
                    Tourist user = TouristDAO.SelectTouristByEmail(tbEmail.Text);
                    Session["tourist_id"] = user.TouristId.ToString();
                }
                finally
                {
                    if (Session["tourguide_id"] != null)
                    {
                        Response.Redirect("TourGuideRequestsPage.aspx");
                    }
                    else if (Session["tourist_id"] != null)
                    {
                        Response.Redirect("Index.aspx");
                    }
                }
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TourGuide tg = TourGuideDAO.SelectTourGuideById(int.Parse(Session["tourguide_id"].ToString()));

            tourguideidLabel.Text     = tg.TourGuideId.ToString();
            tourguideuseridLabel.Text = tg.UserId.ToString();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         TourGuide tg = TourGuideDAO.SelectTourGuideById(int.Parse(Session["tourguide_id"].ToString()));
         tourguidenameTextBox.Text        = tg.Name;
         tourguidedescriptionTextBox.Text = tg.Description;
         tourguidelanguagesTextBox.Text   = tg.Languages;
         tourguidecredentialsTextBox.Text = tg.Credentials;
         tourguideemailLabel.Text         = tg.Email;
         tourguideidLabel.Text            = tg.TourGuideId.ToString();
         tourguideuseridLabel.Text        = tg.UserId.ToString();
         tourguidepasswordLabel.Text      = tg.Password.ToString();
     }
 }
Exemple #4
0
        protected void btnSignupTG_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string name  = tbNameTG.Text;
                string email = tbEmailTG.Text.ToLower();
                string pass1 = tbPasswordTG.Text;
                string pass2 = tbRepeatPassTG.Text;
                string desc  = tbDesc.Text;
                string lang  = tbLang.Text;
                if (pass1 == pass2 && name != "" && email != "" && pass1 != "")
                {
                    string    hash = SHA256Hash.GenerateSHA256(pass1);
                    TourGuide obj  = new TourGuide(name, email, hash, desc, lang, "", "");
                    TourGuideDAO.InsertTourGuide(obj);

                    Response.Redirect("Login.aspx");
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["tourguide_id"] != null || Session["tourist_id"] != null)
     {
         string name = "";
         try
         {
             name = TouristDAO.SelectTouristById(int.Parse(Session["tourist_id"].ToString())).Name;
         }
         catch
         {
             name = TourGuideDAO.SelectTourGuideById(int.Parse(Session["tourguide_id"].ToString())).Name;
         }
         finally
         {
             LblName.Text = name;
         }
     }
     else
     {
         Response.Redirect("Login.aspx");
     }
 }
Exemple #6
0
 public static void UpdateTourGuide(TourGuide tg)
 {
     TourGuideDAO.UpdateTourGuide(tg);
 }
Exemple #7
0
 public static List <TourGuide> GetAllTourGuidesByLanguage(string language)
 {
     return(TourGuideDAO.SelectTourGuideByLanguage(language));
 }
Exemple #8
0
 public static List <TourGuide> GetAllTourGuide()
 {
     return(TourGuideDAO.SelectAllTourGuides());
 }