コード例 #1
0
 public HomeController(ILogger <HomeController> logger, ISqlClient uow, IConfiguration configuration, IToastNotification toastNotification)
 {
     _logger            = logger;
     _uow               = uow;
     Configuration      = configuration;
     _toastNotification = toastNotification;
 }
コード例 #2
0
 public UserController(ISqlClient uow,
                       UserManager <AspNetUsers> userManager
                       )
 {
     _uow         = uow;
     _userManager = userManager;
 }
コード例 #3
0
        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();
                }
            };
        }
コード例 #4
0
ファイル: DbClient.cs プロジェクト: TianyuanC/dals
 /// <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;
 }
コード例 #5
0
        public void T02_GetTables()
        {
            ISqlClient    sqlClient = getClient();
            List <string> tables    = sqlClient.GetTablenames();

            Assert.IsTrue(tables.Count >= 1);
            Assert.IsTrue(tables.Contains(testTable));
        }
コード例 #6
0
 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>();
 }
コード例 #7
0
        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);
        }
コード例 #8
0
        public void Setup()
        {
            var service = new ServicesBuilder();

            _untity    = service.GetService <IUntityFunction>();
            _db        = service.GetService <WorkToolEntity>();
            _work      = service.GetService <IWork>();
            _sqlClient = service.GetService <ISqlClient>();
        }
コード例 #9
0
 public void Login(ISqlClient sqlClient)
 {
     if (LoginType == SqlEESettings.LogonType.SqlUser)
     {
         sqlClient.Connect(Instance, Catalog, Username, PasswordEncryption.Decrypt(Password));
     }
     else
     {
         sqlClient.Connect(Instance, Catalog);
     }
 }
コード例 #10
0
 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();
 }
コード例 #11
0
        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;
                }
            }
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
                }
            }
        }
コード例 #14
0
        /// <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);
        }
コード例 #15
0
        /// <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());
        }
コード例 #16
0
        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);
            }
        }
コード例 #17
0
 public WorkflowRepository(ISqlClient sqlClient)
 {
     _sqlClient = sqlClient;
 }
コード例 #18
0
 public QueueRepository(ISqlClient sqlClient, IServiceLog serviceLog)
 {
     _sqlClient  = sqlClient;
     _serviceLog = serviceLog;
 }
コード例 #19
0
 public ActivityData(ISqlClient sqlClient, IConfig config)
 {
     _sqlClient = sqlClient;
     _config    = config;
 }
コード例 #20
0
 public PratymuSkaiciusRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
 public SapphireRepository(ISqlClient sqlClient)
 {
     _sqlClient = sqlClient;
 }
コード例 #22
0
 public HomeController(ILogger <HomeController> logger, ISqlClient uow)
 {
     _logger = logger;
     _uow    = uow;
 }
コード例 #23
0
 public AtliktuPrtymuSkaicius(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #24
0
 public VartotojasRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #25
0
        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;
        }
コード例 #26
0
 public PakviestiTreneriaiRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #27
0
 public CompetitionController(ISqlClient uow, IToastNotification toastNotification)
 {
     _uow = uow;
     _toastNotification = toastNotification;
 }
コード例 #28
0
 public void AddJob(ISqlClient client)
 {
     repository.AddJob((Job)client);
 }
コード例 #29
0
 public SqlEEExport(ISqlClient sqlClient)
 {
     this.sqlClient = sqlClient;
 }
コード例 #30
0
 public PrasymaiPakeistRoleRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #31
0
 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);
 }
コード例 #32
0
 public TreniruoteRepo(ISqlClient sqlclient, IVartotojaiRepo ivertotojai, IPratymuSkaiciusRepo ipratymuSkaicius)
 {
     _sqlClient        = sqlclient;
     _ivertotojai      = ivertotojai;
     _ipratymuSkaicius = ipratymuSkaicius;
 }
コード例 #33
0
 public PratymaiRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #34
0
ファイル: RoleRepo.cs プロジェクト: Sushilla/ISportas-backend
 public RoleRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }
コード例 #35
0
 public ServiceLog(ISqlClient sqlClient)
 {
     _sqlClient = sqlClient;
 }
コード例 #36
0
 public SqlTableRef(string tableName, ISqlClient client) : base(tableName)
 {
     Client = client;
 }
コード例 #37
0
 public KvietimaiRepo(ISqlClient sqlclient)
 {
     _sqlClient = sqlclient;
 }