private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         using (FacultyLinqDataContext data = new FacultyLinqDataContext())
         {
             Faculty_Info lg = data.Faculty_Infos.Single(Faculty_Info => Faculty_Info.Name == textBox1.Text);
             Password = lg.CreatePassword;
             name     = lg.Name;
         }
         if (Password == textBox2.Text)
         {
             MessageBox.Show("login successfull ");
             textBox1.Text = null;
             textBox2.Text = null;
         }
         path = @"C:\Users\Tomal\Documents\Visual Studio 2013\Projects\Info\AllInfo\facultypropic\" + name + ".jpg";
         FacultyHomepage fhome = new FacultyHomepage(name, path);
         fhome.Show();
         this.Hide();
     }
     catch
     {
         MessageBox.Show("Invalid username or password");
         textBox1.Text = null;
         textBox2.Text = null;
     }
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                FacultyLinqDataContext db  = new FacultyLinqDataContext();
                Faculty_Info           fac = new Faculty_Info();
                fac.Name            = textBox1.Text;
                fac.Email           = textBox2.Text;
                fac.Contact         = textBox3.Text;
                fac.Address         = textBox4.Text;
                fac.Education       = textBox5.Text;
                fac.Age             = textBox6.Text;
                fac.Sex             = textBox7.Text;
                fac.Religion        = textBox8.Text;
                fac.PreferredCourse = textBox9.Text;
                fac.DayOff          = "Friday";
                fac.Depatment       = textBox13.Text;
                fac.CreatePassword  = textBox12.Text;
                db.Faculty_Infos.InsertOnSubmit(fac);
                db.SubmitChanges();
                File.Copy(temp_a, @"C:\Users\Tomal\Documents\Visual Studio 2013\Projects\Info\AllInfo\facultypropic\" + textBox1.Text + ".jpg");

                MessageBox.Show("Data Inserted");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         using (FacultyLinqDataContext data = new FacultyLinqDataContext())
         {
             login lg = data.logins.Single(login => login.Name == textBox1.Text);
             Password = lg.Password;
             name     = lg.Name;
         }
         if (Password == textBox2.Text)
         {
             MessageBox.Show("login successfull ");
             textBox1.Text = null;
             textBox2.Text = null;
         }
         path = @"C:\Users\Tomal\Documents\Visual Studio 2013\Projects\Info\AllInfo\adminpropic\" + name + ".jpg";
         AdminHomepage adminhome = new AdminHomepage(name, path);
         adminhome.Show();
         this.Hide();
     }
     catch
     {
         MessageBox.Show("Invalid username or password");
         textBox1.Text = null;
         textBox2.Text = null;
     }
 }
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                using (FacultyLinqDataContext fup = new FacultyLinqDataContext())
                {
                    FacultyLinqDataContext fupdate = new FacultyLinqDataContext();
                    int          id   = int.Parse(label6.Text);
                    Faculty_Info fobj = fupdate.Faculty_Infos.SingleOrDefault(Faculty_Info => Faculty_Info.Id == id);
                    MessageBox.Show(textBox1.Text);
                    fobj.Name      = textBox1.Text;
                    fobj.Email     = textBox2.Text;
                    fobj.Contact   = textBox3.Text;
                    fobj.Address   = textBox4.Text;
                    fobj.Depatment = textBox5.Text;

                    fupdate.SubmitChanges();

                    MessageBox.Show("Data Updated");
                }
            }
            catch (Exception ex)
            {
                //FacultyLinqDataContext fupdate = new FacultyLinqDataContext();

                //fupdate.SubmitChanges();
                MessageBox.Show(ex.Message);
                ///  textBox1.Text = null;
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                using (FacultyLinqDataContext fsearch = new FacultyLinqDataContext())
                {
                    Faculty_Info finfo = fsearch.Faculty_Infos.Single(Faculty_Info => Faculty_Info.Name == textBox1.Text);



                    textBox1.Text = finfo.Name;
                    textBox2.Text = finfo.Email;
                    textBox3.Text = finfo.Contact;
                    textBox4.Text = finfo.Address;
                    textBox5.Text = finfo.Depatment;
                    label6.Text   = finfo.Id.ToString();
                    MessageBox.Show("Data Found");
                }
            }
            catch
            {
                MessageBox.Show("Data Not Found");
                textBox1.Text = null;
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            FacultyLinqDataContext fdelete = new FacultyLinqDataContext();

            Faculty_Info finfo = fdelete.Faculty_Infos.Single(Faculty_Info => Faculty_Info.Name == textBox1.Text);

            fdelete.Faculty_Infos.DeleteOnSubmit(finfo);

            fdelete.SubmitChanges();
            MessageBox.Show("Data ddeleted");
        }
        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                using (FacultyLinqDataContext Ssearch = new FacultyLinqDataContext())
                {
                    Faculty_Info sinfo = Ssearch.Faculty_Infos.Single(Faculty_Info => Faculty_Info.Name == name);



                    label3.Text  = sinfo.Name;
                    label4.Text  = sinfo.Email;
                    label12.Text = sinfo.Contact;
                    label6.Hide();
                    label8.Text = sinfo.Depatment;
                    MessageBox.Show("Data Found");
                    label3.Show();
                    label4.Show();
                    label5.Show();
                    label6.Show();
                    label7.Show();
                    label8.Show();
                    label9.Show();
                    label10.Show();
                    label11.Show();
                    label12.Show();
                    label13.Show();
                    textBox1.Text = null;
                }
            }
            catch
            {
                MessageBox.Show("Data Not Found ");
                textBox1.Text = null;
            }
        }