Пример #1
0
        private void AddActivity()
        {
            CustomerActivity ca = new CustomerActivity();
            ca.Timestamp = dtPicker.Value;
            ca.Type = cmdTypeOfActivity.SelectedItem.ToString();
            ca.Note = txtNote.Text;

            CustomerManager.AddActivity(txtCustomerNo.Text, ca);
        }
Пример #2
0
        public void AddActivity(String customerNo, CustomerActivity customerActivity)
        {
            XDocument xDoc = XDocument.Load(this.DataSource);

            var dbElement = (from item in xDoc.Descendants("Customers").Descendants("Customer")
                             where item.Attribute("number").Value == customerNo
                             select item).FirstOrDefault();

            if (dbElement != null)
            {
                dbElement.Element("Activities").Add(GetCustomerActivityElement(customerActivity));

                xDoc.Save(this.DataSource);
            }
        }
Пример #3
0
        public static void AddActivity(String customerNo, CustomerActivity ca)
        {
            CustomerDataLayer cDL = GetDataLayer();

            cDL.AddActivity(customerNo, ca);
        }
Пример #4
0
        private XElement GetCustomerActivityElement(CustomerActivity ca)
        {
            XElement xElement = new XElement("Activity",
                new XElement("Timestamp", ca.Timestamp),
                new XElement("Type", ca.Type),
                new XElement("Note", ca.Note));

            return xElement;
        }