private void btnEdit_Click(object sender, EventArgs e) { cmbYearTo.Items.Clear(); cmbYearTo.Items.Add(DateTime.Now.ToString("yyyy")); cmbYearTo.Items.Add(Int16.Parse(DateTime.Now.ToString("yyyy")) + 1); if (DGRenewal.Rows.Count != 0) { if (rdbYes.Checked == false) { rdbNo.Checked = true; } txtFCardNo.ReadOnly = true; btnReset.Enabled = false; DGRenewal.Hide(); btnAdd.Enabled = false; btnEdit.Enabled = false; btnFCardNo.Enabled = false; btnDelete.Enabled = false; RDate = cmbRenewalYear.Text; ToYr = cmbYearTo.Text; DGRenewal.Enabled = false; cmbRenewalYear.Focus(); txtReceiptNo.Enabled = false; this.AcceptButton = btnSubmit; btnPrint.Enabled = false; mode = 0; ID = Convert.ToInt32(DGRenewal.CurrentRow.Cells[0].Value.ToString()); } else { MessageBox.Show("No record to modify!", "No record", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnAdd_Click(object sender, EventArgs e) { cmbYearTo.Items.Clear(); cmbYearTo.Items.Add(DateTime.Now.ToString("yyyy")); cmbYearTo.Items.Add(Int16.Parse(DateTime.Now.ToString("yyyy")) + 1); txtReceiptNo.Focus(); rdbYes.Checked = true; EmptyFields(); btnReset.Enabled = true; txtFCardNo.ReadOnly = true; DGRenewal.Hide(); btnAdd.Enabled = false; btnEdit.Enabled = false; btnFCardNo.Enabled = false; btnPrint.Enabled = false; DGRenewal.Enabled = false; btnDelete.Enabled = false; btnEdit.Enabled = false; mode = 1; cmbAccount.SelectedIndex = 0; cmbPoorAcc.SelectedIndex = 0; this.AcceptButton = btnSubmit; txtReceiptNo.Text = next().ToString("00000"); dpRenewalDate.Value = DateTime.Now; //Get CardRenewalFee Data dt = DBLayer.GetFamilyCardRenewalFeeEnhanceDate(); //SqlConnection con = new SqlConnection(Community.DBLayer.con_String); //SQLCache sqlCache = new SQLCache(); //string query = sqlCache.GetSQL("GetCardRenewalFee"); //SqlCommand cmd = new SqlCommand(query, con); //con.Open(); //SqlDataAdapter da = new SqlDataAdapter(cmd); //da.Fill(dt); //con.Close(); //da.Dispose(); txtCardFee.Text = Decimal.Parse(dt.Rows[0]["CardRenewalFee"].ToString()).ToString("F").ToString(); txtPerMemberFee.Text = Decimal.Parse(dt.Rows[0]["MemberFee"].ToString()).ToString("F").ToString(); //txtLateFee.Text = Decimal.Parse(dt.Rows[0]["LateFee"].ToString()).ToString("F").ToString(); dt = DBLayer.GetRenewalByFCardNo(txtFCardNo.Text); if (dt.Rows.Count > 0) { cmbRenewalYear.Text = ""; cmbRenewalYear.SelectedText = dt.Rows[0]["RenewalTo"].ToString(); } }
private void frmRenewal_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dataset3.tblDonAcc' table. You can move, or remove it, as needed. this.tblDonAccTableAdapter.Fill(this.dataset3.tblDonAcc); // TODO: This line of code loads data into the 'dataset3.tblRenAcc' table. You can move, or remove it, as needed. this.tblRenAccTableAdapter.Fill(this.dataset3.tblRenAcc); // TODO: This line of code loads data into the 'comDataSet.tblTransactions' table. You can move, or remove it, as needed. this.tblTransactionsTableAdapter.Fill(this.comDataSet.tblTransactions); txtFCardNo.Focus(); this.tblAccountsTableAdapter.Fill_All(this.comDataSet.tblAccounts); DGRenewal.BringToFront(); cmbAccount.SelectedItem = 0; Height = 328; }
private void btnCancel_Click(object sender, EventArgs e) { DialogResult Result = MessageBox.Show("Are you Sure! You Want to Cancel", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.Yes) { usp_SEL_RenewalTableAdapter.Fill(comDataSet.usp_SEL_Renewal, txtFCardNo.Text); txtFCardNo.ReadOnly = false; DGRenewal.Show(); btnAdd.Enabled = true; btnEdit.Enabled = true; btnFCardNo.Enabled = true; btnReset.Enabled = true; DGRenewal.Enabled = true; btnAdd.Enabled = true; txtReceiptNo.Enabled = true; btnDelete.Enabled = true; btnPrint.Enabled = true; this.AcceptButton = btnAdd; mode = 0; calc = 0; lblRenewalYears.Text = ""; } }
private void btnSubmit_Click(object sender, EventArgs e) { if (CheckFields()) { bool Result = DBLayer.CHK_RWL(txtFCardNo.Text, cmbRenewalYear.Text, cmbYearTo.Text); try { string FCardNo = txtFCardNo.Text; string Year = cmbRenewalYear.Text; DateTime Date = Convert.ToDateTime(dpRenewalDate.Text); decimal Fee = Convert.ToDecimal(txtRenewlFee.Text); decimal LateFee = Convert.ToDecimal(txtLateFee.Text); decimal PoorFund = Convert.ToDecimal(txtPoorFund.Text); decimal Total = Convert.ToDecimal(txtTotal.Text); decimal EducationFund = Convert.ToDecimal(txtEduFund.Text); decimal KabristanFund = Convert.ToDecimal(txtKabrFund.Text); decimal ZakatFund = Convert.ToDecimal(txtZakatFund.Text); decimal DonationFund = Convert.ToDecimal(txtDonationFund.Text); decimal TamiratiFund = Convert.ToDecimal(txtTamiratiFund.Text); // bool Link = Convert.ToBoolean(rdbYes.Checked); decimal CardFee = Convert.ToDecimal(txtCardFee.Text); string TotalMembers = txtTotalMembers.Text; string AdultMemebers = txtAdult.Text; bool Link = AccountLink(); string ReceiptNo = txtReceiptNo.Text; //int Account =Convert.ToInt32(cmbAccount.SelectedValue.ToString()); //int PoorAcc = Convert.ToInt32(cmbPoorAcc.SelectedValue.ToString()); string RenewalTo = cmbYearTo.Text; if (mode == 1) { if (/*Result*/ 1 != 1) { MessageBox.Show("Already Renewed for range of Year!", "Duplicate", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { usp_SEL_RenewalTableAdapter.Insert1(FCardNo, Date, Year, Fee, PoorFund, LateFee, Total, Link, CardFee, AdultMemebers, TotalMembers, /*ReceiptNo*/ next().ToString("00000"), 115, 118, RenewalTo, EducationFund, KabristanFund, ZakatFund, DonationFund, TamiratiFund, new DBLayer().GetUserID()); tblTransactionsTableAdapter.InsertTransaction(MCKJ.frmHallBoking.HRD("Card Renewal Charges"), "RWL", Convert.ToInt32(ReceiptNo), Date, 0, Total, "Year = " + Year + " CardNo = " + FCardNo, "", ""); //tblTransactionsTableAdapter.InsertTransaction(115, "RWL", Convert.ToInt32(ReceiptNo), Date, Total - PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", ""); tblTransactionsTableAdapter.InsertTransaction(117, "RWL", Convert.ToInt32(ReceiptNo), Date, PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", ""); UpdateFamilyTable(RenewalTo); MessageBox.Show("Saved Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); usp_SEL_RenewalTableAdapter.Fill(comDataSet.usp_SEL_Renewal, FCardNo); mode = 0; btnReset.Show(); DGRenewal.Show(); btnAdd.Show(); btnEdit.Show(); // btnDelete.Show(); btnPrint.Show(); btnClose.Show(); btnFCardNo.Show(); btnReset.Hide(); DGRenewal.Enabled = true; txtFCardNo.ReadOnly = false; btnAdd.Enabled = true; btnEdit.Enabled = true; btnPrint.Enabled = true; btnDelete.Enabled = true; btnFCardNo.Enabled = true; } } else if (mode == 0) { int[] idz = TransactionID(Convert.ToInt32(ReceiptNo)); if (RDate == cmbRenewalYear.Text && ToYr == cmbYearTo.Text) { usp_SEL_RenewalTableAdapter.Update1(ID, FCardNo, Date, Year, Fee, PoorFund, LateFee, Total, Link, CardFee, AdultMemebers, TotalMembers, ReceiptNo, 115, 118, RenewalTo, EducationFund, KabristanFund, ZakatFund, DonationFund, TamiratiFund, new DBLayer().GetUserID()); tblTransactionsTableAdapter.UpdateTransaction(MCKJ.frmHallBoking.HRD("Card Renewal Charges"), "RWL", Convert.ToInt32(ReceiptNo), Date, 0, Total, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[0]); tblTransactionsTableAdapter.UpdateTransaction(115, "RWL", Convert.ToInt32(ReceiptNo), Date, Total - PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[1]); tblTransactionsTableAdapter.UpdateTransaction(118, "RWL", Convert.ToInt32(ReceiptNo), Date, PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[2]); UpdateFamilyTable(RenewalTo); MessageBox.Show("Updated Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); usp_SEL_RenewalTableAdapter.Fill(comDataSet.usp_SEL_Renewal, FCardNo); btnReset.Show(); DGRenewal.Show(); btnAdd.Show(); btnEdit.Show(); // btnDelete.Show(); btnPrint.Show(); btnClose.Show(); btnFCardNo.Show(); btnReset.Hide(); DGRenewal.Enabled = true; txtFCardNo.ReadOnly = false; txtReceiptNo.Enabled = true; btnAdd.Enabled = true; btnEdit.Enabled = true; btnPrint.Enabled = true; btnDelete.Enabled = true; btnFCardNo.Enabled = true; } else { if (Result) { MessageBox.Show("Already Renewed for range of Year!", "Duplicate", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { usp_SEL_RenewalTableAdapter.Update1(ID, FCardNo, Date, Year, Fee, PoorFund, LateFee, Total, Link, CardFee, AdultMemebers, TotalMembers, ReceiptNo, 115, 118, RenewalTo, EducationFund, KabristanFund, ZakatFund, DonationFund, TamiratiFund, new DBLayer().GetUserID()); tblTransactionsTableAdapter.UpdateTransaction(MCKJ.frmHallBoking.HRD("Card Renewal Charges"), "RWL", Convert.ToInt32(ReceiptNo), Date, 0, Total, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[0]); tblTransactionsTableAdapter.UpdateTransaction(115, "RWL", Convert.ToInt32(ReceiptNo), Date, Total - PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[1]); tblTransactionsTableAdapter.UpdateTransaction(118, "RWL", Convert.ToInt32(ReceiptNo), Date, PoorFund, 0, "Year = " + Year + " CardNo = " + FCardNo, "", "", idz[2]); MessageBox.Show("Updated Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); usp_SEL_RenewalTableAdapter.Fill(comDataSet.usp_SEL_Renewal, FCardNo); btnReset.Show(); DGRenewal.Show(); btnAdd.Show(); btnEdit.Show(); // btnDelete.Show(); btnPrint.Show(); btnClose.Show(); btnFCardNo.Show(); btnReset.Hide(); DGRenewal.Enabled = true; txtFCardNo.ReadOnly = false; txtReceiptNo.Enabled = true; btnAdd.Enabled = true; btnEdit.Enabled = true; btnPrint.Enabled = true; btnDelete.Enabled = true; btnFCardNo.Enabled = true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } txtFCardNo.Focus(); this.AcceptButton = btnAdd; calc = 0; lblRenewalYears.Text = ""; } }