protected void firstButton_Click(object sender, EventArgs e) { OthersBillPayment othersBillPayment = othersBillPaymentManager.GetOthesBills(0); GetData(othersBillPayment); Session["active"] = 0; }
protected void saveButton_Click(object sender, EventArgs e) { OthersBillPayment othersBillPayment = new OthersBillPayment(); othersBillPayment.Date = dateTextBox.Value; othersBillPayment.OtherGroupId = int.Parse(expHeadDropDownList.SelectedValue); othersBillPayment.PaymentMode = paymentModeDropDownList.SelectedValue; othersBillPayment.BankId = int.Parse(bankNameDropDownList.SelectedValue); othersBillPayment.CheckNo = checkNoTextBox.Text; othersBillPayment.CheckDate = checkDateTextBox.Value; string amount = amountTextBox.Text; othersBillPayment.Remarks = remarksTextArea.InnerText; if (dateTextBox.Value == "" || paymentModeDropDownList.Text == "" || checkNoTextBox.Text == "" || checkDateTextBox.Value == "" || amountTextBox.Text == "" || remarksTextArea.InnerText == "") { messageLabel.InnerText = "All Fields are Required!!"; } else { othersBillPayment.Amount = Convert.ToDouble(amount); messageLabel.InnerText = othersBillPaymentManager.Save(othersBillPayment); } ClearTextBoxes(); }
public string Save(OthersBillPayment othersBillPayment) { if (othersBillPaymentGateway.Insert(othersBillPayment) > 0) { return("Saved Successfully!!"); } return("Could not Save Data in Database!!"); }
protected void lastButton_Click(object sender, EventArgs e) { List <OthersBillPayment> othersBillPaymentList = (List <OthersBillPayment>)(Session["othersBill"]); int x = othersBillPaymentList.Count - 1; OthersBillPayment othersBillPayment = othersBillPaymentManager.GetOthesBills(x); GetData(othersBillPayment); Session["active"] = x; }
private void GetData(OthersBillPayment othersBillPayment) { dateTextBox.Value = othersBillPayment.Date; expHeadDropDownList.Text = othersBillPayment.OtherGroupName; paymentModeDropDownList.Text = othersBillPayment.PaymentMode; bankNameDropDownList.Text = othersBillPayment.BankName; checkNoTextBox.Text = othersBillPayment.CheckNo; checkDateTextBox.Value = othersBillPayment.CheckDate; amountTextBox.Text = othersBillPayment.Amount.ToString(); remarksTextArea.InnerText = othersBillPayment.Remarks; }
private static void GetValueFromDatabase(OthersBillPayment othersBillPayment, SqlDataReader reader) { othersBillPayment.OthersBillPaymentId = int.Parse(reader["id"].ToString()); othersBillPayment.Date = reader["date"].ToString(); othersBillPayment.OtherGroupName = reader["other_name_id"].ToString(); othersBillPayment.PaymentMode = reader["payment_mode"].ToString(); othersBillPayment.BankName = reader["bank_id"].ToString(); othersBillPayment.CheckNo = reader["check_no"].ToString(); othersBillPayment.CheckDate = reader["check_date"].ToString(); othersBillPayment.Amount = Convert.ToDouble(reader["amount"].ToString()); othersBillPayment.Remarks = reader["remarks"].ToString(); }
public int Insert(OthersBillPayment othersBillPayment) { SqlConnection connection = new SqlConnection(connectionString); string query = "INSERT INTO tbl_otherBillPayment VALUES('" + othersBillPayment.Date + "','" + othersBillPayment.OtherGroupId + "','" + othersBillPayment.PaymentMode + "','" + othersBillPayment.BankId + "','" + othersBillPayment.CheckNo + "','" + othersBillPayment.CheckDate + "','" + othersBillPayment.Amount + "','" + othersBillPayment.Remarks + "')"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
protected void nextButton_Click(object sender, EventArgs e) { int active = (int)Session["active"]; active++; List <OthersBillPayment> othersBillPaymentList = (List <OthersBillPayment>)(Session["othersBill"]); if (active >= othersBillPaymentList.Count) { active = 0; } OthersBillPayment othersBillPayment = othersBillPaymentManager.GetOthesBills(active); GetData(othersBillPayment); Session["active"] = active; }
public OthersBillPayment GetOthersBills(int i) { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_otherBillPayment ORDER BY id ASC OFFSET " + i + " ROWS FETCH NEXT 1 ROWS ONLY"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); OthersBillPayment othersBillPayment = new OthersBillPayment(); while (reader.Read()) { GetValueFromDatabase(othersBillPayment, reader); } reader.Close(); connection.Close(); return(othersBillPayment); }
public List <OthersBillPayment> GetAllOthersBillPaymentList() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_otherBillPayment"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <OthersBillPayment> othersBillPaymentList = new List <OthersBillPayment>(); while (reader.Read()) { OthersBillPayment othersBillPayment = new OthersBillPayment(); GetValueFromDatabase(othersBillPayment, reader); othersBillPaymentList.Add(othersBillPayment); } reader.Close(); connection.Close(); return(othersBillPaymentList); }