public override void btndelete_Click(object sender, EventArgs e) { string CText = string.Empty; foreach (System.Data.DataRowView item in listBox1.SelectedItems) { CText += item.Row.Field <String>(1); } var value = CText.Split(' ').ToList(); int k = Connection.Login("select count(*) from tbl_classstudent where classno ='" + valcmbclass.SelectedValue.ToString() + "' and section=(select top 1 sectioncode from tbl_section where sectionname='" + value[1].ToString() + "')"); if (k > 0) { MessageBox.Show("You Can Not Delete Record."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record.", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete FROM tbl_class where classno='" + listBox1.SelectedValue.ToString() + "'"); MessageBox.Show("Record Deleted."); c.FillListBox("select a.classno,b.classname+' '+c.sectionname as class from tbl_class a,tbl_classmaster b,tbl_section c where b.classcode=a.classcode and c.sectioncode=a.sectioncode order by a.classcode,c.sectioncode", "class", "classno", ref listBox1); //Connection.AllPerform("Delete from tbl_section where sectioncode ='" + valcmbsection.SelectedValue.ToString() + "'"); //Connection.AllPerform("Delete from tbl_sankay where sankaycode ='" + valcmbsankay.SelectedValue.ToString() + "'"); DesignForm.fromClear(this); } } }
public override void btnnew_Click(object sender, EventArgs e) { DesignForm.fromDesign2(this); add_edit = true; c.cleartext(this); c.GetMdiParent(this).DisableAllEditMenuButtons(); cmbclass.Focus(); }
public void btnnew_Click(object sender, EventArgs e) { DesignForm.fromDesign2(this); add_edit = true; c.cleartext(this); c.btndisable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, null); txtsankayname.Focus(); }
public void btnnew_Click(object sender, EventArgs e) { DesignForm.fromDesign2(this); add_edit = true; c.cleartext(this); //c.GetMdiParent(this).DisableAllEditMenuButtons(); c.btndisable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, btnedit); txtsankayname.Focus(); }
public override void btnsave_Click(object sender, EventArgs e) { if (txtsankayname.Text == "") { MessageBox.Show("Null Value Not Allowed"); } else {//c.datasave("tbl_school", c.myconn, this); if (add_edit == true) { c.returnconn(c.myconn); SqlCommand command = new SqlCommand("select max(sankaycode) from tbl_sankay", c.myconn); command.CommandTimeout = 120; Int32 mstudentno; mstudentno = 1001; if (command.ExecuteScalar() != System.DBNull.Value) { mstudentno = Convert.ToInt32(command.ExecuteScalar()) + 1; } DataSet ds = Connection.GetDataSet("select count(* ) from tbl_sankay where sankayname='" + txtsankayname.Text + "'"); int i = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (i == 0) { txtsankaycode.Text = mstudentno.ToString(); c.insertdata("tbl_sankay", c.myconn, this); MessageBox.Show("Record Saved.", "School"); } else { MessageBox.Show("Duplicate data not allowed"); } } if (add_edit == false) { if (Convert.ToInt32(listBox1.SelectedValue) == 1001) { MessageBox.Show("You Can Not Delete This Stream..."); return; } else { c.updatedata("tbl_sankay", c.myconn, this, "sankaycode", txtsankaycode.Text); MessageBox.Show("Record Updated.", "School"); } } c.FillListBox("select * from tbl_sankay", "sankayname", "sankaycode", ref listBox1); c.GetMdiParent(this).EnableAllEditMenuButtons(); } DesignForm.fromDesign1(this); }
public override void btnsave_Click(object sender, EventArgs e) { if (txtfeehead.Text == "") { MessageBox.Show("Null Value Not Allowed"); } else { if (add_edit == true) { c.returnconn(c.myconn); SqlCommand command = new SqlCommand("select DISTINCT max(feecode) from tbl_feeheads", c.myconn); command.CommandTimeout = 120; Int32 mstudentno; mstudentno = 101; if (command.ExecuteScalar() != System.DBNull.Value) { mstudentno = Convert.ToInt32(command.ExecuteScalar()) + 1; } DataSet ds = Connection.GetDataSet("select count(*) from tbl_feeheads where feeheads='" + txtfeehead.Text + "'"); int i = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (i == 0) { txtclasscode.Text = mstudentno.ToString(); c.insertdata("tbl_feeheads", c.myconn, this); } else { MessageBox.Show("Duplicate data not allowed"); } } if (add_edit == false) { c.updatedata("tbl_feeheads", c.myconn, this, "feecode", txtclasscode.Text); } c.FillListBox("select DISTINCT feecode,feeheads from tbl_feeheads order by feeheads", "feeheads", "feecode", ref listBox1); MessageBox.Show("Record Saved...", "School"); c.GetMdiParent(this).EnableAllEditMenuButtons(); Connection.AllPerform("Update tbl_feeheads SET DualSlipType='" + ((rdoDualSlip.Checked)?true:false).ToString() + "'"); } DesignForm.fromDesign1(this); }
public void btndelete_Click(object sender, EventArgs e) { int k = Connection.Login("select count(*) from tbl_student where tehcode ='" + txtsankaycode.Text + "'"); if (k > 0) { MessageBox.Show("You Can Not Delete Student Record ..."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete from tbl_tehsil where tehsil='" + txtsankayname.Text + "' "); MessageBox.Show("Record Deleted"); c.FillListBox("select * from tbl_tehsil order by tehsil", "tehsil", "tehcode", ref listBox1); DesignForm.fromClear(this); } } }
private void btndelete_Click(object sender, EventArgs e) { int k = Connection.Login("SELECT COUNT(*) AS Expr1 FROM tbl_subwiseclass WHERE (subjectno = '" + txtSubjectNo.Text + "') "); if (k > 0) { MessageBox.Show("You Can Not Delete Subject Record."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete from tbl_subject where subjectno='" + txtSubjectNo.Text + "' "); Connection.AllPerform("Delete from tbl_subwiseclass where subjectno ='" + txtSubjectNo.Text + "'"); MessageBox.Show("Record Deleted."); c.FillListBox("select distinct subjectno,subjectname from tbl_subject Order By subjectno", "subjectname", "subjectno", ref listBox1); DesignForm.fromClear(this); } } }
public override void btndelete_Click(object sender, EventArgs e) { int k = Connection.Login("SELECT COUNT(*) AS Expr1 FROM tbl_classstudent WHERE (Stream = '" + txtsankaycode.Text + "') "); if (k > 0) { MessageBox.Show("You Can Not Delete Stream Record."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record.", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete from tbl_sankay where sankayname='" + txtsankayname.Text + "' "); MessageBox.Show("Record Deleted."); c.FillListBox("select * from tbl_sankay", "sankayname", "sankaycode", ref listBox1); DesignForm.fromClear(this); } } }
public override void btnedit_Click(object sender, EventArgs e) { //int i = Connection.UserCheck("tbl_school"); //if (i == 0) //{ DesignForm.fromDesign2(this); txtinstitute.Enabled = false; txtcity.Enabled = false; button1.Enabled = true; BtnHOE.Enabled = true; BtnPrincipal.Enabled = true; add_edit = false; c.GetMdiParent(this).DisableAllEditMenuButtons(); //txtinstitute.Focus(); // Connection.UserEntery(Connection.username, "tbl_school"); //} //else //{ //MessageBox.Show("This Information is accessed by another user Please wait.."); // } }
public override void btndelete_Click(object sender, EventArgs e) { int k = Connection.Login("select count(*) from tbl_classfeeregular where feecode='" + txtclasscode.Text + "'"); if (k > 0) { MessageBox.Show("You Can Not Delete Fee Heads Record ..."); } else { DialogResult d = MessageBox.Show("Are You Sure You Want To Delete Record", "", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { Connection.AllPerform("delete from tbl_feeheads where feeheads='" + txtfeehead.Text + "' "); txtfeehead.Text = ""; MessageBox.Show("Record Deleted"); c.FillListBox("select DISTINCT feecode,feeheads from tbl_feeheads order by feeheads", "feeheads", "feecode", ref listBox1); DesignForm.fromClear(this); } } }
public override void btnsave_Click(object sender, EventArgs e) { int i = 0; if (add_edit == true) { c.returnconn(c.myconn); SqlTransaction trn = c.myconn.BeginTransaction(); do { c.connectsql("insert into tbl_schamount (Classcode,Category,sessioncode,Amount) values ('" + cmbclass.SelectedValue + "','" + dtgfeeheads.Rows[i].Cells["Category"].Value + "','" + school.CurrentSessionCode + "','" + Convert.ToDecimal(dtgfeeheads.Rows[i].Cells["Amount"].Value) + "')", c.myconn, trn); i++; }while (i < dtgfeeheads.Rows.Count); trn.Commit(); MessageBox.Show("Data Saved..", "School"); add_edit = false; c.GetMdiParent(this).EnableAllEditMenuButtons(); } else { if (add_edit == false) { SqlTransaction trn = c.myconn.BeginTransaction(); c.connectsql("delete from tbl_schamount where sessioncode='" + school.CurrentSessionCode + "' and Classcode='" + cmbclass.SelectedValue + "'", c.myconn, trn); do { c.connectsql("insert into tbl_schamount (Classcode,Category,sessioncode,Amount) values ('" + cmbclass.SelectedValue + "','" + dtgfeeheads.Rows[i].Cells["Category"].Value + "','" + school.CurrentSessionCode + "','" + Convert.ToDecimal(dtgfeeheads.Rows[i].Cells["Amount"].Value) + "')", c.myconn, trn); i++; }while (i < dtgfeeheads.Rows.Count); trn.Commit(); MessageBox.Show("Data Saved..", "School"); add_edit = false; c.GetMdiParent(this).EnableAllEditMenuButtons(); } DesignForm.fromDesign1(this); } }
public frmScholarshipclassfee() { InitializeComponent(); Connection.SetUserControlTheme(this); DesignForm.fromDesign1(this); }
public frmtehsil() { InitializeComponent(); DesignForm.fromDesign1(this); }
public void btnsave_Click(object sender, EventArgs e) { if (valcmbbank.Text == "" && valcmbaccountgroup.Text == "" && txtPaidAmt.Text == "" && txtNarration.Text == "") { MessageBox.Show("Null Value Not Allowed "); } else { int Bank1; int Bank2; Bank1 = Convert.ToInt32(valcmbaccountgroup.SelectedValue); Bank2 = Convert.ToInt32(valcmbbank.SelectedValue); if (Bank1 == Bank2) { MessageBox.Show("Both Accounts are same...."); goto mline; } c.returnconn(c.myconn); txtvchtype.Text = "BP"; if (add_edit == true) { SqlConnection con = c.myconn; DateTime dt = dtp.Value; Int32 VchNo = c.getvchno(txtvchtype.Text, ref dt, con); vouchNo = c.getvouchernumber(txtvchtype.Text, ref dt, con); //txtvchtype.Text + dtp.Value.Date.ToString("ddMMyyyy") + VchNo; txtvoucherno.Text = vouchNo; SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "insert into tbl_Voucher(YearNo,VchNo,VouchNo,VchType,VchDate,Remark,Status)values('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dtp.Value.Date + "','" + txtNarration.Text + "','AE')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,CashBankNo,ChequeNo,ChequeDate) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbbank.SelectedValue + "','" + dtp.Value.Date + "'," + -1 * Convert.ToDecimal(txtPaidAmt.Text) + ",0,'" + txtChkNo.Text + "','" + txtChkDate.Value + "')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,CashBankNo,ChequeNo,ChequeDate) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbaccountgroup.SelectedValue + "','" + dtp.Value.Date + "','" + txtPaidAmt.Text + "','" + valcmbbank.SelectedValue + "','" + txtChkNo.Text + "','" + txtChkDate.Value + "')"; c.connectsql(mysql, c.myconn, trn); trn.Commit(); MessageBox.Show("Record Saved..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } trn.Dispose(); } if (add_edit == false) { c.getconnstr(); c.returnconn(c.myconn); SqlDataReader dr = null; con = c.myconn; dr = c.fillreader(ref dr, "select VchNo,Status from tbl_Voucher where vchtype='BP' and VouchNo='" + txtvoucherno.Text + "'", con); if (dr.HasRows == true) { dr.Read(); VchNo = Convert.ToInt16(dr[0]); if (dr[1] == "AE") { MessageBox.Show("Voucher Not Made from Account Entry..."); dr.Close(); goto mline; } } dr.Close(); c.returnconn(c.myconn); SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "delete from tbl_Voucher where vchtype='BP' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); mysql = "delete from tbl_VoucherDetail where vchtype='BP' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_Voucher(YearNo,VchNo,VouchNo,VchType,VchDate,Remark,Status)values('" + school.CurrentSessionCode + "','" + VchNo + "','" + txtvoucherno.Text + "','" + txtvchtype.Text + "','" + dtp.Value.Date + "','" + txtNarration.Text + "','AE')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,CashBankNo,ChequeNo,ChequeDate) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbbank.SelectedValue + "','" + dtp.Value.Date + "'," + -1 * Convert.ToDecimal(txtPaidAmt.Text) + ",0,'" + txtChkNo.Text + "','" + txtChkDate.Value + "')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,CashBankNo,ChequeNo,ChequeDate) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbaccountgroup.SelectedValue + "','" + dtp.Value.Date + "','" + txtPaidAmt.Text + "','" + valcmbbank.SelectedValue + "','" + txtChkNo.Text + "','" + txtChkDate.Value + "')"; c.connectsql(mysql, c.myconn, trn); trn.Commit(); MessageBox.Show("Record Update..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } trn.Dispose(); } mline: c.GetMdiParent(this).EnableAllEditMenuButtons(); DesignForm.fromDesign1(this); } }
public void btnsave_Click(object sender, EventArgs e) { try { int ricept; int Payment; ricept = Convert.ToInt32(txtReciept.Text); Payment = Convert.ToInt32(txtPayment.Text); if (ricept != Payment) { MessageBox.Show("Payment Amount and Reciept Amount Does not Match...Entry Cannot Saved.."); } else { c.getconnstr(); c.returnconn(c.myconn); txtvchtype.Text = "JV"; if (add_edit == true) { SqlConnection con = c.myconn; DateTime dt = dtp.Value; Int32 VchNo = c.getvchno(txtvchtype.Text, ref dt, con); vouchNo = c.getvouchernumber(txtvchtype.Text, ref dt, con); //txtvchtype.Text + dtp.Value.Date.ToString("ddMMyyyy") + VchNo; txtvoucherno.Text = vouchNo; SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "insert into tbl_Voucher(yearno,VchNo,VouchNo,VchType,VchDate,Remark,status)values('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dtp.Value.Date + "','" + txtRemark.Text + "','AE')"; c.connectsql(mysql, c.myconn, trn); for (int i = 0; i < dataGridView1.Rows.Count; i++) { decimal pay = Convert.ToInt32(dataGridView1.Rows[i].Cells["Payment"].Value); decimal rec = Convert.ToInt32(dataGridView1.Rows[i].Cells["Reciept"].Value); if (pay == 0) { mysql = "insert into tbl_VoucherDetail (yearno,vchno,VouchNo,VchType,AccCode,VchDate,Amount) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dataGridView1.Rows[i].Cells["ACCOUNT"].Value.ToString() + "','" + dtp.Value.Date + "','" + rec + "')"; } else { mysql = "insert into tbl_VoucherDetail (yearno,vchno,VouchNo,VchType,AccCode,VchDate,Amount) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dataGridView1.Rows[i].Cells["ACCOUNT"].Value.ToString() + "','" + dtp.Value.Date + "','" + -1 * pay + "')"; } c.connectsql(mysql, c.myconn, trn); } trn.Commit(); MessageBox.Show("Record Saved..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } } if (add_edit == false) { c.getconnstr(); c.returnconn(c.myconn); SqlDataReader dr = null; con = c.myconn; dr = c.fillreader(ref dr, "select VchNo from tbl_Voucher where vchtype='JV' and VouchNo='" + txtvoucherno.Text + "'", con); if (dr.HasRows == true) { dr.Read(); VchNo = Convert.ToInt16(dr[0]); if (dr[1] == "AE") { MessageBox.Show("Voucher Not Made from Account Entry..."); dr.Close(); goto mline; } } dr.Close(); SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "delete from tbl_Voucher where vchtype='JV' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); mysql = "delete from tbl_VoucherDetail where vchtype='JV' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); for (int i = 0; i < dataGridView1.Rows.Count; i++) { decimal pay = Convert.ToInt32(dataGridView1.Rows[i].Cells["Payment"].Value); decimal rec = Convert.ToInt32(dataGridView1.Rows[i].Cells["Reciept"].Value); if (pay == 0) { mysql = "insert into tbl_VoucherDetail (yearno,vchno,VouchNo,VchType,AccCode,VchDate,Amount) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dataGridView1.Rows[i].Cells["ACCOUNT"].Value.ToString() + "','" + dtp.Value.Date + "'," + rec + "')"; } else { mysql = "insert into tbl_VoucherDetail (yearno,vchno,VouchNo,VchType,AccCode,VchDate,Amount) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dataGridView1.Rows[i].Cells["ACCOUNT"].Value.ToString() + "','" + dtp.Value.Date + "'," + -1 * pay + "')"; } c.connectsql(mysql, c.myconn, trn); } trn.Commit(); MessageBox.Show("Record Update..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } trn.Dispose(); } mline: c.GetMdiParent(this).EnableAllEditMenuButtons(); DesignForm.fromDesign1(this); } } catch { } }
public override void btnedit_Click(object sender, EventArgs e) { DesignForm.fromDesign2(this); add_edit = false; c.GetMdiParent(this).DisableAllEditMenuButtons(); }
public override void btnsave_Click(object sender, EventArgs e) { if (add_edit == true) { Connection.AllPerform("insert into tbl_school(schoolname, schooladdress, schoolcity, schoolphone, affiliate_by, principal, registrationno,Website,SchoolCode) values('" + txtinstitute.Text + "','" + txtaddress.Text + "','" + txtcity.Text + "','" + txtphone.Text + "','" + txtaffiliate.Text + "','" + txtprincipal.Text + "','" + txtregno.Text + "','" + txtWebsite.Text.Trim() + "', '" + txtSchoolCode.Text.Trim() + "')"); // c.insertdata("tbl_school", c.myconn, this); } if (add_edit == false) { if (PicturePath != null) { FileStream fs1; fs1 = new FileStream(PicturePath, FileMode.Open, FileAccess.Read); //a byte array to read the image byte[] picbyte1 = new byte[fs1.Length]; fs1.Read(picbyte1, 0, System.Convert.ToInt32(fs1.Length)); System.Threading.Thread.Sleep(1000); fs1.Flush(); fs1.Close(); Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Size.Width, Screen.PrimaryScreen.Bounds.Size.Height); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size); g.Save(); bmp.Save(@"" + Connection.GetAccessPathId() + @"Images\" + txtinstitute.Text + ".jpg", ImageFormat.Bmp); Bitmap oBitmap = new Bitmap(PicturePath); Graphics oGraphic = Graphics.FromImage(oBitmap); oBitmap.Save(@"" + Connection.GetAccessPathId() + @"Images\" + txtinstitute.Text + ".jpg", ImageFormat.Jpeg); oBitmap.Dispose(); oGraphic.Dispose(); string str1 = "Update tbl_school set LOGOimage=@simage "; SqlConnection con = Connection.Conn(); SqlCommand cmd = new SqlCommand(str1, con); cmd.Parameters.AddWithValue("@simage", picbyte1); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } Update_HOESIGN(); Update_PEINCSIGN(); //Connection.AllPerform("update tbl_school set schoolname='" + txtinstitute.Text + "',schooladdress='" + txtaddress.Text + "',schoolcity='" + txtcity.Text + "',schoolphone='" + txtphone.Text + "',affiliate_by='" + txtaffiliate.Text + "',principal='" + txtprincipal.Text + "',registrationno='" + txtregno.Text + "',Website='" + txtWebsite.Text.Trim() + "', SchoolCode = '"+txtSchoolCode.Text.Trim()+"'"); string updateqry = "update tbl_school set schoolname=@schoolname,schooladdress=@schooladdress,schoolcity=@schoolcity,schoolphone=@schoolphone,affiliate_by=@affiliate_by,principal=@principal,registrationno=@registrationno,Website=@Website,SchoolCode=@SchoolCode"; SqlConnection conu = Connection.Conn(); SqlCommand cmdu = new SqlCommand(updateqry, conu); cmdu.Parameters.AddWithValue("@schoolname", txtinstitute.Text.Trim()); cmdu.Parameters.AddWithValue("@schooladdress", txtaddress.Text.Trim()); cmdu.Parameters.AddWithValue("@schoolcity", txtcity.Text.Trim()); cmdu.Parameters.AddWithValue("@schoolphone", txtphone.Text.Trim()); cmdu.Parameters.AddWithValue("@affiliate_by", txtaffiliate.Text.Trim()); cmdu.Parameters.AddWithValue("@principal", txtprincipal.Text.Trim()); cmdu.Parameters.AddWithValue("@registrationno", txtregno.Text.Trim()); cmdu.Parameters.AddWithValue("@Website", txtWebsite.Text.Trim()); cmdu.Parameters.AddWithValue("@SchoolCode", txtSchoolCode.Text.Trim()); conu.Open(); cmdu.ExecuteNonQuery(); conu.Close(); //c.connectsql("insert into tbl_classstudent (studentno,classno,sessioncode) values ('" + txtstudentno.Text + "','" + classno + "','" + valcmbsession.SelectedValue + "')", c.myconn, trn); } MessageBox.Show("Record Saved...", "School"); c.GetMdiParent(this).EnableAllEditMenuButtons(); c.GetMdiParent(this).ToggleNewButton(false); c.GetMdiParent(this).ToggleDeleteButton(false); DesignForm.fromDesign1(this); }
public void btnedit_Click(object sender, EventArgs e) { DesignForm.fromDesign2(this); add_edit = false; c.btndisable(btnnew, btnedit, btndelete, btnsave, btncancel, btnprint, null); }
public framfeesetup() { InitializeComponent(); DesignForm.fromDesign1(this); Connection.SetUserControlTheme(this); }
public override void btnsave_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Strenght Null Value Not Allowed."); } else { if (valcmbclass.SelectedIndex == 0) { valcmbclass.SelectedIndex = 0; } if (valcmbsankay.SelectedIndex == 0) { valcmbsankay.SelectedIndex = 0; } if (valcmbsection.SelectedIndex == 0) { valcmbsection.SelectedIndex = 0; } if (add_edit == true) { c.returnconn(c.myconn); SqlCommand command = new SqlCommand("select max(classno) from tbl_class", c.myconn); command.CommandTimeout = 120; Int32 mstudentno; mstudentno = 101; if (command.ExecuteScalar() != System.DBNull.Value) { mstudentno = Convert.ToInt32(command.ExecuteScalar()) + 1; } DataSet ds = Connection.GetDataSet("select count(*) from tbl_class where sectioncode='" + valcmbsection.SelectedValue.ToString() + "' and classcode='" + valcmbclass.SelectedValue.ToString() + "' and sankaycode ='" + valcmbsankay.SelectedValue.ToString() + "'"); int i = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (i == 0) { txtclasscode.Text = mstudentno.ToString(); c.insertdata("tbl_class", c.myconn, this); MessageBox.Show("Record Saved.", "School"); } else { MessageBox.Show("Duplicate data not allowed."); } } if (add_edit == false) { //c.updatedata("tbl_class", c.myconn, this, "classno", txtclasscode.Text); string uqry = "update tbl_class set classcode=@classcode,sectioncode=@sectioncode,sankaycode=@sankaycode,strength=@strength where classno=@classno"; SqlConnection conu = Connection.Conn(); SqlCommand cmdu = new SqlCommand(uqry, conu); cmdu.Parameters.AddWithValue("@classcode", valcmbclass.SelectedValue.ToString().Trim()); cmdu.Parameters.AddWithValue("@sectioncode", valcmbsection.SelectedValue.ToString().Trim()); cmdu.Parameters.AddWithValue("@sankaycode", valcmbsankay.SelectedValue.ToString().Trim()); cmdu.Parameters.AddWithValue("@strength", textBox1.Text.Trim()); cmdu.Parameters.AddWithValue("@classno", txtclasscode.Text.Trim()); conu.Open(); cmdu.ExecuteNonQuery(); conu.Close(); MessageBox.Show("Record Updated.", "School"); } c.FillListBox("select a.classno,b.classname+' '+c.sectionname as class from tbl_class a,tbl_classmaster b,tbl_section c where b.classcode=a.classcode and c.sectioncode=a.sectioncode order by a.classcode,c.sectioncode", "class", "classno", ref listBox1); c.GetMdiParent(this).EnableAllEditMenuButtons(); } DesignForm.fromDesign1(this); }
public void btnsave_Click(object sender, EventArgs e) { int BHM_DES = 0; SqlCommand command1 = new SqlCommand("select BHM_COD from tbl_LedgerAcc where BHM_COD=1", c.myconn); SqlDataReader reader1 = command1.ExecuteReader(); int i = 0; if (reader1.HasRows) { reader1.Read(); BHM_DES = Convert.ToInt16(reader1["BHM_COD"]); if (BHM_DES != 1) { MessageBox.Show("Cannot Select Cash Account.."); reader1.Close(); goto mline; } } c.returnconn(c.myconn); txtvchtype.Text = "CR"; if (add_edit == true) { SqlConnection con = c.myconn; DateTime dt = dtp.Value; Int32 VchNo = c.getvchno(txtvchtype.Text, ref dt, con); vouchNo = c.getvouchernumber(txtvchtype.Text, ref dt, con); //txtvchtype.Text + dtp.Value.Date.ToString("ddMMyyyy") + VchNo; txtvoucherno.Text = vouchNo; SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "insert into tbl_Voucher(YearNo,VchNo,VouchNo,VchType,VchDate,Remark)values('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dtp.Value.Date + "','" + txtRemark.Text + "')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,cashbankno) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + BHM_DES + "','" + dtp.Value.Date + "'," + txtReceiptAmt.Text + ",0)"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,cashbankno) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbaccountgroup.SelectedValue + "','" + dtp.Value.Date + "'," + -1 * Convert.ToDecimal(txtReceiptAmt.Text) + ",'" + BHM_DES + "')"; c.connectsql(mysql, c.myconn, trn); trn.Commit(); MessageBox.Show("Record Saved..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } trn.Dispose(); } if (add_edit == false) { c.getconnstr(); c.returnconn(c.myconn); SqlDataReader dr = null; con = c.myconn; dr = c.fillreader(ref dr, "select VchNo from tbl_Voucher where vchtype='CR' and VouchNo='" + txtvoucherno.Text + "'", con); if (dr.HasRows == true) { dr.Read(); VchNo = Convert.ToInt16(dr[0]); } dr.Close(); SqlTransaction trn; trn = c.myconn.BeginTransaction(); try { string mysql; mysql = "delete from tbl_Voucher where vchtype='CR' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); mysql = "delete from tbl_VoucherDetail where vchtype='CR' and VouchNo='" + txtvoucherno.Text + "'"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_Voucher(YearNo,VchNo,VouchNo,VchType,VchDate,Remark)values('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + dtp.Value.Date + "','" + txtRemark.Text + "')"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,cashbankno) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + BHM_DES + "','" + dtp.Value.Date + "'," + txtReceiptAmt.Text + "," + BHM_DES + ")"; c.connectsql(mysql, c.myconn, trn); mysql = "insert into tbl_VoucherDetail (YearNo,vchno,VouchNo,VchType,AccCode,VchDate,Amount,cashbankno) values ('" + school.CurrentSessionCode + "','" + VchNo + "','" + vouchNo + "','" + txtvchtype.Text + "','" + valcmbaccountgroup.SelectedValue + "','" + dtp.Value.Date + "'," + -1 * Convert.ToDecimal(txtReceiptAmt.Text) + ",0)"; c.connectsql(mysql, c.myconn, trn); trn.Commit(); MessageBox.Show("Record Update..."); } catch (Exception ex) { MessageBox.Show(ex.Message); trn.Rollback(); } trn.Dispose(); } mline: c.GetMdiParent(this).EnableAllEditMenuButtons(); DesignForm.fromDesign1(this); }
public ShowAllReports() { InitializeComponent(); DesignForm.fromDesign1(this); }
public Distic_Setup() { InitializeComponent(); DesignForm.fromDesign1(this); //Connection.SetUserControlTheme(this); }