protected void Page_Load(object sender, EventArgs e) { //Checks if user is logged in because only logged in users can access this page if (Convert.ToString(Session["sessionValue"]) == "set") { if (Convert.ToInt32(UsersDB.userType(Convert.ToString(Session["email"]))) == 1) { if (UsersDB.profileFilled(Convert.ToInt32(Session["id"]), "company")) { } } } else { System.Windows.Forms.MessageBox.Show("Kjo faqe nuk mund te aksesohet sepse ju nuk jeni te loguar!"); Response.Redirect("Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToString(Session["sessionValue"]) == "set") { if (Convert.ToInt32(UsersDB.userType(Convert.ToString(Session["email"]))) == 1) { if (UsersDB.profileFilled(Convert.ToInt32(Session["id"]), "company")) { profile.NavigateUrl = "~/companyProfile.aspx"; notification.NavigateUrl = "~/UserNotifications.aspx"; } else { profile.NavigateUrl = "~/companyProfileToFill.aspx"; notification.NavigateUrl = "~/UserNotifications.aspx"; } home.NavigateUrl = "~/mainPageCompany.aspx"; } else if (Convert.ToInt32(UsersDB.userType(Convert.ToString(Session["email"]))) != 1) { if (UsersDB.profileFilled(Convert.ToInt32(Session["id"]), "user")) { profile.NavigateUrl = "~/profile.aspx"; notification.NavigateUrl = "~/CompanyNotifications.aspx"; } else { profile.NavigateUrl = "~/profileToFill.aspx"; notification.NavigateUrl = "~/CompanyNotifications.aspx"; } home.NavigateUrl = "~/mainPageUser.aspx"; } } else { System.Windows.Forms.MessageBox.Show("Kjo faqe nuk mund te aksesohet sepse ju nuk jeni te loguar!"); Response.Redirect("Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToString(Session["sessionValue"]) == "set") { if (Convert.ToInt32(UsersDB.userType(Convert.ToString(Session["email"]))) == 1) { if (UsersDB.profileFilled(Convert.ToInt32(Session["id"]), "company")) { profile.NavigateUrl = "~/companyProfile.aspx"; } else { profile.NavigateUrl = "~/companyProfileToFill.aspx"; } home.NavigateUrl = "~/mainPageCompany.aspx"; notification.NavigateUrl = "~/UserNotifications.aspx"; } else if (Convert.ToInt32(UsersDB.userType(Convert.ToString(Session["email"]))) != 1) { if (UsersDB.profileFilled(Convert.ToInt32(Session["id"]), "user")) { profile.NavigateUrl = "~/profile.aspx"; } else { profile.NavigateUrl = "~/profileToFill.aspx"; } home.NavigateUrl = "~/mainPageUser.aspx"; notification.NavigateUrl = "~/CompanyNotifications.aspx"; } } else { System.Windows.Forms.MessageBox.Show("Kjo faqe nuk mund te aksesohet sepse ju nuk jeni te loguar!"); Response.Redirect("Login.aspx"); } int idcomp = Convert.ToInt32(Session["id"]); String query = "SELECT * FROM Users WHERE id = @id"; SqlConnection connect = UsersDB.GetConnection(); SqlCommand command = new SqlCommand(query, connect); command.Parameters.AddWithValue("@id", idcomp); connect.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { ouremail.Text = Convert.ToString(reader["email"]); } int id = Convert.ToInt32(Request.QueryString["id"]); query = "SELECT * FROM Users WHERE id = @id"; connect = UsersDB.GetConnection(); command = new SqlCommand(query, connect); command.Parameters.AddWithValue("@id", id); connect.Open(); reader = command.ExecuteReader(); while (reader.Read()) { useremail.Text = Convert.ToString(reader["email"]); subject.Text = "Pergjigje per lajmerimin"; } }