示例#1
0
        private void addStudentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Add_Student adstu = new Add_Student();

            adstu.MdiParent = this;
            adstu.Show();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Add_Student a = new Add_Student();

            a.Show();
        }
示例#3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Add_Student adstu = new Add_Student();

            adstu.MdiParent = this;
            adstu.Show();
        }
示例#4
0
        private void btnupdateteac_Click_1(object sender, EventArgs e)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(c))
                {
                    connection.Open();
                    SqlCommand     command = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction         = connection.BeginTransaction("SampleTransaction");
                    command.Connection  = connection;
                    command.Transaction = transaction;
                    command.CommandText = "update addstudent set s_rollno='" + rollnos.Text + "', s_name='" + txtsname.Text + "',s_last_name='" + txtlastname.Text + "', s_fname='" + txtsfnam.Text + "', s_gender='" + txtsgender.Text + "', s_dob='" + txtsdob.Text + "', s_email='" + txts_email.Text + "', s_home_phone='" + txts_home_phone.Text + "', s_mobile_phone='" + txts_mobile_phone.Text + "', s_start_date='" + txts_start_date.Text + "', s_state='" + txts_state.Text + "', s_street='" + txts_street.Text + "', s_city='" + txts_city.Text + "', s_zip_code='" + txts_zip_code.Text + "', s_country='" + txts_country.Text + "', s_ready_password='******', s_note='" + txts_note.Text + "', team_id='" + team_id.SelectedValue.ToString() + "' where s_id='" + Convert.ToInt32(txts_id.Text) + "'";
                    command.ExecuteNonQuery();
                    transaction.Commit();
                    MessageBox.Show("Student Record Have Been Successfully Updated");

                    Add_Student objads = new Add_Student();
                    objads.Show();
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#5
0
        private void refreshbtn_Click(object sender, EventArgs e)
        {
            Add_Student adst = new Add_Student();

            adst.Show();
            this.Hide();
        }
示例#6
0
 private void btndeleteteac_Click(object sender, EventArgs e)
 {
     try
     {
         objcon = new SqlConnection(c);
         objcon.Open();
         SqlTransaction objsdel;
         objsdel             = objcon.BeginTransaction();
         objcomm             = new SqlCommand("delete from addstudent where s_id =  '" + txts_id.Text + "'", objcon);
         objcomm.Transaction = objsdel;
         objcomm.ExecuteNonQuery();
         objsdel.Commit();
         MessageBox.Show("Your Student Record Have been Successfully Delete");
         objcon.Close();
         Add_Student adds = new Add_Student();
         adds.Show();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#7
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Add_Student objAdd_Student = new Add_Student();

            objAdd_Student.Show();
            try
            {
                vargetvalue = "";
                using (SqlConnection connection = new SqlConnection(c))
                {
                    connection.Open();
                    SqlCommand     command = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction         = connection.BeginTransaction("SampleTransaction");
                    command.Connection  = connection;
                    command.Transaction = transaction;
                    command.CommandText = "select * from addstudent left join team on team.team_id=addstudent.team_id where s_id ='" + this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
                    SqlDataAdapter objadp = new SqlDataAdapter(command.CommandText, connection);
                    objadp.SelectCommand.Transaction = transaction;
                    DataTable dta = new DataTable();
                    objadp.Fill(dta);
                    foreach (DataRow dtrow in dta.Rows)
                    {
                        objAdd_Student.txts_id.Text             = dtrow["s_id"].ToString();
                        objAdd_Student.rollnos.Text             = dtrow["s_rollno"].ToString();
                        objAdd_Student.txtsdob.Text             = dtrow["s_dob"].ToString();
                        objAdd_Student.txtsname.Text            = dtrow["s_name"].ToString();
                        objAdd_Student.txtlastname.Text         = dtrow["s_last_name"].ToString();
                        objAdd_Student.txtsfnam.Text            = dtrow["s_fname"].ToString();
                        objAdd_Student.txtsgender.Text          = dtrow["s_gender"].ToString();
                        objAdd_Student.txts_email.Text          = dtrow["s_email"].ToString();
                        objAdd_Student.txts_home_phone.Text     = dtrow["s_home_phone"].ToString();
                        objAdd_Student.txts_mobile_phone.Text   = dtrow["s_mobile_phone"].ToString();
                        objAdd_Student.txts_street.Text         = dtrow["s_street"].ToString();
                        objAdd_Student.txts_city.Text           = dtrow["s_city"].ToString();
                        objAdd_Student.txts_state.Text          = dtrow["s_state"].ToString();
                        objAdd_Student.txts_zip_code.Text       = dtrow["s_zip_code"].ToString();
                        objAdd_Student.txts_country.Text        = dtrow["s_country"].ToString();
                        objAdd_Student.txts_note.Text           = dtrow["s_note"].ToString();
                        objAdd_Student.txts_ready_password.Text = dtrow["s_ready_password"].ToString();
                        objAdd_Student.team_id.Text             = dtrow["team_name"].ToString();
                        vargetvalue = dtrow["team_name"].ToString();
                        objAdd_Student.txts_start_date.Text = dtrow["s_start_date"].ToString();
                        objAdd_Student.supdatepic           = (string)dtrow["s_pic"].ToString();
                        if (objAdd_Student.supdatepic != null && objAdd_Student.supdatepic != "")
                        {
                            objAdd_Student.pictureBox3.Load(Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) +
                                                            @"\pics\" + objAdd_Student.supdatepic);
                        }
                    }
                    transaction.Commit();
                }
                if (vargetvalue == "")
                {
                    objAdd_Student.funsimple();
                    objAdd_Student.clearinputs();
                    objAdd_Student.getrollno();
                }
                else
                {
                    objAdd_Student.funedit();
                }

                objAdd_Student.rollnos.Enabled = false;
                objAdd_Student.stueditrollnumber.Hide();
                objAdd_Student.metroButton1.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            //try
            //{
            //    Edit_AddStudent edads = new Edit_AddStudent();
            //    edads.editsid.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            //    edads.editsbarcod.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
            //    edads.editsrolno.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            //    edads.editsname.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
            //    edads.editsfname.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
            //    edads.editsgender.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
            //    edads.editscnic.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
            //    edads.editsfcnic.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString();
            //    edads.editsdob.Text = this.dataGridView1.CurrentRow.Cells[8].Value.ToString();
            //    edads.editsclass.Text = this.dataGridView1.CurrentRow.Cells[9].Value.ToString();
            //    edads.editsclassection.Text = this.dataGridView1.CurrentRow.Cells[10].Value.ToString();
            //    edads.editscontact.Text = this.dataGridView1.CurrentRow.Cells[11].Value.ToString();
            //    edads.editslastscl.Text = this.dataGridView1.CurrentRow.Cells[12].Value.ToString();
            //    edads.editsadress.Text = this.dataGridView1.CurrentRow.Cells[13].Value.ToString();
            //    edads.spicpath = this.dataGridView1.CurrentRow.Cells[14].Value.ToString();
            //    edads.edittxtstudentfee.Text = this.dataGridView1.CurrentRow.Cells[15].Value.ToString();
            //    edads.editstudentfeediscount.Text = this.dataGridView1.CurrentRow.Cells[15].Value.ToString();
            //    edads.edittxtdiscountfee.Text = this.dataGridView1.CurrentRow.Cells[16].Value.ToString();
            //    edads.edittxtstatus.Text = this.dataGridView1.CurrentRow.Cells[17].Value.ToString();
            //    edads.MdiParent = this.MdiParent;
            //    edads.Show();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);

            //}
        }
示例#8
0
        private void btnupdateteac_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtsname.Text.Trim() == "")
                {
                    txtsname.Focus();
                    MessageBox.Show("Please Enter The Student Name ..!");
                    return;
                }
                if (txtsfnam.Text.Trim() == "")
                {
                    txtsfnam.Focus();
                    MessageBox.Show("Please Enter The Student Father Name ..!");
                    return;
                }
                if (txtsgender.Text.Trim() == "")
                {
                    txtsgender.Focus();
                    MessageBox.Show("Please Select The Student Gender ..!");
                    return;
                }
                if (txtsdob.Text.Trim() == "")
                {
                    txtsdob.Focus();
                    MessageBox.Show("Please enter The Student DOB ..!");
                    return;
                }
                if (txts_email.Text.Trim() == "")
                {
                    txts_email.Focus();
                    MessageBox.Show("Please enter The E-mail Id ..!");
                    return;
                }
                if (txts_home_phone.Text.Trim() == "")
                {
                    txts_home_phone.Focus();
                    MessageBox.Show("Please enter Home # ..!");
                    return;
                }
                if (txts_street.Text.Trim() == "")
                {
                    txts_street.Focus();
                    MessageBox.Show("Please enter Street # ..!");
                    return;
                }
                if (txts_city.Text.Trim() == "")
                {
                    txts_city.Focus();
                    MessageBox.Show("Please enter City Name # ..!");
                    return;
                }

                if (txts_zip_code.Text.Trim() == "")
                {
                    txts_zip_code.Focus();
                    MessageBox.Show("Please enter Zip Code ..!");
                    return;
                }
                if (txts_country.Text.Trim() == "")
                {
                    txts_country.Focus();
                    MessageBox.Show("Please enter Country ..!");
                    return;
                }
                string status;
                using (SqlConnection connection = new SqlConnection(c))
                {
                    connection.Open();
                    SqlCommand     command = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction         = connection.BeginTransaction("SampleTransaction");
                    command.Connection  = connection;
                    command.Transaction = transaction;
                    command.CommandText = "update addstudent set s_rollno='" + rollnos.Text + "', s_name='" + txtsname.Text + "', s_fname='" + txtsfnam.Text + "', s_gender='" + txtsgender.Text + "', s_dob='" + txtsdob.Text + "', s_email='" + txts_email.Text + "', s_home_phone='" + txts_home_phone.Text + "', s_mobile_phone='" + txts_mobile_phone.Text + "', s_start_date='" + txts_start_date.Text + "', s_street='" + txts_street.Text + "', s_city='" + txts_city.Text + "', s_zip_code='" + txts_zip_code.Text + "', s_country='" + txts_country.Text + "', s_ready_password='******', s_note='" + txts_note.Text + "', team_id='" + team_id.SelectedValue.ToString() + "' where s_id='" + Convert.ToInt32(txts_id.Text) + "'";
                    command.ExecuteNonQuery();
                    transaction.Commit();
                    MessageBox.Show("Student Record Have Been Successfully Updated");
                    Add_Student objads = new Add_Student();
                    objads.Show();
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#9
0
        private void txtsinsert_Click(object sender, EventArgs e)
        {
            try
            {
                if (rollnos.Text.Trim() == "")
                {
                    rollnos.Focus();
                    MessageBox.Show("Please Enter Roll #..!");
                    return;
                }

                if (txtsname.Text.Trim() == "")
                {
                    txtsname.Focus();
                    MessageBox.Show("Please Enter The Student Name ..!");
                    return;
                }
                if (txtsfnam.Text.Trim() == "")
                {
                    txtsfnam.Focus();
                    MessageBox.Show("Please Enter The Student Father Name ..!");
                    return;
                }
                if (txtsgender.Text.Trim() == "")
                {
                    txtsgender.Focus();
                    MessageBox.Show("Please Select The Student Gender ..!");
                    return;
                }
                if (!Regex.IsMatch(txts_email.Text, @"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"))
                {
                    MessageBox.Show("Plz Enter Email in  Correct Format");
                    txts_email.Focus();
                    return;
                }

                if (txts_email.Text.Trim() == "")
                {
                    txts_email.Focus();
                    MessageBox.Show("Please enter The E-mail Id ..!");
                    return;
                }
                if (txts_mobile_phone.Text.Trim() == "")
                {
                    txts_home_phone.Focus();
                    MessageBox.Show("Please enter Mobile # ..!");
                    return;
                }

                if (txtsdob.Text.Trim() == "")
                {
                    txtsdob.Focus();
                    MessageBox.Show("Please enter The Student DOB ..!");
                    return;
                }



                Random rmd         = new Random();
                string ran         = DateTime.UtcNow.Ticks.ToString().Substring(8);
                string exsitrecord = "";
                using (SqlConnection connection = new SqlConnection(c))
                {
                    connection.Open();
                    SqlCommand     command = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction         = connection.BeginTransaction("SampleTransaction");
                    command.Connection  = connection;
                    command.Transaction = transaction;

                    command.CommandText = "select s_rollno from addstudent where s_rollno='" + rollnos.Text + "' OR s_barecode='" + ran + "'";
                    SqlDataAdapter objadp3 = new SqlDataAdapter(command.CommandText, connection);
                    objadp3.SelectCommand.Transaction = transaction;
                    DataTable dta3 = new DataTable();
                    objadp3.Fill(dta3);
                    foreach (DataRow dtrow3 in dta3.Rows)
                    {
                        dtrow3["s_rollno"].ToString();
                    }

                    if (exsitrecord == "")
                    {
                        command.CommandText = "insert into addstudent (s_barecode,s_rollno,s_name,s_fname,s_gender,s_dob,s_pic,s_state,s_email,s_home_phone,s_mobile_phone,s_start_date,s_street,s_city,s_zip_code,s_country,s_ready_password,s_note,team_id,s_last_name) values('" + ran + "','" + rollnos.Text + "','" + txtsname.Text + "','" + txtsfnam.Text + "','" + txtsgender.Text + "','" + txtsdob.Text + "','" + CorrectFileName + "','" + txts_state.Text + "','" + txts_email.Text + "','" + txts_home_phone.Text + "','" + txts_mobile_phone.Text + "','" + txts_start_date.Text + "','" + txts_street.Text + "','" + txts_city.Text + "','" + txts_zip_code.Text + "','" + txts_country.Text + "','" + txts_ready_password.Text + "','" + txts_note.Text + "','" + team_id.SelectedValue.ToString() + "','" + txtlastname.Text + "')";
                        command.ExecuteNonQuery();
                        transaction.Commit();
                        MessageBox.Show("Your Student Have Been Successfully Saved In Your Record");
                        Add_Student objads = new Add_Student();
                        objads.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("This Student Is Already Saved Yours In Record..!");
                        rollnos.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }