Пример #1
0
        }//method end...

        public void insert_student_status(student_status_class sa)
        {
            SqlConnection conn = new SqlConnection(connstring);

            try
            {
                SqlCommand cmd = new SqlCommand("insert_student_status", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@sa_st_id", SqlDbType.Int).Value    = sa.status_student_id;
                cmd.Parameters.Add("@sa_class_id", SqlDbType.Int).Value = sa.class_id;
                cmd.Parameters.Add("@sa_year", SqlDbType.Int).Value     = sa.year;

                conn.Open();
                cmd.ExecuteNonQuery();

                MessageBox.Show("DATA record has been inserted successfully.....");
            }
            catch (Exception)
            {
                MessageBox.Show("data is not inserted !!!");
            }

            finally
            {
                conn.Close();
            }
        }//method end...
Пример #2
0
        }//method end...

        public void insert_Fees(student_status_class sa, string id)
        {
            SqlConnection conn = new SqlConnection(connstring);

            try
            {
                SqlCommand cmd = new SqlCommand("insert_tblfees", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@fee_amount", SqlDbType.Float).Value  = sa.class_fees;
                cmd.Parameters.Add("@fee_date", SqlDbType.NVarChar).Value = System.DateTime.Now.ToShortDateString();
                cmd.Parameters.Add("@fee_fk_std_id", SqlDbType.Int).Value = id;
                cmd.Parameters.Add("@@sa_st_id", SqlDbType.Int).Value     = sa.status_student_id;

                conn.Open();
                cmd.ExecuteNonQuery();

                MessageBox.Show("DATA record has been inserted successfully.....");
            }
            catch (Exception)
            {
                MessageBox.Show("data is not inserted !!!");
            }

            finally
            {
                conn.Close();
            }
        }//method end...
        private void button1_Click(object sender, EventArgs e)
        {
            Student s = new Student();

            s.sfk    = Form1.fk_ad;
            s.sdate  = System.DateTime.Now.ToShortDateString();
            s.sname  = textBox4.Text;
            s.sfname = textBox3.Text;
            if (radioButton4.Checked == true)
            {
                s.sgender = "Male";
            }
            else if (radioButton3.Checked == true)
            {
                s.sgender = "Female";
            }
            else
            {
                MessageBox.Show("Please select your gender!");
            }
            s.saddress = richTextBox2.Text;



            MessageBox.Show(i.insert_srecord(s));

            returnclass          r  = new returnclass();
            student_status_class sa = new student_status_class();

            sa.year              = System.DateTime.Now.Year.ToString();
            sa.class_id          = Convert.ToInt16(comboBox1.SelectedValue.ToString());
            sa.status_student_id = Convert.ToInt32(r.scalarReturn("select max(std_id) from student"));
            i.insert_student_status(sa);
        }
        private void button5_Click(object sender, EventArgs e)
        {
            returnclass          r  = new returnclass();
            student_status_class sa = new student_status_class();

            sa.year              = System.DateTime.Now.Year.ToString();
            sa.class_id          = Convert.ToInt16(comboBox1.SelectedValue.ToString());
            sa.status_student_id = Convert.ToInt32(textBox7.Text);
            i.insert_student_status(sa);
        }
        private void button2_Click_1(object sender, EventArgs e)
        {
            student_status_class sa = new student_status_class();

            sa.status_student_id = Convert.ToInt32(label6.Text);
            sa.class_fees        = label5.Text;
            sa.class_name        = label4.Text;
            insert i = new insert();

            i.insert_Fees(sa, textBox1.Text);
        }