예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var dbn   = new DataClasses2DataContext();
            var query = from c in dbn.users
                        where c.username == textBox1.Text &&
                        c.pas == textBox2.Text
                        select c;

            foreach (var c in query)
            {
                bool ismodir;
                userid = c.id;
                // MessageBox.Show(c.ismodir);
                if (c.ismodir.Contains("yes"))
                {
                    //     MessageBox.Show("in yes");
                    ismodir = true;
                }
                else
                {
                    //     MessageBox.Show("in no");
                    ismodir = false;
                }
                this.Hide();
                home a = new home(userid, ismodir);
                a.Show();
                a.userid = userid;
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var nw        = new DataClasses2DataContext();
            var musicinfo = from p in nw.musics
                            where p.name.Contains(textBox1.Text)
                            select new
            {
                id   = p.id,
                name = p.name,
                p.jhanrid,
                path = p.fileaddress
            };

            dataGridView1.DataSource = musicinfo;
        }
예제 #3
0
        public home(int userid, bool ism)
        {
            InitializeComponent();
            uid     = userid;
            ismodir = ism;
            if (ismodir)
            {
            }
            else
            {
                button7.Hide();
                button8.Hide();
                button9.Hide();
                button10.Hide();
            }
            var nw        = new DataClasses2DataContext();
            var musicinfo = from a in nw.musics join
                            b in  nw.likeds on a.id equals b.musicid
                            where b.userid == userid
                            select new
            {
                id    = a.id,
                name  = a.name,
                jhanr = a.jhanrid,
                path  = a.fileaddress
            };

            dataGridView2.DataSource = musicinfo;


            //
            nw = new DataClasses2DataContext();
            var musici = from a in nw.musics
                         join
                         b in nw.suggestions on a.id equals b.musicid
                         where b.userid == userid
                         select new
            {
                id    = a.id,
                name  = a.name,
                jhanr = a.jhanrid,
                path  = a.fileaddress
            };

            dataGridView3.DataSource = musicinfo;

            Console.WriteLine("home is runnning");
        }
        public list_resquest()
        {
            InitializeComponent();
            var nw    = new DataClasses2DataContext();
            var uinfo = from a in nw.pishnahads

                        select new
            {
                id     = a.id,
                name   = a.name_new_music_pishnahadi,
                userid = a.userid
            };

            dataGridView1.DataSource = uinfo;
            Console.WriteLine("usermanagement is runnning");
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         var  db     = new DataClasses2DataContext();
         user myuser = db.users.Single(p => p.id == uid);
         myuser.pas = textBox1.Text;
         db.SubmitChanges();
         string message = "password changed!";
         MessageBox.Show(message);
         this.Close();
     }
     catch
     {
         MessageBox.Show("password not changed");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            var dbn   = new DataClasses2DataContext();
            var query = from c in dbn.musics
                        select c;
            DataClasses2DataContext db = new DataClasses2DataContext();

            music myp = new music();

            myp.fileaddress = textBox1.Text;
            myp.name        = textBox2.Text;
            myp.jhanrid     = Int32.Parse(textBox3.Text);
            db.musics.InsertOnSubmit(myp);
            db.SubmitChanges();
            MessageBox.Show("added!");
            //this.Close();
        }
예제 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (userid == -1)
            {
                MessageBox.Show("no user selected");
                return;
            }
            else
            {
                MessageBox.Show(userid.ToString());
            }

            var  nw = new DataClasses2DataContext();
            user removeFromGroup = (from gm in nw.users
                                    where (gm.id == userid)
                                    select gm).SingleOrDefault();

            try
            {
                nw.users.DeleteOnSubmit(removeFromGroup);
                nw.SubmitChanges();

                nw = new DataClasses2DataContext();
                var uinfo = from a in nw.users

                            select new
                {
                    id      = a.id,
                    name    = a.name,
                    jhanr   = a.username,
                    path    = a.pas,
                    tavalod = a.saletavalod,
                    email   = a.email,
                    ismodir = a.ismodir
                };
                dataGridView1.DataSource = uinfo;
                userid = -1;
            }
            catch
            {
                Console.WriteLine("has been deleted befor!!");
                MessageBox.Show("has been deleted befor!!");
                MessageBox.Show(userid.ToString());
            }
        }
예제 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            var dbn   = new DataClasses2DataContext();
            var query = from c in dbn.pishnahads

                        select c;
            DataClasses2DataContext db = new DataClasses2DataContext();

            pishnahad myp = new pishnahad();

            myp.name_new_music_pishnahadi = textBox1.Text;
            myp.userid = uid;

            db.pishnahads.InsertOnSubmit(myp);
            db.SubmitChanges();
            MessageBox.Show("sent!");
            this.Close();
        }
예제 #9
0
        private void button4_Click(object sender, EventArgs e)
        {
            userid = uid;
            var nw        = new DataClasses2DataContext();
            var musicinfo = from a in nw.musics
                            join
                            b in nw.likeds on a.id equals b.musicid
                            where b.userid == uid
                            select new
            {
                id    = a.id,
                name  = a.name,
                jhanr = a.jhanrid,
                path  = a.fileaddress
            };

            dataGridView2.DataSource = musicinfo;
            Console.WriteLine("ref reshing");
        }
예제 #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                DataClasses2DataContext db = new DataClasses2DataContext();

                liked a = new liked();

                a.musicid = musicid;
                a.userid  = userid;

                db.likeds.InsertOnSubmit(a);

                db.SubmitChanges();
            }

            catch
            {
                Console.WriteLine("has been aded befor!!");
            }
        }
예제 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            var dbn   = new DataClasses2DataContext();
            var query = from c in dbn.users

                        select c;
            DataClasses2DataContext db = new DataClasses2DataContext();

            user emp = new user();

            emp.username = textBox1.Text;

            emp.pas         = textBox2.Text;
            emp.name        = textBox3.Text;
            emp.email       = textBox5.Text;
            emp.ismodir     = "no";
            emp.saletavalod = Int32.Parse(textBox4.Text);
            db.users.InsertOnSubmit(emp);

            db.SubmitChanges();
            this.Close();
            //
        }