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(); } }