Example #1
0
        public static void Save(Common.OrderItem orderItem, string cs)
        {
            using (var ctx = new ExchangeDataContext(cs))
            {
                var o = new Order
                {
                    ClientId  = orderItem.ClientId,
                    PriceId   = orderItem.PriceId,
                    DealDate  = orderItem.Date,
                    DealValue = orderItem.Value
                };

                ctx.Orders.InsertOnSubmit(o);
                ctx.SubmitChanges();

                orderItem.Id = o.Id;
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            RemotingConfiguration.Configure("TestClient.exe.config", false);
            Console.WriteLine("Press <Enter> to terminate.");

            Common.OrderList list = new Common.OrderList();
            Common.OrderItem[] cenas = new Common.OrderItem[2];
            cenas[0] = new Common.OrderItem("sushi", 1);
            cenas[1] = new Common.OrderItem("abc", 2);
            Common.Order o = new Common.Order(list.GetCurrentId(), new Common.Client("hudur", "morada", "c"), cenas, 10);

            //list.OnNew += list.HandleOnNew;
            Common.OrderEventHandler hand = new Common.OrderEventHandler(list, Common.status.encomendada);
            list.OnNew += hand.HandleAddToOrders;

            //list.OnPreparing += new Common.OrderEventHandler().HandleOnPreparing;

            list.AddOrder(o);

            Console.Write(hand.relevant_orders.Count);
            Console.ReadLine();
            list.OnNew -= hand.HandleAddToOrders;
        }