Ejemplo n.º 1
0
        public static void CreateNewOrder(ClientContext ctx, Order order)
        {
            List     list = ctx.Web.GetListByTitle("Customer Orders");
            ListItem item = list.AddItem(new ListItemCreationInformation());

            item["SW_Customer"]    = order.Customer;
            item["SW_AmountMoney"] = order.Amount;
            item.Update();

            TermCollection termCollection = OrderListHelper.GetTaxonomyTermSet(ctx);
            List <KeyValuePair <Guid, String> > products_ordered = new List <KeyValuePair <Guid, string> >();

            foreach (var termItem in termCollection)
            {
                foreach (var productItem in order.Products)
                {
                    if (termItem.Name.ToString() == productItem)
                    {
                        products_ordered.Add(new KeyValuePair <Guid, string>(termItem.Id, termItem.Name.ToString()));
                    }
                }
            }
            item.SetTaxonomyFieldValues("{854C4414-A6AB-46B2-A18B-D8BD4C46E960}".ToGuid(), products_ordered);

            ctx.ExecuteQuery();
        }
Ejemplo n.º 2
0
        public static List <Customer> GetCustomerWithoutOrder(ClientContext ctx)
        {
            List <Customer> customerList         = ReturnCustomerList(ctx);
            List <Customer> customerListToReturn = new List <Customer>();
            List <Order>    orderList            = OrderListHelper.GetAllOrders(ctx);

            foreach (Customer item in customerList)
            {
                if (!orderList.Any(x => x.CustomerName == item.Title))
                {
                    customerListToReturn.Add(GetCustomerFromSharepoint(item.Id, ctx));
                }
            }
            return(customerListToReturn);
        }