示例#1
0
        private void BindingData()
        {
            Random rnd    = new Random();
            int    index1 = rnd.Next(_collection.Count());

            if (_collection[index1] is ItemMember)
            {
                ItemMember item1 = _collection[index1] as ItemMember;
                Img1Path = item1.ImgPath[0];
                Title1   = item1.Title;
                Info1    = item1.Info;

                int index2 = rnd.Next(_collection.Count());
                while (index1 == index2)
                {
                    index2 = rnd.Next(_collection.Count());
                }


                ItemMember item2 = _collection[index2] as ItemMember;
                Img2Path = item2.ImgPath[0];
                Title2   = item2.Title;
                Info2    = item2.Info;
            }
        }
        private ItemMemberInfo CreateItemMemberInfo(ItemMember itemMember)
        {
            var info = new ItemMemberInfo
            {
                name = itemMember.Item.Name.ToColonSeparated(_xHtml),
                doc  = _settings.IncludeDocumentation ? itemMember.Item.GetDocumentation() : null,
                refs = _settings.IncludeReferences ? CreateReferenceInfos(itemMember) : null
            };

            return(info);
        }
        private IList <ReferenceInfo> CreateReferenceInfos(ItemMember itemMember)
        {
            var knownRoles = new Dictionary <Uri, string> {
                [ReferenceRoles.Disclosure]     = "disclosure",
                [ReferenceRoles.Example]        = "example",
                [ReferenceRoles.CommonPractice] = "commonpractice",
            };

            var referenceNodes = itemMember.Item.GetReferenceNodes();

            return(referenceNodes.Select(rn =>
                                         new ReferenceInfo
            {
                type = knownRoles[rn.Role],
                loc = rn.ToString(),
                link = rn.Uri
            }).ToList());
        }
        private void PopulateItemMemberElement(XElement xContainer, ItemMember itemMember)
        {
            xContainer.Value = RemoveBracketedMarkers(itemMember.Label);
            xContainer.AddClass(InlineXbrlClassNames.ItemMember);

            if (itemMember.Item.IsAbstract)
            {
                xContainer.AddClass(InlineXbrlClassNames.AbstractMember);
            }

            var conceptMember = itemMember as ConceptMember;

            if (conceptMember != null && LabelRoles.Totals.Contains(conceptMember.PreferredLabelRole))
            {
                xContainer.AddClass(InlineXbrlClassNames.TotalMember);
            }

            xContainer.AddData("info", SerializeJson(CreateItemMemberInfo(itemMember)));
        }
示例#5
0
        public com.netsuite.webservices.AssemblyItem[] GenerateNetSuitelst(List <Item> Lst_Items)
        {
            Price[]   pricelst   = new Price[1];
            Pricing[] Pricinglst = new Pricing[1];
            com.netsuite.webservices.AssemblyItem[] ItemArr = new com.netsuite.webservices.AssemblyItem[Lst_Items.Count];
            try
            {
                for (int i = 0; i < Lst_Items.Count; i++)
                {
                    Item    Obj        = Lst_Items[i];
                    Setting objSetting = new GenericeDAO <Setting>().GetWhere("Subsidiary_Netsuite_Id=" + Obj.Subsidiary_Id).FirstOrDefault();
                    com.netsuite.webservices.AssemblyItem NewItemObject = new com.netsuite.webservices.AssemblyItem();
                    Categories.CategoriesAccounts         objCatAccount = new Categories.CategoriesAccounts();

                    // if (Obj.Netsuite_Id <= 0)
                    //{
                    NewItemObject.itemId      = Obj.UPC_Code;
                    NewItemObject.displayName = Obj.Display_Name_En;
                    //}


                    NewItemObject.trackLandedCost          = true;
                    NewItemObject.trackLandedCostSpecified = true;

                    if (Obj.Category_Id > 0)
                    {
                        RecordRef classref = new RecordRef();
                        classref.internalId  = Obj.Category_Id.ToString();
                        classref.type        = RecordType.classification;
                        NewItemObject.@class = classref;

                        objCatAccount = new GenericeDAO <Categories.CategoriesAccounts>().GetWhere("Netsuite_Id=" + Obj.Category_Id).FirstOrDefault();
                    }

                    #region Custom fields

                    Obj.Storage_Unit = string.IsNullOrEmpty(Obj.Storage_Unit) ? "" : Obj.Storage_Unit;

                    CustomFieldRef[] custFieldList = new CustomFieldRef[] {
                        new StringCustomFieldRef {
                            value    = !string.IsNullOrEmpty(Obj.Name_Ar)? Obj.Name_Ar.ToString():"",
                            scriptId = "custitem_da_item_name_ar"
                        }
                        ,
                        new StringCustomFieldRef {
                            value    = Obj.UPC_Code.ToString(),
                            scriptId = "custitem1"
                        }
                    };
                    NewItemObject.customFieldList = custFieldList;
                    #endregion
                    if (Obj.Netsuite_Id > 0)
                    {
                        NewItemObject.internalId = Obj.Netsuite_Id.ToString();
                    }

                    #region pricing

                    NewItemObject.pricingMatrix = Helper.GeneratePricingMatrix(objSetting, Obj.Price);
                    #endregion
                    #region AssemblyComponent

                    List <ItemCompnent> itemCompnentslst = new GenericeDAO <ItemCompnent>().GetWhere("ItemFoodics_Id ='" + Obj.Foodics_Id + "'");
                    if (itemCompnentslst.Count > 0)
                    {
                        ItemMember[]   ItemMemberlst = new ItemMember[itemCompnentslst.Count];
                        ItemMemberList memberlst     = new ItemMemberList();
                        for (int x = 0; x < itemCompnentslst.Count; x++)
                        {
                            ItemMember   obj        = new ItemMember();
                            ItemCompnent itmcompobj = itemCompnentslst[x];
                            RecordRef    Itemref    = new RecordRef();
                            Itemref.internalId = itmcompobj.ComponentId.ToString();
                            Itemref.type       = RecordType.inventoryItem;

                            obj.item = Itemref;

                            obj.quantity          = itmcompobj.Quantity == 0 ? 1 : itmcompobj.Quantity;
                            obj.quantitySpecified = true;
                            ItemMemberlst[x]      = obj;
                        }
                        memberlst.itemMember                = ItemMemberlst;
                        NewItemObject.memberList            = memberlst;
                        NewItemObject.memberList.replaceAll = true;
                    }



                    #endregion
                    #region Items Account
                    RecordRef IncomAccountref = new RecordRef();
                    IncomAccountref.type        = RecordType.account;
                    NewItemObject.incomeAccount = IncomAccountref;
                    if (objCatAccount.income_account > 0)
                    {
                        IncomAccountref.internalId = objCatAccount.income_account.ToString();
                    }
                    else if (objSetting.IncomeAccount_Netsuite_Id > 0)
                    {
                        IncomAccountref.internalId = objSetting.IncomeAccount_Netsuite_Id.ToString();
                    }

                    RecordRef cogsAccountref = new RecordRef();
                    cogsAccountref.type       = RecordType.account;
                    NewItemObject.cogsAccount = cogsAccountref;
                    if (objCatAccount.cogs_account > 0)
                    {
                        cogsAccountref.internalId = objCatAccount.cogs_account.ToString();
                    }
                    else if (objSetting.CogsAccount_Netsuite_Id > 0)
                    {
                        cogsAccountref.internalId = objSetting.CogsAccount_Netsuite_Id.ToString();
                    }

                    RecordRef assetAccountref = new RecordRef();
                    assetAccountref.type       = RecordType.account;
                    NewItemObject.assetAccount = assetAccountref;
                    if (objCatAccount.asset_account > 0)
                    {
                        assetAccountref.internalId = objCatAccount.asset_account.ToString();
                    }
                    else if (objSetting.AssetAccount_Netsuite_Id > 0)
                    {
                        assetAccountref.internalId = objSetting.AssetAccount_Netsuite_Id.ToString();
                    }

                    RecordRef intercoIncomeref = new RecordRef();
                    intercoIncomeref.type = RecordType.account;
                    NewItemObject.intercoIncomeAccount = intercoIncomeref;
                    if (objCatAccount.income_intercompany_account > 0)
                    {
                        intercoIncomeref.internalId = objCatAccount.income_intercompany_account.ToString();
                    }
                    else if (objSetting.IntercoIncomeAccount_Netsuite_Id > 0)
                    {
                        intercoIncomeref.internalId = objSetting.IntercoIncomeAccount_Netsuite_Id.ToString();
                    }

                    RecordRef intercoCogsAccount = new RecordRef();
                    intercoCogsAccount.type          = RecordType.account;
                    NewItemObject.intercoCogsAccount = intercoCogsAccount;
                    if (objCatAccount.inter_cogs_account > 0)
                    {
                        intercoCogsAccount.internalId = objCatAccount.inter_cogs_account.ToString();
                    }
                    else if (objSetting.IntercoCogsAccount_Netsuite_Id > 0)
                    {
                        intercoCogsAccount.internalId = objSetting.IntercoCogsAccount_Netsuite_Id.ToString();
                    }

                    RecordRef gainLossAccount = new RecordRef();
                    gainLossAccount.type          = RecordType.account;
                    NewItemObject.gainLossAccount = gainLossAccount;
                    if (objCatAccount.gainloss_account > 0)
                    {
                        gainLossAccount.internalId = objCatAccount.gainloss_account.ToString();
                    }
                    else if (objSetting.GainLossAccount_Netsuite_Id > 0)
                    {
                        gainLossAccount.internalId = objSetting.GainLossAccount_Netsuite_Id.ToString();
                    }


                    if (objCatAccount.cust_qty_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type                  = RecordType.account;
                        refgAccount.internalId            = objCatAccount.cust_qty_variance_account.ToString();
                        NewItemObject.billQtyVarianceAcct = refgAccount;
                    }

                    if (objCatAccount.cust_ex_rate_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.cust_ex_rate_account.ToString();
                        NewItemObject.billExchRateVarianceAcct = refgAccount;
                    }
                    if (objCatAccount.price_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.price_variance_account.ToString();
                        NewItemObject.billPriceVarianceAcct = refgAccount;
                    }

                    #endregion
                    RecordRef Tax_Schedule = new RecordRef();
                    Tax_Schedule.internalId   = objSetting.TaxSchedule_Netsuite_Id.ToString();
                    Tax_Schedule.type         = RecordType.salesTaxItem;
                    NewItemObject.taxSchedule = Tax_Schedule;
                    RecordRef[] subsidiarylst = new RecordRef[1];
                    RecordRef   subsidiary    = new RecordRef();
                    subsidiary.internalId        = Obj.Subsidiary_Id.ToString();
                    subsidiary.type              = RecordType.subsidiary;
                    subsidiarylst[0]             = subsidiary;
                    NewItemObject.subsidiaryList = subsidiarylst;

                    if (Obj.InActive)
                    {
                        NewItemObject.isInactive          = true;
                        NewItemObject.isInactiveSpecified = true;
                    }

                    ItemArr[i] = NewItemObject;
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            return(ItemArr);
        }
        //protected List<Model.ItemSubsidiary> subsidiaryListLocal = new List<Model.ItemSubsidiary>();
        //protected List<Model.Item> itemWithImages = new List<Model.Item>();
        //protected List<Model.ItemOptionListValue> ItemOptionList = new List<Model.ItemOptionListValue>();
        public override Int64 Set(string parametersArr)
        {
            List <Item> Lst_Items  = new GenericeDAO <Item>().GetWhere(" (Netsuite_Id IS NULL or Netsuite_Id =0) and Item_Type=" + (int)Item_Type.GiftCertificate);
            Setting     objSetting = new GenericeDAO <Setting>().GetAll().FirstOrDefault();

            if (objSetting == null)
            {
                return(0);
            }
            if (Lst_Items.Count <= 0)
            {
                return(0);
            }



            RecordRef[] subsidiarylst = new RecordRef[1];
            Price[]     pricelst      = new Price[1];
            Pricing[]   Pricinglst    = new Pricing[1];
            // AssemblyComponentList assemplyList = new AssemblyComponentList();
            ItemMemberList memberlst = new ItemMemberList();

            ItemMember[] ItemMemberlst = new ItemMember[1];
            com.netsuite.webservices.GiftCertificateItem[] ItemArr = new com.netsuite.webservices.GiftCertificateItem[Lst_Items.Count];
            for (int i = 0; i < Lst_Items.Count; i++)
            //for (int i = 0; i < 1; i++)
            {
                Item Obj = Lst_Items[i];

                com.netsuite.webservices.GiftCertificateItem NewItemObject = new com.netsuite.webservices.GiftCertificateItem();
                NewItemObject.displayName = Obj.Display_Name_En;
                NewItemObject.itemId      = Obj.UPC_Code;

                #region Custom fields

                if (!string.IsNullOrEmpty(Obj.Storage_Unit))
                {
                    CustomFieldRef[] custFieldList = new CustomFieldRef[] {
                        new StringCustomFieldRef {
                            value    = Obj.Storage_Unit.ToString(),
                            scriptId = "custitem_da_it_uom"
                        },
                    };
                    NewItemObject.customFieldList = custFieldList;
                }

                #endregion


                //obj.


                #region AssemblyComponent
                // AssemblyComponent obj = new AssemblyComponent();
                //obj.



                //ItemMember obj = new ItemMember();

                //RecordRef Itemref = new RecordRef();
                //Itemref.internalId = "612";//objSetting.Subsidiary_Netsuite_Id.ToString();
                //Itemref.type = RecordType.inventoryItem;

                //obj.item = Itemref;
                //obj.quantity = 1;



                //ItemMemberlst[0] = obj;


                //memberlst.itemMember = ItemMemberlst;
                //NewItemObject.memberList = memberlst;

                //NewItemObject.item
                ////NewItemObject.component
                #endregion
                RecordRef Tax_Schedule = new RecordRef();
                Tax_Schedule.internalId   = objSetting.TaxSchedule_Netsuite_Id.ToString();
                Tax_Schedule.type         = RecordType.salesTaxItem;
                NewItemObject.taxSchedule = Tax_Schedule;

                RecordRef subsidiary = new RecordRef();
                subsidiary.internalId        = objSetting.Subsidiary_Netsuite_Id.ToString();
                subsidiary.type              = RecordType.subsidiary;
                subsidiarylst[0]             = subsidiary;
                NewItemObject.subsidiaryList = subsidiarylst;


                RecordRef Liability = new RecordRef();
                Liability.internalId           = objSetting.LiabilityAccount_Netsuite_Id.ToString();
                Liability.type                 = RecordType.subsidiary;
                NewItemObject.liabilityAccount = Liability;


                if (Obj.InActive)
                {
                    NewItemObject.isInactive          = true;
                    NewItemObject.isInactiveSpecified = true;
                }

                ItemArr[i] = NewItemObject;
            }
            // Send order list to netsuite
            WriteResponseList wr = Service(true).addList(ItemArr);
            bool result          = wr.status.isSuccess;
            if (result)
            {
                //Update database with returned Netsuite ids
                UpdatedLst(Lst_Items, wr);
            }
            return(0);
        }