protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <OthersGroup> othersGroupList = othersBillPaymentManager.GetAllGroupByIdDropDownList(); OthersGroup othersGroup = new OthersGroup(); othersGroup.OthersGroupId = -1; othersGroup.OtherGroupName = "<--Select One Option-->"; othersGroupList.Insert(0, othersGroup); expHeadDropDownList.DataSource = othersGroupList; expHeadDropDownList.DataValueField = "OthersGroupId"; expHeadDropDownList.DataTextField = "OtherGroupName"; expHeadDropDownList.DataBind(); List <BankAccount> bankAccountList = othersBillPaymentManager.GetAllBankInfoByIdDropDownList(); BankAccount bankAccount = new BankAccount(); bankAccount.BankAccountId = -1; bankAccount.BankAccountName = "<--Select One Option-->"; bankAccountList.Insert(0, bankAccount); bankNameDropDownList.DataSource = bankAccountList; bankNameDropDownList.DataValueField = "BankAccountId"; bankNameDropDownList.DataTextField = "BankAccountName"; bankNameDropDownList.DataBind(); List <OthersBillPayment> othersBillPaymentList = othersBillPaymentManager.GetAllOthersBillPaymentList(); Session["othersBill"] = othersBillPaymentList; Session["active"] = -1; } }
private static void GetDataFromDatabase(OthersGroup othersGroup, SqlDataReader reader) { othersGroup.OthersGroupId = int.Parse(reader["id"].ToString()); othersGroup.OtherGroupCode = reader["other_group_code"].ToString(); othersGroup.OtherGroupName = reader["other_group_name"].ToString(); othersGroup.OtherGroupRemarks = reader["other_group_remarks"].ToString(); othersGroup.GroupName = reader["group_id"].ToString(); }
public string Save(OthersGroup othersGroup) { if (otherGroupGateway.Insert(othersGroup) > 0) { return("Saved Successfully!!"); } return("Could Not Save data in Database!!"); }
protected void lastButton_Click(object sender, EventArgs e) { OthersGroup otherGroup = otherGroupManager.GetLastGroup(); otherGroupCodeTextBox.Text = otherGroup.OtherGroupCode; otherGroupNameTextBox.Text = otherGroup.OtherGroupName; otherGroupRemarksTextArea.InnerText = otherGroup.OtherGroupRemarks; groupNameDropDownList.SelectedValue = otherGroup.GroupName; }
public int Insert(OthersGroup othersGroup) { SqlConnection connection = new SqlConnection(connectionString); string query = "INSERT INTO tbl_other_group VALUES('" + othersGroup.OtherGroupCode + "','" + othersGroup.OtherGroupName + "','" + othersGroup.OtherGroupRemarks + "','" + othersGroup.GroupName + "')"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
protected void saveButton_Click(object sender, EventArgs e) { OthersGroup othersGroup = new OthersGroup(otherGroupCodeTextBox.Text, otherGroupNameTextBox.Text, otherGroupRemarksTextArea.InnerText, groupNameDropDownList.Text); if (otherGroupCodeTextBox.Text == "" || otherGroupNameTextBox.Text == "" || otherGroupRemarksTextArea.InnerText == "" || groupNameDropDownList.SelectedValue == "") { message.InnerText = "All Fields are Required!!"; } else { messageLabel.InnerText = otherGroupManager.Save(othersGroup); message.InnerText = ""; } }
public OthersGroup GetLastGroup() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT TOP 1 * FROM tbl_other_group ORDER BY id DESC"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); OthersGroup othersGroup = new OthersGroup(); while (reader.Read()) { GetDataFromDatabase(othersGroup, reader); } reader.Close(); connection.Close(); return(othersGroup); }
public OthersGroup GetSearchInfo(string oGroup) { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_other_group WHERE other_group_code='" + oGroup + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); OthersGroup othersGroup = new OthersGroup(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { GetDataFromDatabase(othersGroup, reader); } reader.Close(); connection.Close(); return(othersGroup); }
private string LoadNextCode() { OthersGroup othersGroup = otherGroupManager.GetNextCode(); string otherGCode = othersGroup.OtherGroupCode; int c; if (otherGCode == null) { c = 1; } else { c = (otherGCode[2] - '0') * 10 + (otherGCode[3] - '0') + 1; } string nextCode = "OG" + c.ToString("00"); return(nextCode); }
protected void searchButton_Click(object sender, EventArgs e) { var oGroup = otherGroupTextBox.Value; OthersGroup otherGroup = otherGroupManager.GetSearchInfo(oGroup); if (otherGroup.OtherGroupCode == null) { message.InnerText = "Invalid Group Code!!"; } else { otherGroupCodeTextBox.Text = otherGroup.OtherGroupCode; otherGroupNameTextBox.Text = otherGroup.OtherGroupName; otherGroupRemarksTextArea.InnerText = otherGroup.OtherGroupRemarks; groupNameDropDownList.SelectedValue = otherGroup.GroupName; message.InnerText = ""; } }
public OthersGroup GetNextCode() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT TOP 1 * FROM tbl_other_group ORDER BY id DESC"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); OthersGroup othersGroup = new OthersGroup(); while (reader.Read()) { othersGroup.OthersGroupId = int.Parse(reader["id"].ToString()); othersGroup.OtherGroupCode = reader["other_group_code"].ToString(); } reader.Close(); connection.Close(); return(othersGroup); }
public List <OthersGroup> GetAllOthersGroup() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_other_group"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <OthersGroup> otherGroupList = new List <OthersGroup>(); while (reader.Read()) { OthersGroup othersGroup = new OthersGroup(); GetDataFromDatabase(othersGroup, reader); otherGroupList.Add(othersGroup); } reader.Close(); connection.Close(); return(otherGroupList); }
public List <OthersGroup> GetAllGroupByIdDropDownList() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_other_group"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <OthersGroup> othersGroupList = new List <OthersGroup>(); while (reader.Read()) { OthersGroup othersGroup = new OthersGroup(); othersGroup.OthersGroupId = int.Parse(reader["id"].ToString()); othersGroup.OtherGroupName = reader["other_group_name"].ToString(); othersGroupList.Add(othersGroup); } reader.Close(); connection.Close(); return(othersGroupList); }