public Result(bool _isError, string _Message, IDetailedLog _LogSystem, OrganizationResponse _Response) { Message = _Message; isError = _isError; Response = _Response; LogSystem = _LogSystem; if (Message != null && Message != string.Empty) { System.Diagnostics.EventLogEntryType logType = System.Diagnostics.EventLogEntryType.Information; if (isError) logType = System.Diagnostics.EventLogEntryType.Error; if (LogSystem != null) LogSystem.CreateLog(Message, logType); } }
/// <summary> /// Default constractor of Result Class for Object /// </summary> /// <param name="_isError">if method send an object as a result, it will be in this object file</param> /// <param name="_Message">if there is an error result of a method you can see the detail of error in this property</param> /// <param name="_BusinessObject">if method send an object as a result, it will be in this object file</param> /// <param name="_LogSystem">The _ log system.</param> public Result(bool _isError, string _Message, Object _BusinessObject, IDetailedLog _LogSystem) { Message = _Message; isError = _isError; BusinessObject = _BusinessObject; LogSystem = _LogSystem; if (Message != null && Message != string.Empty) { System.Diagnostics.EventLogEntryType logType = System.Diagnostics.EventLogEntryType.Information; if (isError) logType = System.Diagnostics.EventLogEntryType.Error; if (LogSystem != null) LogSystem.CreateLog(Message, logType); } }
/// <summary> /// Default constractor of Result Class for Object /// </summary> /// <param name="_isError">if method send an object as a result, it will be in this object file</param> /// <param name="_Message">if there is an error result of a method you can see the detail of error in this property</param> /// <param name="_BusinessObject">if method send an object as a result, it will be in this object file</param> /// <param name="_LogSystem">The _ log system.</param> public Result(bool _isError, string _Message, Object _BusinessObject, IDetailedLog _LogSystem) { Message = _Message; isError = _isError; BusinessObject = _BusinessObject; LogSystem = _LogSystem; if (Message != null && Message != string.Empty) { System.Diagnostics.EventLogEntryType logType = System.Diagnostics.EventLogEntryType.Information; if (isError) { logType = System.Diagnostics.EventLogEntryType.Error; } if (LogSystem != null) { LogSystem.CreateLog(Message, logType); } } }
public Result(bool _isError, string _Message, IDetailedLog _LogSystem, OrganizationResponse _Response) { Message = _Message; isError = _isError; Response = _Response; LogSystem = _LogSystem; if (Message != null && Message != string.Empty) { System.Diagnostics.EventLogEntryType logType = System.Diagnostics.EventLogEntryType.Information; if (isError) { logType = System.Diagnostics.EventLogEntryType.Error; } if (LogSystem != null) { LogSystem.CreateLog(Message, logType); } } }
/// <summary> /// Initializers the specified system setting reader. /// </summary> /// <param name="SystemSettingReader">The system setting reader.</param> private void Initializer(ISettingReader SystemSettingReader, string SettingKey) { ILogger SystemLogger = null; IOrganizationService XrmService = null; CubeBase SystemBase = null; List <SettingGroup> SystemSettingsGroup = SystemSettingReader.Read(SettingKey); //load global settings if (SystemSettingsGroup != null && SystemSettingsGroup.Count > 0) { SettingGroup groupGlobalSettings = SystemSettingsGroup.FirstOrDefault(s => s.GroupName == "GlobalSettings"); EnumCarrier.LogLevel logLevel = EnumCarrier.LogLevel.None; EnumCarrier.LogScreen logScreen = EnumCarrier.LogScreen.None; EnumCarrier.LogLocation logger = EnumCarrier.LogLocation.None; if (groupGlobalSettings != null && groupGlobalSettings.Settings != null && groupGlobalSettings.Settings.Count > 0) { //load logger settings logLevel = (EnumCarrier.LogLevel)groupGlobalSettings.Settings.FirstOrDefault(l => l.Key == "LogLevel").Value; logScreen = (EnumCarrier.LogScreen)groupGlobalSettings.Settings.FirstOrDefault(l => l.Key == "LogScreen").Value; logger = (EnumCarrier.LogLocation)groupGlobalSettings.Settings.FirstOrDefault(l => l.Key == "LogLocation").Value; switch (logger) { case EnumCarrier.LogLocation.CRM: break; case EnumCarrier.LogLocation.SQL: SystemLogger = new SqlLogger(); break; case EnumCarrier.LogLocation.Text: SystemLogger = new TextLogger(); break; } } SettingGroup groupConnections = SystemSettingsGroup.FirstOrDefault(s => s.GroupName == "Connections"); if (groupConnections != null && groupConnections.Settings != null && groupConnections.Settings.Count > 0) { IDetailedLog logSystem = null; if (logger == EnumCarrier.LogLocation.SQL) { string connectionString = groupConnections.Settings.FirstOrDefault(l => l.Key == "SQL").Value.ToString(); SqlConnection connection = new SqlConnection(connectionString); logSystem = new DetailedLog(SystemLogger, logLevel, connection, logScreen); } else if (logger == EnumCarrier.LogLocation.Text) { string logPath = groupGlobalSettings.Settings.FirstOrDefault(l => l.Key == "LogPath").Value.ToString(); logSystem = new DetailedLog(SystemLogger, logLevel, logPath, logScreen); } SystemBase = new CubeBase(); SystemBase.LogSystem = logSystem; bool OpenOrganizationService = (bool)groupGlobalSettings.Settings.FirstOrDefault(l => l.Key == "OpenOrganizationService").Value; if (OpenOrganizationService) { string crmConnection = groupConnections.Settings.FirstOrDefault(l => l.Key == "CRM").Value.ToString(); Service service = new Service(SystemBase.LogSystem); Result result = service.GetService(crmConnection); if (!result.isError) { XrmService = (IOrganizationService)result.BusinessObject; SystemBase.XrmService = XrmService; } } } cube = SystemBase; cube.XRMActions.Create(new Entity()); cube.RetrieveActions.getItemsFetch(""); cube.MetadataRetrieveActions.GetOptionSets("", ""); } }
/// <summary> /// Initializes a new instance of the <see cref="Actions"/> class. /// </summary> /// <param name="_logSystem">The _log system.</param> /// <param name="_xrmService">The _XRM service.</param> /// <param name="_logEntityItems">if set to <c>true</c> [_log entity items].</param> public Actions(IDetailedLog _logSystem, IOrganizationService _xrmService, bool _logEntityItems) { this.logSystem = _logSystem; this.xrmService = _xrmService; this.logEntityItems = _logEntityItems; }
/// <summary> /// Initializes a new instance of the <see cref="Actions" /> class. /// </summary> /// <param name="_logSystem">The _log system.</param> /// <param name="_xrmService">The _XRM service.</param> public Actions(IDetailedLog _logSystem, IOrganizationService _xrmService) { this.logSystem = _logSystem; this.xrmService = _xrmService; }
/// <summary> /// Initializes a new instance of the <see cref="Service" /> class. /// </summary> /// <param name="_logger">The _logger.</param> public Service(IDetailedLog _logger) { logSystem = _logger; }
/// <summary> /// Initializes a new instance of the <see cref="MetadataActions" /> class. /// </summary> /// <param name="_logSystem">The _log system.</param> /// <param name="_xrmService">The _XRM service.</param> public MetadataActions(IDetailedLog _logSystem, IOrganizationService _xrmService) { this.logSystem = _logSystem; this.xrmService = _xrmService; }