Ejemplo n.º 1
0
 public bool IsInitDocument(string tagName, string tagValue, bool IsInternalPluginUsed, string configKey)
 {
     if (_configDoc == null)
     {
         return(false);
     }
     else
     {
         XmlNode rootNode = _configDoc.SelectSingleNode("/root");
         if (rootNode == null)
         {
             return(false);
         }
         else
         {
             if (!IsInternalPluginUsed || refInternalPlugin == null)
             {
                 return(Util_XmlOperHelper.GetNodeValue(tagName, rootNode) == tagValue ? true : false);
             }
             else
             {
                 string result = "";
                 Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
                 paramsDirc.Add("key", configKey);
                 paramsDirc.Add("value", tagValue);
                 paramsDirc.Add("return", "");
                 refInternalPlugin.actionSet(paramsDirc);
                 result = paramsDirc["return"].ToString();
                 return(Util_XmlOperHelper.GetNodeValue(tagName, rootNode) == result ? true : false);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public string GetSessionValue(string SessionName, bool IsInternalPluginUsed, string configKey)
        {
            if (SessionName == "")
            {
                return("");
            }
            else
            {
                XmlNode activeSessionNode = GetSessionNode(SessionName);
                string  result            = "";
                if (activeSessionNode != null)
                {
                    string value = Util_XmlOperHelper.GetNodeValue("", activeSessionNode);
                    result = value;
                    if (IsInternalPluginUsed && refInternalPlugin != null)
                    {
                        Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
                        paramsDirc.Add("key", configKey);
                        paramsDirc.Add("value", value);
                        paramsDirc.Add("return", "");
                        refInternalPlugin.actionGet(paramsDirc);
                        result = paramsDirc["return"].ToString();
                    }
                }

                return(result);
            }
        }
Ejemplo n.º 3
0
        public bool SetSessionAttr(string SessionName, string AttrName, string AttrValue, bool IsInternalPluginUsed, string configKey)
        {
            if (SessionName == "" || AttrName == "")
            {
                return(false);
            }
            string activeAttrValue = AttrValue;
            string result          = AttrValue;

            if (IsInternalPluginUsed && refInternalPlugin != null)
            {
                Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
                paramsDirc.Add("key", configKey);
                paramsDirc.Add("value", AttrValue);
                paramsDirc.Add("return", "");
                refInternalPlugin.actionGet(paramsDirc);
                result = paramsDirc["return"].ToString();
            }
            XmlNode activeSessionNode = GetSessionNode(SessionName);

            if (activeSessionNode != null)
            {
                Util_XmlOperHelper.SetAttribute(activeSessionNode, AttrName, result);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 public string GetNodeValue(XmlNode activeNode, bool IsInternalPluginUsed, string configKey)
 {
     if (activeNode != null)
     {
         string sourceData = Util_XmlOperHelper.GetNodeValue("", activeNode);
         string resultData = "";
         if (IsInternalPluginUsed && refInternalPlugin != null)
         {
             Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
             paramsDirc.Add("key", configKey);
             paramsDirc.Add("value", sourceData);
             paramsDirc.Add("return", "");
             refInternalPlugin.actionGet(paramsDirc);
             resultData = paramsDirc["return"].ToString();
         }
         else
         {
             resultData = sourceData;
         }
         return(resultData);
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 5
0
        public XmlNode CreateItem(XmlNode activeParentNode, string ItemName, string ItemValue, bool IsInternalPluginUsed, string configKey)
        {
            if (activeParentNode == null)
            {
                return(null);
            }
            string result = ItemValue;

            if (IsInternalPluginUsed && refInternalPlugin != null)
            {
                Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
                paramsDirc.Add("key", configKey);
                paramsDirc.Add("value", ItemValue);
                paramsDirc.Add("return", "");
                refInternalPlugin.actionSet(paramsDirc);
                result = paramsDirc["return"].ToString();
            }
            try
            {
                XmlNode newItemNode = Util_XmlOperHelper.CreateNode(_configDoc, "item", result);
                Util_XmlOperHelper.SetAttribute(newItemNode, "name", ItemName);
                activeParentNode.AppendChild(newItemNode);
                return(newItemNode);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
 public bool SetInitDocument(string tagName, string tagValue, bool IsInternalPluginUsed, string configKey)
 {
     if (_configDoc == null)
     {
         return(false);
     }
     else
     {
         XmlNode rootNode = _configDoc.SelectSingleNode("/root");
         if (rootNode == null)
         {
             return(false);
         }
         else
         {
             string result = "";
             if (IsInternalPluginUsed && refInternalPlugin != null)
             {
                 Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
                 paramsDirc.Add("key", configKey);
                 paramsDirc.Add("value", tagValue);
                 paramsDirc.Add("return", "");
                 refInternalPlugin.actionSet(paramsDirc);
                 result = paramsDirc["return"].ToString();
             }
             Util_XmlOperHelper.SetAttribute(rootNode, tagName, IsInternalPluginUsed ? result : tagValue);
             return(true);
         }
     }
 }
Ejemplo n.º 7
0
 public static string ActionConvertDTtoXMLString(DataTable activeDataTable)
 {
     if (activeDataTable == null)
     {
         return(string.Empty);
     }
     else
     {
         XmlDocument resultDoc = new XmlDocument();
         resultDoc.LoadXml("<root></root>");
         XmlNode rootNode = resultDoc.SelectSingleNode("/root");
         int     rowIndex = 1;
         foreach (DataRow dr in activeDataTable.Rows)
         {
             XmlNode newRowNode = Util_XmlOperHelper.CreateNode(resultDoc, "row", "");
             Util_XmlOperHelper.SetAttribute(newRowNode, "index", rowIndex.ToString());
             foreach (DataColumn dc in activeDataTable.Columns)
             {
                 string columnValue = "";
                 GetColumnData(dr, dc.ColumnName, out columnValue);
                 Util_XmlOperHelper.SetAttribute(newRowNode, dc.ColumnName, columnValue);
             }
             rootNode.AppendChild(newRowNode);
         }
         Util_XmlOperHelper.SetAttribute(rootNode, "itemcount", rowIndex.ToString());
         return(resultDoc.OuterXml);
     }
 }
Ejemplo n.º 8
0
        public Basic_Exceptions()
        {
            string        exceptionLogDir = Environment.CurrentDirectory + "\\" + "exceptions";
            DirectoryInfo objDir          = new DirectoryInfo(exceptionLogDir);

            if (!objDir.Exists)
            {
                try
                {
                    objDir.Create();
                }
                catch
                {
                    return;
                }
            }
            else
            {
                string     exceptionLogFile = "Exception_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xml";
                FileInfo   objFi            = new FileInfo(exceptionLogDir + "\\" + exceptionLogFile);
                FileStream objFS;
                if (!objFi.Exists)
                {
                    try
                    {
                        objFS = new FileStream(exceptionLogFile, FileMode.Create);
                        StreamWriter objSW = new StreamWriter(objFS);
                        objSW.WriteLine("<root></root>");
                        objSW.Flush();
                        objSW.Close();
                        objFS.Close();
                    }
                    catch
                    {
                        return;
                    }
                }
                XmlDocument exceptionLogDoc = new XmlDocument();
                exceptionLogDoc.Load(exceptionLogFile);
                XmlNode rootNode = exceptionLogDoc.SelectSingleNode("/root");
                XmlNode newItem  = Util_XmlOperHelper.CreateNode(exceptionLogDoc, "item", "");
                Util_XmlOperHelper.SetAttribute(newItem, "message", Message);
                Util_XmlOperHelper.SetAttribute(newItem, "time", DateTime.Now.ToString());
                Util_XmlOperHelper.SetAttribute(newItem, "stake", StackTrace.ToString());
                rootNode.AppendChild(newItem);
                try
                {
                    lock (exceptionLogDoc)
                    {
                        exceptionLogDoc.Save(exceptionLogFile);
                    }
                }
                catch
                {
                    return;
                }
            }
        }
Ejemplo n.º 9
0
 public bool SetItemAttr(XmlNode Item, string AttrName, string AttrValue)
 {
     if (Item == null)
     {
         return(false);
     }
     else
     {
         string result = AttrValue;
         if (isDesMode)
         {
             result = _objectDes.AesEncrypt(AttrValue);
         }
         Util_XmlOperHelper.SetAttribute(Item, AttrName, result);
         return(true);
     }
 }
Ejemplo n.º 10
0
 public string GetItemValue(XmlNode parentNode)
 {
     if (parentNode == null)
     {
         return("");
     }
     else
     {
         string attrResult = Util_XmlOperHelper.GetNodeValue("", parentNode);
         string Result     = attrResult;
         if (isDesMode)
         {
             Result = _objectDes.AesDecrypt(attrResult);
         }
         return(Result);
     }
 }
Ejemplo n.º 11
0
 public string GetAttrValue(XmlNode ActiveNode, string AttrName)
 {
     if (ActiveNode == null)
     {
         return("");
     }
     else
     {
         string attrResult = Util_XmlOperHelper.GetAttrValue(ActiveNode, AttrName);
         string result     = attrResult;
         if (isDesMode)
         {
             result = _objectDes.AesDecrypt(attrResult);
         }
         return(result);
     }
 }
Ejemplo n.º 12
0
 public string GetItemValue(string SessionName, string ItemName)
 {
     if (SessionName == "" || ItemName == "")
     {
         return("");
     }
     else
     {
         XmlNode activeItemNode = GetItemNode(SessionName, ItemName);
         string  attrResult     = Util_XmlOperHelper.GetNodeValue("", activeItemNode);
         string  Result         = attrResult;
         if (isDesMode)
         {
             Result = _objectDes.AesDecrypt(attrResult);
         }
         return(Result);
     }
 }
Ejemplo n.º 13
0
 public string GetNodeValue(XmlNode activeNode)
 {
     if (activeNode != null)
     {
         string sourceData = Util_XmlOperHelper.GetNodeValue("", activeNode);
         string resultData = "";
         resultData = sourceData;
         if (isDesMode)
         {
             resultData = _objectDes.AesDecrypt(sourceData);
         }
         return(resultData);
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 14
0
 public string GetItemValue(XmlNode parentNode, bool IsInternalPluginUsed, string configKey)
 {
     if (parentNode == null)
     {
         return("");
     }
     else
     {
         string attrResult = Util_XmlOperHelper.GetNodeValue("", parentNode);
         string Result     = attrResult;
         if (IsInternalPluginUsed && refInternalPlugin != null)
         {
             Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
             paramsDirc.Add("key", configKey);
             paramsDirc.Add("value", attrResult);
             paramsDirc.Add("return", "");
             refInternalPlugin.actionGet(paramsDirc);
             Result = paramsDirc["return"].ToString();
         }
         return(Result);
     }
 }
Ejemplo n.º 15
0
 public bool SetItemAttr(XmlNode Item, string AttrName, string AttrValue, bool IsInternalPluginUsed, string configKey)
 {
     if (Item == null)
     {
         return(false);
     }
     else
     {
         string result = AttrValue;
         if (IsInternalPluginUsed && refInternalPlugin != null)
         {
             Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
             paramsDirc.Add("key", configKey);
             paramsDirc.Add("value", AttrValue);
             paramsDirc.Add("return", "");
             refInternalPlugin.actionSet(paramsDirc);
             result = paramsDirc["return"].ToString();
         }
         Util_XmlOperHelper.SetAttribute(Item, AttrName, result);
         return(true);
     }
 }
Ejemplo n.º 16
0
 public XmlNode CreateNewSession(string SessionName, string SessionValue)
 {
     if (SessionName == "")
     {
         return(null);
     }
     else
     {
         string sessionValueResult = "";
         if (isDesMode)
         {
             sessionValueResult = _objectDes.AesEncrypt(SessionValue);
         }
         else
         {
             sessionValueResult = SessionValue;
         }
         XmlNode newSessionNode = Util_XmlOperHelper.CreateNode(_configDoc, "session", sessionValueResult);
         Util_XmlOperHelper.SetAttribute(newSessionNode, "name", SessionName);
         _configDoc.SelectSingleNode("/root").AppendChild(newSessionNode);
         return(newSessionNode);
     }
 }
Ejemplo n.º 17
0
 public XmlNode CreateNewSession(string SessionName, string SessionValue, bool IsInternalPluginUsed, string configKey)
 {
     if (SessionName == "")
     {
         return(null);
     }
     else
     {
         string result = SessionValue;
         if (IsInternalPluginUsed && refInternalPlugin != null)
         {
             Dictionary <string, string> paramsDirc = new Dictionary <string, string>();
             paramsDirc.Add("key", configKey);
             paramsDirc.Add("value", SessionValue);
             paramsDirc.Add("return", "");
             refInternalPlugin.actionSet(paramsDirc);
             result = paramsDirc["return"].ToString();
         }
         XmlNode newSessionNode = Util_XmlOperHelper.CreateNode(_configDoc, "session", result);
         Util_XmlOperHelper.SetAttribute(newSessionNode, "name", SessionName);
         _configDoc.SelectSingleNode("/root").AppendChild(newSessionNode);
         return(newSessionNode);
     }
 }
Ejemplo n.º 18
0
        public XmlNode CreateItem(XmlNode activeParentNode, string ItemName, string ItemValue)
        {
            if (activeParentNode == null)
            {
                return(null);
            }
            string result = ItemValue;

            try
            {
                if (isDesMode)
                {
                    result = _objectDes.AesEncrypt(ItemValue);
                }
                XmlNode newItemNode = Util_XmlOperHelper.CreateNode(_configDoc, "item", result);
                Util_XmlOperHelper.SetAttribute(newItemNode, "name", ItemName);
                activeParentNode.AppendChild(newItemNode);
                return(newItemNode);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 19
0
        public bool SetSessionAttr(string SessionName, string AttrName, string AttrValue)
        {
            if (SessionName == "" || AttrName == "")
            {
                return(false);
            }
            string  activeAttrValue   = AttrValue;
            string  result            = AttrValue;
            XmlNode activeSessionNode = GetSessionNode(SessionName);

            if (activeSessionNode != null)
            {
                if (isDesMode)
                {
                    result = _objectDes.AesEncrypt(AttrValue);
                }
                Util_XmlOperHelper.SetAttribute(activeSessionNode, AttrName, result);
                return(true);
            }
            else
            {
                return(false);
            }
        }