public GJournalsCreditDetails Details(long GJournalCreditID) { try { string SQL = "SELECT " + "GJournalCreditID, " + "GJournalID, " + "a.ChartOfAccountID, " + "ChartOfAccountCode, " + "ChartOfAccountName, " + "Amount " + "FROM tblGJournalCredit a INNER JOIN tblChartOfAccount b " + "ON a.ChartOfAccountID = b.ChartOfAccountID " + "WHERE GJournalCreditID = @GJournalCreditID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalCreditID = new MySqlParameter("@GJournalCreditID", MySqlDbType.Int64); prmGJournalCreditID.Value = GJournalCreditID; cmd.Parameters.Add(prmGJournalCreditID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); GJournalsCreditDetails Details = new GJournalsCreditDetails(); while (myReader.Read()) { Details.GJournalCreditID = GJournalCreditID; Details.GJournalID = myReader.GetInt64("GJournalID"); Details.ChartOfAccountID = myReader.GetInt32("ChartOfAccountID"); Details.Amount = myReader.GetDecimal("Amount"); } myReader.Close(); return(Details); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public void Update(GJournalsCreditDetails Details) { try { string SQL = "UPDATE tblGJournalCredit SET " + "GJournalID = @GJournalID, "+ "ChartOfAccountID = @ChartOfAccountID, "+ "Amount = @Amount "+ "WHERE GJournalCreditID = @GJournalCreditID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalID = new MySqlParameter("@GJournalID", MySqlDbType.Int64); prmGJournalID.Value = Details.GJournalID; cmd.Parameters.Add(prmGJournalID); MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID", MySqlDbType.Int64); prmChartOfAccountID.Value = Details.ChartOfAccountID; cmd.Parameters.Add(prmChartOfAccountID); MySqlParameter prmAmount = new MySqlParameter("@Amount", MySqlDbType.Decimal); prmAmount.Value = Details.Amount; cmd.Parameters.Add(prmAmount); MySqlParameter prmGJournalCreditID = new MySqlParameter("@GJournalCreditID", MySqlDbType.Int64); prmGJournalCreditID.Value = Details.GJournalCreditID; cmd.Parameters.Add(prmGJournalCreditID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public long Insert(GJournalsCreditDetails Details) { try { string SQL = "INSERT INTO tblGJournalCredit (" + "GJournalID, " + "ChartOfAccountID, " + "Amount" + ") VALUES (" + "@GJournalID, " + "@ChartOfAccountID, " + "@Amount" + ");"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalID = new MySqlParameter("@GJournalID", MySqlDbType.Int64); prmGJournalID.Value = Details.GJournalID; cmd.Parameters.Add(prmGJournalID); MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID", MySqlDbType.Int64); prmChartOfAccountID.Value = Details.ChartOfAccountID; cmd.Parameters.Add(prmChartOfAccountID); MySqlParameter prmAmount = new MySqlParameter("@Amount", MySqlDbType.Decimal); prmAmount.Value = Details.Amount; cmd.Parameters.Add(prmAmount); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName); base.MySqlDataAdapterFill(cmd, dt); Int64 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int64.Parse(dr[0].ToString()); } return(iID); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public long Insert(GJournalsCreditDetails Details) { try { string SQL = "INSERT INTO tblGJournalCredit (" + "GJournalID, " + "ChartOfAccountID, " + "Amount" + ") VALUES (" + "@GJournalID, " + "@ChartOfAccountID, " + "@Amount" + ");"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalID = new MySqlParameter("@GJournalID",MySqlDbType.Int64); prmGJournalID.Value = Details.GJournalID; cmd.Parameters.Add(prmGJournalID); MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID",MySqlDbType.Int64); prmChartOfAccountID.Value = Details.ChartOfAccountID; cmd.Parameters.Add(prmChartOfAccountID); MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal); prmAmount.Value = Details.Amount; cmd.Parameters.Add(prmAmount); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName); base.MySqlDataAdapterFill(cmd, dt); Int64 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int64.Parse(dr[0].ToString()); } return iID; } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public GJournalsCreditDetails Details(long GJournalCreditID) { try { string SQL = "SELECT " + "GJournalCreditID, " + "GJournalID, " + "a.ChartOfAccountID, " + "ChartOfAccountCode, " + "ChartOfAccountName, " + "Amount " + "FROM tblGJournalCredit a INNER JOIN tblChartOfAccount b " + "ON a.ChartOfAccountID = b.ChartOfAccountID " + "WHERE GJournalCreditID = @GJournalCreditID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalCreditID = new MySqlParameter("@GJournalCreditID",MySqlDbType.Int64); prmGJournalCreditID.Value = GJournalCreditID; cmd.Parameters.Add(prmGJournalCreditID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); GJournalsCreditDetails Details = new GJournalsCreditDetails(); while (myReader.Read()) { Details.GJournalCreditID = GJournalCreditID; Details.GJournalID = myReader.GetInt64("GJournalID"); Details.ChartOfAccountID = myReader.GetInt32("ChartOfAccountID"); Details.Amount = myReader.GetDecimal("Amount"); } myReader.Close(); return Details; } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public void Update(GJournalsCreditDetails Details) { try { string SQL = "UPDATE tblGJournalCredit SET " + "GJournalID = @GJournalID, " + "ChartOfAccountID = @ChartOfAccountID, " + "Amount = @Amount " + "WHERE GJournalCreditID = @GJournalCreditID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmGJournalID = new MySqlParameter("@GJournalID",MySqlDbType.Int64); prmGJournalID.Value = Details.GJournalID; cmd.Parameters.Add(prmGJournalID); MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID",MySqlDbType.Int64); prmChartOfAccountID.Value = Details.ChartOfAccountID; cmd.Parameters.Add(prmChartOfAccountID); MySqlParameter prmAmount = new MySqlParameter("@Amount",MySqlDbType.Decimal); prmAmount.Value = Details.Amount; cmd.Parameters.Add(prmAmount); MySqlParameter prmGJournalCreditID = new MySqlParameter("@GJournalCreditID",MySqlDbType.Int64); prmGJournalCreditID.Value = Details.GJournalCreditID; cmd.Parameters.Add(prmGJournalCreditID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
private void SaveCredit() { GJournalsCreditDetails clsDetails = new GJournalsCreditDetails(); clsDetails.GJournalID = Convert.ToInt64(lblGJournalID.Text); clsDetails.ChartOfAccountID = Convert.ToInt32(cboAccount.SelectedItem.Value); clsDetails.Amount = Convert.ToDecimal(txtAmount.Text); GJournalsCredit clsGJournalsCredit = new GJournalsCredit(); clsGJournalsCredit.Insert(clsDetails); clsGJournalsCredit.CommitAndDispose(); }