/// <summary> ///Get Accounting Class /// </summary> /// <param name="ass">accounting schema array</param> /// <param name="dr">result set</param> /// <param name="trxName">trx</param> /// <returns>instance or null</returns> public AccountingInterface GetAccountingInstance(MAcctSchema[] ass, DataRow dr, Trx trxName) { //Class<?> clazz = getAccountingClass(); Type clazz = GetAccountingClass(); if (clazz == null) { return(null); } try { //Constructor<?> constr = clazz.getConstructor(MAcctSchema[].class, ResultSet.class, String.class); System.Reflection.ConstructorInfo constr = clazz.GetConstructor(new Type[] { typeof(MAcctSchema[]), typeof(DataRow), typeof(Trx) }); log.Info(constr.Name + ": Constructor check "); //AccountingInterface retValue = (AccountingInterface)constr.newInstance(ass, rs, trxName); AccountingInterface retValue = (AccountingInterface)constr.Invoke(new object[] { ass, dr, trxName }); log.Info(retValue.ToString() + ": Constructor invoke check "); return(retValue); } catch (Exception e) { log.Warning("Error instanciating " + GetName() + ": - " + e.ToString()); } return(null); }
public void Insert(AccountingInterface entity) { try { if (entity.Id == Guid.Empty) { entity.Id = Guid.NewGuid(); } this.Table.Add(entity); this.SubmitChanges(); } catch { throw; } }
public void Save(AccountingInterface entity) { try { if (entity.Id == Guid.Empty) { this.Insert(entity); } else { this.SubmitChanges(); } } catch { throw; } }