/// <summary> /// If channel item dont have the value and if it has only one associated master item then fill the master item value to channel. /// </summary> /// <param name="objChannel"></param> /// <param name="itemRow"></param> /// <param name="lstItemAssociationsRow"></param> private void CheckKititemWithSingleAssociation(ref ChannelSale objChannel, dsItemDetail.ItemsRow itemRow, List<dsItemDetail.ItemAssociationsRow> lstItemAssociationsRow) { try { if (!itemRow.Isitem_type_idNull()) { objChannel.Master = (itemRow.item_type_id == 3 ? "1" : string.Empty); if (!itemRow.Isitem_sub_type_idNull() && 1 == itemRow.item_sub_type_id && 1 == itemRow.item_type_id) { objChannel.ChildItem = "1"; if (string.IsNullOrEmpty(Convert.ToString(objChannel.FreeShipping.Trim())) && !itemRow.Isitem_wholesale_priceNull()) objChannel.FreeShipping = (itemRow.item_wholesale_price >= 100M ? "Yes" : "No"); } if (1 == itemRow.item_type_id && !itemRow.Ismaster_guidNull() && !itemRow.Ismaster_item_cdNull()) objChannel.AssociatedMaster = itemRow.master_item_cd; } //Kit item if (!itemRow.Isitem_type_idNull() && !itemRow.Isitem_sub_type_idNull() && 1 == itemRow.item_type_id && 2 == itemRow.item_sub_type_id && null != lstItemAssociationsRow && 1 == lstItemAssociationsRow.Count && !lstItemAssociationsRow[0].Isitem_guidNull()) { objChannel.IsNeedKitItemData = true; objChannel.AssociatedMasterItemGuid = lstItemAssociationsRow[0].item_guid; } } catch (Exception ex) { Console.WriteLine("EXCEPTION. While CheckKititemWithSingleAssociation: " + ex.Message); log.Error("CheckKititemWithSingleAssociation: ", ex); } }
/// <summary> /// Add the BF item vendor details to channel feed. /// </summary> /// <param name="objChannel"></param> /// <param name="itemVendorsRow"></param> private void AddItemVendorToChannel(ref ChannelSale objChannel, dsItemDetail.ItemVendorsRow itemVendorsRow) { try { if (null != itemVendorsRow && !itemVendorsRow.Isvendor_item_cdNull()) objChannel.ManufacturerModel = (itemVendorsRow.vendor_item_cd.Length > 40 ? itemVendorsRow.vendor_item_cd.Substring(0, 39) : itemVendorsRow.vendor_item_cd); } catch (Exception ex) { Console.WriteLine("EXCEPTION. While AddItemVendorToChannel: " + ex.Message); log.Error("AddItemVendorToChannel: ", ex); } }
/// <summary> /// Add the BF item details to channel feed. /// </summary> /// <param name="objChannel"></param> /// <param name="itemRow"></param> private void AddItemdetailToChannel(ref ChannelSale objChannel, dsItemDetail.ItemsRow itemRow, bool isKitAssociatedItem = false) { PropertyDescriptorCollection pdCollectionChannel = null; try { pdCollectionChannel = TypeDescriptor.GetProperties(objChannel); foreach (PropertyDescriptor pdChannel in pdCollectionChannel) { PropertyInfo pInfo = null; if (!string.IsNullOrEmpty(pdChannel.Description) && itemRow.Table.Columns.Contains(pdChannel.Description) && itemRow[pdChannel.Description] != DBNull.Value) { //if (!isKitAssociatedItem || !strRemoveKitAssociatedItem.Split(',').Contains(pdChannel.Name)) if (!isKitAssociatedItem || strKitAssociatedItemAttributes.Split(',').Contains(pdChannel.Name)) { pInfo = objChannel.GetType().GetProperty(pdChannel.Name); if (null != pInfo && string.IsNullOrEmpty(Convert.ToString(pInfo.GetValue(objChannel, null)))) pdChannel.SetValue(objChannel, Convert.ToString(itemRow[pdChannel.Description])); } } } } catch (Exception ex) { Console.WriteLine("EXCEPTION. While AddItemdetailToChannel: " + ex.Message); log.Error("\n AddItemdetailToChannel: ", ex); } }
/// <summary> /// Get the item available and stock quantity from item site. /// </summary> /// <param name="objChannel"></param> /// <param name="itemSitesRow"></param> private void AddItemSitesToChannel(ref ChannelSale objChannel, dsItemDetail.ItemSitesRow itemSitesRow) { try { if (null != itemSitesRow && !itemSitesRow.Issite_quantity_on_handNull() && !itemSitesRow.Issite_quantity_on_holdNull()) { objChannel.AvailableInventory = Convert.ToString(itemSitesRow.site_quantity_on_hand - itemSitesRow.site_quantity_on_hold); objChannel.StockQuantity = Convert.ToString(itemSitesRow.site_quantity_on_hand - itemSitesRow.site_quantity_on_hold); } } catch (Exception ex) { Console.WriteLine("EXCEPTION. While AddItemSitesToChannel: " + ex.Message); log.Error("AddItemSitesToChannel: ", ex); } }
/// <summary> /// Add the BF item catalog details to channel feed. /// </summary> /// <param name="objChannel"></param> /// <param name="itemCatalogsRow"></param> private void AddItemCatalogToChannel(ref ChannelSale objChannel, dsItemDetail.ItemCatalogsRow itemCatalogsRow) { try { if (null != itemCatalogsRow) objChannel.ProductURL = string.Format("http://www.babyhaven.com/product_details.aspx?item_guid={0}", itemCatalogsRow.item_guid); } catch (Exception ex) { Console.WriteLine("EXCEPTION. While AddItemCatalogToChannel: " + ex.Message); log.Error("AddItemCatalogToChannel: ", ex); } }