Esempio n. 1
0
 public void CloneAs(DataItems DItems)
 {
     try
     {
         DataItem NewItem;
         DataItem CurrItem;
         this.mCol.clear();
         this.Name  = DItems.Name;
         this.Value = DItems.Value;
         for (int i = 0; i < DItems.Count(); i++)
         {
             NewItem  = new DataItem();
             CurrItem = DItems.Item(i);
             NewItem.CloneAs(CurrItem);
             this.Add(NewItem);
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 2
0
        public static string GetXml(DataItems DIs)
        {
            try
            {
                ////XElement xe = new XElement("Company", new XAttribute("MyName", "C Y"), new XElement("CompanyName", "ASM"), new XElement("CompanyAddress", new XElement("Country", "Singapore")));
                ////Console.WriteLine(xe.ToString());
                string   ceName = DIs.Name;
                XElement xe     = new XElement("CEID");
                xe.Add(new XAttribute("logicalName", ceName));

                for (int i = 0; i < DIs.Count(); i++)
                {
                    DataItem rptLayer = DIs.Item(i);
                    string   rptName  = rptLayer.Name;
                    xe.Add(new XElement("RPTID", new XAttribute("logicalName", rptName)));

                    for (int j = 0; j < rptLayer.Children.Count(); j++)
                    {
                        DataItem svLayer = rptLayer.Children.Item(j);
                        string   svName  = svLayer.Name;
                        string   svValue = svLayer.Value.ToString();

                        var query = from item in xe.Elements("RPTID")
                                    where item.Attribute("logicalName").Value == rptName
                                    select item;

                        foreach (XElement rptitem in query)
                        {
                            rptitem.Add(new XElement("ReportVariable", svValue, new XAttribute("logicalName", svName)));
                        }
                    }
                }
                return(xe.ToString());
            }
            catch (Exception ex)
            {
                logger.Logline(">>>Error Occur in GetXml:" + ex.Message + "\nStack Trace:\n" + ex.StackTrace + "\n");
            }
            return("");
        }