public int InsertWithResult(T _Search_VM) { DataTable temp = null; GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>(); try { SqlParameter result = new SqlParameter("@Result", SqlDbType.Int); result.Direction = ParameterDirection.Output; result.Value = 0; SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator(); List <SqlParameter> sqlParameters = _SqlParametersGenerator.GenerateInsertUpdateParameters <T>(_Search_VM); sqlParameters.Add(result); int Result = 0; new StartUp().ExecuteNonQuery(Insert_SP, sqlParameters); int.TryParse(result.Value.ToString(), out Result); return(Result); } catch (Exception ex) { return(-2); } finally { if (temp != null) { temp.Dispose(); } } }
public int Insert(T _Search_VM) { DataTable temp = null; GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>(); try { SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator(); List <SqlParameter> sqlParameters = _SqlParametersGenerator.GenerateInsertUpdateParameters <T>(_Search_VM); return(new StartUp().ExecuteNonQuery(Insert_SP, sqlParameters)); } catch (Exception ex) { return(-2); } finally { if (temp != null) { temp.Dispose(); } } }