//select Users.name, id_user ,job_title, job_type, description, OperationField.name as operating_field from UserNotifications inner join OperationField on UserNotifications.operation_field = OperationField.Id inner join Users on Users.id = UserNotifications.id_user  where operation_field in(select operatingField from User_Preferences where id_user = @id)
        private void CreateNotifications()
        {
            int           user    = Convert.ToInt32(Session["id"]);
            String        query   = "select Users.name AS username, id_user ,job_title, jobType.type as job_type, description, OperationField.name as operating_field from UserNotifications inner join OperationField on UserNotifications.operation_field = OperationField.Id inner join Users on Users.id = UserNotifications.id_user inner join jobType on UserNotifications.job_type = jobType.Id  where operation_field in(select operatingField from User_Preferences where id_user = @id)";
            SqlConnection connect = UsersDB.GetConnection();
            SqlCommand    command = new SqlCommand(query, connect);

            command.Parameters.AddWithValue("@id", user);
            connect.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                CreateDiv(Convert.ToString(reader["username"]), Convert.ToInt32(reader["id_user"]), Convert.ToString(reader["job_title"]), Convert.ToString(reader["job_type"]), Convert.ToString(reader["description"]), Convert.ToString(reader["operating_field"]));
            }
        }
Example #2
0
        protected void send_Click(object sender, EventArgs e)
        {
            String        email   = "";
            int           id      = 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", id);
            connect.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                email = Convert.ToString(reader["Email"]);
            }

            System.Web.UI.HtmlControls.HtmlTextArea textArea = (System.Web.UI.HtmlControls.HtmlTextArea)(form1.FindControl("message"));
            String message = textArea.Value;
            String body    = message;

            System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage();
            SmtpClient sc = new SmtpClient();

            try
            {
                m.From = new MailAddress("*****@*****.**", "*****@*****.**");
                m.To.Add(new MailAddress(useremail.Text, useremail.Text));
                m.Bcc.Add(new MailAddress(email, email));
                String usertype = "normal";
                m.Subject      = subject.Text;
                m.IsBodyHtml   = true;
                m.Body         = body;
                sc.Host        = "smtp.gmail.com";
                sc.Port        = 587;
                sc.Credentials = new
                                 System.Net.NetworkCredential("*****@*****.**", "Serena123!");
                sc.EnableSsl = true;
                sc.Send(m);
                textArea.Value = "";
                Label5.Text    = "Email-i u dergua me sukses!";
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        //select Users.name, id_user ,job_title, job_type, description, OperationField.name as operating_field from UserNotifications inner join OperationField on UserNotifications.operation_field = OperationField.Id inner join Users on Users.id = UserNotifications.id_user  where operation_field in(select operatingField from User_Preferences where id_user = @id)
        public void CreateNotifications()
        {
            int user = Convert.ToInt32(Session["id"]);

            String query = "select CompanyNotifications.id_user, CompanyInfo.name as username, OperationField.name as operatingfield, skills, type, job_title, job_description, education_description, year_experience from CompanyNotifications inner join OperationField on CompanyNotifications.operation_field = OperationField.Id inner join Users on Users.id = CompanyNotifications.id_user  inner join jobType ON jobType.Id = CompanyNotifications.job_type inner join CompanyInfo on CompanyInfo.id_user = Users.Id  where CompanyNotifications.operation_field in(select operatingField from User_Preferences where id_user = @id)";

            SqlConnection connect = UsersDB.GetConnection();
            SqlCommand    command = new SqlCommand(query, connect);

            command.Parameters.AddWithValue("@id", user);
            connect.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                CreateDiv(Convert.ToString(reader["username"]), Convert.ToInt32(reader["id_user"]), Convert.ToString(reader["job_title"]), Convert.ToString(reader["type"]), Convert.ToString(reader["operatingfield"]), Convert.ToString(reader["skills"]), Convert.ToString(reader["job_description"]), Convert.ToString(reader["education_description"]), Convert.ToInt32(reader["year_experience"]));
            }
        }
Example #4
0
        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";
            }
        }