Beispiel #1
0
 /// <summary>
 /// Gets flow data
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="dataType">Type of flow data</param>
 /// <returns>Flow data</returns>
 public string GetFlowDataDS(ClientInfo clientInfo, FlowDataType dataType, FlowDataParameter parameter)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     Log.SystemLogBegin(clientInfo, timeStart, "GetFlowDataDS");
     try
     {
         var data = globalModule.GetFlowDataDS(dataType, parameter);
         var timeEnd = DateTime.Now;
         Log.SystemLogEnd(clientInfo, timeStart, "GetFlowDataDS", timeEnd - timeStart);
         return data;
     }
     catch (Exception e)
     {
         var message = Log.SystemLogError(clientInfo, timeStart, "GetFlowDataDS", e);
         throw new Exception(message, e);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates sd entity reference assembly
        /// </summary>
        /// <param name="clientInfo">Information of client</param>
        /// <param name="assemblyName">Name of assembly</param>
        /// <param name="commandName">Name of command</param>
        /// <param name="commmandText">Command Text</param>
        public Stream CreateSDEntityReferenceAssembly(ClientInfo clientInfo, string assemblyName, string commandName, string commmandText)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            if (string.IsNullOrEmpty(assemblyName))
            {
                throw new ArgumentNullException("assemblyName");
            }

            User.CheckUserLogoned(clientInfo);
            var timeStart = DateTime.Now;
            var provider = new EEPAdapter.SDModuleProvider();
            provider.ClientInfo = clientInfo;
            Log.SystemLogBegin(clientInfo, timeStart, "CreateSDEntityReferenceAssembly");
            try
            {
                var dataSets = new List<DataSet>();
                if (assemblyName == "SYS_REFVAL")
                {
                    var dataSet = provider.GetSysRefVals();
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        var refvalID = (string)dataSet.Tables[0].Rows[i]["REFVAL_NO"];
                        var commandText = (string)dataSet.Tables[0].Rows[i]["SELECT_COMMAND"];
                        try
                        {
                            dataSets.Add(Database.ExecuteDataSet(clientInfo.Database, clientInfo.SDDeveloperID, commandText, refvalID));
                        }
                        catch { }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(commmandText))
                    {
                        dataSets.Add(Database.ExecuteDataSet(clientInfo.Database, clientInfo.SDDeveloperID, commmandText, commandName));
                    }
                    else
                    {
                        var commandNames = provider.GetCommandNames(assemblyName);
                        foreach (var command in commandNames)
                        {
                            try
                            {
                                dataSets.Add(provider.GetDataSet(assemblyName, command
                                    , new PacketInfo() { OnlySchema = true, OrderParameters = new List<OrderParameter>(), WhereParameters = new List<WhereParameter>() }));
                            }
                            catch { }
                        }
                    }
                }
                var stream = EEPAdapter.SDModuleProvider.CreateEntityReferenceAssembly(dataSets, assemblyName, clientInfo);
                var timeEnd = DateTime.Now;
                Log.SystemLogEnd(clientInfo, timeStart, "CreateSDEntityReferenceAssembly", timeEnd - timeStart);
                return stream;
            }
            catch (Exception e)
            {
                var message = Log.SystemLogError(clientInfo, timeStart, "CreateSDEntityReferenceAssembly", e);
                throw new Exception(message, e);
            }
        }
Beispiel #3
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);
     }
 }
Beispiel #4
0
 /// <summary>
 /// AutoSeqMenuID
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <returns>int</returns>
 public int AutoSeqMenuID(ClientInfo clientInfo, object[] param)
 {
     int returnValue = 0;
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     Log.SystemLogBegin(clientInfo, timeStart, "AutoSeqMenuID");
     try
     {
         returnValue = globalModule.AutoSeqMenuID(param);
         var timeEnd = DateTime.Now;
         Log.SystemLogEnd(clientInfo, timeStart, "AutoSeqMenuID", timeEnd - timeStart);
     }
     catch (Exception e)
     {
         var message = Log.SystemLogError(clientInfo, timeStart, "AutoSeqMenuID", e);
         throw new Exception(message, e);
     }
     return returnValue;
 }
Beispiel #5
0
 /// <summary>
 /// Excute server method
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="methodName">Name of method</param>
 /// <param name="parameters">Parameters of method</param>
 /// <returns>Result of excuting server method</returns>
 public object CallServerMethod(ClientInfo clientInfo, string assemblyName, string methodName, object[] parameters)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(methodName))
     {
         throw new ArgumentNullException("methodName");
     }
     if (clientInfo.LogonResult != LogonResult.Logoned)
     {
         PackageProvider.CheckMethodLogOnRequired(clientInfo.Solution, assemblyName, methodName);
     }
     else
     {
         User.CheckUserLogoned(clientInfo);
     }
     IModuleProvider provider = new EEPAdapter.DataModuleProvider();
     //if (clientInfo.IsSDModule)
     //{
     //    provider = new EEPAdapter.SDModuleProvider();
     //}
     provider.ClientInfo = clientInfo;
     var timeStart = DateTime.Now;
     Log.CallMethodLogBegin(clientInfo, timeStart, assemblyName, methodName);
     try
     {
         var returnObject = provider.CallMethod(assemblyName, methodName, parameters);
         var timeEnd = DateTime.Now;
         Log.CallMethodLogEnd(clientInfo, timeStart, assemblyName, methodName, timeEnd - timeStart);
         return returnObject;
     }
     catch (TargetInvocationException e)
     {
         var exception = e.InnerException;
         var message = Log.CallMethodLogError(clientInfo, timeStart, assemblyName, methodName, exception);
         throw new Exception(message, exception);
     }
     catch (Exception e)
     {
         var message = Log.CallMethodLogError(clientInfo, timeStart, assemblyName, methodName, e);
         throw new Exception(message, e);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Update entity objects to 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="objects">List of entity objects</param>
 /// <param name="states">State of entity objects</param>
 /// <returns>List of entity objects</returns>
 public List<EntityObject> UpdateObjects(ClientInfo clientInfo, string assemblyName, string commandName, List<EntityObject> objects, Dictionary<EntityKey, EntityState> states)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (objects == null)
     {
         throw new ArgumentNullException("objects");
     }
     User.CheckUserLogoned(clientInfo);
     var module = PackageProvider.LoadModule(clientInfo, assemblyName);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "UpdateObjects");
     try
     {
         var returnObjects = objects;
         module.UpdateObjects(commandName, objects, states);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "UpdateObjects", timeEnd - timeStart, -1, string.Empty);
         return returnObjects;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "UpdateObjects", e);
         throw new Exception(message, e);
     }
 }
Beispiel #7
0
 private IModuleProvider GetModuleProvider(ClientInfo clientInfo)
 {
     IModuleProvider provider = null;
     if (clientInfo.UseDataSet)
     {
         if (clientInfo.IsSDModule)
         {
             provider = new EEPAdapter.SDModuleProvider();
         }
         else
         {
             provider = new EEPAdapter.DataModuleProvider();
         }
     }
     else
     {
         provider = new EntityModuleProvider();
     }
     provider.ClientInfo = clientInfo;
     return provider;
 }
Beispiel #8
0
 /// <summary>
 /// Get Data from table which SD user's Security Table like user or groups For Design time
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="tableName"></param>
 /// <returns></returns>
 public List<EntityObject> GetSecurityTableForSDDesign(ClientInfo clientInfo, String tableName)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     Log.SystemLogBegin(clientInfo, timeStart, "GetAllDataByTableNameForSD");
     try
     {
         var data = globalModule.GetSecurityTableForSDDesign(tableName);
         var timeEnd = DateTime.Now;
         Log.SystemLogEnd(clientInfo, timeStart, "GetAllDataByTableNameForSD", timeEnd - timeStart);
         return data;
     }
     catch (Exception e)
     {
         var message = Log.SystemLogError(clientInfo, timeStart, "GetAllDataByTableNameForSD", e);
         throw new Exception(message, e);
     }
 }
Beispiel #9
0
 /// <summary>
 /// Gets server path
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <returns>String</returns>
 public String GetServerPath(ClientInfo clientInfo)
 {
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     return globalModule.GetServerPath();
 }
Beispiel #10
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);
     }
 }
Beispiel #11
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);
     }
 }
Beispiel #12
0
 /// <summary>
 /// Gets name of entity type
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="entitySetName">Name of entity set</param>
 /// <returns>Name of entity type</returns>
 public string GetObjectClassName(ClientInfo clientInfo, string assemblyName, string commandName, string entitySetName)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     return GetModuleProvider(clientInfo).GetObjectClassName(assemblyName, commandName, entitySetName);
 }
Beispiel #13
0
 /// <summary>
 /// Gets entity object by key
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="entitySetName">Name of entity set</param>
 /// <param name="keyValues">Key and values</param>
 /// <returns>Entity object</returns>
 public object GetObjectByKey(ClientInfo clientInfo, string assemblyName, string commandName, string entitySetName, Dictionary<string, object> keyValues)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (keyValues == null)
     {
         throw new ArgumentNullException("keyValues");
     }
     User.CheckUserLogoned(clientInfo);
     var module = PackageProvider.LoadModule(clientInfo, assemblyName);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "GetObjectByKey");
     try
     {
         var returnObject = module.GetObjectByKey(commandName, entitySetName, keyValues);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "GetObjectByKey", timeEnd - timeStart, -1, string.Empty);
         return returnObject;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "GetObjectByKey", e);
         throw new Exception(message, e);
     }
 }
Beispiel #14
0
        /// <summary>
        /// Gets list of module names
        /// </summary>
        /// <param name="clientInfo">Information of client</param>
        /// <returns>List of module names</returns>
        public List<string> GetModuleNames(ClientInfo clientInfo)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }

            return GetModuleProvider(clientInfo).GetModules();
        }
Beispiel #15
0
        public string SDUpdateTable(ClientInfo clientInfo, string tableName, List<UpdateRow> updateRows, 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, "ExecuteCommand");
            try
            {
                if (tableName == "SYS_WEBPAGES" && tableType == SDTableType.SDSystemTable)
                {
                    foreach (var updateRow in updateRows)
                    {
                        if ((string)updateRow.NewValues["PageType"] == "S")
                        {
                            if (updateRow.RowState == DataRowState.Added || updateRow.RowState == DataRowState.Modified)
                            {
                                var sComponentCS = (string)updateRow.NewValues["SERVERDLL"];

                                var resx = string.Empty;
                                if (updateRow.NewValues.ContainsKey("RESX"))
                                {
                                    resx = (string)updateRow.NewValues["RESX"];
                                    updateRow.NewValues.Remove("RESX");
                                }

                                var assemblyBytes = SDModuleProvider.CreateServerDllAssembly(sComponentCS, (string)updateRow.NewValues["PageName"], resx, clientInfo);
                                updateRow.NewValues["SERVERDLL"] = assemblyBytes;

                                if (!updateRow.NewValues.ContainsKey("Content"))
                                {
                                    updateRow.NewValues["Content"] = System.Text.Encoding.UTF8.GetBytes(SDModuleProvider.GetServerContent(assemblyBytes, sComponentCS));
                                }
                            }
                        }
                    }
                }

                var returnObject = Database.UpdateTable(database, tableName, developerID, updateRows);
                var timeEnd = DateTime.Now;
                Log.CallMethodLogEnd(clientInfo, timeStart, string.Empty, "ExecuteCommand", timeEnd - timeStart);
                return returnObject;
            }
            catch (Exception e)
            {
                var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, "ExecuteCommand", e);
                throw new Exception(message, e);
            }
        }
Beispiel #16
0
 /// <summary>
 /// Gets list of solutions
 /// </summary>
 /// <returns></returns>
 public List<SolutionInfo> GetSolutions(ClientInfo clientInfo)
 {
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     return globalModule.GetSolutions();
 }
Beispiel #17
0
 /// <summary>
 /// Updates dataset to 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="dataset">Dataset</param>
 /// <returns>Dataset</returns>
 public object UpdateDataSet(ClientInfo clientInfo, string assemblyName, string commandName, object dataset)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     if (dataset == null)
     {
         throw new ArgumentNullException("objects");
     }
     User.CheckUserLogoned(clientInfo);
     clientInfo.UseDataSet = true;
     var provider = GetModuleProvider(clientInfo);
     var timeStart = DateTime.Now;
     Log.ProviderLogBegin(clientInfo, timeStart, assemblyName, commandName, "UpdateDataSet");
     try
     {
         var returnObjects = provider.UpdateDataSet(assemblyName, commandName, dataset);
         var timeEnd = DateTime.Now;
         Log.ProviderLogEnd(clientInfo, timeStart, assemblyName, commandName, "UpdateDataSet", timeEnd - timeStart, 2, provider.SqlSentence);
         return returnObjects;
     }
     catch (Exception e)
     {
         var message = Log.ProviderLogError(clientInfo, timeStart, assemblyName, commandName, "UpdateDataSet", e);
         throw new Exception(message, e);
     }
 }
Beispiel #18
0
        /// <summary>
        /// Logs off
        /// </summary>
        /// <param name="clientInfo">Information of client</param>
        public ClientInfo LogOff(ClientInfo clientInfo)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            var timeStart = DateTime.Now;
            Log.SystemLogBegin(clientInfo, timeStart, "LogOff");
            try
            {
                User.LogOff(clientInfo);

                clientInfo.LogonResult = LogonResult.NotLogoned;
                if (!SrvGL.IsUserLogined(clientInfo.UserID.ToLower(), clientInfo.SDDeveloperID, clientInfo.SecurityKey))
                {
                    RecordLock.ClearRecordFile(clientInfo.UserID.ToLower());
                }
                var timeEnd = DateTime.Now;
                Log.SystemLogEnd(clientInfo, timeStart, "LogOff", timeEnd - timeStart);
                return clientInfo;
            }
            catch (Exception e)
            {
                var message = Log.SystemLogError(clientInfo, timeStart, "LogOff", e);
                throw new Exception(message, e);
            }
        }
Beispiel #19
0
 /// <summary>
 /// Logs user define method
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="status">Status</param>
 /// <param name="title">Title</param>
 /// <param name="description">Description</param>
 public void UserDefineLog(ClientInfo clientInfo, LogStatus status, string title, string description)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     Log.UserDefineLog(clientInfo, status, DateTime.Now, title, description);
 }
Beispiel #20
0
 /// <summary>
 /// Logs on
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <returns>Information of client returned</returns>
 public ClientInfo LogOn(ClientInfo clientInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     Log.SystemLogBegin(clientInfo, timeStart, "LogOn");
     try
     {
     #warning 标记借用
         if (clientInfo.IsSDModule)
         {
             var returnInfo = globalModule.CheckUserForSDModule();
             if (returnInfo.LogonResult == LogonResult.Logoned)
             {
                 User.LogOn(clientInfo);
             }
             var timeEnd = DateTime.Now;
             Log.SystemLogEnd(clientInfo, timeStart, "LogOn", timeEnd - timeStart);
             return returnInfo;
         }
         else
         {
             var returnInfo = globalModule.CheckUser();
             if (returnInfo.LogonResult == LogonResult.Logoned)
             {
                 User.LogOn(clientInfo);
             }
             var timeEnd = DateTime.Now;
             Log.SystemLogEnd(clientInfo, timeStart, "LogOn", timeEnd - timeStart);
             return returnInfo;
         }
     }
     catch (Exception e)
     {
         var message = Log.SystemLogError(clientInfo, timeStart, "LogOn", e);
         throw new Exception(message, e);
     }
 }
Beispiel #21
0
 private string GetSDDatabase(ClientInfo clientInfo, SDTableType tableType)
 {
     if (tableType == SDTableType.SDSystemTable)
     {
         return Database.GetSystemDatabase(null);
     }
     else
     {
         if (tableType == SDTableType.SystemTable && Database.GetSplitSystemTable(clientInfo.Database, clientInfo.SDDeveloperID))
         {
             return Database.GetSystemDatabase(clientInfo.SDDeveloperID);
         }
         return clientInfo.Database;
     }
 }
Beispiel #22
0
 /// <summary>
 /// log sd user
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 public void RefreshUserLogForSD(ClientInfo clientInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     try
     {
         globalModule.RefreshUserLogForSD();
     }
     catch { }
 }
Beispiel #23
0
 /// <summary>
 /// Calls flow method
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="parameter">Flow parameter</param>
 /// <returns>Result of flow method</returns>
 public FlowResult CallFlowMethod(ClientInfo clientInfo, FlowParameter parameter)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (parameter == null)
     {
         throw new ArgumentNullException("parameter");
     }
     User.CheckUserLogoned(clientInfo);
     var timeStart = DateTime.Now;
     Log.CallMethodLogBegin(clientInfo, timeStart, string.Empty, parameter.Operation.ToString());
     try
     {
         var returnObject = Flow.CallFlowMethod(clientInfo, parameter);
         var timeEnd = DateTime.Now;
         Log.CallMethodLogEnd(clientInfo, timeStart, string.Empty, parameter.Operation.ToString(), timeEnd - timeStart);
         return returnObject;
     }
     catch (TargetInvocationException e)
     {
         var exception = e.InnerException;
         var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, parameter.Operation.ToString(), exception);
         throw new Exception(message, exception);
     }
     catch (Exception e)
     {
         var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, parameter.Operation.ToString(), e);
         throw new Exception(message, e);
     }
 }
Beispiel #24
0
 //public int SDExcuteCommand(ClientInfo clientInfo, string commandText, SDTableType tableType, Dictionary<string, object> parameters)
 //{
 //    if (clientInfo == null)
 //    {
 //        throw new ArgumentNullException("clientInfo");
 //    }
 //    if (string.IsNullOrEmpty(commandText))
 //    {
 //        throw new ArgumentNullException("commandText");
 //    }
 //    var database = GetSDDatabase(clientInfo, tableType);
 //    clientInfo.Database = database;
 //    var developerID = tableType == SDTableType.SDSystemTable ? string.Empty : clientInfo.SDDeveloperID;
 //    clientInfo.SDDeveloperID = developerID;
 //    User.CheckUserLogoned(clientInfo);
 //    var timeStart = DateTime.Now;
 //    Log.CallMethodLogBegin(clientInfo, timeStart, string.Empty, "ExecuteCommand");
 //    try
 //    {
 //        var returnObject = Database.ExecuteCommand(database, developerID, commandText, parameters);
 //        var timeEnd = DateTime.Now;
 //        Log.CallMethodLogEnd(clientInfo, timeStart, string.Empty, "ExecuteCommand", timeEnd - timeStart);
 //        return returnObject;
 //    }
 //    catch (Exception e)
 //    {
 //        var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, "ExecuteCommand", e);
 //        throw new Exception(message, e);
 //    }
 //}
 public int SDExcuteCommands(ClientInfo clientInfo, List<SQLCommandInfo> sqlCommands, 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, "ExecuteCommand");
     try
     {
         var returnObject = Database.ExecuteCommands(database, developerID, sqlCommands);
         var timeEnd = DateTime.Now;
         Log.CallMethodLogEnd(clientInfo, timeStart, string.Empty, "ExecuteCommand", timeEnd - timeStart);
         return returnObject;
     }
     catch (Exception e)
     {
         var message = Log.CallMethodLogError(clientInfo, timeStart, string.Empty, "ExecuteCommand", e);
         throw new Exception(message, e);
     }
 }
Beispiel #25
0
        /// <summary>
        /// Create html page
        /// </summary>
        /// <param name="clientInfo">Information of client</param>
        /// <param name="pageName">Name of page</param>
        /// <param name="aspxContent">Content of aspx</param>
        /// <param name="code">Code</param>
        /// <param name="reportContent">Content of report</param>
        /// <param name="websitePath">Path of website</param>
        /// <returns>path of page</returns>
        public string CreateHtmlPage(ClientInfo clientInfo, string pageName, string aspxContent, string code, string reportContent, string websitePath)
        {
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            if (string.IsNullOrEmpty(pageName))
            {
                throw new ArgumentNullException("pageName");
            }

            User.CheckUserLogoned(clientInfo);
            var timeStart = DateTime.Now;
            var provider = new EEPAdapter.SDModuleProvider();
            provider.ClientInfo = clientInfo;
            Log.SystemLogBegin(clientInfo, timeStart, "CreateHtmlPage");
            try
            {
                var path = EEPAdapter.SDModuleProvider.CreateHtmlPage(pageName, aspxContent, code, reportContent, clientInfo, websitePath);
                var timeEnd = DateTime.Now;
                Log.SystemLogEnd(clientInfo, timeStart, "CreateHtmlPage", timeEnd - timeStart);
                return path;
            }
            catch (Exception e)
            {
                var message = Log.SystemLogError(clientInfo, timeStart, "CreateHtmlPage", e);
                throw new Exception(message, e);
            }
        }
Beispiel #26
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);
            }
        }
Beispiel #27
0
 /// <summary>
 /// DeleteDataFromTable For SD System Talble
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <returns>void</returns>
 public void DeleteDataFromTableForSDSysTb(ClientInfo clientInfo, object param, String tableName)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var globalModule = PackageProvider.LoadGlobalModule(clientInfo);
     var timeStart = DateTime.Now;
     Log.SystemLogBegin(clientInfo, timeStart, "DeleteDataFromTableForSDSysTb");
     try
     {
         globalModule.DeleteDataFromTableForSDSystemTable(param, tableName);
         var timeEnd = DateTime.Now;
         Log.SystemLogEnd(clientInfo, timeStart, "DeleteDataFromTableForSDSysTb", timeEnd - timeStart);
     }
     catch (Exception e)
     {
         var message = Log.SystemLogError(clientInfo, timeStart, "DeleteDataFromTableForSDSysTb", e);
         throw new Exception(message, e);
     }
 }
Beispiel #28
0
 public string SDGetSolutions(ClientInfo clientInfo)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     var provider = new SDModuleProvider();
     provider.ClientInfo = clientInfo;
     return provider.GetSolutions();
 }
Beispiel #29
0
        public void GetDetailObjects(System.Data.Objects.DataClasses.EntityObject masterObject, ClientInfo clientInfo)
        {
            if (masterObject == null)
            {
                throw new ArgumentNullException("masterObject");
            }
            if (clientInfo == null)
            {
                throw new ArgumentNullException("clientInfo");
            }
            if (DetailCommand == null)
            {
                throw new ArgumentNullException("DetailCommand");
            }
            Context.Attach(masterObject);
            //var provider = new MetadataProvider(Context.MetadataWorkspace);
            //var relatedEnd = ((IEntityWithRelationships)masterObject).RelationshipManager.GetAllRelatedEnds()
            //    .FirstOrDefault(c => provider.GetAssociationSetEndEntitySetName(MasterCommand.ContextName, c.RelationshipName, c.TargetRoleName).Equals(DetailCommand.EntitySetName));
            //if (relatedEnd == null)
            //{
            //    throw new ObjectNotFoundException(string.Format("RelatedEnd:{0}->{1} not found.", MasterCommand.EntitySetName, DetailCommand.EntitySetName));
            //}
            var relatedEnd = EntityProvider.GetRelatedEnd(Context, masterObject, DetailCommand.EntitySetName);

            if (relatedEnd.RelationshipSet != null && relatedEnd.RelationshipSet is AssociationSet)
            {
                var constraint = (relatedEnd.RelationshipSet as AssociationSet).ElementType.ReferentialConstraints
                    .FirstOrDefault(c => c.FromRole.Name.Equals(relatedEnd.SourceRoleName) && c.ToRole.Name.Equals(relatedEnd.TargetRoleName));
                if (constraint == null)
                {
                    throw new ObjectNotFoundException(string.Format("ReferentialConstraint:{0}->{1} not found.", relatedEnd.SourceRoleName, relatedEnd.TargetRoleName));
                }

                var listWhereParameter = new List<WhereParameter>();
                for (int i = 0; i < constraint.FromProperties.Count; i++)
                {
                    var fromField = constraint.FromProperties[i].Name;
                    var toField = constraint.ToProperties[i].Name;

                    var value = masterObject.GetValue(fromField);
                    listWhereParameter.Add(new WhereParameter() { Field = toField, Value = value });
                }
                DetailCommand.Context = Context;
                var objects = DetailCommand.GetObjects(clientInfo);
                objects = EntityProvider.SetWhere(objects, listWhereParameter);
                objects.ToList();
            }
            else
            {
                throw new EntityException("Can not cast relatedEnd.RelationshipSet to AssociationSet.");
            }
        }
Beispiel #30
0
 /// <summary>
 /// Gets list of name of eneity sets which type is specialfied type
 /// </summary>
 /// <param name="clientInfo">Information of client</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="commandName">Name of command</param>
 /// <param name="entityTypeName">Type of entity set</param>
 /// <returns>Name of entity object</returns>
 public List<string> GetEntitySetNames(ClientInfo clientInfo, string assemblyName, string commandName, string entityTypeName)
 {
     if (clientInfo == null)
     {
         throw new ArgumentNullException("clientInfo");
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         throw new ArgumentNullException("assemblyName");
     }
     if (string.IsNullOrEmpty(commandName))
     {
         throw new ArgumentNullException("commandName");
     }
     var module = PackageProvider.LoadModule(clientInfo, assemblyName);
     return module.GetEntitySetNames(commandName, entityTypeName);
 }