using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class feessubmission : Form
{
private string connstring = ConfigurationManager.ConnectionStrings["TESTDB"].ConnectionString;
public feessubmission()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection(connstring);
string sql = "select s.std_id,s.std_name,sa.SA_ID,SA_Class_id,sa.sa_year,c.classname,c.fees from student s inner join STUDENT_STATUS sa on sa.SA_ST_ID=s.std_id inner join classes c on c.class_id=sa.SA_Class_id where sa.sa_year='"+System.DateTime.Now.Year+"' and s.std_id="+textBox1.Text;
try
{
label2.Text = " ";
label3.Text = " ";
label4.Text = " ";
label5.Text = " ";
connection.Open();
SqlCommand cmd = new SqlCommand(sql, connection);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
label2.Text ="Name: "+reader.GetValue(1).ToString();
label3.Text ="Class: "+ reader.GetValue(5).ToString();
label4.Text ="fees: "+ reader.GetValue(6).ToString();
label5.Text = "Status id: "+reader.GetValue(2).ToString();
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("No RECORDS WERE FOUND!");
}
returnclass rc = new returnclass();
string pathquerry = rc.scalarReturn("select img_path from student_img where img_fk=" + textBox1.Text);
if (pathquerry == " ")
{
pictureBox1.Image = Image.FromFile(@"C:\Users\salman\documents\visual studio 2013\Projects\WindowsFormsApplication4\WindowsFormsApplication4\Resources\profile.jpg");
}
else
{
pictureBox1.Image = Image.FromFile(pathquerry);
}
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
}
private void button2_Click(object sender, EventArgs e)
{
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);
}
}
}