//private void btnPrint_Click(object sender, EventArgs e) //{ // int id = Convert.ToInt32(txtSerialNo.Text); // SqlConnection con = new SqlConnection(Community.DBLayer.con_String); // con.Open(); // SqlCommand cmd = new SqlCommand("Select * from tblHallBooking WHERE SerialNo =" + id, con); // DataTable dt = new DataTable(); // SqlDataAdapter da = new SqlDataAdapter(); // da.SelectCommand = cmd; // da.Fill(dt); // Reports.Hall_Booking.frmViewer frm = new MCKJ.Reports.Hall_Booking.frmViewer(); // Reports.Hall_Booking.rptHallBooking rpt = new MCKJ.Reports.Hall_Booking.rptHallBooking(); // frm.crystalReportViewer1.ReportSource = rpt; // rpt.SetDataSource(dt); // rpt.SetParameterValue("SerialNo", id.ToString("00000")); // rpt.SetParameterValue("SerialNo", id.ToString("00000"), rpt.Subreports[0].Name.ToString()); // frm.Show(); // con.Close(); //} private void txtFCardNo_Leave(object sender, EventArgs e) { try { if (txtFCardNo.Text != "") { int fcardno = Convert.ToInt32(txtFCardNo.Text); int x = 5 - txtFCardNo.Text.Length; string zeros = ""; for (int i = 0; i < x; i++) { zeros += "0"; } txtFCardNo.Text = zeros + txtFCardNo.Text; } } catch (FormatException) { MessageBox.Show("Only numbers are allowed!", "Only Numbers"); } string y = txtFCardNo.Text; Community.DBLayer DBLayer = new Community.DBLayer(); bool result = DBLayer.CheckFamily(txtFCardNo.Text); for (int x = 0; x < dgvHallBooking.Rows.Count - 1; x++) { dgvHallBooking.Rows[x].Cells[0].Value = null; } if (txtFCardNo.Text != "") { if (result) { Fill(txtFCardNo.Text); txtFName.Text = FName; txtHead.Text = Head; txtOrakh.Text = Orakh; if (txtFCardNo.Text == "") { txtFCardNo.Text = y; } } else { MessageBox.Show("Family CardNo doesnot exist! Please enter a Valid CardNo.", "Invalid CardNo.", MessageBoxButtons.OK, MessageBoxIcon.Stop); txtHead.Text = ""; } } usp_SEL_tblFamilyMemberTableAdapter.Fill(comDataSet.usp_SEL_tblFamilyMember, txtFCardNo.Text); }
private void txtFCardNo_Leave(object sender, EventArgs e) { try { if (txtFCardNo.Text != "") { int fcardno = Convert.ToInt32(txtFCardNo.Text); int x = 5 - txtFCardNo.Text.Length; string zeros = ""; for (int i = 0; i < x; i++) { zeros += "0"; } txtFCardNo.Text = zeros + txtFCardNo.Text; bool Result = DBLayer.CheckFamily(txtFCardNo.Text); if (Result) { usp_SEL_FAMILYTableAdapter.Leader(comDataSet.usp_SEL_FAMILY, txtFCardNo.Text); txtOrakh.Text = comDataSet.usp_SEL_FAMILY.Rows[0].ItemArray[17].ToString(); txtNukh.Text = comDataSet.usp_SEL_FAMILY.Rows[0].ItemArray[18].ToString(); dt = usp_SEL_DeathTableAdapter.GetDataByFCardNo(txtFCardNo.Text); if (dt.Rows.Count > 0) { txtAddress.Text = dt.Rows[0]["RAddress"].ToString(); } else { txtAddress.Text = comDataSet.usp_SEL_FAMILY.Rows[0].ItemArray[6].ToString(); } usp_SEL_tblFamilyMemberTableAdapter.Fill(comDataSet.usp_SEL_tblFamilyMember, txtFCardNo.Text); if (txtName.Text == "") { MessageBox.Show("No Member Found!", "Unable to Find", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Card Does Not Exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtName.Text = ""; } } } catch (FormatException) { MessageBox.Show("Only numbers are allowed!", "Errors"); } }
private void txtFCardNo_Leave(object sender, EventArgs e) { //if (txtFCardNo.Text.Length != 5) //{ // txtFCardNo.Text = txtFCardNo.Text.PadLeft(5, '0'); //} try { if (txtFCardNo.Text != "") { int fcardno = Convert.ToInt32(txtFCardNo.Text); int x = 5 - txtFCardNo.Text.Length; string zeros = ""; for (int i = 0; i < x; i++) { zeros += "0"; } txtFCardNo.Text = zeros + txtFCardNo.Text; } } catch (FormatException) { MessageBox.Show("Only numbers are allowed!", "Only Numbers"); } string y = txtFCardNo.Text; Community.DBLayer DBLayer = new Community.DBLayer(); bool result = DBLayer.CheckFamily(txtFCardNo.Text); if (txtFCardNo.Text != "") { if (result) { usp_SEL_FAMILYTableAdapter.Leader(comDataSet.usp_SEL_FAMILY, txtFCardNo.Text); txtFName.Text = FName(txtFCardNo.Text, txtHead.Text); if (txtFCardNo.Text == "") { txtFCardNo.Text = y; } } else { MessageBox.Show("Family CardNo doesnot exist! Please enter a Valid CardNo.", "Invalid CardNo.", MessageBoxButtons.OK, MessageBoxIcon.Stop); txtHead.Text = ""; } } }
private void btnSubmit_Click(object sender, EventArgs e) { Community.DBLayer dblayer = new Community.DBLayer(); if (CheckFields()) { try { string Gender = cmbGender.Text; DateTime IssueDate = Convert.ToDateTime(dpIssueDate.Text); string DOB = Year(); string Address = txtAddress.Text; string Area = cmbArea.Text; string BAddress = txtBAddress.Text; string BName = txtBName.Text; string BPhone = txtBPhone.Text; string City = cmbCity.Text; string Country = txtCountry.Text; string Designattion = txtDesignation.Text; string Email = txtEmail.Text; string Leader = txtFamilyLeader.Text; string FamilyName = txtFamilyName.Text; string Fax = txtFax.Text; string FCardNo = txtFCardNo.Text; string Mobile = txtMobile.Text; string Nukh = cmbNukh.Text; string Phone = txtPhone.Text; string Sign = cmbSign.Text; string TypeWork = cmbType.Text; string Village = cmbVillage.Text; string Website = txtWebsite.Text; string ParentFCardNo = txtParentFCardNo.Text.PadLeft(5, '0'); string RenewalDueFrom = txtRenewalDueFrom.Text; DialogResult Result = MessageBox.Show("Are you sure??", "Confirmation", MessageBoxButtons.YesNo); if (Result == DialogResult.Yes) { if (mode == 1) { bool result = dblayer.CheckFamily(txtFCardNo.Text); if (result) { MessageBox.Show("Family Card No already exist! Please insert new Card No", "Invalid Card No", MessageBoxButtons.OK, MessageBoxIcon.Stop); txtFCardNo.Focus(); } else { usp_SEL_FAMILYTableAdapter.Insert1(FCardNo, IssueDate, FamilyName, Leader, Gender, DOB, Country, City, Nukh, Sign, Village, Area, Address, Phone, Mobile, BName, TypeWork, Designattion, BAddress, BPhone, Fax, Email, Website, true, ParentFCardNo, RenewalDueFrom, DBLayer.GetUserID()); //usp_SEL_FAMILYTableAdapter.Fill(comDataSet.usp_SEL_FAMILY); MessageBox.Show("Saved Succesfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); EmptyFields(); txtFCardNo.Focus(); } lbl.Text = Header; } else if (mode == 0) { if (chk_active == "True") { usp_SEL_FAMILYTableAdapter.Update1(FCardNo, IssueDate, FamilyName, Leader, Gender, DOB, Country, City, Nukh, Sign, Village, Area, Address, Phone, Mobile, BName, TypeWork, Designattion, BAddress, BPhone, Fax, Email, Website, true, ParentFCardNo, RenewalDueFrom, DBLayer.GetUserID()); } else { usp_SEL_FAMILYTableAdapter.Update1(FCardNo, IssueDate, FamilyName, Leader, Gender, DOB, Country, City, Nukh, Sign, Village, Area, Address, Phone, Mobile, BName, TypeWork, Designattion, BAddress, BPhone, Fax, Email, Website, false, ParentFCardNo, RenewalDueFrom, DBLayer.GetUserID()); } //usp_SEL_FAMILYTableAdapter.Fill(comDataSet.usp_SEL_FAMILY); MessageBox.Show("Updated Succesfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); txtFCardNo.Enabled = true; grb1.Hide(); Disable_Btn(true); grbSearch.Show(); lbl.Text = Header; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.AcceptButton = btnAdd; } }
private void btnAllMembers_Click(object sender, EventArgs e) { Community.DBLayer dblayer = new Community.DBLayer(); btnNonActiveMembers.Enabled = true; btnActiveMembers.Enabled = true; string x = txtFCardNo.Text; if (txtFCardNo.Text == "") { MessageBox.Show("Please Insert Family Card Number", "Family Card Required", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { bool result = dblayer.CheckFamily(txtFCardNo.Text); if (result) { btnView.Enabled = true; if (DBLayer.User_Right(UserID, SecurityLevelID, "[Modify]")) { btnEdit.Enabled = true; } else { btnEdit.Enabled = false; } if (DBLayer.User_Right(UserID, SecurityLevelID, "[Delete]")) { btnDelete.Enabled = true; } else { btnDelete.Enabled = false; } if (DBLayer.User_Right(UserID, SecurityLevelID, "[Write]")) { btnAdd.Enabled = true; } else { btnAdd.Enabled = false; } FillGrid_All(txtFCardNo.Text); //FillFamilyGrid("usp_SEL_tblAllFamilyMembers"); if (DGFamily.RowCount == 0) { DGFamily.Enabled = false; } else { DGFamily.Enabled = true; } //btnDelete.Enabled = true; if (txtFCardNo.Text == "") { txtFCardNo.Text = x; } } else { MessageBox.Show("Family CardNo doesnot exist! Please try Again.", "Invalid CardNo.", MessageBoxButtons.OK, MessageBoxIcon.Stop); btnDelete.Enabled = false; btnAdd.Enabled = false; btnEdit.Enabled = false; DGFamily.Enabled = false; btnView.Enabled = false; } } }
private void btnFCardNo_Click(object sender, EventArgs e) { txtFCardNo_Leave(sender, e); string x = txtFCardNo.Text; Community.DBLayer dblayer = new Community.DBLayer(); if (txtFCardNo.Text == "") { MessageBox.Show("Please Insert Family Card Number", "Family Card Required", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { if (Chk == 0) { bool result = dblayer.CheckFamily(txtFCardNo.Text); if (result) { usp_SEL_FAMILYTableAdapter.Leader(comDataSet.usp_SEL_FAMILY, txtFCardNo.Text); FillGrid(txtFCardNo.Text); //FillGrid(txtFCardNo.Text); btnView.Enabled = true; //User_Right(); if (DBLayer.User_Right(UserID, SecurityLevelID, "[Modify]")) { btnEdit.Enabled = true; } else { btnEdit.Enabled = false; } if (DBLayer.User_Right(UserID, SecurityLevelID, "[Delete]")) { btnDelete.Enabled = true; } else { btnDelete.Enabled = false; } if (DBLayer.User_Right(UserID, SecurityLevelID, "[Write]")) { btnAdd.Enabled = true; } else { btnAdd.Enabled = false; } Chk = 0; if (DGFamily.RowCount == 0) { DGFamily.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; btnView.Enabled = false; } else { DGFamily.Enabled = true; } if (txtFCardNo.Text == "") { txtFCardNo.Text = x; } this.AcceptButton = btnAdd; } else { MessageBox.Show("Family CardNo doesnot exist! Please enter a Valid CardNo.", "Invalid CardNo.", MessageBoxButtons.OK, MessageBoxIcon.Stop); btnDelete.Enabled = false; btnAdd.Enabled = false; btnEdit.Enabled = false; DGFamily.Enabled = false; btnView.Enabled = false; txtOrakh.Text = ""; txtFamilyLeader.Text = ""; } } } }