//---------------------------------------------------------------------
        #endregion

        #region --------------UpdateCart--------------
        //---------------------------------------------------------------------
        //UpdateCart
        //---------------------------------------------------------------------
        public bool UpdateCart(int userId, List <ShoppingCartItem> items)
        {
            bool   savestats                     = false;
            string sp1_RemoveAllItems            = "[dbo].[ShoppingCart_RemoveAllItems]";
            string sp2_AddItemWithOutReturnCount = "[dbo].[ShoppingCart_AddItemWithOutReturnCount]";

            using (SqlConnection myConnection = SqlDataHelper.GetSqlConnection())
            {
                SqlTransaction transaction = null;
                try
                {
                    myConnection.Open();
                    transaction = myConnection.BeginTransaction();

                    using (SqlCommand myCommand = new SqlCommand(sp1_RemoveAllItems, myConnection, transaction))
                    {
                        myCommand.CommandType = CommandType.StoredProcedure;
                        myCommand.Parameters.Add("@UserID", SqlDbType.Int, 4).Value = userId;
                        myCommand.ExecuteNonQuery();
                    }
                    using (SqlCommand myCommand = new SqlCommand(sp2_AddItemWithOutReturnCount, myConnection, transaction))
                    {
                        myCommand.CommandType = CommandType.StoredProcedure;
                        myCommand.Parameters.Add("@UserID", SqlDbType.Int, 4).Value = userId;
                        myCommand.Parameters.Add("@ProductID", SqlDbType.Int, 4);
                        myCommand.Parameters.Add("@Quantity", SqlDbType.Int, 4);
                        foreach (var item in items)
                        {
                            myCommand.Parameters["@ProductID"].Value = item.ProductID;
                            myCommand.Parameters["@Quantity"].Value  = item.Quantity;
                            myCommand.ExecuteNonQuery();
                        }
                    }
                    transaction.Commit();
                    myConnection.Close();
                    savestats = true;
                }
                catch (Exception ex)
                {
                    // Attempt to roll back the transaction.
                    try
                    {
                        transaction.Rollback();
                    }
                    catch (Exception ex2)
                    {
                        // This catch block will handle any errors that may have occurred
                        // on the server that would cause the rollback to fail, such as
                        // a closed connection.
                    }
                }
            }
            return(savestats);
        }
 public SupplierSystemSqlData(ISupplierSystem m)
 {
     this.m = m;
     SqlDataHelper.TableName          = "table_m_temp";
     SqlDataHelper.DataSource         = ".";
     SqlDataHelper.DatabaseName       = "TKDB";
     SqlDataHelper.IntegratedSecurity = true;
     conn            = SqlDataHelper.GetSqlConnection();
     comm            = new SqlCommand();
     comm.Connection = conn;
 }