Ejemplo n.º 1
0
 public static int ExecuteCommand(SQLCommandInfo sqlCommand, SDTableType tableType)
 {
     var clientInfo = EFClientTools.ClientUtility.ClientInfo;
     var sqlCommands = new List<SQLCommandInfo>();
     sqlCommands.Add(sqlCommand);
     return EFClientTools.ClientUtility.Client.SDExcuteCommands(clientInfo, sqlCommands, tableType);
 }
Ejemplo n.º 2
0
 public static DataSet ExecuteSql(SQLCommandInfo sqlCommand, PacketInfo packetInfo, SDTableType tableType)
 {
     var clientInfo = EFClientTools.ClientUtility.ClientInfo;
     var xml = (string)EFClientTools.ClientUtility.Client.SDExcuteSql(clientInfo, sqlCommand, packetInfo, tableType);
     return Deserialize(xml);
 }
Ejemplo n.º 3
0
 public static DataSet ExecuteSql(string commandText, PacketInfo packetInfo, SDTableType tableType)
 {
     return ExecuteSql(new SQLCommandInfo() { CommandText = commandText }, packetInfo, tableType);
 }
Ejemplo n.º 4
0
 public static DataSet ExecuteSql(SQLCommandInfo sqlCommand, SDTableType tableType)
 {
     return ExecuteSql(sqlCommand, new PacketInfo() { WhereParameters = new List<WhereParameter>(), OrderParameters = new List<OrderParameter>() }, tableType);
 }
Ejemplo n.º 5
0
 public static DataSet ExecuteSchema(string commandText, SDTableType tableType)
 {
     return ExecuteSql(new SQLCommandInfo() { CommandText = commandText }, new PacketInfo() { WhereParameters = new List<WhereParameter>(), OrderParameters = new List<OrderParameter>(), OnlySchema = true }, tableType);
 }
Ejemplo n.º 6
0
 public static int ExecuteCommands(List<SQLCommandInfo> sqlCommands, SDTableType tableType)
 {
     var clientInfo = EFClientTools.ClientUtility.ClientInfo;
     return EFClientTools.ClientUtility.Client.SDExcuteCommands(clientInfo, sqlCommands, tableType);
 }
Ejemplo n.º 7
0
 public static int ExecuteCommand(string commandText, SDTableType tableType)
 {
     return ExecuteCommand(new SQLCommandInfo() { CommandText = commandText }, tableType);
 }
Ejemplo n.º 8
0
 public static void UpdateTable(string tableName, List<UpdateRow> updateRows, SDTableType tableType)
 {
     var clientInfo = EFClientTools.ClientUtility.ClientInfo;
     EFClientTools.ClientUtility.Client.SDUpdateTable(clientInfo, tableName, updateRows, tableType);
 }
Ejemplo n.º 9
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;
     }
 }
Ejemplo n.º 10
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);
            }
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
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);
     }
 }