Beispiel #1
0
        public bool InsertEmployee(Entities.Concrete.Employee.Employee prmEmployee)
        {
            bool result = false;

            using (var conn = GetConnection())
            {
                using (SqlCommand command = new SqlCommand("[dbo].[stpEmployeeInsert]", (SqlConnection)conn))
                {
                    var parametersMapper = command;
                    command.CommandType = CommandType.StoredProcedure;
                    EmployeeMapper.EntityToParameters(ref parametersMapper, prmEmployee);
                    command.Parameters.Add(new SqlParameter {
                        ParameterName = "@prmSuccessFlag", SqlDbType = SqlDbType.Bit, Direction = ParameterDirection.Output, Value = result
                    });
                    var rowsAffected = command.ExecuteNonQuery();
                    result = (bool)command.Parameters["@prmSuccessFlag"].Value;
                }
                conn.Close();
            }
            return(result);
        }