private static void DownloadTBProps()
        {
            using (TaoBaoDataContext tbCon = new TaoBaoDataContext())
            {
                //先清空TB_ItemProp表
                var allItemProp = tbCon.TB_ItemProps.ToList<TB_ItemProp>();
                List<ItemProp> itemproplist = new List<ItemProp>();
                var itemcatlist = tbCon.TB_ItemCats.ToList<TB_ItemCat>();
                List<ItemProp> itempropinsert = new List<ItemProp>();
                //获取ItemProp中所有字段
                string fieldsitemprop = @"child_template,cid,is_allow_alias,is_color_prop,is_enum_prop,is_input_prop,is_item_prop,is_key_prop,
            is_sale_prop,modified_time,modified_type,multi,must,name,parent_pid,parent_vid,pid,required,sort_order,status,type";
                foreach (var item in itemcatlist)
                {
                    if (item.IsParent == false)
                    {
                        //如果是叶子类目 调用API获取属性列表
                        List<ItemProp> tempitemprop = ProductService.GetItemprops(item.Cid, fieldsitemprop, null, null, null, null, null, null, null, null, null, 1, null);
                        foreach (var tempitem in tempitemprop)
                        {
                            tempitem.Cid = item.Cid;
                        }
                        itemproplist.AddRange(tempitemprop);
                    }
                }
                //先判断数据库里是否存在,不存在的数据才需要插入
                if (allItemProp != null && allItemProp.Count() > 0)
                {
                    foreach (var itemprop in itemproplist)
                    {
                        if (allItemProp.Where(i => i.Pid == itemprop.Pid && i.Cid == itemprop.Cid && i.Name == itemprop.Name).FirstOrDefault() == null)
                        {
                            itempropinsert.Add(itemprop);
                        }
                    }
                }
                else
                {
                    itempropinsert.AddRange(itemproplist);
                }
                if (itempropinsert != null && itempropinsert.Count > 0)
                {
                    //插入TB_ItemProp表
                    foreach (var item in itempropinsert)
                    {
                        TB_ItemProp obj = new TB_ItemProp();
                        obj.ID = Guid.NewGuid();
                        obj.Cid = item.Cid;
                        obj.Pid = item.Pid;
                        obj.ParentPid = item.ParentPid;
                        obj.ParentVid = item.ParentVid;
                        obj.ChildTemplate = item.ChildTemplate;
                        obj.IsAllowAlias = item.IsAllowAlias;
                        obj.IsColorProp = item.IsColorProp;
                        obj.IsEnumProp = item.IsEnumProp;
                        obj.IsInputProp = item.IsInputProp;
                        obj.IsItemProp = item.IsItemProp;
                        obj.IsKeyProp = item.IsKeyProp;
                        obj.IsSaleProp = item.IsSaleProp;
                        if (string.IsNullOrEmpty(item.ModifiedTime) == false)
                        {
                            obj.ModifiedTime = DateTime.Parse(item.ModifiedTime);
                        }
                        obj.ModifiedType = item.ModifiedType;
                        obj.Multi = item.Multi;
                        obj.Must = item.Must;
                        obj.Name = item.Name;
                        obj.Required = item.Required;
                        obj.SortOrder = item.SortOrder;
                        obj.Status = item.Status;
                        tbCon.TB_ItemProps.InsertOnSubmit(obj);
                    }
                }
                tbCon.SubmitChanges();

            }
        }
 partial void UpdateTB_ItemProp(TB_ItemProp instance);
 partial void DeleteTB_ItemProp(TB_ItemProp instance);
 partial void InsertTB_ItemProp(TB_ItemProp instance);