예제 #1
0
 /// <summary>
 /// Do record lock
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <param name="type">Lock type</param>
 /// <returns>Lock</returns>
 public LockStatus DoRecordLock(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo, EFWCFModule.EEPAdapter.LockType type)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (packetInfo == null)
     {
         throw new ArgumentNullException("packetInfo");
     }
     User.CheckUserLogoned(clientInfo);
     var provider = GetModuleProvider(clientInfo);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "DoRecordLock");
     try
     {
         var user = string.Empty;
         var returnObject = provider.DoRecordLock(assemblyName, commandName, packetInfo, type, ref user);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "DoRecordLock", timeEnd - timeStart, -1, string.Empty);
         return new LockStatus() { LockType = returnObject, UserID = user };
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "DoRecordLock", e);
         throw new Exception(message, e);
     }
 }
예제 #2
0
 /// <summary>
 /// Gets a list of entity objects
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <returns>List of entity objects</returns>
 public List<EntityObject> GetObjects(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (packetInfo == null)
     {
         throw new ArgumentNullException("packetInfo");
     }
     User.CheckUserLogoned(clientInfo);
     var module = PackageProvider.LoadModule(clientInfo, assemblyName);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "GetObjects");
     try
     {
         var returnObjects = module.GetObjects(commandName, packetInfo);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "GetObjects", timeEnd - timeStart, -1, string.Empty);
         return returnObjects;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "GetObjects", e);
         throw new Exception(message, e);
     }
 }
예제 #3
0
        public string SDExcuteSql(ClientInfo clientInfo, SQLCommandInfo sqlCommand, PacketInfo packetInfo, SDTableType tableType)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            User.CheckUserLogoned(clientInfo);
            var database = GetSDDatabase(clientInfo, tableType);
            clientInfo.Database = database;
            var developerID = tableType == SDTableType.SDSystemTable ? string.Empty : clientInfo.SDDeveloperID;
            clientInfo.SDDeveloperID = developerID;

            var timeStart = DateTime.Now;
            Log.CallMethodLogBegin(clientInfo, timeStart, string.Empty, "ExecuteSQL");
            try
            {
                if (!string.IsNullOrEmpty(sqlCommand.CommandText) && sqlCommand.CommandText.IndexOf("SysDatabases", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    throw new Exception("Invalid object name 'SysDatabases'.");
                }

                var returnObject = string.Empty;
                if (packetInfo.OnlySchema)
                {
                    returnObject = (string)Database.ExecuteSchema(database, developerID, sqlCommand.CommandText);
                }
                else
                {
                    returnObject = (string)Database.ExecuteSQL(database, developerID, sqlCommand, null, packetInfo);
                }
                var timeEnd = DateTime.Now;
                Log.CallMethodLogEnd(clientInfo, timeStart, string.Empty, "ExecuteSQL", timeEnd - timeStart);
                return returnObject;
            }
            catch (Exception e)
            {
                var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, "ExecuteSQL", e);
                throw new Exception(message, e);
            }
        }
예제 #4
0
 /// <summary>
 /// Gets count of entity objects
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <returns>Count of entity objects</returns>
 public int GetObjectCount(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (packetInfo == null)
     {
         throw new ArgumentNullException("packetInfo");
     }
     User.CheckUserLogoned(clientInfo);
     var provider = GetModuleProvider(clientInfo);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "GetObjectCount");
     try
     {
         var count = provider.GetDataCount(assemblyName, commandName, packetInfo);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "GetObjectCount", timeEnd - timeStart, -1, string.Empty);
         return count;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "GetObjectCount", e);
         throw new Exception(message, e);
     }
 }
예제 #5
0
 /// <summary>
 /// Gets total
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <param name="totals">Information of total</param>
 /// <returns>Total of data</returns>
 public object GetDataTotal(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo, Dictionary<string, string> totals)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (packetInfo == null)
     {
         throw new ArgumentNullException("packetInfo");
     }
     User.CheckUserLogoned(clientInfo);
     clientInfo.UseDataSet = true;
     var provider = GetModuleProvider(clientInfo);
     provider.ClientInfo = clientInfo;
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "GetTotal");
     try
     {
         var returnObject = provider.GetDataTotal(assemblyName, commandName, packetInfo, totals);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "GetTotal", timeEnd - timeStart, -1, string.Empty);
         return returnObject;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "GetTotal", e);
         throw new Exception(message, e);
     }
 }
예제 #6
0
 /// <summary>
 /// Gets dataset from database
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <returns>Dataset</returns>
 public object GetDataSet(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (packetInfo == null)
     {
         throw new ArgumentNullException("packetInfo");
     }
     User.CheckUserLogoned(clientInfo);
     clientInfo.UseDataSet = true;
     var provider = GetModuleProvider(clientInfo);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "GetDataSet");
     try
     {
         var returnObject = provider.GetSerializedDataSet(assemblyName, commandName, packetInfo);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "GetDataSet", timeEnd - timeStart, 1, provider.SqlSentence);
         return returnObject;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "GetDataSet", e);
         throw new Exception(message, e);
     }
 }
예제 #7
0
 /// <summary>
 /// Gets count of data
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="packetInfo">Information of packet</param>
 /// <returns>Count of data</returns>
 public int GetDataCount(ClientInfo clientInfo, string assemblyName, string commandName, PacketInfo packetInfo)
 {
     return GetObjectCount(clientInfo, assemblyName, commandName, packetInfo);
 }
예제 #8
0
        /// <summary>
        /// Execute SQL method
        /// </summary>
        /// <param name="clientInfo">Information of client</param>
        /// <param name="database">Database</param>
        /// <param name="CommandText">CommandText</param>
        /// <param name="packetInfo">Information of packet</param>
        /// <returns>DataSet</returns>
        public object ExecuteSQL(ClientInfo clientInfo, string database, string commandText, PacketInfo packetInfo)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            if (string.IsNullOrEmpty(commandText))
            {
                throw new ArgumentNullException("commandText");
            }
            if (string.IsNullOrEmpty(database))
            {
                database = clientInfo.Database;
            }
            User.CheckUserLogoned(clientInfo);

            var timeStart = DateTime.Now;
            Log.ProviderLogBegin(clientInfo, timeStart, string.Empty, string.Empty, "ExecuteSQL");
            try
            {
                var returnObject = Database.ExecuteSQL(database, clientInfo.SDDeveloperID, packetInfo.InsertQueryString(clientInfo, commandText), null, packetInfo);
                var timeEnd = DateTime.Now;
                Log.ProviderLogEnd(clientInfo, timeStart, string.Empty, string.Empty, "ExecuteSQL", timeEnd - timeStart, 0, commandText);
                return returnObject;
            }
            catch (Exception e)
            {
                var message = Log.ProviderLogError(clientInfo, timeStart, string.Empty, string.Empty, "ExecuteSQL", e);
                throw new Exception(message, e);
            }
        }