DB changes broke stock-notification mod

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

DB changes broke stock-notification mod

Post by William_firefold » Fri Dec 18, 2009 8:35 am

We have a mod to buyproductdialog which allows users to enter their email if a product is out of stock and be notified when it comes back. Something about the database changes in 704 broke it. We have a method in producthelper which adds people to the notification list, here is the code:

Code: Select all

using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.SqlClient;
using System.Data;

Code: Select all

	    
//FireFold - custom methods
    public static int StoreStockNotificationEmailId(int ProductId, string EmailId)
    {
        //have to check first... to avoid duplicates.
        Database database = Token.Instance.Database;
        ParameterCollection parameterColl = new ParameterCollection();
        string sqlQuery = "Insert into custom_StockNotify (ProductId, EmailId) values (@ProductId, @EmailId)";
        int rowsAffected = 0;
        {
            //using (System.Data.Common.DbCommand selectCommand = database.GetSqlStringCommand(sqlQuery))
            using (System.Data.Common.DbCommand selectCommand = database.GetStoredProcCommand("sp_AddStockEmailId"))
            {
                database.AddInParameter(selectCommand, "@ProductId", System.Data.DbType.Int32, ProductId);
                database.AddInParameter(selectCommand, "@EmailId", System.Data.DbType.String, EmailId);

                database.AddOutParameter(selectCommand, "@returnVal", System.Data.DbType.Int32, 0);

                database.ExecuteNonQuery(selectCommand);
                rowsAffected = int.Parse(database.GetParameterValue(selectCommand, "@returnVal").ToString());
            }
        }
        return rowsAffected;
    }
and this is in the conlib:

Code: Select all

	    //FireFold Mod: For Stock email Notification
    protected void StockEmailSubmit_Click(object sender, System.EventArgs e)
    {
        int result = ProductHelper.StoreStockNotificationEmailId(_ProductId, StockEmail.Text);
        if (result > 0)
        {
            lblResult.Text = "E-Mail Accepted. Watch Your Inbox For Our E-Mail!";
        }
    }
It errors with this:
CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Any ideas?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: DB changes broke stock-notification mod

Post by jmestep » Fri Dec 18, 2009 11:17 am

It's this line using Microsoft.Practices.EnterpriseLibrary.Data;
In 7.0.2 or 7.0.3 Able started using their own object. using CommerceBuilder.Data;

That is the only change you should have to make. I have run into some occasions where I changed that and then the code still didn't pick it up, so if I started typing out the line of code from scratch, it picked it up then. Maybe it was a slowness on Visual Studio, I don't know why.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: DB changes broke stock-notification mod

Post by William_firefold » Mon Dec 21, 2009 6:36 am

It works!
Thank you!

Post Reply