/// <summary> /// Adds secuity entry. /// </summary> /// <param name="Description"></param> /// <param name="protocol"></param> /// <param name="type"></param> /// <param name="action"></param> /// <param name="content"></param> /// <param name="startIP"></param> /// <param name="endIP"></param> /// <returns></returns> public DataRow AddSecurityEntry(string Description,string protocol,string type,string action,string content,long startIP,long endIP) { DataRow retVal = null; switch(m_DB_Type) { #region DB_Type.XML case DB_Type.XML: DataSet dsSecurityCopy = dsSecurity.Copy(); DataRow dr = dsSecurityCopy.Tables["Security_List"].NewRow(); dr["SecurityID"] = Guid.NewGuid().ToString(); dr["Description"] = Description; dr["Protocol"] = protocol; dr["Type"] = type; dr["Content"] = content; dr["Action"] = action; dr["StartIP"] = startIP; dr["EndIP"] = endIP; dsSecurityCopy.Tables["Security_List"].Rows.Add(dr); dsSecurityCopy.WriteXml(m_DataPath + "Security.xml",XmlWriteMode.IgnoreSchema); retVal = dr; break; #endregion #region DB_Type.MSSQL case DB_Type.MSSQL: using(WSqlCommand sqlCmd = new WSqlCommand(m_ConStr,"lspr_AddSecurityEntry")){ sqlCmd.AddParameter("@Description" ,SqlDbType.NVarChar,Description); sqlCmd.AddParameter("@Protocol" ,SqlDbType.NVarChar,protocol); sqlCmd.AddParameter("@Type" ,SqlDbType.NVarChar,type); sqlCmd.AddParameter("@Action" ,SqlDbType.NVarChar,action); sqlCmd.AddParameter("@Content" ,SqlDbType.NVarChar,content); sqlCmd.AddParameter("@StartIP" ,SqlDbType.NVarChar,startIP); sqlCmd.AddParameter("@EndIP" ,SqlDbType.NVarChar,endIP); DataSet ds = sqlCmd.Execute(); ds.Tables[0].TableName = "Security_List"; if(ds.Tables["Security_List"].Rows.Count > 0){ return ds.Tables["Security_List"].Rows[0]; } } break; #endregion #region DB_Type.WebServices case DB_Type.WebServices: using(RemoteAdmin eng = new RemoteAdmin()){ _Core.InitWebService(m_WebServicesUrl,m_WebServicesPwd,m_WebServicesUser,eng); return eng.AddSecurityEntry(Description,protocol,type,action,content,startIP,endIP).Tables["Security_List"].Rows[0]; } #endregion } return retVal; }