private void Studentsdetailedlist_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676288_cmyk_04); dtp.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); SqlControl sql = new SqlControl(); sql.ExecSql("select class as [class] ,section as [section] from class"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboclass.Items.Contains(r["class"]) == false) { cboclass.Items.Add(r["class"]); } if (cbosection.Items.Contains(r["section"]) == false) { cbosection.Items.Add(r["section"]); } } sql.ExecSql("select name from students"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["name"]) == false) { cboname.Items.Add(r["name"]); } } }
private void cbofill_SelectedIndexChanged(System.Object sender, System.EventArgs e) { if (boons == true) { SqlControl sql = new SqlControl(); if (cboclass.Text != "" & cbosection.Text != "") { sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { ComboBox combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; if (cbofill.SelectedIndex == 0) { combo.SelectedIndex = 0; } else { combo.SelectedIndex = 1; } num += 1; } } } }
private void cbofill_SelectedIndexChanged(System.Object sender, System.EventArgs e) { if (boons == true) { SqlControl sqls = new SqlControl(); sqls.ExecSql("select * from teacher"); if (sqls.exep != "") { MessageBox.Show(sqls.exep); return; } int num = 1; var loopTo = sqls.count; for (var j = 1; j <= loopTo; j++) { ComboBox combo = new ComboBox(); combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; if (cbofill.SelectedIndex == 0) { combo.SelectedIndex = 0; } else { combo.SelectedIndex = 1; } num += 1; } } }
private void cboname_SelectedIndexChanged(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.ExecSql("select * from dbo.show_students(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count != 0) { Grpdetails.Visible = true; picbox.ImageLocation = sql.data.Tables[0].Rows[0]["pic"].ToString(); lblage.Text = sql.data.Tables[0].Rows[0]["age"].ToString(); lblclass.Text = sql.data.Tables[0].Rows[0]["Class"].ToString(); lblname.Text = sql.data.Tables[0].Rows[0]["Student Name"].ToString(); lblsection.Text = sql.data.Tables[0].Rows[0]["Section"].ToString(); lbldue.Text = sql.data.Tables[0].Rows[0]["due"].ToString(); return; } makepay_Click(sender, e); }
private void DataGridView1_CellEndEdit(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { SqlControl sql = new SqlControl(); if (this.DataGridView1.CurrentCell.ColumnIndex == 2) { Type numberType = this.DataGridView1.CurrentCell.Value.IsNumber(); if (numberType == null) { MessageBox.Show("Please Enter A Number", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } double value = Convert.ToDouble(this.DataGridView1.CurrentCell.Value); if (value < 0 || value > 100) { MessageBox.Show("Enter a number between 1 to 100", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bnload_Click(sender, e); return; } sql.addprams("@name", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[0].Value); sql.addprams("@sub", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[1].Value); sql.addprams("@date", dtp.Value); sql.addprams("@mark", this.DataGridView1.CurrentCell.Value); sql.ExecProc("exec update_marks @name,@sub,@date,@mark"); bnload_Click(sender, e); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } } }
private void document_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { int height = 100; SqlControl sql = new SqlControl(); sql.ExecSql("select name,due from students where due>0"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } Font fontss = new Font("Arial", 22); e.Graphics.DrawString("The List of Students With Due", fontss, Brushes.ForestGreen, 200, 50); Font fonts = new Font("Arial", 10); var loopTo = sql.count - 1; for (var r = index; r <= loopTo; r++) { e.Graphics.DrawRectangle(Pens.Black, 100, height, 200, 40); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["due"].ToString(), fonts, Brushes.Black, 400, height + 5); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["name"].ToString(), fonts, Brushes.Black, 100, height + 5); e.Graphics.DrawLine(Pens.Black, 350, height + 20, 320, height + 20); e.Graphics.DrawRectangle(Pens.Black, 400, height, 150, 40); height += 80; if (height > 1000) { height = 100; index = r + 1; e.HasMorePages = true; return; } } }
private void bnload_Click(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); if (cboname.Text != "" & cbosub.Text != "") { sql.addprams("@name", cboname.Text); sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select *from dbo.show_marks(@name,@sub,@date)"); if (sql.count <= 0) { sql.addprams("@name", cboname.Text); sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecProc("Exec insert_marks @date,NULL,@sub,@name"); bnload_Click(sender, e); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } if (cboname.Text != "" & cbosub.Text == "") { sql.addprams("@name", cboname.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * From dbo.show_marks(@name,default,@date)"); bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } if (cboname.Text == "" & cbosub.Text != "") { sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_marks(default,@sub,@date)"); bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } }
private void Entermarkss_FormClosed(System.Object sender, System.Windows.Forms.FormClosedEventArgs e) { SqlControl sql = new SqlControl(); sql.ExecSql("delete from marks where marks is null"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } }
private void bnsubmit_Click(System.Object sender, System.EventArgs e) { if (txtpass.Text == "" | txtrepass.Text == "" | txtsecurity.Text == "" | txtusername.Text == "") { MessageBox.Show("Please fill up The above fields", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtpass.Text != txtrepass.Text) { MessageBox.Show("Your password and confirmation password does not match", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtsecurity.Text != "vinu") { MessageBox.Show("Your authentication password does not match", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SqlControl sql = new SqlControl(); sql.addprams("@name", txtusername.Text); sql.ExecSql("select *From users where username =@name"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count != 0) { MessageBox.Show("There is already a user with that name please select a different username!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SqlControl sql1 = new SqlControl(); sql1.addprams("@name", txtfullname.Text); sql1.addprams("@user", txtusername.Text); sql1.addprams("@pass", txtpass.Text); sql1.addprams("@pic", PictureBox1.ImageLocation); sql1.ExecSql("insert into Users(name,pass,picture,username) values(@user,@pass,@pic,@user)"); if (sql1.exep != "") { MessageBox.Show(sql.exep); return; } MessageBox.Show("The new User Details hav been added to the database :)", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtfullname.Clear(); txtpass.Clear(); txtrepass.Clear(); txtsecurity.Clear(); txtusername.Clear(); PictureBox1.Image = null; txtusername.Focus(); ManageUsers_Load(sender, e); }
private void txtsearch_KeyUp(System.Object sender, System.Windows.Forms.KeyEventArgs e) { SqlControl sql = new SqlControl(); sql.addprams("@name", txtsearch.Text); sql.ExecSql("Select * from dbo.show_fee(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
private void dates() { ListBox1.Items.Clear(); SqlControl sql = new SqlControl(); sql.addprams("@name", lblnames.Text); sql.addprams("@date", dtp.Value.Month); sql.ExecSql("select *from dbo.get_dates(@name,@date)"); var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { ListBox1.Items.Add(sql.data.Tables[0].Rows[0]["dates"].ToString()); } }
private void feesda_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676753_vector_65_04); SqlControl sql = new SqlControl(); sql.addprams("@name", txtsearch.Text); sql.ExecSql("Select * from dbo.show_fee(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
private void ManageUsers_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676551_add_user); SqlControl sql = new SqlControl(); sql.ExecSql("Select username from users order by username asc"); lstusernames.Items.Clear(); if (sql.count != 0) { var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { lstusernames.Items.Add(sql.data.Tables[0].Rows[j - 1]["username"]); } } }
private void bnclear_Click(System.Object sender, System.EventArgs e) { try { SqlControl sql = new SqlControl(); sql.addprams("@name", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[0].Value); sql.addprams("@sub", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[1].Value); sql.addprams("@date", dtp.Value); sql.ExecProc("exec delete_marks @name,@sub,@date"); MessageBox.Show("The Mark Details Has Been Deleted", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); bnload_Click(sender, e); } catch (Exception ex) { MessageBox.Show("Please Select A Mark Info first In The Grid", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public void saves(System.Object sender, System.EventArgs e) { SqlControl sqls = new SqlControl(); sqls.ExecSql("select * from teacher"); if (sqls.exep != "") { MessageBox.Show(sqls.exep); return; } int num = 1; var loopTo = sqls.count; for (var j = 1; j <= loopTo; j++) { if (pan.Controls["Combos" + num.ToString()].Text == "") { MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } num += 1; } num = 1; var loopTo1 = sqls.count; for (var j = 1; j <= loopTo1; j++) { SqlControl sql = new SqlControl(); sql.addprams("@name", sqls.data.Tables[0].Rows[j - 1]["name"]); sql.addprams("@date", dtp.Value); ComboBox combo = new ComboBox(); combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; sql.addprams("@at", combo.SelectedIndex + 1); sql.ExecProc("exec insert_Tat @name,@date,@at"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } num += 1; } see(); }
private void Txtdue_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.addprams("@due", double.Parse(txtdue.Text)); sql.ExecSql("update students set due = @due where name = @name"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } txtdue.Visible = false; lbldue.Visible = true; Cboname_SelectedIndexChanged(sender, e); } }
public void saves(System.Object sender, System.EventArgs e) { if (cboclass.Text != "" & cbosection.Text != "") { SqlControl sql = new SqlControl(); sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (pan.Controls["Combos" + num.ToString()].Text == "") { MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } num += 1; } num = 1; var loopTo1 = sql.count; for (var j = 1; j <= loopTo1; j++) { SqlControl sql1 = new SqlControl(); sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text); sql1.addprams("@date", dtp.Value); ComboBox combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; sql1.addprams("@at", combo.SelectedIndex + 1); sql1.ExecProc("exec insert_at @name,@date,@at"); if (sql1.exep != "") { MessageBox.Show(sql1.exep); return; } num += 1; } see(); } }
private void FeesStructures_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676753_vector_65_04); Grpdetails.Visible = false; SqlControl sql = new SqlControl(); sql.ExecSql("Select name as [Student] from students"); if (sql.exep != "") { MessageBox.Show(sql.exep); } foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["Student"]) == false) { cboname.Items.Add(r["Student"]); } } }
public void clicky(System.Object sender, System.EventArgs e) { if (cboclass.Text != "" & cbosection.Text != "") { SqlControl sql = new SqlControl(); sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (sender == pan.Controls["Names" + num.ToString()]) { SqlControl sql1 = new SqlControl(); sql1.addprams("@class", cboclass.Text); sql1.addprams("@section", cbosection.Text); sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text); sql1.ExecSql("select * from dbo.show_atclassname(@class,@section,@name)"); PictureBox1.ImageLocation = sql1.data.Tables[0].Rows[0]["pic"].ToString(); lblnames.Text = sql1.data.Tables[0].Rows[0]["name"].ToString(); lblgender.Text = sql1.data.Tables[0].Rows[0]["gender"].ToString(); lblclass.Text = sql1.data.Tables[0].Rows[0]["class"].ToString(); lblsection.Text = sql1.data.Tables[0].Rows[0]["section"].ToString(); lblnoholidays.Text = sql1.data.Tables[0].Rows[0]["leaves"].ToString(); dates(); } num += 1; } grphidden.Visible = false; grpbox.Visible = true; } else { MessageBox.Show("You must not leave class and section empty", "Fill Up", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void loadpay_Click(System.Object sender, System.EventArgs e) { if (txtpay.Text == "" | txtrange.Text == "") { MessageBox.Show("Please Enter An Amount and Fill The Range", "Fill Up", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DialogResult mess; mess = MessageBox.Show("Are You sure the amount is collected?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (mess == DialogResult.No) { return; } SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.addprams("@date", DateTime.Now.Date); sql.addprams("@amount", double.Parse(txtpay.Text)); sql.ExecProc("exec insert_transaction @name,@date,@amount"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } mess = MessageBox.Show("The Payment is Done! Do you want a Bill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (mess == DialogResult.Yes) { PrintDocument1.Print(); mess = MessageBox.Show("Do You Want To Print Another Copy?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (mess == DialogResult.Yes) { PrintDocument1.Print(); } } cboname_SelectedIndexChanged(sender, e); loadcan_Click(sender, e); txtpay.Text = ""; txtrange.Text = ""; }
private void PrintDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.ExecSql("select *From show_students(@name)"); SqlControl sql1 = new SqlControl(); sql1.addprams("@name", cboname.Text); sql1.ExecSql("select count(*) as counts From transactions"); Font fonts; fonts = new Font("Arial", 16); Image newim; newim = SchoolManagementApplciation.Properties.Resources.Bill_Heading; System.Drawing.Size sizes = new System.Drawing.Size(); sizes = new System.Drawing.Size(725, 200); newim = new Bitmap(newim, sizes); e.Graphics.DrawImage(newim, 20, 20); e.Graphics.DrawString("Fees Receipt", new Font("Arial", 26), Brushes.Black, 300, 250); e.Graphics.DrawString("No: 00" + sql1.data.Tables[0].Rows[0]["counts"].ToString() + @"\" + DateTime.Now.Date.ToShortMonthName() + @"\" + DateTime.Now.Date.Year.ToString(), new Font("Arial", 16), Brushes.Black, 310, 300); e.Graphics.DrawString("Name : " + cboname.Text, fonts, Brushes.Black, 50, 350); e.Graphics.DrawString("Registration Number : " + (sql.data.Tables[0].Rows[0]["Register Number"]).ToString(), fonts, Brushes.Black, 450, 350); e.Graphics.DrawString("Class : " + lblclass.Text, fonts, Brushes.Black, 50, 400); e.Graphics.DrawString("Date : 20/may/2016", fonts, Brushes.Black, 450, 400); e.Graphics.DrawRectangle(Pens.Black, 50, 500, 750, 250); e.Graphics.DrawRectangle(Pens.Black, 50, 500, 750, 80); e.Graphics.DrawString("Description", new Font("Arial", 20), Brushes.Black, 250, 520); e.Graphics.DrawString("Coaching Fee", new Font("Arial", 16), Brushes.Black, 60, 630); e.Graphics.DrawString(txtrange.Text, new Font("Arial", 16), Brushes.Black, 60, 680); e.Graphics.DrawString(txtpay.Text + @"\- Rs", new Font("Arial", 16), Brushes.Black, 650, 650); e.Graphics.DrawRectangle(Pens.Black, 600, 500, 200, 250); e.Graphics.DrawString("Amount in words : .............................................................................................", new Font("Arial", 16), Brushes.Black, 50, 800); e.Graphics.DrawString("Amount", new Font("Arial", 20), Brushes.Black, 640, 520); e.Graphics.DrawString("Signature", new Font("Arial", 16), Brushes.Black, 640, 970); e.Graphics.DrawString("Seal", new Font("Arial", 16), Brushes.Black, 200, 970); e.Graphics.DrawString("Vinu Academy,177 Mountbatten Road , 5th Street,Kumaran kudil ,Thoraipakkam,chennai 600097", new Font("Arial", 12), Brushes.Black, 100, 1030); e.Graphics.DrawString("9381887424", new Font("Arial", 12), Brushes.Black, 400, 1050); }
private void bndelete_Click(System.Object sender, System.EventArgs e) { if (lstusernames.Text == "") { MessageBox.Show("Please Slect a Username from the above list box first :) ", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (lstusernames.Items.Count == 1) { MessageBox.Show("You cannt delete this user because you need atleast 1 user to log in the software!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SqlControl sql = new SqlControl(); sql.addprams("@user", lstusernames.Text); sql.ExecSql("delete from users where username = @user"); if (sql.exep != "") { MessageBox.Show(sql.exep); } ManageUsers_Load(sender, e); }
public void clicky(System.Object sender, System.EventArgs e) { SqlControl sql2 = new SqlControl(); sql2.ExecSql("Select * from teacher"); if (sql2.exep != "") { MessageBox.Show(sql2.exep); return; } int num = 1; var loopTo = sql2.count; for (var j = 1; j <= loopTo; j++) { if (sender == pan.Controls["Names" + num.ToString()]) { SqlControl sql1 = new SqlControl(); sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text); sql1.ExecSql("Select *From dbo.teacher_shows(@name)"); if (sql1.exep != "") { MessageBox.Show(sql1.exep); return; } Picbox1.ImageLocation = sql1.data.Tables[0].Rows[0]["Picture"].ToString(); lbldesig.Text = sql1.data.Tables[0].Rows[0]["Designation"].ToString(); lblgender.Text = sql1.data.Tables[0].Rows[0]["Gender"].ToString(); lbltname.Text = sql1.data.Tables[0].Rows[0]["Staff Name"].ToString(); lblleaves.Text = sql1.data.Tables[0].Rows[0]["leave"].ToString(); } num += 1; } grphidden.Visible = false; grpbox.Visible = true; dates(); }
private void Entermarkss_Load(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676723_Test_paper_24); sql.ExecSql("select name as [dash] from students"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["dash"]) == false) { cboname.Items.Add(r["dash"]); } } sql.ExecSql("select name as [lol] from sub"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cbosub.Items.Contains(r["lol"]) == false) { cbosub.Items.Add(r["lol"]); } } dtp.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); }
private void dates() { lstbo.Items.Clear(); SqlControl sql = new SqlControl(); sql.addprams("@date", dtp.Value.Month); sql.addprams("@name", lbltname.Text); sql.ExecSql("select * from dbo.get_datess(@name,@date)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (lstbo.Items.Contains(sql.data.Tables[0].Rows[j - 1]["date"]) == false) { lstbo.Items.Add(sql.data.Tables[0].Rows[j - 1]["date"]); } } }
private void PrintDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { int height = 250; SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_marks(@name,default,@date)"); Font fontss = new Font("Arial", 22); Font fonts = new Font("Arial", 16); Rectangle rectangles = new Rectangle(); Font fullnamesfont = new Font("Arial", 20); e.Graphics.DrawString("Name : ", fullnamesfont, Brushes.Black, 50, 50); e.Graphics.DrawString(sql.data.Tables[0].Rows[0]["Student Name"].ToString(), fullnamesfont, Brushes.DarkOrange, 250, 50); e.Graphics.DrawString("Class : ", fullnamesfont, Brushes.Black, 50, 100); e.Graphics.DrawString(sql.data.Tables[0].Rows[0]["class"].ToString(), fullnamesfont, Brushes.DarkOrange, 250, 100); e.Graphics.DrawString("Section : ", fullnamesfont, Brushes.Black, 50, 150); e.Graphics.DrawString(sql.data.Tables[0].Rows[0]["section"].ToString(), fullnamesfont, Brushes.DarkOrange, 250, 150); rectangles = new Rectangle(20, 200, 250, 50); e.Graphics.DrawRectangle(Pens.Black, rectangles); e.Graphics.FillRectangle(Brushes.ForestGreen, rectangles); e.Graphics.DrawString("Subjects", fontss, Brushes.Black, 22, 210); rectangles = new Rectangle(270, 200, 120, 50); e.Graphics.DrawRectangle(Pens.Black, rectangles); e.Graphics.FillRectangle(Brushes.ForestGreen, rectangles); e.Graphics.DrawString("Mark", fonts, Brushes.Black, 272, 210); rectangles = new Rectangle(390, 200, 120, 50); e.Graphics.DrawRectangle(Pens.Black, rectangles); e.Graphics.FillRectangle(Brushes.ForestGreen, rectangles); e.Graphics.DrawString("Grade", fonts, Brushes.Black, 392, 210); rectangles = new Rectangle(510, 200, 300, 50); e.Graphics.DrawRectangle(Pens.Black, rectangles); e.Graphics.FillRectangle(Brushes.ForestGreen, rectangles); e.Graphics.DrawString("Remarks", fonts, Brushes.Black, 632, 210); var loopTo = sql.count - 1; for (int r = index; r <= loopTo; r++) { e.Graphics.DrawRectangle(Pens.Black, 20, height, 250, 50); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["Subject Name"].ToString(), fonts, Brushes.Brown, 22, height + 10); e.Graphics.DrawRectangle(Pens.Black, 270, height, 120, 50); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["Marks"].ToString(), fonts, Brushes.Brown, 272, height + 10); e.Graphics.DrawRectangle(Pens.Black, 390, height, 120, 50); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["Grade"].ToString(), fonts, Brushes.Brown, 392, height + 10); e.Graphics.DrawRectangle(Pens.Black, 510, height, 300, 50); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["Remark"].ToString(), fonts, Brushes.Brown, 530, height + 10); height += 50; if (height > 1000) { height = 100; index = r + 1; e.HasMorePages = true; return; } } e.HasMorePages = false; }
private void see() { if (cotn > 0) { int num = 1; var loopTo = cotn; for (var j = 1; j <= loopTo; j++) { pan.Controls["Combos" + num.ToString()].Dispose(); pan.Controls["Names" + num.ToString()].Dispose(); num += 1; } } cotn = 0; try { pan.Controls["bnload"].Dispose(); } catch (Exception ex) { } SqlControl sql = new SqlControl(); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_Tattendance(@date)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count != 0) { int arraysize; arraysize = sql.count; ComboBox[] combos = new ComboBox[arraysize + 1]; Label[] lables = new Label[arraysize + 1]; Font fonts = new Font("Arial", 12); int num = 1; int yy = 100; var loopTo1 = sql.count; for (var j = 1; j <= loopTo1; j++) { combos[j] = new ComboBox(); combos[j].Name = "Combos" + num.ToString(); combos[j].Location = new Point(300, yy); combos[j].Size = new Size(140, 24); combos[j].Text = sql.data.Tables[0].Rows[j - 1]["P/A"].ToString(); pan.Controls.Add(combos[j]); lables[j] = new Label(); lables[j].Name = "Names" + num.ToString(); lables[j].Location = new Point(50, yy); lables[j].Size = new Size(140, 24); lables[j].Font = fonts; lables[j].Text = sql.data.Tables[0].Rows[j - 1]["Staff Name"].ToString(); pan.Controls.Add(lables[j]); lables[j].Click += clicky; yy += 50; num += 1; cotn += 1; } cbofill.Enabled = false; } else { SqlControl sqls = new SqlControl(); sqls.ExecSql("select * from teacher"); if (sqls.exep != "") { MessageBox.Show(sqls.exep); return; } int arraysize; arraysize = sqls.count; ComboBox[] combos = new ComboBox[arraysize + 1]; Label[] lables = new Label[arraysize + 1]; Font fonts = new Font("Arial", 12); int num = 1; Button butt; Font buttfont = new Font("Arial", 22); int yy = 100; var loopTo2 = sqls.count; for (var j = 1; j <= loopTo2; j++) { combos[j] = new ComboBox(); combos[j].Name = "Combos" + num.ToString(); combos[j].Location = new Point(300, yy); combos[j].Size = new Size(140, 24); combos[j].Items.Add("Present"); combos[j].Items.Add("Absent"); pan.Controls.Add(combos[j]); lables[j] = new Label(); lables[j].Name = "Names" + num.ToString(); lables[j].Location = new Point(50, yy); lables[j].Size = new Size(140, 24); lables[j].Font = fonts; lables[j].Text = sqls.data.Tables[0].Rows[j - 1]["name"].ToString(); pan.Controls.Add(lables[j]); lables[j].Click += clicky; yy += 50; num += 1; cotn += 1; } butt = new Button(); butt.Name = "bnload"; butt.Text = "Save"; butt.Font = buttfont; butt.Location = new Point(75, yy + 50); butt.Size = new Size(400, 100); butt.Click += saves; pan.Controls.Add(butt); cbofill.Enabled = true; } grphidden.Visible = true; grpbox.Visible = false; boons = true; }