error : an object reference is required for the non-static field, method, or property
<p>I have a class with these fields and these static methods, when I want to use "SetSaleMode" in line  "return (byte)SaleMode.ToPost;" this error occurred, Can anybody help me?</p>

<p>these are my code:</p>

<p><pre>public enum SaleMode:byte { ToPost = 0, Downloadable = 1, DownloadableAndFreeTrial = 2, SourceSiteSale = 3 };
public enum FilePriceMode { ProductFile = 0, Free = 1, FreeTrial = 2 };</p>

<p>public class ProductDAL : BaseDAL
{</p>

<code>#region fields
public Int64 ID { get; set; }
public string Name { get; set; }
public Int64 Price { get; set; }
public bool Private { get; set; }
public Int64 ProductType { get; set; }
public string Notes { get; set; }
public string Image { get; set; }
public DateTime Date { get; set; }
public Int64 Owner { get; set; }
public long Counter { get; set; }
public bool Proved { get; set; }
public byte[] Files { get; set; }
public byte SaleMode { get; set; }
public string SourceSiteSaleAddress { get; set; }
public List&lt;FilesOfProductsDAL&gt; FOfPro;

#endregion fields        

#region constructor
public ProductDAL()
{
    ID = -1;
    FOfPro = new List&lt;FilesOfProductsDAL&gt;();
}

public ProductDAL(string saveIconPath)
{
    ID = -1;
    this.Image = saveIconPath;
    FOfPro = new List&lt;FilesOfProductsDAL&gt;();
}
#endregion constructor

#region method

public static long InsertProduct(ProductDAL objProductDAL)
{
    try
    {
        Int64 ID;
        objProductDAL.SaleMode = SetSaleMode(objProductDAL);
        SqlCommand Sqlcomm = new SqlCommand();
        Sqlcomm.CommandText = StoreQueries.InsertProduct;
        Sqlcomm.CommandType = CommandType.StoredProcedure;
        Sqlcomm.Parameters.AddWithValue("@Name", SqlDbType.NVarChar).Value = objProductDAL.Name;
        Sqlcomm.Parameters.AddWithValue("@Price", SqlDbType.BigInt).Value = objProductDAL.Price;
        Sqlcomm.Parameters.AddWithValue("@Private", SqlDbType.Bit).Value = objProductDAL.Private;
        Sqlcomm.Parameters.AddWithValue("@ProductType", SqlDbType.BigInt).Value = objProductDAL.ProductType;
        Sqlcomm.Parameters.AddWithValue("@Notes", SqlDbType.NVarChar).Value = objProductDAL.Notes;
        Sqlcomm.Parameters.AddWithValue("@Date", SqlDbType.DateTime).Value = objProductDAL.Date;
        Sqlcomm.Parameters.AddWithValue("@Image", SqlDbType.NVarChar).Value = objProductDAL.Image;
        Sqlcomm.Parameters.AddWithValue("@Owner", SqlDbType.BigInt).Value = 1019;//objProductDL.Owner ;
        Sqlcomm.Parameters.AddWithValue("@SaleMode", SqlDbType.VarBinary).Value = objProductDAL.SaleMode;
        if (objProductDAL.Files == null)
            Sqlcomm.Parameters.AddWithValue("@Files", SqlDbType.VarBinary).Value =System.Data.SqlTypes.SqlBinary.Null;// DBNull.Value;
        else
            Sqlcomm.Parameters.AddWithValue("@Files", SqlDbType.VarBinary).Value = objProductDAL.Files;
        if (objProductDAL.SourceSiteSaleAddress == null)
            Sqlcomm.Parameters.AddWithValue("@SourceSiteSaleAddress", SqlDbType.NVarChar).Value = DBNull.Value;
        else
            Sqlcomm.Parameters.AddWithValue("@SourceSiteSaleAddress", SqlDbType.NVarChar).Value = objProductDAL.SourceSiteSaleAddress;
        Sqlcomm.Parameters.AddWithValue("@CheangedSet", SqlDbType.NVarChar).Value = "محصول جدید است.";
        Sqlcomm.Parameters.AddWithValue("PID", SqlDbType.BigInt).Value =objProductDAL.ID;

        ID = Convert.ToInt64(ExecuteScalar(Sqlcomm));

        objProductDAL.Image = objProductDAL.Image.Replace(Path.GetFileNameWithoutExtension(objProductDAL.Image), ID.ToString() );

        for (int i = 0; i &lt;objProductDAL.FOfPro.Count; i++)
        { objProductDAL.FOfPro[i].FileUrl = objProductDAL.FOfPro[i].FileUrl.Replace(Path.GetFileNameWithoutExtension(objProductDAL.FOfPro[i].FileUrl), Path.GetFileNameWithoutExtension(objProductDAL.FOfPro[i].FileUrl) + "." + ID.ToString() + "." + i.ToString()); }
        UpdateFileAndImageUrl(Store.SerializeData(objProductDAL.FOfPro), objProductDAL.Image, ID);
        return ID;
    }
    catch (Exception) { throw; }
}
private static byte SetSaleMode(ProductDAL objProductDAL)
{
    if (objProductDAL.SourceSiteSaleAddress == null || objProductDAL.SourceSiteSaleAddress == "")
    {
         if (!ProductTypesDAL.IsDownloadable(objProductDAL.ProductType))
            return (byte)SaleMode.ToPost;
        if (objProductDAL.FOfPro.Exists(priceMode =&gt; priceMode.FilePriceMode == (int)FilePriceMode.FreeTrial))
            return (byte)SaleMode.DownloadableAndFreeTrial;
        else
            return (byte)SaleMode.Downloadable;
    }
    else
        return (byte)SaleMode.SourceSiteSale;
}
</code></pre>

<p>}</p>

<p></p>
