public Int32 Insert(AccountCategoryDetails 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 Insert(AccountCategoryDetails 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(AccountCategoryDetails Details) { try { string SQL = "CALL procSaveAccountCategory(@AccountCategoryID, @AccountSummaryID, @AccountCategoryCode, @AccountCategoryName, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryID); cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryDetails.AccountSummaryID); cmd.Parameters.AddWithValue("AccountCategoryCode", Details.AccountCategoryCode); cmd.Parameters.AddWithValue("AccountCategoryName", Details.AccountCategoryName); 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 void Update(AccountCategoryDetails Details) { try { Save(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
private void SaveRecord() { AccountCategoryDetails clsDetails = new AccountCategoryDetails(); clsDetails.AccountCategoryID = Convert.ToInt16(lblAccountCategoryID.Text); clsDetails.AccountSummaryDetails = new AccountSummaryDetails { AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value) }; clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text; clsDetails.AccountCategoryName = txtAccountCategoryName.Text; AccountCategories clsAccountCategory = new AccountCategories(); clsAccountCategory.Update(clsDetails); clsAccountCategory.CommitAndDispose(); }
public AccountCategoryDetails Details(Int32 AccountCategoryID) { try { string SQL = SQLSelect() + "WHERE AccountCategoryID = @AccountCategoryID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmAccountCategoryID = new MySqlParameter("@AccountCategoryID", MySqlDbType.Int16); prmAccountCategoryID.Value = AccountCategoryID; cmd.Parameters.Add(prmAccountCategoryID); 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); AccountCategoryDetails Details = new AccountCategoryDetails(); AccountSummaries clsAccountSummary = new AccountSummaries(this.Connection, this.Transaction); AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction); foreach (System.Data.DataRow dr in dt.Rows) { Details.AccountCategoryID = AccountCategoryID; Details.AccountCategoryCode = "" + dr["AccountCategoryCode"].ToString(); Details.AccountCategoryName = "" + dr["AccountCategoryName"].ToString(); Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString())); //Details.AccountClassificationDetails = Details.AccountSummaryDetails.AccountClassificationDetails; } return(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void Update(AccountCategoryDetails Details) { try { Save(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public AccountCategoryDetails Details(Int32 AccountCategoryID) { try { string SQL = SQLSelect() + "WHERE AccountCategoryID = @AccountCategoryID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmAccountCategoryID = new MySqlParameter("@AccountCategoryID",MySqlDbType.Int16); prmAccountCategoryID.Value = AccountCategoryID; cmd.Parameters.Add(prmAccountCategoryID); 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); AccountCategoryDetails Details = new AccountCategoryDetails(); AccountSummaries clsAccountSummary = new AccountSummaries(this.Connection, this.Transaction); AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction); foreach(System.Data.DataRow dr in dt.Rows) { Details.AccountCategoryID = AccountCategoryID; Details.AccountCategoryCode = "" + dr["AccountCategoryCode"].ToString(); Details.AccountCategoryName = "" + dr["AccountCategoryName"].ToString(); Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString())); //Details.AccountClassificationDetails = Details.AccountSummaryDetails.AccountClassificationDetails; } return Details; } catch (Exception ex) { throw base.ThrowException(ex); } }
public Int32 Save(AccountCategoryDetails Details) { try { string SQL = "CALL procSaveAccountCategory(@AccountCategoryID, @AccountSummaryID, @AccountCategoryCode, @AccountCategoryName, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("AccountCategoryID", Details.AccountCategoryID); cmd.Parameters.AddWithValue("AccountSummaryID", Details.AccountSummaryDetails.AccountSummaryID); cmd.Parameters.AddWithValue("AccountCategoryCode", Details.AccountCategoryCode); cmd.Parameters.AddWithValue("AccountCategoryName", Details.AccountCategoryName); 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); } }
private Int32 SaveRecord() { AccountCategoryDetails clsDetails = new AccountCategoryDetails(); clsDetails.AccountSummaryDetails = new AccountSummaryDetails { AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value) }; clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text; clsDetails.AccountCategoryName = txtAccountCategoryName.Text; AccountCategories clsAccountCategory = new AccountCategories(); Int32 id = clsAccountCategory.Insert(clsDetails); clsAccountCategory.CommitAndDispose(); return id; }