Exemplo n.º 1
0
        public static string ValidateNewID(string aID, XmlNode aParentNode)
        {
            int    lNumber = 0;
            string lResult = aID;
            bool   lIDisOk = true;

            if (aParentNode != null && aParentNode.ChildNodes.Count > 0)
            {
                lIDisOk = false;
                while (!lIDisOk)
                {
                    foreach (XmlNode iNode in aParentNode.ChildNodes)
                    {
                        lIDisOk = lNumber > 0 ?
                                  XmlTools.GetAttrib(iNode, XMLa_ID).ToUpper() + lNumber.ToString() != aID.ToUpper() + lNumber.ToString()
                                    :
                                  XmlTools.GetAttrib(iNode, XMLa_ID).ToUpper() != aID.ToUpper();

                        if (!lIDisOk)
                        {
                            lNumber++;
                            break;
                        }
                    }
                }
            }

            return(lNumber > 0 ? aID + lNumber.ToString() : aID);
        }
Exemplo n.º 2
0
        // If value cannot be converted to number, returns 0.
        public int GetAsInt(string iAttribute)
        {
            int  lResult  = 0;
            bool lSuccess = int.TryParse(XmlTools.GetAttrib(_DataNode, iAttribute), out lResult);

            return(lSuccess ? lResult : 0);
        }
Exemplo n.º 3
0
 public string this[string iAttribute]
 {
     get { return(XmlTools.GetAttrib(_DataNode, iAttribute)); }
     set
     {
         XmlTools.SetAttrib(_DataNode, iAttribute, value);
         if (PropertyChanged != null)
         {
             PropertyChanged(this);
         }
     }
 }
Exemplo n.º 4
0
        public static void ConvertToNew(string aFile)
        {
            CSecurityData lNewDoc = CSecurityData.CreateNew();
            XmlDocument   lOldDoc = new XmlDocument();

            lOldDoc.Load(aFile);
            XmlNode lRootNode = XmlTools.getXmlNodeByName("ReportSmartSecurity", lOldDoc);

            foreach (XmlNode iNode in lRootNode)
            {
                CSecurityNode iSecNode = CSecurityData.AddSecNode(
                    lNewDoc,
                    XmlTools.GetAttrib(iNode, "datasource"),
                    iNode.Name
                    );
                iSecNode.UserName = XmlTools.GetAttrib(iNode, "userid");
                iSecNode.Password = XmlTools.GetAttrib(iNode, "passwd");
            }
            lNewDoc.Save(aFile);
        }
Exemplo n.º 5
0
 // "yes" value means true, otherwise value is false.
 public bool GetAsBool(string iAttribute)
 {
     return(XmlTools.GetAttrib(_DataNode, iAttribute).ToUpper() == XMLv_YES.ToUpper());
 }