public Int32 Insert(AccountClassificationDetails Details) { try { Save(Details); string SQL = "SELECT LAST_INSERT_ID();"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; 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); Int32 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int32.Parse(dr[0].ToString()); } return iID; } catch (Exception ex) { throw base.ThrowException(ex); } }
public Int32 Save(AccountClassificationDetails Details) { try { string SQL = "CALL procSaveAccountClassification(@AccountClassificationID, @AccountClassificationCode, @AccountClassificationName, @AccountClassificationType, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("AccountClassificationID", Details.AccountClassificationID); cmd.Parameters.AddWithValue("AccountClassificationCode", Details.AccountClassificationCode); cmd.Parameters.AddWithValue("AccountClassificationName", Details.AccountClassificationName); cmd.Parameters.AddWithValue("AccountClassificationType", Details.AccountClassificationType.ToString("d")); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); return(base.ExecuteNonQuery(cmd)); } catch (Exception ex) { throw base.ThrowException(ex); } }
public Int32 Insert(AccountClassificationDetails Details) { try { Save(Details); string SQL = "SELECT LAST_INSERT_ID();"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; 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); Int32 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int32.Parse(dr[0].ToString()); } return(iID); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void Update(AccountClassificationDetails Details) { try { Save(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void Update(AccountClassificationDetails Details) { try { Save(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public AccountClassificationDetails Details(Int32 AccountClassificationID) { try { string SQL = SQLSelect() + "WHERE AccountClassificationID = @AccountClassificationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmAccountClassificationID = new MySqlParameter("@AccountClassificationID", MySqlDbType.Int16); prmAccountClassificationID.Value = AccountClassificationID; cmd.Parameters.Add(prmAccountClassificationID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); AccountClassificationDetails Details = new AccountClassificationDetails(); while (myReader.Read()) { Details.AccountClassificationID = AccountClassificationID; Details.AccountClassificationCode = "" + myReader["AccountClassificationCode"].ToString(); Details.AccountClassificationName = "" + myReader["AccountClassificationName"].ToString(); Details.AccountClassificationType = (AccountClassificationType)Enum.Parse(typeof(AccountClassificationType), myReader.GetString("AccountClassificationType")); } myReader.Close(); return(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public Int32 Save(AccountClassificationDetails Details) { try { string SQL = "CALL procSaveAccountClassification(@AccountClassificationID, @AccountClassificationCode, @AccountClassificationName, @AccountClassificationType, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("AccountClassificationID", Details.AccountClassificationID); cmd.Parameters.AddWithValue("AccountClassificationCode", Details.AccountClassificationCode); cmd.Parameters.AddWithValue("AccountClassificationName", Details.AccountClassificationName); cmd.Parameters.AddWithValue("AccountClassificationType", Details.AccountClassificationType.ToString("d")); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); return base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
public AccountClassificationDetails Details(Int32 AccountClassificationID) { try { string SQL = SQLSelect() + "WHERE AccountClassificationID = @AccountClassificationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmAccountClassificationID = new MySqlParameter("@AccountClassificationID",MySqlDbType.Int16); prmAccountClassificationID.Value = AccountClassificationID; cmd.Parameters.Add(prmAccountClassificationID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); AccountClassificationDetails Details = new AccountClassificationDetails(); while (myReader.Read()) { Details.AccountClassificationID = AccountClassificationID; Details.AccountClassificationCode = "" + myReader["AccountClassificationCode"].ToString(); Details.AccountClassificationName = "" + myReader["AccountClassificationName"].ToString(); Details.AccountClassificationType = (AccountClassificationType) Enum.Parse(typeof(AccountClassificationType), myReader.GetString("AccountClassificationType")); } myReader.Close(); return Details; } catch (Exception ex) { throw base.ThrowException(ex); } }