Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
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);
         }
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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;
                }
            }
        }
Exemplo n.º 6
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);
     }
 }
Exemplo n.º 7
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);
     }
 }
Exemplo n.º 8
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);
     }
 }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
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);
     }
 }