public void PullFeeState(string phone, int adm) { try { adapter = new SqlDataAdapter("SELECT TOP 5 CONCAT(Date,Paid,PayMode)AS statement,(SELECT PhoneNO FROM tblStudents WHERE AdmNo= " + adm + ") AS number FROM tblPayment WHERE AdmNo= " + adm + " AND PayMode !='NULL' ", con); ds = new DataSet(); adapter.Fill(ds, "States"); var dt = new DataTable(); adapter.Fill(dt); if (ds.Tables[0].Rows.Count > 0) { string pno = ds.Tables[0].Rows[rno][1].ToString(); if (pno == phone) { string s = "Fee Statement for" + adm + ": " + string.Join(", | ", dt.Rows.OfType <DataRow>().Select(r => r[0].ToString())); frmDashb smss = new frmDashb(); } else { frmDashb dsm = new frmDashb(); } } else { frmDashb smsf = new frmDashb(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "Pull Fees Statement"); } }
private void loader_Tick(object sender, EventArgs e) { pgBarSPlash.Increment(1); gunaLabel2.Text = pgBarSPlash.ProgressPercentText; counter++; if (counter >= 150) { loader.Enabled = false; this.Hide(); frmDashb dashb = new frmDashb(); dashb.Show(); } }
private void btnSave21_Click(object sender, EventArgs e) { DateTime dt = new DateTime(); dt = DateTime.Now; // Perform Fees Updation Calculations getCurrentBalance(); paid = Convert.ToInt32(txtAmount21.Text); //int Billed = Convert.ToInt32(txtBilled21.Text); if (paid > cBalance) { prepaid = paid - cBalance; cBalance = 0; } else { cBalance = cBalance - paid; prepaid = 0; } try { cmd = new SqlCommand("INSERT into tblPayment(AdmNo,TotalAmount,Paid,Date,Balance,Prepayment,PayMode) values(" + txtAdmNo21.Text + "," + txtBilled21.Text + "," + paid + ",'" + DateTime.Parse(dpPayDate.Text) + "'," + cBalance + "," + prepaid + ", '" + cbxMode.Text + "')", con); con.Open(); int n = cmd.ExecuteNonQuery(); con.Close(); this.Alert("Payment processed", PizzaPalace.Alert.alertTypeEnum.Info); getStudent(); // Send SMS to the parent of successful payment frmDashb smpf = new frmDashb(); } catch (Exception ex) { this.Alert("Unable to Bill Current Student!!", PizzaPalace.Alert.alertTypeEnum.Error); con.Close(); } }
public void PullFeesBal(string phone, int adm) { // Search student to pay Fees try { adapter = new SqlDataAdapter("SELECT (SELECT Name FROM tblStudents WHERE AdmNo=" + adm + ") AS Name, (SELECT PhoneNO FROM tblStudents WHERE AdmNo=" + adm + ") AS number,Balance FROM tblPayment WHERE PaymentID= (select MAX(PaymentID) FROM tblPayment WHERE AdmNo = " + adm + ")", con); ds = new DataSet(); adapter.Fill(ds, "student"); if (ds.Tables[0].Rows.Count > 0) { string name = ds.Tables[0].Rows[rno][0].ToString(); string pno = ds.Tables[0].Rows[rno][1].ToString(); int Bal = Convert.ToInt32(ds.Tables[0].Rows[rno][2]); if (pno == phone) { string s = "Current Fees Balance for " + name + "," + adm + " " + "is KES" + Bal + ".00" + ". Thank you for being part of Singoronik Secondary School. ^BN"; frmDashb sms = new frmDashb(); } else { frmDashb dsm = new frmDashb(); } // MessageBox.Show(s); } // If the student is not found else { frmDashb smsb = new frmDashb(); } //this.Alert("A student with this Admission Number does not Exist!", SDRS.Alert.alertTypeEnum.Error); } catch (Exception ex) { MessageBox.Show(ex.Message + "Pull Fees Balance"); this.Alert("Could Perform query Operation" + ex.Message, PizzaPalace.Alert.alertTypeEnum.Warning); } }