Example #1
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            string s = textBox2.Text;
            string pass;
            var    str = from a2 in DB.DocRegs
                         where a2.Password == s
                         select a2;

            try
            {
                DocReg pa = str.First();

                pass = pa.Password.ToString();
                if (pass != null)
                {
                    if (pass.Equals(textBox2.Text))
                    {
                        if (dataGridView1.CurrentRow.Index != -1)
                        {
                            textBox3.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                            textBox4.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                            textBox5.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                            textBox6.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                            textBox7.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                            textBox8.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
                            textBox9.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message.ToString(), "Error");
            }
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            DocReg dr = new DocReg();

            dr.Name        = textBox2.Text;
            dr.UserName    = textBox3.Text;
            dr.Password    = textBox4.Text;
            dr.PhoneNumber = textBox5.Text;
            dr.Category    = textBox6.Text;
            dr.Area        = textBox7.Text;
            dr.Chamber     = textBox8.Text;
            DB.DocRegs.InsertOnSubmit(dr);
            DB.SubmitChanges();
            MessageBox.Show("Registered !!");
        }
Example #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            string s  = textBox1.Text;
            string s2 = textBox2.Text;
            string username;
            string pass;
            var    str = from a2 in DB.DocRegs
                         where a2.UserName == s && a2.Password == s2
                         select a2;

            try
            {
                DocReg pa = str.First();
                username = pa.UserName.ToString();
                pass     = pa.Password.ToString();
                if (username != null && pass != null)
                {
                    if (username.Equals(textBox1.Text) && pass.Equals(textBox2.Text))
                    {
                        //this.Hide();
                        DocSearch se = new DocSearch();
                        se.ShowDialog();
                    }
                }
            }
            catch (Exception exve)
            {
                MessageBox.Show("Please Put valid User Name and Password");
            }

            /*if (username != null && pass != null)
             * {
             *  if (username.Equals(textBox1.Text) && pass.Equals(textBox2.Text))
             *  {
             *      //this.Hide();
             *      Search se = new Search();
             *      se.ShowDialog();
             *
             *
             *  }
             *  else
             *  {
             *      MessageBox.Show("Please Put valid User Name and Password");
             *  }
             * }*/
        }
 partial void DeleteDocReg(DocReg instance);
 partial void UpdateDocReg(DocReg instance);
 partial void InsertDocReg(DocReg instance);