public HomeController(ILogger <HomeController> logger, ISqlClient uow, IConfiguration configuration, IToastNotification toastNotification) { _logger = logger; _uow = uow; Configuration = configuration; _toastNotification = toastNotification; }
public UserController(ISqlClient uow, UserManager <AspNetUsers> userManager ) { _uow = uow; _userManager = userManager; }
public SqlEEViewModel(SIEESettings settings, ISqlClient sqlClient) { SqlEESettings = settings as SqlEESettings; SqlClient = sqlClient; CT = new SqlEEViewModel_CT(this); TT = new SqlEEViewModel_TT(this); DT = new SqlEEViewModel_DT(this); SelectedTab = 0; IsRunning = false; DataLoaded = false; if (SqlEESettings.LoginPossible) { LoginButtonHandler(); } CT.PropertyChanged += (s, e) => { if (CT.IsConnectionRelevant(e.PropertyName)) { SqlEESettings.LoginPossible = false; DataLoaded = false; TabNamesReset(); } }; }
/// <summary> /// Initializes a new instance of the <see cref="DbClient"/> class. /// </summary> /// <param name="sqlClient">The sqlClient.</param> /// <exception cref="System.ArgumentNullException">sqlClient</exception> public DbClient(ISqlClient sqlClient) { if (sqlClient == null) { throw new ArgumentNullException("sqlClient"); } this.sqlClient = sqlClient; }
public void T02_GetTables() { ISqlClient sqlClient = getClient(); List <string> tables = sqlClient.GetTablenames(); Assert.IsTrue(tables.Count >= 1); Assert.IsTrue(tables.Contains(testTable)); }
public void SetUp() { this.dataClientFactory = MockRepository.GenerateMock<IDataClientFactory>(); this.sqlClient = MockRepository.GenerateMock<ISqlClient>(); this.graphiteClientFactory = MockRepository.GenerateMock<IGraphiteClientFactory>(); statsClient = MockRepository.GenerateMock<IStatsClient>(); log = MockRepository.GenerateMock<ILog>(); }
public void T04_Insert() { ISqlClient sqlClient = getClient(); sqlClient.ClearTable(testTable); // Get column definitions (from data base) List <SqlColumn> columns = sqlClient.GetColumns(testTable); // Add some information from test meta data definition foreach (ColumnMetadata cmd in columnMetadata) { SqlColumn col = columns.Where(n => n.Name == cmd.Fieldname).First(); col.ValueString = cmd.TestValue; col.IsDocument = cmd.IsDocument; } // Remove unsupported columns List <SqlColumn> toBeRemoved = columns.Where(n => n.SqlType == null).ToList(); foreach (SqlColumn col in toBeRemoved) { columns.Remove(col); } // Convert strings to objects and insert row sqlClient.SetObjectValues(columns); sqlClient.Insert(columns); // Read back row from data base List <SqlColumn> result = new List <SqlColumn>(); foreach (SqlColumn col in columns) { result.Add(new SqlColumn() { Name = col.Name, SqlType = col.SqlType }); } sqlClient.GetOneRow(result); // Verify that input values and output values match foreach (SqlColumn col in columns) { compareSqlColumn(col, result.Where(n => n.Name == col.Name).First()); } // Verify that docuoment has been stored properly as blob string resultDocument = Path.Combine(Path.GetTempPath(), "Document1.pdf"); File.WriteAllBytes(resultDocument, columns.Where(n => n.Name == "MyDocument").First().ValueObject as Byte[]); Assert.IsTrue(SIEEUtils.CompareFiles(testDocument, resultDocument)); File.Delete(resultDocument); // Clear table sqlClient.ClearTable(testTable); }
public void Setup() { var service = new ServicesBuilder(); _untity = service.GetService <IUntityFunction>(); _db = service.GetService <WorkToolEntity>(); _work = service.GetService <IWork>(); _sqlClient = service.GetService <ISqlClient>(); }
public void Login(ISqlClient sqlClient) { if (LoginType == SqlEESettings.LogonType.SqlUser) { sqlClient.Connect(Instance, Catalog, Username, PasswordEncryption.Decrypt(Password)); } else { sqlClient.Connect(Instance, Catalog); } }
public void DisplayJob(string name) { var typedJob = controller.GetTypedJob(name); foreach (var property in typedJob.GetType().GetProperties()) { var value = GetPropertyValue(typedJob, property); var help = GetHelp(property); this.AddPair(property.Name, value, help); } HelpPanel(); this.AddButton(typedJob, "Test", this.TestButtonClick); this.client = typedJob; this.DisplayResultsPannel(); }
public void T05_CultureInfo() { ISqlClient sqlClient = getClient(); foreach (SqlColumn col in sqlClient.GetColumns(testTable).Where(n => n.SqlType != null)) { List <SqlColumn> lc = new List <SqlColumn>(); lc.Add(col); switch (col.SqlType.DotNetType.ToString()) { case SqlTypes.DateTime_TypeName: col.ValueString = "03.04.2016"; sqlClient.SetCulture(new CultureInfo("de-DE")); sqlClient.SetObjectValues(lc); Assert.AreEqual(4, ((DateTime)col.ValueObject).Month); sqlClient.SetCulture(new CultureInfo("en-US")); sqlClient.SetObjectValues(lc); Assert.AreEqual(3, ((DateTime)col.ValueObject).Month); break; case SqlTypes.Decimal_TypeName: col.ValueString = "1.234,56"; sqlClient.SetCulture(new CultureInfo("de-DE")); sqlClient.SetObjectValues(lc); Assert.AreEqual((decimal)1234.56, col.ValueObject); col.ValueString = "1,234.56"; sqlClient.SetCulture(new CultureInfo("en-US")); sqlClient.SetObjectValues(lc); Assert.AreEqual((decimal)1234.56, col.ValueObject); break; case SqlTypes.Double_TypeName: col.ValueString = "1.234,5678"; sqlClient.SetCulture(new CultureInfo("de-DE")); sqlClient.SetObjectValues(lc); Assert.AreEqual(1234.5678, col.ValueObject); col.ValueString = "1,234.5678"; sqlClient.SetCulture(new CultureInfo("en-US")); sqlClient.SetObjectValues(lc); Assert.AreEqual(1234.5678, col.ValueObject); break; default: break; } } }
public void DisplayEmptyJob(string name) { Type type = assemblyResolver.ResolveType(name); client = (ISqlClient)Activator.CreateInstance(type); foreach (var property in client.GetType().GetProperties()) { if (property.Name != "ClientName" && property.Name != "Type") { var value = GetPropertyValue(client, property); var help = GetHelp(property); this.AddPair(property.Name, value, help); } } HelpPanel(); this.AddButton(client, "Test", this.TestButtonClick); this.AddButton(client, "Add", this.AddJobButtonClick); }
public void T03_GetColumns() { ISqlClient sqlClient = getClient(); List <SqlColumn> columns = sqlClient.GetColumns(testTable); Assert.AreEqual(columnMetadata.Count, columns.Count); foreach (SqlColumn cd in columns) { ColumnMetadata cmd = columnMetadata.Where(n => n.Fieldname == cd.Name).First(); if (cmd.Implemented) { Assert.AreEqual(SqlTypes.GetSqlType(cmd.Typename).SqlDbType, cd.SqlType.SqlDbType); } else { Assert.IsNull(cd.SqlType); } } }
/// <summary> /// Execute JSON command to the database /// </summary> /// <param name="jsonCommand"></param> /// <param name="connectionId"></param> /// <returns></returns> public string ExecuteQuery(string jsonCommand = "", int connectionId = 0) { ISqlClient sqlClient = _Connections[connectionId]; LinqQueryModel linqQuery = (LinqQueryModel)Helper.JsonDeserialize(jsonCommand, typeof(LinqQueryModel)); string result = ""; switch (linqQuery.command) { case "select": string dataResult = sqlClient.ExecuteReader(linqQuery); result = "{\"data\":" + dataResult + "}"; break; default: result = "error"; break; } return(result); }
/// <summary> /// Opens a connection to the database /// </summary> /// <param name="jsonConnection"></param> /// <returns></returns> public string OpenConnection(string jsonConnection) { LinqConnectionModel linqConnection = (LinqConnectionModel)Helper.JsonDeserialize(jsonConnection, typeof(LinqConnectionModel)); ISqlClient sqlClient = null; switch (linqConnection.database) { case "sqlite": sqlClient = new SQLiteClient(linqConnection.connection); break; case "mssql": sqlClient = new MSSqlClient(linqConnection.connection); break; } sqlClient.Open(); _Connections.Add(sqlClient); return((_Connections.Count - 1).ToString()); }
private bool TestFunction_Read(ref string errorMsg) { SqlEEViewModel_CT vmConnection = (SqlEEViewModel_CT)CallingViewModel; ISqlClient sqlClient = vmConnection.GetSqlClient(); try { List <string> tables = sqlClient.GetTablenames(); errorMsg = tables.Count.ToString() + " Tables found"; return(true); } catch (Exception e) { errorMsg = "Could not read solutions\n" + e.Message; if (e.InnerException != null) { errorMsg += "\n" + e.InnerException.Message; } return(false); } }
public WorkflowRepository(ISqlClient sqlClient) { _sqlClient = sqlClient; }
public QueueRepository(ISqlClient sqlClient, IServiceLog serviceLog) { _sqlClient = sqlClient; _serviceLog = serviceLog; }
public ActivityData(ISqlClient sqlClient, IConfig config) { _sqlClient = sqlClient; _config = config; }
public PratymuSkaiciusRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
public SapphireRepository(ISqlClient sqlClient) { _sqlClient = sqlClient; }
public HomeController(ILogger <HomeController> logger, ISqlClient uow) { _logger = logger; _uow = uow; }
public AtliktuPrtymuSkaicius(ISqlClient sqlclient) { _sqlClient = sqlclient; }
public VartotojasRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
protected string GetPropertyValue(ISqlClient typedJob, PropertyInfo property) { string rtn; if (property == null) { rtn = string.Empty; } else { object obj = null; if (this.IsEncrypted(property)) { var encryption = new Encryption(); var v = property.GetValue(typedJob, null); if(v != null) { var value = v.ToString(); if (value != string.Empty) { obj = encryption.Decrypt(property.GetValue(typedJob, null).ToString()); } } } else { obj = property.GetValue(typedJob, null); } rtn = obj == null ? string.Empty : obj.ToString(); } return rtn; }
public PakviestiTreneriaiRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
public CompetitionController(ISqlClient uow, IToastNotification toastNotification) { _uow = uow; _toastNotification = toastNotification; }
public void AddJob(ISqlClient client) { repository.AddJob((Job)client); }
public SqlEEExport(ISqlClient sqlClient) { this.sqlClient = sqlClient; }
public PrasymaiPakeistRoleRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
private void AddButton(ISqlClient c, string name, EventHandler eventHandler) { client = c; var button = new Button { Text = name, Top = this.GetNextTop(), Left = 0 }; button.Click += eventHandler; panel.Controls.Add(button); }
public TreniruoteRepo(ISqlClient sqlclient, IVartotojaiRepo ivertotojai, IPratymuSkaiciusRepo ipratymuSkaicius) { _sqlClient = sqlclient; _ivertotojai = ivertotojai; _ipratymuSkaicius = ipratymuSkaicius; }
public PratymaiRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
public RoleRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }
public ServiceLog(ISqlClient sqlClient) { _sqlClient = sqlClient; }
public SqlTableRef(string tableName, ISqlClient client) : base(tableName) { Client = client; }
public KvietimaiRepo(ISqlClient sqlclient) { _sqlClient = sqlclient; }