Beispiel #1
0
        public virtual KitCart KitCartFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            KitCart entity = new KitCart();

            entity.KitCartRecId                 = (System.Int32)dr["KitCartRecID"];
            entity.CustomerId                   = (System.Int32)dr["CustomerID"];
            entity.ShoppingCartRecId            = (System.Int32)dr["ShoppingCartRecID"];
            entity.ProductId                    = (System.Int32)dr["ProductID"];
            entity.VariantId                    = (System.Int32)dr["VariantID"];
            entity.KitGroupId                   = (System.Int32)dr["KitGroupID"];
            entity.KitGroupTypeId               = (System.Int32)dr["KitGroupTypeID"];
            entity.KitItemId                    = (System.Int32)dr["KitItemID"];
            entity.Quantity                     = (System.Int32)dr["Quantity"];
            entity.CartType                     = (System.Int32)dr["CartType"];
            entity.OriginalRecurringOrderNumber = dr["OriginalRecurringOrderNumber"] == DBNull.Value?(System.Int32?)null : (System.Int32?)dr["OriginalRecurringOrderNumber"];
            entity.TextOption                   = dr["TextOption"].ToString();
            entity.InventoryVariantId           = dr["InventoryVariantID"] == DBNull.Value?(System.Int32?)null : (System.Int32?)dr["InventoryVariantID"];
            entity.InventoryVariantColor        = dr["InventoryVariantColor"].ToString();
            entity.InventoryVariantSize         = dr["InventoryVariantSize"].ToString();
            entity.ExtensionData                = dr["ExtensionData"].ToString();
            entity.CreatedOn                    = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
Beispiel #2
0
        public virtual KitCart UpdateKitCart(KitCart entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            KitCart other = GetKitCart(entity.KitCartRecId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update KitCart set  [CustomerID]=@CustomerID
							, [ShoppingCartRecID]=@ShoppingCartRecID
							, [ProductID]=@ProductID
							, [VariantID]=@VariantID
							, [KitGroupID]=@KitGroupID
							, [KitGroupTypeID]=@KitGroupTypeID
							, [KitItemID]=@KitItemID
							, [Quantity]=@Quantity
							, [CartType]=@CartType
							, [OriginalRecurringOrderNumber]=@OriginalRecurringOrderNumber
							, [TextOption]=@TextOption
							, [InventoryVariantID]=@InventoryVariantID
							, [InventoryVariantColor]=@InventoryVariantColor
							, [InventoryVariantSize]=@InventoryVariantSize
							, [ExtensionData]=@ExtensionData
							, [CreatedOn]=@CreatedOn 
							 where KitCartRecID=@KitCartRecID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@KitCartRecID", entity.KitCartRecId)
                , new SqlParameter("@CustomerID", entity.CustomerId)
                , new SqlParameter("@ShoppingCartRecID", entity.ShoppingCartRecId)
                , new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@VariantID", entity.VariantId)
                , new SqlParameter("@KitGroupID", entity.KitGroupId)
                , new SqlParameter("@KitGroupTypeID", entity.KitGroupTypeId)
                , new SqlParameter("@KitItemID", entity.KitItemId)
                , new SqlParameter("@Quantity", entity.Quantity)
                , new SqlParameter("@CartType", entity.CartType)
                , new SqlParameter("@OriginalRecurringOrderNumber", entity.OriginalRecurringOrderNumber ?? (object)DBNull.Value)
                , new SqlParameter("@TextOption", entity.TextOption ?? (object)DBNull.Value)
                , new SqlParameter("@InventoryVariantID", entity.InventoryVariantId ?? (object)DBNull.Value)
                , new SqlParameter("@InventoryVariantColor", entity.InventoryVariantColor ?? (object)DBNull.Value)
                , new SqlParameter("@InventoryVariantSize", entity.InventoryVariantSize ?? (object)DBNull.Value)
                , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetKitCart(entity.KitCartRecId));
        }
Beispiel #3
0
 public virtual KitCart DeleteKitCart(KitCart entity)
 {
     this.DeleteKitCart(entity.KitCartRecId);
     return(entity);
 }
Beispiel #4
0
        public virtual KitCart InsertKitCart(KitCart entity)
        {
            KitCart other = new KitCart();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into KitCart ( [CustomerID]
				,[ShoppingCartRecID]
				,[ProductID]
				,[VariantID]
				,[KitGroupID]
				,[KitGroupTypeID]
				,[KitItemID]
				,[Quantity]
				,[CartType]
				,[OriginalRecurringOrderNumber]
				,[TextOption]
				,[InventoryVariantID]
				,[InventoryVariantColor]
				,[InventoryVariantSize]
				,[ExtensionData]
				,[CreatedOn] )
				Values
				( @CustomerID
				, @ShoppingCartRecID
				, @ProductID
				, @VariantID
				, @KitGroupID
				, @KitGroupTypeID
				, @KitItemID
				, @Quantity
				, @CartType
				, @OriginalRecurringOrderNumber
				, @TextOption
				, @InventoryVariantID
				, @InventoryVariantColor
				, @InventoryVariantSize
				, @ExtensionData
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@KitCartRecID", entity.KitCartRecId)
                    , new SqlParameter("@CustomerID", entity.CustomerId)
                    , new SqlParameter("@ShoppingCartRecID", entity.ShoppingCartRecId)
                    , new SqlParameter("@ProductID", entity.ProductId)
                    , new SqlParameter("@VariantID", entity.VariantId)
                    , new SqlParameter("@KitGroupID", entity.KitGroupId)
                    , new SqlParameter("@KitGroupTypeID", entity.KitGroupTypeId)
                    , new SqlParameter("@KitItemID", entity.KitItemId)
                    , new SqlParameter("@Quantity", entity.Quantity)
                    , new SqlParameter("@CartType", entity.CartType)
                    , new SqlParameter("@OriginalRecurringOrderNumber", entity.OriginalRecurringOrderNumber ?? (object)DBNull.Value)
                    , new SqlParameter("@TextOption", entity.TextOption ?? (object)DBNull.Value)
                    , new SqlParameter("@InventoryVariantID", entity.InventoryVariantId ?? (object)DBNull.Value)
                    , new SqlParameter("@InventoryVariantColor", entity.InventoryVariantColor ?? (object)DBNull.Value)
                    , new SqlParameter("@InventoryVariantSize", entity.InventoryVariantSize ?? (object)DBNull.Value)
                    , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetKitCart(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Beispiel #5
0
 public KitCart InsertKitCart(KitCart entity)
 {
     return(_iKitCartRepository.InsertKitCart(entity));
 }
Beispiel #6
0
 public KitCart UpdateKitCart(KitCart entity)
 {
     return(_iKitCartRepository.UpdateKitCart(entity));
 }