コード例 #1
0
        public void addOrder(Order order)
        {
            order.OrderKey = getAndUpdateOrderConfig();

            XElement HostingUnitKey  = new XElement("HostingUnitKey", order.HostingUnitKey);
            XElement GuestRequestKey = new XElement("GuestRequestKey", order.GuestRequestKey);
            XElement OrderKey        = new XElement("OrderKey", order.OrderKey);
            XElement Status          = new XElement("Status", order.Status);
            XElement CreateDate      = new XElement("CreateDate", order.CreateDate);
            XElement OrderDate       = new XElement("OrderDate", order.OrderDate);
            XElement isClosed        = new XElement("isClosed", order.isClosed);
            XElement isSendMail      = new XElement("isSendMail", order.isSendMail);

            OrderRoot.Add(new XElement("Order", HostingUnitKey, GuestRequestKey, OrderKey, Status, CreateDate, OrderDate, isClosed, isSendMail));
            OrderRoot.Save(OrderdPath);
        }
コード例 #2
0
        public bool deleteOrder(long key)
        {
            XElement OrderElement;

            try
            {
                OrderElement = (from item in OrderRoot.Elements()
                                where int.Parse(item.Element("OrderKey").Value) == key
                                select item).FirstOrDefault();
                OrderElement.Remove();
                OrderRoot.Save(OrderdPath);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #3
0
        public void updateOrder(Order order)
        {
            XElement orderElement = (from item in OrderRoot.Elements()
                                     where int.Parse(item.Element("OrderKey").Value) == order.OrderKey
                                     select item).FirstOrDefault();

            if (orderElement == null)
            {
                throw new Exception("ההזמנה לא נמצאה");
            }

            orderElement.Element("OrderKey").Value        = order.HostingUnitKey.ToString();
            orderElement.Element("CreateDate").Value      = order.CreateDate.ToString();
            orderElement.Element("GuestRequestKey").Value = order.GuestRequestKey.ToString();
            orderElement.Element("isClosed").Value        = order.isClosed.ToString();
            orderElement.Element("isSendMail").Value      = order.isSendMail.ToString();
            orderElement.Element("OrderDate").Value       = order.OrderDate.ToString();
            orderElement.Element("OrderKey").Value        = order.OrderKey.ToString();
            orderElement.Element("Status").Value          = order.Status.ToString();

            OrderRoot.Save(OrderdPath);
        }