Example #1
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        //vbox1.Add(button); //Con esta linea añadimos un boton en toda la pantalla
        random = new Random ();

        Table table = new Table(9,10,true);

        //Forma de sacar las filas y las columnas
        for (uint row=0; row<9; row++) {
            for (uint col=0; col<10; col++) {
                uint index = row * 10 + col;
                int numero = (int)index + 1;
                Button button = new Button ();
                button.Label = numero.ToString();
                button.Visible = true;
                table.Attach (button, col, col+1, row, row+1);
                buttons.Add (button);
                numeros.Add (numero);
            }
        }

        table.Visible = true;
        vbox1.Add (table);

        buttonNumero.Clicked += delegate {
            int numero = getNumero();
            show(numero);
            buttonNumero.Sensitive = numeros.Count>0; // No cerrarse cuando se pongan todos los numeros.
            espeak(numero);
        };
    }
Example #2
0
 // Initialize any Table-derived type to point to the union at the given offset.
 protected internal virtual Table __union(Table t, int offset)
 {
     offset += bb_pos;
     t.bb_pos = offset + bb.getInt(offset);
     t.bb = bb;
     return t;
 }
Example #3
0
        public static Table Parse(IRestResponse response)
        {
            Table table = new Table();
            StringReader reader = new StringReader(response.Content);
            string readLine = reader.ReadLine();

            if (readLine != null)
            {
                string[] collection = readLine.Split(Separator);
                foreach (string column in collection)
                {
                    table.Columns.Add(column.TrimStart('"').TrimEnd('"'));
                }
            }

            string line = reader.ReadLine();

            while (!string.IsNullOrEmpty(line))
            {
                Row row = new Row(line);
                table.Rows.Add(row);
                line = reader.ReadLine();
            }

            return table;
        }
Example #4
0
        private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo)
        {
            //create table to add address of the customer
            Table adressTable = new Table();
            adressTable.IsFirstParagraph = true;
            adressTable.ColumnWidths = "60 180 60 180";
            adressTable.DefaultCellTextInfo.FontSize = 10;
            adressTable.DefaultCellTextInfo.LineSpacing = 3;
            adressTable.DefaultCellPadding.Bottom = 3;
            //add this table in the first section/page
            Section section = pdf.Sections[0];
            section.Paragraphs.Add(adressTable);
            //add a new row in the table
            Row row1AdressTable = new Row(adressTable);
            adressTable.Rows.Add(row1AdressTable);
            //add cells and text
            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.Color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            tf1.FontName = "Helvetica-Bold";

            row1AdressTable.Cells.Add("Bill To:", tf1);
            row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" +
                passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" +
                passengerInfo.PhoneNumber);

        }
Example #5
0
		public static void AssertNotModifiedByAnotherTransaction(TableStorage storage, ITransactionStorageActions transactionStorageActions, string key, Table.ReadResult readResult, TransactionInformation transactionInformation)
		{
			if (readResult == null)
				return;
			var txIdAsBytes = readResult.Key.Value<byte[]>("txId");
			if (txIdAsBytes == null)
				return;

			var txId = new Guid(txIdAsBytes);
			if (transactionInformation != null && transactionInformation.Id == txId)
			{
				return;
			}

			var existingTx = storage.Transactions.Read(new RavenJObject { { "txId", txId.ToByteArray() } });
			if (existingTx == null)//probably a bug, ignoring this as not a real tx
				return;

			var timeout = existingTx.Key.Value<DateTime>("timeout");
			if (SystemTime.UtcNow > timeout)
			{
				transactionStorageActions.RollbackTransaction(txId);
				return;
			}

			throw new ConcurrencyException("Document '" + key + "' is locked by transacton: " + txId);
		}
Example #6
0
 void Initialize()
 {
     string connect = "Server=127.0.0.1;Port=5432;User Id=s;Database=practice;";
     var connection = new NpgsqlConnection(connect);
     if(connection.State == ConnectionState.Closed) { connection.Open(); }
     users = new Table("users", connection);
 }
Example #7
0
    /*
    ** 2001 September 15
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    ** This file contains C code routines that are called by the parser
    ** to handle UPDATE statements.
    **
    ** $Id: update.c,v 1.207 2009/08/08 18:01:08 drh Exp $
    **
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  $Header$
    *************************************************************************
    */
    //#include "sqliteInt.h"

#if !SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
//static void updateVirtualTable(
//Parse pParse,       /* The parsing context */
//SrcList pSrc,       /* The virtual table to be modified */
//Table pTab,         /* The virtual table */
//ExprList pChanges,  /* The columns to change in the UPDATE statement */
//Expr pRowidExpr,    /* Expression used to recompute the rowid */
//int aXRef,          /* Mapping from columns of pTab to entries in pChanges */
//Expr pWhere         /* WHERE clause of the UPDATE statement */
//);
#endif // * SQLITE_OMIT_VIRTUALTABLE */

    /*
** The most recently coded instruction was an OP_Column to retrieve the
** i-th column of table pTab. This routine sets the P4 parameter of the
** OP_Column to the default value, if any.
**
** The default value of a column is specified by a DEFAULT clause in the
** column definition. This was either supplied by the user when the table
** was created, or added later to the table definition by an ALTER TABLE
** command. If the latter, then the row-records in the table btree on disk
** may not contain a value for the column and the default value, taken
** from the P4 parameter of the OP_Column instruction, is returned instead.
** If the former, then all row-records are guaranteed to include a value
** for the column and the P4 value is not required.
**
** Column definitions created by an ALTER TABLE command may only have
** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated
** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.)
**
** Therefore, the P4 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr()
** function is capable of transforming these types of expressions into
** sqlite3_value objects.
**
** If parameter iReg is not negative, code an OP_RealAffinity instruction
** on register iReg. This is used when an equivalent integer value is
** stored in place of an 8-byte floating point value in order to save
** space.
*/
    static void sqlite3ColumnDefault( Vdbe v, Table pTab, int i, int iReg )
    {
      Debug.Assert( pTab != null );
      if ( null == pTab.pSelect )
      {
        sqlite3_value pValue = new sqlite3_value();
        int enc = ENC( sqlite3VdbeDb( v ) );
        Column pCol = pTab.aCol[i];
#if SQLITE_DEBUG
        VdbeComment( v, "%s.%s", pTab.zName, pCol.zName );
#endif
        Debug.Assert( i < pTab.nCol );
        sqlite3ValueFromExpr( sqlite3VdbeDb( v ), pCol.pDflt, enc,
        pCol.affinity, ref pValue );
        if ( pValue != null )
        {
          sqlite3VdbeChangeP4( v, -1, pValue, P4_MEM );
        }
#if !SQLITE_OMIT_FLOATING_POINT
        if ( iReg >= 0 && pTab.aCol[i].affinity == SQLITE_AFF_REAL )
        {
          sqlite3VdbeAddOp1( v, OP_RealAffinity, iReg );
        }
#endif
      }
    }
Example #8
0
    /*
    ** Given table pTab, return a list of all the triggers attached to
    ** the table. The list is connected by Trigger.pNext pointers.
    **
    ** All of the triggers on pTab that are in the same database as pTab
    ** are already attached to pTab.pTrigger.  But there might be additional
    ** triggers on pTab in the TEMP schema.  This routine prepends all
    ** TEMP triggers on pTab to the beginning of the pTab.pTrigger list
    ** and returns the combined list.
    **
    ** To state it another way:  This routine returns a list of all triggers
    ** that fire off of pTab.  The list will include any TEMP triggers on
    ** pTab as well as the triggers lised in pTab.pTrigger.
    */
    static Trigger sqlite3TriggerList( Parse pParse, Table pTab )
    {
      Schema pTmpSchema = pParse.db.aDb[1].pSchema;
      Trigger pList = null;                  /* List of triggers to return */

      if ( pParse.disableTriggers != 0 )
      {
        return null;
      }

      if ( pTmpSchema != pTab.pSchema )
      {
        HashElem p;
        Debug.Assert( sqlite3SchemaMutexHeld( pParse.db, 0, pTmpSchema ) );
        for ( p = sqliteHashFirst( pTmpSchema.trigHash ); p != null; p = sqliteHashNext( p ) )
        {
          Trigger pTrig = (Trigger)sqliteHashData( p );
          if ( pTrig.pTabSchema == pTab.pSchema
          && pTrig.table.Equals( pTab.zName, StringComparison.InvariantCultureIgnoreCase ) )
          {
            pTrig.pNext = ( pList != null ? pList : pTab.pTrigger );
            pList = pTrig;
          }
        }
      }

      return ( pList != null ? pList : pTab.pTrigger );
    }
Example #9
0
 void BeforeWhere()
 {
     Initialize();
     counter = 0;
     users = users.Select("*").Where("id < 3").All();
     while(users.data.Read()) { counter++; }
 }
Example #10
0
        public static void SetBaseMethods( Table globals )
        {
            globals[Name__G] = globals;

            globals[Name_Next] = Next;
            globals[Name_Pairs] = Pairs;
            globals[Name_IPairs] = IPairs;

            globals[Name_RawGet] = RawGet;
            globals[Name_RawSet] = RawSet;

            globals[Name_GetMetatable] = GetMetatable;
            globals[Name_SetMetatable] = SetMetatable;

            globals[Name_ToString] = ToString;
            globals[Name_ToNumber] = ToNumber;

            globals[Name_Print] = Print;

            globals[Name_Type] = Type;

            globals[Name_Select] = Select;

            globals[Name_CollectGarbage] = CollectGarbage_Nop;
        }
            private void AttachToTable(Table table,
						    Widget widget, uint x,
						    uint y, uint width)
            {
                //                      table.Attach(widget, x, x + width, y, y + 1, AttachOptions.Fill, AttachOptions.Fill, 2, 2);
                table.Attach (widget, x, x + width, y, y + 1);
            }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sw"></param>
    public static void Export(StringWriter sw, GridView gv)
    {
        using (HtmlTextWriter htw = new HtmlTextWriter(sw))
        {
            //  Create a table to contain the grid
            Table table = new Table();

            //  include the gridline settings
            table.GridLines = gv.GridLines;

            //  add the header row to the table
            if (gv.HeaderRow != null)
            {

                table.Rows.Add(gv.HeaderRow);
            }

            //  add each of the data rows to the table
            foreach (GridViewRow row in gv.Rows)
            {

                table.Rows.Add(row);
            }

            //  add the footer row to the table
            if (gv.FooterRow != null)
            {

                table.Rows.Add(gv.FooterRow);
            }

            //  render the table into the htmlwriter
            table.RenderControl(htw);
        }
    }
Example #13
0
        public void InitDefinitions()
        {
            origTable = m_mainForm.Definition;

            var def = origTable?.Clone();

            if (def == null)
            {
                DialogResult result = MessageBox.Show(this, string.Format("Table {0} missing definition. Create default definition?", m_mainForm.DBCName),
                    "Definition Missing!",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button1);

                if (result != DialogResult.Yes)
                    return;

                def = CreateDefaultDefinition();
                if (def == null)
                {
                    MessageBox.Show(string.Format("Can't create default definitions for {0}", m_mainForm.DBCName));

                    def = new Table();
                    def.Name = m_mainForm.DBCName;
                    def.Fields = new List<Field>();
                }
            }

            InitForm(def);
        }
Example #14
0
    /*
    ** Check to make sure the given table is writable.  If it is not
    ** writable, generate an error message and return 1.  If it is
    ** writable return 0;
    */
    static bool sqlite3IsReadOnly( Parse pParse, Table pTab, int viewOk )
    {
      /* A table is not writable under the following circumstances:
      **
      **   1) It is a virtual table and no implementation of the xUpdate method
      **      has been provided, or
      **   2) It is a system table (i.e. sqlite_master), this call is not
      **      part of a nested parse and writable_schema pragma has not
      **      been specified.
      **
      ** In either case leave an error message in pParse and return non-zero.
      */
      if (
         ( IsVirtual( pTab )
          && sqlite3GetVTable( pParse.db, pTab ).pMod.pModule.xUpdate == null )
        || ( ( pTab.tabFlags & TF_Readonly ) != 0
      && ( pParse.db.flags & SQLITE_WriteSchema ) == 0
      && pParse.nested == 0 )
      )
      {
        sqlite3ErrorMsg( pParse, "table %s may not be modified", pTab.zName );
        return true;
      }

#if !SQLITE_OMIT_VIEW
      if ( viewOk == 0 && pTab.pSelect != null )
      {
        sqlite3ErrorMsg( pParse, "cannot modify %s because it is a view", pTab.zName );
        return true;
      }
#endif
      return false;
    }
Example #15
0
        public void LinqInsert_Batch_Test()
        {
            Table<Movie> nerdMoviesTable = new Table<Movie>(_session, new MappingConfiguration());
            Batch batch = _session.CreateBatch();

            Movie movie1 = Movie.GetRandomMovie();
            Movie movie2 = Movie.GetRandomMovie();
            movie1.Director = "Joss Whedon";
            var movies = new List<Movie>
            {
                movie1,
                movie2,
            };

            batch.Append(from m in movies select nerdMoviesTable.Insert(m));
            Task taskSaveMovies = Task.Factory.FromAsync(batch.BeginExecute, batch.EndExecute, null);
            taskSaveMovies.Wait();

            Task taskSelectStartMovies = Task<IEnumerable<Movie>>.Factory.FromAsync(
                nerdMoviesTable.BeginExecute, nerdMoviesTable.EndExecute, null).
                ContinueWith(res => Movie.DisplayMovies(res.Result));
            taskSelectStartMovies.Wait();

            CqlQuery<Movie> selectAllFromWhere = from m in nerdMoviesTable where m.Director == movie1.Director select m;

            Task taskselectAllFromWhere =
                Task<IEnumerable<Movie>>.Factory.FromAsync(selectAllFromWhere.BeginExecute, selectAllFromWhere.EndExecute, null).
                ContinueWith(res => Movie.DisplayMovies(res.Result));
            taskselectAllFromWhere.Wait();
            Task<List<Movie>> taskselectAllFromWhereWithFuture = Task<IEnumerable<Movie>>.
                Factory.FromAsync(selectAllFromWhere.BeginExecute, selectAllFromWhere.EndExecute, null).
                ContinueWith(a => a.Result.ToList());

            Movie.DisplayMovies(taskselectAllFromWhereWithFuture.Result);
        }
Example #16
0
        protected override object Convert(Table table, IBindingType typeToConvertTo, CultureInfo cultureInfo)
        {
            var runtimeBindingType = (RuntimeBindingType)typeToConvertTo;
            var verticalTable = GetVerticalTable(table, runtimeBindingType);
            var values = GetValues(verticalTable);
            var objectInitializationData = GetObjectInitializationData(values.Keys, runtimeBindingType.Type);
            var bindingTypes = objectInitializationData.GetBindingTypes();

            var convertedValues = values
                .Where(x => bindingTypes.ContainsKey(x.Key))
                .ToDictionary(
                    x => x.Key,
                    x => stepArgumentTypeConverter.Convert(x.Value, bindingTypes[x.Key], cultureInfo));
            var constructorParameters = objectInitializationData.Constructor.GetParameters()
                .Select(x => convertedValues[SanitizePropertyName(x.Name)]).ToArray();
            var result = objectInitializationData.Constructor.Invoke(constructorParameters);

            foreach (var property in objectInitializationData.PropertiesToSet)
            {
                var value = convertedValues[SanitizePropertyName(property.Name)];
                property.SetValue(result, value, null);
            }

            return result;
        }
		protected override IEnumerable<DbParameter> CoreGetColumnParameters(Type connectionType, string dataSourceTag, Server server, Database database, Schema schema, Table table)
		{
			if ((object)connectionType == null)
				throw new ArgumentNullException(nameof(connectionType));

			if ((object)dataSourceTag == null)
				throw new ArgumentNullException(nameof(dataSourceTag));

			if ((object)server == null)
				throw new ArgumentNullException(nameof(server));

			if ((object)database == null)
				throw new ArgumentNullException(nameof(database));

			if ((object)schema == null)
				throw new ArgumentNullException(nameof(schema));

			if ((object)table == null)
				throw new ArgumentNullException(nameof(table));

			if (dataSourceTag.SafeToString().ToLower() == ODBC_SQL_SERVER_DATA_SOURCE_TAG)
			{
				return new DbParameter[]
						{
							//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P1", server.ServerName),
							//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P2", database.DatabaseName),
							DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P3", schema.SchemaName),
							DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P4", table.TableName)
						};
			}

			throw new ArgumentOutOfRangeException(string.Format("dataSourceTag: '{0}'", dataSourceTag));
		}
Example #18
0
        protected override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _session = Session;
            _session.CreateKeyspace(_uniqueKsName);
            _session.ChangeKeyspace(_uniqueKsName);

            // Create necessary tables
            MappingConfiguration config1 = new MappingConfiguration();
            config1.MapperFactory.PocoDataFactory.AddDefinitionDefault(typeof(EntityWithTimeUuid),
                () => LinqAttributeBasedTypeDefinition.DetermineAttributes(typeof(EntityWithTimeUuid)));
            _tableEntityWithTimeUuid = new Table<EntityWithTimeUuid>(_session, config1);
            _tableEntityWithTimeUuid.Create();

            MappingConfiguration config2 = new MappingConfiguration();
            config2.MapperFactory.PocoDataFactory.AddDefinitionDefault(typeof(EntityWithNullableTimeUuid),
                () => LinqAttributeBasedTypeDefinition.DetermineAttributes(typeof(EntityWithNullableTimeUuid)));
            _tableEntityWithNullableTimeUuid = new Table<EntityWithNullableTimeUuid>(_session, config2);
            _tableEntityWithNullableTimeUuid.Create();

            _expectedTimeUuidObjectList = EntityWithTimeUuid.GetDefaultObjectList();
            _expectedNullableTimeUuidObjectList = EntityWithNullableTimeUuid.GetDefaultObjectList();

            _dateBefore = DateTimeOffset.Parse("2014-2-1");
            _dateAfter = DateTimeOffset.Parse("2014-4-1");
        }
	static Settings() {
		custom = new Table();
		
		
		
		
	}
Example #20
0
		private static string CreateInsertSqlString(Table table, IDictionary<string, object> parameters)
		{
			var sb = new StringBuilder();
			sb.AppendLine("IF NOT EXISTS (SELECT * FROM {0} WHERE {1})".Put(table.Name, table.Columns.Where(c => c.IsPrimaryKey).Select(c => "{0} = @{0}".Put(c.Name)).Join(" AND ")));
			sb.AppendLine("BEGIN");
			sb.Append("INSERT INTO ");
			sb.Append(table.Name);
			sb.Append(" (");
			foreach (var par in parameters)
			{
				sb.Append("[");
				sb.Append(par.Key);
				sb.Append("],");
			}
			sb.Remove(sb.Length - 1, 1);
			sb.Append(") VALUES (");
			foreach (var par in parameters)
			{
				sb.Append("@");
				sb.Append(par.Key);
				sb.Append(",");
			}
			sb.Remove(sb.Length - 1, 1);
			sb.AppendLine(")");
			sb.Append("END");
			return sb.ToString();
		}
Example #21
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        try
        {

            int i = 0;
            Table TBL = new Table();
            TBL = (Table)(Session["MessageTbl"]);
            int num = TBL.Rows.Count;

            foreach (TableRow x in TBL.Rows)
            {
                if (((x.Cells[1].Text) != "הודעות") && (i < num - 1))
                {
                    CheckBox itemBox = divmessage.FindControl("ChekBox" + i.ToString()) as CheckBox;
                    i++;
                    if (itemBox.Checked == true)
                    {
                        DBservices.DeleteMessage(x.Cells[1].Text);
                    }
                }
            }
            Response.Redirect("message.aspx");

        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("ארעה שגיאה");
        }
    }
Example #22
0
        public static Tuple<long,long> Delete(Table Data, Predicate Where)
        {

            long CurrentCount = 0;
            long NewCount = 0;

            foreach (RecordSet rs in Data.Extents)
            {

                // Append the current record count //
                CurrentCount += (long)rs.Count;

                // Delete //
                NewCount += Delete(rs, Where);

                // Push //
                Data.Push(rs);

            }

            BinarySerializer.Flush(Data);

            // Return the delta //
            return new Tuple<long,long>(CurrentCount, NewCount);

        }
Example #23
0
        public void Transaction_Delete()
        {
            using (var context = new Table())
            {
                int? ID;
                // 普通Where
                ID = context.User.Desc(o => o.ID).GetValue(o => o.ID); context.User.Where(o => o.ID == ID).Delete(); Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
                // 重载
                ID = context.User.Desc(o => o.ID).GetValue(o => o.ID); context.User.Delete(ID); Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
                // 批量
                var IDs = context.User.Desc(o => o.ID).ToSelectList(5, o => o.ID);
                context.User.Delete(IDs); Assert.IsFalse(context.User.Where(o => IDs.Contains(o.ID)).IsHaving());

                // 缓存表
                ID = context.UserRole.Cache.OrderByDescending(o => o.ID).GetValue(o => o.ID);
                context.UserRole.Where(o => o.ID == ID).Delete();
                Assert.IsFalse(context.UserRole.Cache.Where(o => o.ID == ID).IsHaving());

                // 不同逻辑方式(主键为GUID)
                var ID2 = context.Orders.Desc(o => o.ID).GetValue(o => o.ID); context.Orders.Delete(ID2); Assert.IsFalse(context.Orders.Where(o => o.ID == ID2).IsHaving());
                ID2 = context.OrdersAt.Desc(o => o.ID).GetValue(o => o.ID);

                context.OrdersAt.Delete(ID2); Assert.IsFalse(context.OrdersAt.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
                context.OrdersBool.Delete(ID2); Assert.IsFalse(context.OrdersBool.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
                context.OrdersNum.Delete(ID2); Assert.IsFalse(context.OrdersNum.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
                context.OrdersBoolCache.Delete(ID2); Assert.IsFalse(context.OrdersBoolCache.Cache.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());

                // 手动SQL
                ID = context.User.Desc(o => o.ID).GetValue(o => o.ID);
                var table = context; table.ManualSql.Execute("DELETE FROM Members_User WHERE id = @ID", table.DbProvider.CreateDbParam("ID", ID));
                Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
                context.SaveChanges();
            }
        }
Example #24
0
 public void SchemaNameTest()
 {
     var schema = new TableSchema("SchemaNameTest");
     Assert.AreEqual(schema.Name, "SchemaNameTest");
     var table = new Table("SchemaNameTest 2");
     Assert.AreEqual(table.Schema.Name, "SchemaNameTest 2");
 }
Example #25
0
 public static void luaH_free(lua_State L, Table t)
 {
     if (t.node[0] != dummynode)
     luaM_freearray(L, t.node);
       luaM_freearray(L, t.array);
       luaM_free(L, t);
 }
 public void CreateInstance_returns_the_object_returned_from_the_func()
 {
     var table = new Table("Field", "Value");
     var expectedPerson = new Person();
     var person = table.CreateInstance(() => expectedPerson);
     person.Should().Be(expectedPerson);
 }
Example #27
0
 public static void CloseConnection()
 {
     _context.Connection.Close();
     _context.Dispose();
     _table = null;
     _context = null;
 }
Example #28
0
        static void Main(string[] args)
        {
            #region basic config
            Dictionary<string, string> server_config = new Dictionary<string,string>();
            server_config.Add("ipaddr", "localhost");
            server_config.Add("userid", "root");
            server_config.Add("password", "root");
            server_config.Add("db", "translate");

            int count_bits = 64;
            int count_blocks = 6;
            int num_diff_bits = 3;
            #endregion

            List<ulong> bit_mask = new List<ulong>();
            bit_mask.Add(0xFFE0000000000000);
            bit_mask.Add(0x1FFC0000000000);
            bit_mask.Add(0x3FF80000000);
            bit_mask.Add(0x7FF00000);
            bit_mask.Add(0xFFE00);
            bit_mask.Add(0x1FF);

            foreach (ulong item in bit_mask)
            {
                Console.WriteLine("{0:x}", item);
            }
            Table table = new Table(server_config, count_bits, count_blocks, num_diff_bits, bit_mask);
            table.reset();
        }
Example #29
0
        /// <summary>
        /// Erstellt eine Beschreibung.
        /// </summary>
        /// <param name="table">Die gesamte <i>NIT</i>.</param>
        /// <param name="offset">Das erste Byte dieser Beschreibung in den Rohdaten.</param>
        /// <param name="length">Die Größe der Rohdaten zu dieser Beschreibung.</param>
        private NetworkEntry( Table table, int offset, int length )
            : base( table )
        {
            // Access section
            Section section = Section;

            // Load
            TransportStreamIdentifier = (ushort) Tools.MergeBytesToWord( section[offset + 1], section[offset + 0] );
            OriginalNetworkIdentifier = (ushort) Tools.MergeBytesToWord( section[offset + 3], section[offset + 2] );

            // Read the length
            int descrLength = 0xfff & Tools.MergeBytesToWord( section[offset + 5], section[offset + 4] );

            // Caluclate the total length
            Length = 6 + descrLength;

            // Verify
            if (Length > length) return;

            // Try to load descriptors
            Descriptors = Descriptor.Load( this, offset + 6, descrLength );

            // Can use it
            IsValid = true;
        }
Example #30
0
        private static string GenMethodReturn(Table pTable, MethodActionType t)
        {
            StringBuilder wBuilderReturn = null;
            switch (t)
            {
                case MethodActionType.Insert:
                    {
                        Column pPK = FwkGeneratorHelper.GetPrimaryKey(pTable);
                        if (pPK != null)
                        {
                            wBuilderReturn = new StringBuilder(FwkGeneratorHelper.TemplateDocument.GetTemplate("InsertReturn").Content);
                            wBuilderReturn.Replace(CommonConstants.CONST_ENTITY_PROPERTY_NAME, pPK.Name);
                            wBuilderReturn.Replace(CommonConstants.CONST_TYPENAME, FwkGeneratorHelper.GetCSharpType(pPK));

                            return wBuilderReturn.ToString();
                        }
                        else
                            return "  wDataBase.ExecuteNonQuery(wCmd);";
                    }
                case MethodActionType.Update:
                    return "  wDataBase.ExecuteNonQuery(wCmd);";

                case MethodActionType.SearchByParam:

                    wBuilderReturn = new StringBuilder(FwkGeneratorHelper.TemplateDocument.GetTemplate("SearchReturn").Content);

                    return wBuilderReturn.ToString();
                case MethodActionType.Delete:
                    return  "  wDataBase.ExecuteNonQuery(wCmd);";

            }

            return string.Empty;

        }
Example #31
0
        //回答问题
        private IEnumerator SolveProblem(int index, int IsRight)
        {
            //using (new BlockingLayerHelper(0))
            {
                var _msg = NetManager.Instance.AnswerQuestion(IsRight);
                yield return(_msg.SendAndWaitUntilDone());

                if (_msg.State == MessageState.Reply)
                {
                    bLock = false;
                    if (_msg.ErrorCode == (int)ErrorCodes.OK)
                    {
                        //donghua dengdai
                        {
                            DataModel.Option[index].TipState = 1;
                            if (IsRight == 1)
                            {
                                m_iRightCount++;
                                DataModel.Option[index].State = 1;
                            }
                            else
                            {
                                DataModel.Option[index].State        = 2;
                                DataModel.Option[m_iCorrectId].State = 1;
                            }
                            DataModel.AnswerProb = m_iRightCount + "/" + m_iNextAnswer;
                            m_bIsPlayAnimation   = true;
                            yield return(new WaitForSeconds(1f));

                            m_bIsPlayAnimation = false;
                        }

                        if (m_iNextAnswer >= MaxCount || _msg.Response.QuestionId == -1)
                        {
                            DataModel.IsOver = true;
                            var _mTimeStart2 = Game.Instance.ServerTime.AddDays(1).Date.AddHours(12);
                            DataModel.MTime = _mTimeStart2;
                            if (m_objTimerTrigger != null)
                            {
                                TimeManager.Instance.DeleteTrigger(m_objTimerTrigger);
                                m_objTimerTrigger = null;
                            }
                            //活动开启时间
                            DataModel.OverString1 = GameUtils.GetDictionaryText(270230);
                            //今日活动已完成请明日再来挑战
                            DataModel.OverString2 = GameUtils.GetDictionaryText(270228);
                            PlayerDataManager.Instance.NoticeData.AnswerQuestion = false;
                            yield break;
                        }

                        var tbSubject = Table.GetSubject(_msg.Response.QuestionId);
                        //if (tbSubject != null)
                        //{
                        BuildRadom(_msg.Response);
                        m_iNextAnswer++;
                        DataModel.WhichQuestion = String.Format(m_strQuestion, m_iNextAnswer);

                        // }
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(_msg.ErrorCode);
                    }
                }
                else
                {
                    var _e = new ShowUIHintBoard(220821);
                    EventDispatcher.Instance.DispatchEvent(_e);
                }
            }
        }
 /// <summary>
 /// Opens a file for reading the script code.
 /// It can return either a string, a byte[] or a Stream.
 /// If a byte[] is returned, the content is assumed to be a serialized (dumped) bytecode. If it's a string, it's
 /// assumed to be either a script or the output of a string.dump call. If a Stream, autodetection takes place.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="globalContext">The global context.</param>
 /// <returns>
 /// A string, a byte[] or a Stream.
 /// </returns>
 public abstract object LoadFile(string file, Table globalContext);
Example #33
0
        public void FetchOne()
        {
            Table t = testSchema.GetTable("test");

            Assert.Equal(38, t.Select("age").Execute().FetchOne()["age"]);
        }
Example #34
0
        public override void VisitTable(Table table)
        {
            Document document = table.Document;

            if (table._leftPadding.IsNull)
            {
                table._leftPadding = Unit.FromMillimeter(1.2);
            }
            if (table._rightPadding.IsNull)
            {
                table._rightPadding = Unit.FromMillimeter(1.2);
            }

            ParagraphFormat format;
            Style           style = document._styles[table._style.Value];

            if (style != null)
            {
                format = ParagraphFormatFromStyle(style);
            }
            else
            {
                table.Style = "Normal";
                format      = document._styles.Normal._paragraphFormat;
            }

            if (table._format == null)
            {
                table._format         = format.Clone();
                table._format._parent = table;
            }
            else
            {
                FlattenParagraphFormat(table._format, format);
            }

            int rows = table.Rows.Count;
            int clms = table.Columns.Count;

            for (int idxclm = 0; idxclm < clms; idxclm++)
            {
                Column          column = table.Columns[idxclm];
                ParagraphFormat colFormat;
                style = document._styles[column._style.Value];
                if (style != null)
                {
                    colFormat = ParagraphFormatFromStyle(style);
                }
                else
                {
                    column._style = table._style;
                    colFormat     = table.Format;
                }

                if (column._format == null)
                {
                    column._format         = colFormat.Clone();
                    column._format._parent = column;
                    if (column._format._shading == null && table._format._shading != null)
                    {
                        column._format._shading = table._format._shading;
                    }
                }
                else
                {
                    FlattenParagraphFormat(column._format, colFormat);
                }

                if (column._leftPadding.IsNull)
                {
                    column._leftPadding = table._leftPadding;
                }
                if (column._rightPadding.IsNull)
                {
                    column._rightPadding = table._rightPadding;
                }

                if (column._shading == null)
                {
                    column._shading = table._shading;
                }

                else if (table._shading != null)
                {
                    FlattenShading(column._shading, table._shading);
                }

                if (column._borders == null)
                {
                    column._borders = table._borders;
                }
                else if (table._borders != null)
                {
                    FlattenBorders(column._borders, table._borders);
                }
            }

            for (int idxrow = 0; idxrow < rows; idxrow++)
            {
                Row row = table.Rows[idxrow];

                ParagraphFormat rowFormat;
                style = document._styles[row._style.Value];
                if (style != null)
                {
                    rowFormat = ParagraphFormatFromStyle(style);
                }
                else
                {
                    row._style = table._style;
                    rowFormat  = table.Format;
                }

                for (int idxclm = 0; idxclm < clms; idxclm++)
                {
                    Column column = table.Columns[idxclm];
                    Cell   cell   = row[idxclm];

                    ParagraphFormat cellFormat;
                    Style           cellStyle = document._styles[cell._style.Value];
                    if (cellStyle != null)
                    {
                        cellFormat = ParagraphFormatFromStyle(cellStyle);

                        if (cell._format == null)
                        {
                            cell._format = cellFormat;
                        }
                        else
                        {
                            FlattenParagraphFormat(cell._format, cellFormat);
                        }
                    }
                    else
                    {
                        if (row._format != null)
                        {
                            FlattenParagraphFormat(cell.Format, row._format);
                        }

                        if (style != null)
                        {
                            cell._style = row._style;
                            FlattenParagraphFormat(cell.Format, rowFormat);
                        }
                        else
                        {
                            cell._style = column._style;
                            FlattenParagraphFormat(cell.Format, column._format);
                        }
                    }

                    if (cell._format._shading == null && table._format._shading != null)
                    {
                        cell._format._shading = table._format._shading;
                    }

                    if (cell._shading == null)
                    {
                        cell._shading = row._shading;
                    }
                    else if (row._shading != null)
                    {
                        FlattenShading(cell._shading, row._shading);
                    }
                    if (cell._shading == null)
                    {
                        cell._shading = column._shading;
                    }
                    else if (column._shading != null)
                    {
                        FlattenShading(cell._shading, column._shading);
                    }
                    if (cell._borders == null)
                    {
                        CloneHelper(ref cell._borders, row._borders);
                    }
                    else if (row._borders != null)
                    {
                        FlattenBorders(cell._borders, row._borders);
                    }
                    if (cell._borders == null)
                    {
                        cell._borders = column._borders;
                    }
                    else if (column._borders != null)
                    {
                        FlattenBorders(cell._borders, column._borders);
                    }
                }

                if (row._format == null)
                {
                    row._format         = rowFormat.Clone();
                    row._format._parent = row;
                    if (row._format._shading == null && table._format._shading != null)
                    {
                        row._format._shading = table._format._shading;
                    }
                }
                else
                {
                    FlattenParagraphFormat(row._format, rowFormat);
                }

                if (row._topPadding.IsNull)
                {
                    row._topPadding = table._topPadding;
                }
                if (row._bottomPadding.IsNull)
                {
                    row._bottomPadding = table._bottomPadding;
                }

                if (row._shading == null)
                {
                    row._shading = table._shading;
                }
                else if (table._shading != null)
                {
                    FlattenShading(row._shading, table._shading);
                }

                if (row._borders == null)
                {
                    row._borders = table._borders;
                }
                else if (table._borders != null)
                {
                    FlattenBorders(row._borders, table._borders);
                }
            }
        }
Example #35
0
        public static Table CreateSimpleTable(Table table)
        {
            ThemableColor bordersColor    = new ThemableColor(Color.FromRgb(73, 90, 128));
            ThemableColor headerColor     = new ThemableColor(Color.FromRgb(34, 143, 189));
            ThemableColor defaultRowColor = new ThemableColor(Color.FromRgb(176, 224, 230));

            Border border = new Border(1, BorderStyle.Single, bordersColor);

            table.Borders          = new TableBorders(border);
            table.TableCellPadding = new Basic.Primitives.Padding(5);

            //Add table header
            TableRow headerRow = table.Rows.AddTableRow();

            headerRow.RepeatOnEveryPage = true;
            //Add first column
            TableCell column1 = headerRow.Cells.AddTableCell();

            column1.State.BackgroundColor.LocalValue = headerColor;
            column1.Borders        = new TableCellBorders(border, border, border, border, null, null, border, null);
            column1.PreferredWidth = new TableWidthUnit(50);
            //Add second column
            TableCell column2 = headerRow.Cells.AddTableCell();

            column2.State.BackgroundColor.LocalValue = headerColor;
            column2.PreferredWidth    = new TableWidthUnit(150);
            column2.VerticalAlignment = VerticalAlignment.Center;
            Paragraph column2Para = column2.Blocks.AddParagraph();

            column2Para.TextAlignment     = Alignment.Center;
            column2Para.State.LineSpacing = 1;
            TextInline column2Text = column2Para.Inlines.AddText("Product");

            column2Text.State.ForegroundColor = new ThemableColor(Colors.White);
            column2Text.FontSize = 20;
            //Add third column
            TableCell column3 = headerRow.Cells.AddTableCell();

            column3.State.BackgroundColor.LocalValue = headerColor;
            column3.PreferredWidth = new TableWidthUnit(250);
            column3.Padding        = new Basic.Primitives.Padding(20, 0, 0, 0);
            Paragraph column3Para = column3.Blocks.AddParagraph();

            column3Para.State.LineSpacing = 1;
            TextInline column3Text = column3Para.Inlines.AddText("Price");

            column3Text.State.ForegroundColor = new ThemableColor(Colors.White);
            column3Text.FontSize = 20;

            //Add table rows
            Random r = new Random();

            for (int i = 0; i < 50; i++)
            {
                ThemableColor rowColor = i % 2 == 0 ? defaultRowColor : new ThemableColor(Colors.White);

                TableRow row = table.Rows.AddTableRow();
                row.Height = new TableRowHeight(HeightType.Exact, 20);

                TableCell idCell = row.Cells.AddTableCell();
                idCell.State.BackgroundColor.LocalValue = rowColor;
                idCell.Blocks.AddParagraph().Inlines.AddText(i.ToString());

                TableCell productCell = row.Cells.AddTableCell();
                productCell.State.BackgroundColor.LocalValue = rowColor;
                Paragraph productPara = productCell.Blocks.AddParagraph();
                productPara.TextAlignment = Alignment.Center;
                productPara.Inlines.AddText(String.Format("Product{0}", i));

                TableCell priceCell = row.Cells.AddTableCell();
                priceCell.Padding = new Basic.Primitives.Padding(20, 0, 0, 0);
                priceCell.State.BackgroundColor.LocalValue = rowColor;
                priceCell.Blocks.AddParagraph().Inlines.AddText(r.Next(10, 1000).ToString());
            }

            return(table);
        }
Example #36
0
 public Table Add(Table newTable)
 {
     db.Add(newTable);
     return(newTable);
 }
Example #37
0
        public void RefreshData(UIInitArguments data)
        {
            var _args = data as AnswerArguments;

            if (_args != null)
            {
                if (m_objTimerTrigger != null)
                {
                    TimeManager.Instance.DeleteTrigger(m_objTimerTrigger);
                    m_objTimerTrigger = null;
                }
                m_strQuestion        = GameUtils.GetDictionaryText(270227);
                m_iNextAnswer        = PlayerDataManager.Instance.GetExData(436);
                m_iRightCount        = PlayerDataManager.Instance.GetExData(437);
                DataModel.AnswerProb = m_iRightCount + "/" + m_iNextAnswer;

                var _beginTime   = int.Parse(Table.GetClientConfig(206).Value);
                var _endTime     = int.Parse(Table.GetClientConfig(207).Value);
                var _mTimeStart  = Game.Instance.ServerTime.AddDays(0).Date.AddHours(_beginTime);
                var _mTimeEnd    = Game.Instance.ServerTime.AddDays(0).Date.AddHours(_endTime);
                var _mTimeStart2 = Game.Instance.ServerTime.AddDays(1).Date.AddHours(_beginTime);
                var _mTimeEnd2   = Game.Instance.ServerTime.AddDays(1).Date.AddHours(_endTime);

                var _nowTime = Game.Instance.ServerTime;
                PlayerDataManager.Instance.NoticeData.AnswerQuestion = false;
                if (m_iNextAnswer >= MaxCount)
                {
                    m_iNextAnswer    = 0;
                    DataModel.IsOver = true;
                    DataModel.MTime  = _mTimeStart2;
                    //活动开启时间
                    DataModel.OverString1 = GameUtils.GetDictionaryText(270230);
                    //今日活动已完成请明日再来挑战
                    DataModel.OverString2 = GameUtils.GetDictionaryText(270228);
                    return;
                }

                if (_nowTime < _mTimeStart)
                {
                    DataModel.IsOver = true;
                    m_iNextAnswer    = 0;
                    DataModel.MTime  = _mTimeStart;
                    //活动开启时间
                    DataModel.OverString1 = GameUtils.GetDictionaryText(270230);
                    //今日活动未开启
                    DataModel.OverString2 = GameUtils.GetDictionaryText(270229);
                    m_objTimerTrigger     = TimeManager.Instance.CreateTrigger(_mTimeStart, () =>
                    {
                        TimeManager.Instance.DeleteTrigger(m_objTimerTrigger);
                        m_objTimerTrigger = null;
                        //活动剩余时间
                        DataModel.OverString1 = GameUtils.GetDictionaryText(270231);
                        DataModel.IsOver      = false;
                        DataModel.MTime       = _mTimeEnd;
                        m_iNextAnswer         = 1;
                        if (m_strQuestion != "")
                        {
                            DataModel.WhichQuestion = String.Format(m_strQuestion, m_iNextAnswer);
                            NetManager.Instance.StartCoroutine(GetProblemData(m_iNextAnswer));
                        }
                    });
                }
                else if (_nowTime >= _mTimeStart && _nowTime < _mTimeEnd)
                {
                    DataModel.IsOver = false;
                    //活动剩余时间
                    DataModel.OverString1 = GameUtils.GetDictionaryText(270231);
                    DataModel.MTime       = _mTimeEnd;
                    m_objTimerTrigger     = TimeManager.Instance.CreateTrigger(_mTimeEnd, () =>
                    {
                        TimeManager.Instance.DeleteTrigger(m_objTimerTrigger);
                        m_objTimerTrigger = null;
                        DataModel.IsOver  = true;
                        DataModel.MTime   = _mTimeStart2;
                        //活动开启时间
                        DataModel.OverString1 = GameUtils.GetDictionaryText(270230);
                        //今日活动已完成请明日再来挑战
                        DataModel.OverString2 = GameUtils.GetDictionaryText(270228);
                    });
                    m_iNextAnswer++;
                    if (m_strQuestion != "")
                    {
                        DataModel.WhichQuestion = String.Format(m_strQuestion, m_iNextAnswer);
                        NetManager.Instance.StartCoroutine(GetProblemData(m_iNextAnswer));
                    }
                }
                else
                {
                    DataModel.IsOver = true;
                    m_iNextAnswer    = 0;
                    DataModel.MTime  = _mTimeStart2;
                    //今日活动已完成请明日再来挑战
                    DataModel.OverString2 = GameUtils.GetDictionaryText(270228);
                    //活动开启时间
                    DataModel.OverString1 = GameUtils.GetDictionaryText(270230);
                    m_objTimerTrigger     = TimeManager.Instance.CreateTrigger(_mTimeStart2, () =>
                    {
                        TimeManager.Instance.DeleteTrigger(m_objTimerTrigger);
                        m_objTimerTrigger = null;
                        DataModel.IsOver  = false;
                        DataModel.MTime   = _mTimeEnd2;
                        //活动剩余时间
                        DataModel.OverString1 = GameUtils.GetDictionaryText(270231);
                        m_iNextAnswer         = 1;
                        if (m_strQuestion != "")
                        {
                            DataModel.WhichQuestion = String.Format(m_strQuestion, m_iNextAnswer);
                            NetManager.Instance.StartCoroutine(GetProblemData(m_iNextAnswer));
                        }
                    });
                }
            }
        }
 public void CheckThenControlTypeCollectionShown([NotNull] string behavior, string enabled, [NotNull] Table table)
 {
     behavior = $"should {behavior}";
     CheckControlTypeCollectionShown(behavior, enabled, table, _runner.Then);
 }
Example #39
0
 public TableInformation this [Table table] {
     get { return(Tables [(int)table]); }
 }
 public void CheckGivenControlTypeCollectionShown([NotNull] string behavior, string enabled, [NotNull] Table table)
 {
     if (behavior.Contains("are"))
     {
         behavior = behavior.Replace("are", "is");
     }
     CheckControlTypeCollectionShown(behavior, enabled, table, _runner.Given);
 }
Example #41
0
 protected abstract void ExportTableProperties(Table table);
Example #42
0
 public bool HasTable(Table table)
 {
     return((Valid & (1L << (int)table)) != 0);
 }
Example #43
0
 protected abstract void ExportColumnProperties(Table table, Column column);
Example #44
0
 protected abstract void ExportTableExtendedProperty(Table table, string property);
Example #45
0
        public void GivenUserLoginsToAMMWithCredentialAndSeeTheAMMDirectAccountsPageLoaded(Table table)
        {
            driver.Navigate().GoToUrl(ConfigurationManager.AppSettings["amm_url"]);
            loginPage = new LoginPage(driver);

            dynamic instance = table.CreateDynamicInstance();
            loginPage.Login((string)instance.Username, (string)instance.Password);

            aMMDirectAccountsPage = new AMMDirectAccountsPage(driver);
            Assert.IsTrue(aMMDirectAccountsPage.ifElementExist(aMMDirectAccountsPage.txtFID));

        }
Example #46
0
 protected abstract void ExportColumnExtendedProperty(Table table, Column column, string property);
Example #47
0
    bool getInfo(string filterStr, bool isEditMode = false)
    {
        Table pTable = new Table();

        CommCtrl pCommCtrl = new CommCtrl();
        try
        {
            string parentItem = pDataIO.getDbCmdExecuteScalar("select RoleName from RolesTable where id = " + currID).ToString();

            Control myCtrl = pCommCtrl.CreateNaviCtrl(funcItemName, parentItem, Session["BlockType"].ToString(), pDataIO,out logTracingString);
            this.plhNavi.Controls.Add(myCtrl);

            pTable.ID = "ListTable";
            List<string> pLst = new List<string>();

            pLst.Add("已经存在权限");
            pLst.Add("");
            pLst.Add("服务器权限列表");

            TableHeaderRow thr = pCommCtrl.CreateMyTableHeader(pLst);
            if (thr != null)
            {
                pTable.Controls.Add(thr);
            }

            #region 获取当前已有的列表
            DataTable pReaderTable = pDataIO.GetDataTable(filterStr, "CurrFunctionInfo");
            Table currTable = new Table();
            currTable.ID = "currTable";
            currTableChks = new CheckBox[pReaderTable.Rows.Count];

            for (int i = 0; i < pReaderTable.Rows.Count; i++)
            {
                currTableChks[i] = new CheckBox();
                currTableChks[i].ID = "chkCurrID_" + pReaderTable.Rows[i]["ID"].ToString();
                currTableChks[i].Checked = true;

                Label lblName = new Label();
                lblName.Text = pReaderTable.Rows[i]["Title"].ToString();

                Label lblRemark = new Label();
                lblRemark.Text = pReaderTable.Rows[i]["Remarks"].ToString();

                TableCell[] tcs = new TableCell[3];
                tcs[0] = pCommCtrl.CreateMyTableCell(currTableChks[i]);
                tcs[1] = pCommCtrl.CreateMyTableCell(lblName);
                tcs[2] = pCommCtrl.CreateMyTableCell(lblRemark);
                //string[] lblItem = new string[3] { "select", "RoleName", "Remark" };
                TableRow tr = new TableRow();
                for (int j = 0; j < tcs.Length; j++)
                {
                    tr.Cells.Add(tcs[j]);
                }

                currTable.Rows.Add(tr);
            }
            #endregion

            #region 服务器存在的列表
            DataTable rolesListTable = pDataIO.GetDataTable("select * from FunctionTable where blockLevel=0", "FunctionTable");
            Table rolesTable = new Table();
            rolesTable.ID = "GlobalTable";
            globalTableChks = new CheckBox[rolesListTable.Rows.Count];

            for (int i = 0; i < rolesListTable.Rows.Count; i++)
            {
                globalTableChks[i] = new CheckBox();
                globalTableChks[i].ID = "chkGlobalID_" + rolesListTable.Rows[i]["ID"].ToString();

                Label lblName = new Label();
                lblName.Text = rolesListTable.Rows[i]["Title"].ToString();

                Label lblRemark = new Label();
                lblRemark.Text = rolesListTable.Rows[i]["Remarks"].ToString();

                TableCell[] tcs = new TableCell[3];
                tcs[0] = pCommCtrl.CreateMyTableCell(globalTableChks[i]);
                tcs[1] = pCommCtrl.CreateMyTableCell(lblName);
                tcs[2] = pCommCtrl.CreateMyTableCell(lblRemark);
                TableRow tr = new TableRow();
                for (int j = 0; j < tcs.Length; j++)
                {
                    tr.Cells.Add(tcs[j]);
                }

                rolesTable.Rows.Add(tr);
            }
            #endregion

            TableCell dispTc0 = new TableCell();
            dispTc0.Controls.Add(currTable);

            TableCell dispTc1 = new TableCell();
            dispTc1.Text = "";
            TableCell dispTc2 = new TableCell();

            dispTc2.Controls.Add(rolesTable);
            TableRow dispTr = new TableRow();

            dispTr.Cells.Add(dispTc0);
            dispTr.Cells.Add(dispTc1);
            dispTr.Cells.Add(dispTc2);
            pTable.Rows.Add(dispTr);

            setItemEnabled(isEditMode);

            this.plhMain.Controls.Add(pTable);
            this.plhMain.Controls.Add(new HtmlGenericControl("hr"));
            return true;
        }
        catch (Exception ex)
        {
            pDataIO.WriteErrorLogs(ex.ToString());
            pDataIO.OpenDatabase(false);
            throw ex;
        }
    }
Example #48
0
    public void generate_tiles(Table map_data, Bitmap tileset, Viewport viewport)
    {
        if (viewport == null)
        {
            Console.WriteLine("Tilemap viewport is invalid!");
            return;
        }
        Console.Write("Generating tilemap...");
        //if not ready or needed, gtfo
        if (map_data == null || tileset == null)
        {
            if (map_data == null)
            {
                Console.WriteLine("Attempted to generate tilemap with null map_data");
            }
            if (tileset == null)
            {
                Console.WriteLine("Attempted to generate tilemap with null tileset");
            }
            return;
        }
        if (map_data.xsize == 0 || map_data.ysize == 0 || map_data.zsize == 0)
        {
            Console.WriteLine("Attempted to generate tilemap of size 0");
        }
        if (!map_tiles_empty())
        {
            Console.WriteLine("Attempted to generate a tilemap that is already generated");
            return;
        }

        //get map dimensions in 64x tiles
        int tile_width  = Math.Max(1, (int)((float)map_data.xsize / 64f));
        int tile_height = Math.Max(1, (int)((float)map_data.ysize / 64f));
        //set blank color
        Color c_blank = new Color(0, 0, 0, 0);

        //iterate through the 64x64 map tiles we intend to create
        for (int tile_x = 0; tile_x < tile_width; tile_x++)
        {
            for (int tile_y = 0; tile_y < tile_height; tile_y++)
            {
                //determine the map starting tile coordinates
                int start_x = tile_x * 64;
                int start_y = tile_y * 64;
                //calculate the map tile dimensions - normally 64x64 except close to bottom or right edges
                int bm_width  = 64;
                int bm_height = 64;
                if (tile_x == tile_width - 1)
                {
                    bm_width = (map_data.xsize - start_x);
                }
                if (tile_y == tile_height - 1)
                {
                    bm_height = (map_data.ysize - start_y);
                }
                //create a bitmap for this map tile
                Bitmap bitmap = new Bitmap(bm_width * 32, bm_height * 32);
                //determine map tile ending coordinates
                int end_x = start_x + bm_width;
                int end_y = start_y + bm_height;
                //initialize tile image coordinates
                int tile_image_x = 0;
                int tile_image_y = 0;

                //open the bitmap for direct access
                System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap.bmp);
                g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;

                //iterate the map data and fill in the tile bitmap as needed
                for (int x = start_x; x < end_x; x++)
                {
                    for (int y = start_y; y < end_y; y++)
                    {
                        //get the tile id
                        int tile_id = map_data.get(x, y, 0) - 384;
                        if (tile_id < 0) //if tile is empty
                        {
                            //fill in a blank, update the image coordinates, and continue
                            bitmap.fill_rect(tile_image_x, tile_image_y, 32, 32, c_blank);
                            tile_image_y += 32;
                            continue;
                        }

                        //direct copy bitmap info (blt is too slow)
                        System.Drawing.Rectangle source      = new System.Drawing.Rectangle(new System.Drawing.Point((tile_id % 8) * 32, (tile_id / 8) * 32), new System.Drawing.Size(32, 32));
                        System.Drawing.Rectangle destination = new System.Drawing.Rectangle(new System.Drawing.Point(tile_image_x, tile_image_y), new System.Drawing.Size(32, 32));
                        g.DrawImage(tileset.bmp, destination, source, System.Drawing.GraphicsUnit.Pixel);

                        //update tile coordinates and continue
                        tile_image_y += 32;
                    }
                    //recycle column
                    tile_image_x += 32;
                    tile_image_y  = 0;
                }

                //close direct access to bitmap
                g.Dispose();
                OG_Graphics.deferred_action_add(bitmap.syncBitmap);

                //create the tile sprite and add it to the map
                Sprite sprite = new Sprite(viewport);
                sprite.bitmap = bitmap;
                sprite.x      = tile_x * 2048;
                sprite.y      = tile_y * 2048;
                add_map_tile(sprite);
            }
        }
        Console.Write("   done.\n");
    }
Example #49
0
        public Task <User> GetByUserAndPass(string username, string password, CancellationToken cancellationToken)
        {
            var passwordHash = SecurityHelper.GetSha256Hash(password);

            return(Table.Where(p => p.UserName == username && p.PasswordHash == passwordHash).SingleOrDefaultAsync(cancellationToken));
        }
Example #50
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1          = (Window)builder.GetObject("window1");
            button1          = (Button)builder.GetObject("button1");
            button2          = (Button)builder.GetObject("button2");
            table1           = (Table)builder.GetObject("table1");
            table2           = (Table)builder.GetObject("table2");
            firstNameBox     = (Entry)builder.GetObject("firstNameBox");
            lastNameBox      = (Entry)builder.GetObject("lastNameBox");
            organisationBox  = (Entry)builder.GetObject("organisationBox");
            emailBox         = (Entry)builder.GetObject("emailBox");
            countryBox       = (ComboBox)builder.GetObject("countryBox");
            label1           = (Label)builder.GetObject("label1");
            licenseContainer = (Container)builder.GetObject("licenseContainer");
            checkbutton1     = (CheckButton)builder.GetObject("checkbutton1");
            listview1        = (Gtk.TreeView)builder.GetObject("listview1");
            alignment7       = (Alignment)builder.GetObject("alignment7");
            oldVersions      = (CheckButton)builder.GetObject("checkbutton2");
            listview1.Model  = listmodel;

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            if (version.Revision == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
            }

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Populate the combo box with a list of valid country names.
            ListStore countries = new ListStore(typeof(string));

            foreach (string country in Constants.Countries)
            {
                countries.AppendValues(country);
            }
            countryBox.Model = countries;

            // Add a cell renderer to the combo box.
            CellRendererText cell = new CellRendererText();

            countryBox.PackStart(cell, false);
            countryBox.AddAttribute(cell, "text", 0);

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, emailBox, organisationBox, countryBox };

            licenseView = new MarkdownView(owner);
            licenseContainer.Add(licenseView.MainWidget);
            tabbedExplorerView = owner as IMainView;

            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            window1.Modal        = true;
            oldVersions.Toggled += OnShowOldVersionsToggled;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
Example #51
0
 private static void SetProperty <T>(T obj, PropertyInfo property, object value, string columnName, Type type, Table table, Row row)
 {
     try
     {
         property.SetValue(obj, value, null);
     }
     catch (Exception e)
     {
         throw new ConfigException(e, "M_Fixture_Temp_ObjectFactory_SetProperty", columnName, type, table, row, value);
     }
 }
Example #52
0
        /*--------------------------------------------------------------------------
         *                Main
         *--------------------------------------------------------------------------*/
        public static int Main( )
        {
            //  1.  Create a DynamoDB client connected to a DynamoDB-Local instance
            Console.WriteLine(stepString, 1, "Create a DynamoDB client connected to a DynamoDB-Local instance");
            if (!createClient(true) || !pause( ))
            {
                return(1);
            }


            //  2.  Create a table for movie data asynchronously
            Console.WriteLine(stepString, 2, "Create a table for movie data");
            CreatingTable_async(movies_table_name,
                                movie_items_attributes,
                                movies_key_schema,
                                movies_table_provisioned_throughput).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }

            try { moviesTable = Table.LoadTable(Ddb_Intro.client, movies_table_name); }
            catch (Exception ex)
            {
                operationFailed = true;
                Console.WriteLine(
                    " Error: Could not access the new '{0}' table after creating it;\n" +
                    "        Reason: {1}.", movies_table_name, ex.Message);
                pause( );
                return(1);
            }


            //  3.  Load movie data into the Movies table asynchronously
            if ((moviesTableDescription != null) &&
                (moviesTableDescription.ItemCount == 0))
            {
                Console.WriteLine(stepString, 3,
                                  "Load movie data into the Movies table");
                LoadingData_async(moviesTable, movieDataPath).Wait( );
                if (!pause( ) || operationFailed)
                {
                    return(1);
                }
            }
            else
            {
                Console.WriteLine(stepString, 3,
                                  "Skipped: Movie data is already loaded in the Movies table");
                if (!pause( ))
                {
                    return(1);
                }
            }


            //  4.  Add a new movie to the Movies table
            Console.WriteLine(stepString, 4,
                              "Add a new movie to the Movies table");
            Document newItemDocument = new Document();

            newItemDocument["year"]  = 2018;
            newItemDocument["title"] = "The Big New Movie";
            newItemDocument["info"]  = Document.FromJson(
                "{\"plot\" : \"Nothing happens at all.\",\"rating\" : 0}");

            WritingNewMovie_async(newItemDocument).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  5.  Read and display the new movie record that was just added
            Console.WriteLine(stepString, 5,
                              "Read and display the new movie record that was just added");
            ReadingMovie_async(2018, "The Big New Movie", true).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  6.  Update the new movie record in various ways
            //-------------------------------------------------
            //  6a.  Create an UpdateItemRequest to:
            //       -- modify the plot and rating of the new movie, and
            //       -- add a list of actors to it
            Console.WriteLine(stepString, "6a",
                              "Change the plot and rating for the new movie and add a list of actors");
            UpdateItemRequest updateRequest = new UpdateItemRequest()
            {
                TableName = movies_table_name,
                Key       = new Dictionary <string, AttributeValue>
                {
                    { partition_key_name, new AttributeValue {
                          N = "2018"
                      } },
                    { sort_key_name, new AttributeValue {
                          S = "The Big New Movie"
                      } }
                },
                ExpressionAttributeValues = new Dictionary <string, AttributeValue>
                {
                    { ":r", new AttributeValue {
                          N = "5.5"
                      } },
                    { ":p", new AttributeValue {
                          S = "Everything happens all at once!"
                      } },
                    { ":a", new AttributeValue {
                          L = new List <AttributeValue>
                          {
                              new AttributeValue {
                                  S = "Larry"
                              },
                              new AttributeValue {
                                  S = "Moe"
                              },
                              new AttributeValue {
                                  S = "Curly"
                              }
                          }
                      } }
                },
                UpdateExpression = "SET info.rating = :r, info.plot = :p, info.actors = :a",
                ReturnValues     = "NONE"
            };

            UpdatingMovie_async(updateRequest, true).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }

            //  6b  Change the UpdateItemRequest so as to increment the rating of the
            //      new movie, and then make the update request asynchronously.
            Console.WriteLine(stepString, "6b",
                              "Increment the new movie's rating atomically");
            Console.WriteLine("  -- Incrementing the rating of the new movie by 1...");
            updateRequest.ExpressionAttributeValues = new Dictionary <string, AttributeValue>
            {
                { ":inc", new AttributeValue {
                      N = "1"
                  } }
            };
            updateRequest.UpdateExpression = "SET info.rating = info.rating + :inc";
            UpdatingMovie_async(updateRequest, true).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }

            //  6c  Change the UpdateItemRequest so as to increment the rating of the
            //      new movie, and then make the update request asynchronously.
            Console.WriteLine(stepString, "6c",
                              "Now try the same increment again with a condition that fails... ");
            Console.WriteLine("  -- Now trying to increment the new movie's rating, but this time\n" +
                              "     ONLY ON THE CONDITION THAT the movie has more than 3 actors...");
            updateRequest.ExpressionAttributeValues.Add(":n", new AttributeValue {
                N = "3"
            });
            updateRequest.ConditionExpression = "size(info.actors) > :n";
            UpdatingMovie_async(updateRequest, true).Wait( );
            if (!pause( ) || operationSucceeded)
            {
                return(1);
            }


            //  7.  Try conditionally deleting the movie that we added

            //  7a.  Try conditionally deleting the movie that we added
            Console.WriteLine(stepString, "7a",
                              "Try deleting the new movie record with a condition that fails");
            Console.WriteLine("  -- Trying to delete the new movie,\n" +
                              "     -- but ONLY ON THE CONDITION THAT its rating is 5.0 or less...");
            Expression condition = new Expression();

            condition.ExpressionAttributeValues[":val"] = 5.0;
            condition.ExpressionStatement = "info.rating <= :val";
            DeletingItem_async(moviesTable, 2018, "The Big New Movie", condition).Wait( );
            if (!pause( ) || operationSucceeded)
            {
                return(1);
            }

            //  7b.  Now increase the cutoff to 7.0 and try to delete again...
            Console.WriteLine(stepString, "7b",
                              "Now increase the cutoff to 7.0 and try to delete the movie again...");
            Console.WriteLine("  -- Now trying to delete the new movie again,\n" +
                              "     -- but this time on the condition that its rating is 7.0 or less...");
            condition.ExpressionAttributeValues[":val"] = 7.0;

            DeletingItem_async(moviesTable, 2018, "The Big New Movie", condition).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  8.  Query the Movies table in 3 different ways
            Search search;

            //  8a. Just query on the year
            Console.WriteLine(stepString, "8a",
                              "Query the Movies table using a Search object for all movies from 1985");
            Console.WriteLine("  -- First, create a Search object...");
            try { search = moviesTable.Query(1985, new Expression( )); }
            catch (Exception ex)
            {
                Console.WriteLine("     ERROR: Failed to create the Search object because:\n            " +
                                  ex.Message);
                pause( );
                return(1);
            }
            Console.WriteLine("     -- Successfully created the Search object,\n" +
                              "        so now we'll display the movies retrieved by the query:");
            if ((search == null) || !pause( ))
            {
                return(1);
            }

            SearchListing_async(search).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  8b. SearchListing_async
            Console.WriteLine(stepString, "8b",
                              "Query for 1992 movies with titles from B... to Hzz... using Table.Query");
            Console.WriteLine("  -- Now setting up a QueryOperationConfig for the 'Search'...");
            QueryOperationConfig config = new QueryOperationConfig( );

            config.Filter = new QueryFilter( );
            config.Filter.AddCondition("year", QueryOperator.Equal, new DynamoDBEntry[] { 1992 });
            config.Filter.AddCondition("title", QueryOperator.Between, new DynamoDBEntry[] { "B", "Hzz" });
            config.AttributesToGet = new List <string> {
                "year", "title", "info"
            };
            config.Select = SelectValues.SpecificAttributes;
            Console.WriteLine("     -- Creating the Search object based on the QueryOperationConfig");
            try { search = moviesTable.Query(config); }
            catch (Exception ex)
            {
                Console.WriteLine("     ERROR: Failed to create the Search object because:\n            " +
                                  ex.Message);
                if (!pause( ) || operationFailed)
                {
                    return(1);
                }
            }
            Console.WriteLine("     -- Successfully created the Search object,\n" +
                              "        so now we'll display the movies retrieved by the query.");
            if ((search == null) || !pause( ))
            {
                return(1);
            }

            SearchListing_async(search).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  8c. Query using a QueryRequest
            Console.WriteLine(stepString, "8c",
                              "Query the Movies table for 1992 movies with titles from M... to Tzz...");
            Console.WriteLine("  -- Next use a low-level query to retrieve a selection of movie attributes");
            QueryRequest qRequest = new QueryRequest
            {
                TableName = "Movies",
                ExpressionAttributeNames = new Dictionary <string, string>
                {
                    { "#yr", "year" }
                },
                ExpressionAttributeValues = new Dictionary <string, AttributeValue>
                {
                    { ":qYr", new AttributeValue {
                          N = "1992"
                      } },
                    { ":tSt", new AttributeValue {
                          S = "M"
                      } },
                    { ":tEn", new AttributeValue {
                          S = "Tzz"
                      } }
                },
                KeyConditionExpression = "#yr = :qYr and title between :tSt and :tEn",
                ProjectionExpression   = "#yr, title, info.actors[0], info.genres, info.running_time_secs"
            };

            Console.WriteLine("     -- Using a QueryRequest to get the lead actor and genres of\n" +
                              "        1992 movies with titles between 'M...' and 'Tzz...'.");
            ClientQuerying_async(qRequest).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  9.  Try scanning the movies table to retrieve movies from several decades
            //  9a. Use Table.Scan with a Search object and a ScanFilter to retrieve movies from the 1950s
            Console.WriteLine(stepString, "9a",
                              "Scan the Movies table to retrieve all movies from the 1950's");
            ScanFilter filter = new ScanFilter( );

            filter.AddCondition("year", ScanOperator.Between, new DynamoDBEntry[] { 1950, 1959 });
            ScanOperationConfig scanConfig = new ScanOperationConfig
            {
                Filter = filter
            };

            Console.WriteLine("     -- Creating a Search object based on a ScanFilter");
            try { search = moviesTable.Scan(scanConfig); }
            catch (Exception ex)
            {
                Console.WriteLine("     ERROR: Failed to create the Search object because:\n            " +
                                  ex.Message);
                pause( );
                return(1);
            }
            Console.WriteLine("     -- Successfully created the Search object");
            if ((search == null) || !pause( ))
            {
                return(1);
            }

            SearchListing_async(search).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  9b. Use AmazonDynamoDBClient.Scan to retrieve movies from the 1960s
            Console.WriteLine(stepString, "9b",
                              "Use a low-level scan to retrieve all movies from the 1960's");
            Console.WriteLine("     -- Using a ScanRequest to get movies from between 1960 and 1969");
            ScanRequest sRequest = new ScanRequest
            {
                TableName = "Movies",
                ExpressionAttributeNames = new Dictionary <string, string>
                {
                    { "#yr", "year" }
                },
                ExpressionAttributeValues = new Dictionary <string, AttributeValue>
                {
                    { ":y_a", new AttributeValue {
                          N = "1960"
                      } },
                    { ":y_z", new AttributeValue {
                          N = "1969"
                      } },
                },
                FilterExpression     = "#yr between :y_a and :y_z",
                ProjectionExpression = "#yr, title, info.actors[0], info.directors, info.running_time_secs"
            };

            ClientScanning_async(sRequest).Wait( );
            if (!pause( ) || operationFailed)
            {
                return(1);
            }


            //  10.  Finally, delete the Movies table and all its contents
            Console.WriteLine(stepString, 10,
                              "Finally, delete the Movies table and all its contents");
            DeletingTable_async(movies_table_name).Wait( );


            // End:
            Console.WriteLine(
                "\n=================================================================================" +
                "\n            This concludes the DynamoDB Getting-Started demo program" +
                "\n=================================================================================" +
                "\n                      ...Press any key to exit");
            Console.ReadKey( );

            return(0);
        }
Example #53
0
 public virtual async Task <Entity> GetByIdAsync(long id)
 {
     return(await Table.Where(x => x.Id == id).FirstOrDefaultAsync());
 }
Example #54
0
        public void ThenXDBPanelBodyTextContains(Table table)
        {
            var bodyText = table.Rows.Select(x => x.Values.First());

            bodyText.All(t => CommonLocators.XDBpanelMediaBody.Any(x => x.GetAttribute("innerText").Contains(t))).Should().BeTrue();
        }
Example #55
0
 public virtual async Task <List <Entity> > AllAsync()
 {
     return(await Table.ToListAsync());
 }
Example #56
0
        public void GivenAUserRepositoryWithTheFollowingUsers(Table table)
        {
            var users = table.CreateSet <User>();

            _driver.CreateUsers(users);
        }
Example #57
0
 public virtual async Task <Dto> SearchAsync <Dto>(string expression)
 {
     return(await Table.Where(expression).ProjectTo <Dto>(_mapper.ConfigurationProvider).FirstOrDefaultAsync());
 }
Example #58
0
 public virtual async Task <List <Dto> > AllAsync <Dto>()
 {
     return(await Table.ProjectTo <Dto>(_mapper.ConfigurationProvider).ToListAsync());
 }
Example #59
0
 public virtual async Task <Entity> SearchAsync(string expression)
 {
     return(await Table.Where(expression).FirstOrDefaultAsync());
 }
Example #60
0
 public virtual async Task <List <Dto> > SearchAllAsync <Dto>(string expression)
 {
     return(await Table.Where(expression).ProjectTo <Dto>(_mapper.ConfigurationProvider).ToListAsync());
 }