public int Delete(tblEmploymentDuration tblEmploymentDuration)
        {
            int __rowsAffected = 0;

            // Create command
            using (SqlCommand sqlCommand = new SqlCommand("tblEmploymentDurationDelete"))
            {
                // Set command type
                sqlCommand.CommandType = CommandType.StoredProcedure;

                try
                {
                    // Attach command
                    AttachCommand(sqlCommand);

                    // Add command parameters
                    SqlParameter vid = new SqlParameter("@id", SqlDbType.BigInt);
                    vid.Direction = ParameterDirection.Input;
                    sqlCommand.Parameters.Add(vid);

                    // Set input parameter values
                    SqlServerHelper.SetParameterValue(vid, tblEmploymentDuration.id);

                    // Execute command
                    __rowsAffected = sqlCommand.ExecuteNonQuery();
                }
                finally
                {
                    // Detach command
                    DetachCommand(sqlCommand);
                }
            }

            return(__rowsAffected);
        }
        public int Retrieve(tblEmploymentDuration tblEmploymentDuration)
        {
            int __rowsAffected = 1;

            // Create command
            using (SqlCommand sqlCommand = new SqlCommand("tblEmploymentDurationGet"))
            {
                // Set command type
                sqlCommand.CommandType = CommandType.StoredProcedure;

                try
                {
                    // Attach command
                    AttachCommand(sqlCommand);

                    // Add command parameters
                    SqlParameter vid = new SqlParameter("@id", SqlDbType.BigInt);
                    vid.Direction = ParameterDirection.InputOutput;
                    sqlCommand.Parameters.Add(vid);
                    SqlParameter vdescr = new SqlParameter("@descr", SqlDbType.NVarChar, 255);
                    vdescr.Direction = ParameterDirection.Output;
                    sqlCommand.Parameters.Add(vdescr);

                    // Set input parameter values
                    SqlServerHelper.SetParameterValue(vid, tblEmploymentDuration.id);

                    // Execute command
                    sqlCommand.ExecuteNonQuery();

                    try
                    {
                        // Get output parameter values
                        tblEmploymentDuration.id    = SqlServerHelper.ToInt64(vid);
                        tblEmploymentDuration.descr = SqlServerHelper.ToString(vdescr);
                    }
                    catch (Exception ex)
                    {
                        if (ex is System.NullReferenceException)
                        {
                            __rowsAffected = 0;
                        }
                        else
                        {
                            throw ex;
                        }
                    }
                }
                finally
                {
                    // Detach command
                    DetachCommand(sqlCommand);
                }
            }

            return(__rowsAffected);
        }
        public virtual void Clone(tblEmploymentDuration sourceObject)
        {
            if (sourceObject == null)
            {
                throw new ArgumentNullException("sourceObject");
            }

            // Clone attributes from source object
            this._id    = sourceObject.id;
            this._descr = sourceObject.descr;
        }
        public int Insert(tblEmploymentDuration tblEmploymentDuration)
        {
            int __rowsAffected = 0;

            // Create command
            using (SqlCommand sqlCommand = new SqlCommand("tblEmploymentDurationInsert"))
            {
                // Set command type
                sqlCommand.CommandType = CommandType.StoredProcedure;

                // Add command parameters
                SqlParameter vid = new SqlParameter("@id", SqlDbType.BigInt);
                vid.Direction = ParameterDirection.InputOutput;
                sqlCommand.Parameters.Add(vid);
                SqlParameter vdescr = new SqlParameter("@descr", SqlDbType.NVarChar, 255);
                vdescr.Direction = ParameterDirection.Input;
                sqlCommand.Parameters.Add(vdescr);

                // Set input parameter values
                SqlServerHelper.SetParameterValue(
                    vid,
                    tblEmploymentDuration.id,
                    0);
                SqlServerHelper.SetParameterValue(vdescr, tblEmploymentDuration.descr);

                try
                {
                    // Attach command
                    AttachCommand(sqlCommand);

                    // Execute command
                    __rowsAffected = sqlCommand.ExecuteNonQuery();
                    if (__rowsAffected == 0)
                    {
                        return(__rowsAffected);
                    }


                    // Get output parameter values
                    tblEmploymentDuration.id = SqlServerHelper.ToInt64(vid);
                }
                finally
                {
                    // Detach command
                    DetachCommand(sqlCommand);
                }
            }

            return(__rowsAffected);
        }