private void button2_Click(object sender, EventArgs e)
        {
            button2.BackColor = Color.MediumSpringGreen;

            student_status sa = new student_status();

            sa.status_student_id = Convert.ToInt32(label5.Text);
            sa.class_fees        = label4.Text;
            sa.class_name        = label3.Text;

            insert i = new insert();

            i.insert_FEES(sa, textBox1.Text);
            q = "select s.std_id,sa.SA_ID,f.fee_id,s.std_name,sa.sa_year,f.dayx+'/'+f.monthx as PaidDate,f.fee_amount from student s inner join STUDENT_STATUS sa on s.std_id=sa.SA_ST_ID inner join fees f on sa.SA_ID=f.SA_FK_ID where sa.sa_year='" + System.DateTime.Now.Year.ToString() + "' and f.monthx='" + System.DateTime.Now.Month.ToString() + "'";
            dataGridView1.DataSource = vc.showrecord(q);

            string s = rc.scalarReturn("select count(fee_id) from fees where fee_fk_st_id=" + textBox1.Text + " and monthx='" + System.DateTime.Now.Month.ToString() + "'");

            if (s.Equals("0"))
            {
                button2.Enabled = true;

                label10.Text      = "Unpaid!";
                label10.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                label10.Text      = "paid!";
                button2.Enabled   = false;
                label10.ForeColor = System.Drawing.Color.Green;
            }
        }
Example #2
0
        } //method end...........

        public void insert_StudentStatus(student_status 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...........
Example #3
0
        } //method end...........

        public void insert_FEES(student_status 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("@dayx", SqlDbType.NVarChar).Value    = System.DateTime.Now.Day.ToString();
                cmd.Parameters.Add("@monthx", SqlDbType.NVarChar).Value  = System.DateTime.Now.Month.ToString();
                cmd.Parameters.Add("@fee_fk_st_id", SqlDbType.Int).Value = id;
                cmd.Parameters.Add("@SA_FK_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...........
Example #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            returnclass    r  = new returnclass();
            student_status sa = new student_status();

            sa.year              = System.DateTime.Now.Year.ToString();
            sa.class_id          = Convert.ToInt16(comboBox1.SelectedValue.ToString());
            sa.status_student_id = Convert.ToInt32(textBox5.Text);

            i.insert_StudentStatus(sa);
        }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            student s = new student();

            //  s.sfk = Form1.fk_ad;
            s.sfk    = "1";
            s.sdate  = System.DateTime.Now.ToShortDateString();
            s.sname  = textBox1.Text;
            s.sfname = textBox2.Text;
            if (radioButton1.Checked == true)
            {
                s.sgender = "male";
            }
            else if (radioButton2.Checked == true)
            {
                s.sgender = "female";
            }
            else
            {
                MessageBox.Show("Please select gender!");
            }
            s.saddress = richTextBox1.Text;



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



            student_status sa = new student_status();

            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_StudentStatus(sa);

            textBox5.Text = r.scalarReturn("select  max(std_id) from student");

            textBox4.Text = textBox5.Text;
        } //submit tbn ends