7.0.4 Database Access Layer

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
joebeazelman
Lieutenant (LT)
Lieutenant (LT)
Posts: 78
Joined: Wed Mar 05, 2008 11:27 am

7.0.4 Database Access Layer

Post by joebeazelman » Sun Mar 21, 2010 11:29 am

I understand that 7.0.4 no longer uses Enterprise Library for its data access layer. What is it using instead and is there any documentation on it? I want to add an extra field to the product table and have it edited in the admin sections. I was able to do this previously with older versions with mixed results. I had to do a lot of extra work to get around the fact that ENTLIB only updates a record if it detects changes in a particular field. Since my field is foreign, in that it isn't managed at the DAL layer, it wouldn't write out the record. I had to fool it into thinking one of its fields were changed. Has this changed at all?

afm
Captain (CAPT)
Captain (CAPT)
Posts: 339
Joined: Thu Nov 03, 2005 11:52 pm
Location: Portland, OR
Contact:

Re: 7.0.4 Database Access Layer

Post by afm » Sun Mar 21, 2010 11:58 am

Documentation: Data Access Layer (the AbleCommerce Wiki has quite a bit of documentation you may find useful)
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: 7.0.4 Database Access Layer

Post by Mike718NY » Sun Mar 21, 2010 4:45 pm

I've used this and it works great:

viewtopic.php?f=47&t=12056

I added a field to the Products table and used this DAL to access/modify
the field I used with the above:

Code: Select all

            string query = string.Empty;
            if (chk_Engraving.Checked)
            {
              query = "UPDATE ac_Products SET Engraving = 1 WHERE ProductID = " + Request.QueryString["ProductId"] + ";  

IF EXISTS (SELECT ProductId FROM ac_ProductProductTemplates WHERE ProductId = " + Request.QueryString["ProductId"] + " AND ProductTemplateId = 5) RETURN ELSE INSERT INTO ac_ProductProductTemplates (ProductId, ProductTemplateId) VALUES (" + Request.QueryString["ProductId"] + ", 5)";
            }
            else
            {
              query = "UPDATE ac_Products SET Engraving = 0 WHERE ProductID = " + Request.QueryString["ProductId"] + "; DELETE FROM ac_ProductProductTemplates WHERE ProductID = " + Request.QueryString["ProductId"] + " AND ProductTemplateId = 5";
            }
            CommerceBuilder.Data.Database database = Token.Instance.Database;
            System.Data.Common.DbCommand updateCommand = database.GetSqlStringCommand(query);
            //int result = (int)database.ExecuteNonQuery(updateCommand);
            database.ExecuteNonQuery(updateCommand);
 

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: 7.0.4 Database Access Layer

Post by mazhar » Mon Mar 22, 2010 7:29 am

If you simply want to add new field for product then I second the Mike's idea of making of using product custom fields. There is another helpful have a look at that as well
viewtopic.php?f=44&t=9088

Post Reply