Beispiel #1
0
        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();
                }
            }
        }
Beispiel #2
0
        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();
                }
            }
        }