Posts by Rovann Linhalis • 14,881 points
567 posts
-
3
votes1
answer40
viewsA: Remove virtual properties from Typedescriptor.Getproperties()
Try it like this: var properties = typeof(T).GetProperties() .Where(l=> l.PropertyType == typeof(string) || !typeof(IEnumerable).IsAssignableFrom(l.PropertyType) &&…
-
2
votes1
answer36
viewsA: Use the value of a constant to set a property in the mapping with EF Core
If the variable is already as public const just access it: Sistema.TamanhoMaxDescricao; Would look like this: modelBuilder.Entity<Sistema>() .Property(s => s.Descricao)…
c#answered Rovann Linhalis 14,881 -
0
votes1
answer221
viewsA: How to create a Users access history from a Desktop app
It creates a system log table, not just the user’s, and stores events in it... in some systems, I have a structure with the following data: data do servidor, data do computador, ip do computador, id…
c#answered Rovann Linhalis 14,881 -
5
votes8
answers4394
viewsA: How to identify "Capicua" numbers that have 5 digits?
I did some examples in C#, but converting the number to string: First: public static bool Capicua(int x) //0.046s { string s = x.ToString(); int l = s.Length/2; for (int i =0; i<= l; i++) { if…
-
0
votes1
answer183
viewsA: How can I for timers who were initiated by a task c#
You have prompted the object within the main thread, not in the thread you are giving Ispose... you have just created another thread to call start... enfin... in this situation you could put your…
-
-1
votes1
answer911
viewsA: How to disable Browser Auto-Fill?
marks the input autocomplete attribute as off : <input autocomplete="on|off"> https://www.w3schools.com/tags/att_input_autocomplete.asp…
-
0
votes3
answers85
viewsA: Searching and opening files by name
You can use the method GetFiles class Directory, that returns an array of strings with the name of each file found. You just need to inform the folder where it will be perform the search in your…
-
1
votes1
answer456
viewsA: Problems restoring a Postgresql database with C#
I believe you’re using the Process.Start wrong way. See the example: static void LaunchCommandLineApp() { // For the example. const string exe = "C:\\Program Files\\PostgreSQL\\9.4\\bin\\psql";…
-
0
votes1
answer24
viewsA: Error syntax in query with Postgresql JSP sort
just put a gap between the by and its variable: String sql="Select * from tb_motorista where mo_nome like '%"+pesquisa+"%' order by "+ordenacao+" LIMIT 3 OFFSET"+offset; because order bynomecompleto…
-
5
votes2
answers674
viewsA: Remove an N amount of days on a date
simply: namespace TesteData { class Program { static void Main(string[] args) { var qtdDias = 5; var dataAtual = DateTime.Now.Date.AddDays(qtdDias*-1); // dataAtual 13/09/17 } } }…
-
2
votes2
answers1009
viewsA: Repeat previous rows when there is no record in SQL SERVER data
just select the highest date, and group by the other columns. I made an example: select id, max(data_atualizacao) as data_atualizacao, valor from CADASTRO group by id,valor order by id and put on…
-
1
votes1
answer505
viewsA: Problem Inserting Bytea in postgresql
change "update empresa set emp_figura = ?;" for "update empresa set emp_figura = :emp_figura;" I’d put a where there with the primary key of the company as well. Even if you only have one, I believe…
-
2
votes1
answer299
viewsA: Show date field value in a listview in a C#application
When adding the item to listview you must format the date as you want, otherwise the result will be equal to the method ToString() resulting in Date and Time. To format the date you have several…
c#answered Rovann Linhalis 14,881 -
1
votes3
answers535
viewsA: Finding pg_dump and pg_restore (Postgresql) on my C#PC
If you can run the program by lifting the user (run as administrator) you can simply take the postgres process that is running and look at its path: Process[] ps =…
-
1
votes1
answer614
viewsA: Save image in database and give Restore in database with Postgresql
As I mentioned in the comments, I use the column as bytea (byte array) which can store not only images, but also files of any format. Follow the code as I use it, but this one I put is just an…
-
5
votes2
answers482
viewsA: Convert seconds to minutes
Just divide by 60, and you’ll have time in minutes. In the query, it can be done as follows: SELECT (OnlineTime/60) as minutos FROM user_stats INNER JOIN users ON user_stats.id = users.id WHERE…
-
0
votes1
answer70
viewsA: Foreach or for by invoice item
Remove the key from the query item, and loop the DataReader. The Processing you need to do on the line, do inside the loop. string ItemNota = @"SELECT SD.D2_COD, SD.D2_LOTECTL, QR.QER_REVI,…
c#answered Rovann Linhalis 14,881 -
0
votes1
answer53
viewsA: Using "select" in sql (oracle), failed to search
select p.DESCRIPTION from PRODUCT p inner join ITEM i on i.PRODUCT_ID = p.PRODUCT_ID inner join SALES_ORDER s on s.ORDER_ID = i.ORDER_ID inner join CUSTOMER c on…
-
2
votes1
answer80
viewsA: Error trying to log in with mysql
you are calling the getConexão() outside the method that executes the command, and then calls again inside the method. Thus, you pass the command with a connection, and open another. One of the…
-
1
votes1
answer243
viewsA: Renaming values in mysql
if you do not have the table with the description of the status, you can use the case when, otherwise, use the join with the other table: select nf, status, (case when status = 3 then 'Concluido'…
-
0
votes1
answer91
viewsA: Using another path to pull files from a folder outside Directoryinfo
try like this: System.Web.HttpContext.Current.Server.MapPath("~/Arquivos/"); DirectoryInfo dirInfo = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath("~/Arquivos/"));…
-
2
votes2
answers2423
viewsA: What is an offset?
I think it depends a lot on the context, because the word itself, it just means deslocado, compensado, equilibrado... Considering the context you quoted, memory addressing, would consider the offset…
offsetanswered Rovann Linhalis 14,881 -
1
votes2
answers1359
viewsA: Search specific value within a file . txt C#
You can keep a List<> with all the parameters, and when you need to, fetch the necessary value. I made an example: Class Parametro: public class Parametro { public string Id { get; set; }…
-
1
votes1
answer701
viewsA: What is the function of this Mainwindow file?
There is a difference between the method Main and MainWindow of WPF, that MainWindow is equivalent to Form1 of an application winforms. In WPF, you do not find the method Main because it is…
-
1
votes2
answers67
viewsA: How to perform an arithmetic operation by changing numerous database fields efficiently?
I made this function in Postgresql that you can use, just change to their respective fields: CREATE OR REPLACE FUNCTION public.reordenar (antiga integer,nova integer) RETURNS boolean AS $body$…
-
8
votes1
answer207
viewsA: C# | Format Time
Simple: DateTime.Parse("01/08/2017 08:30:00").ToString(@"HH\hmm") If you want without 0 before 8, just change: DateTime.Parse("01/08/2017 08:30:00").ToString(@"H\hmm")…
c#answered Rovann Linhalis 14,881 -
3
votes2
answers880
viewsA: C# - How to check if a string has only spaces?
you can do so: string texto = " "; if (String.IsNullOrEmpty(texto) || texto.Trim().Length == 0) { //a string só tem espaços ou não tem nada }
-
1
votes2
answers89
viewsA: SQL SERVER - Calculus
You didn’t put example data, not even an example of how the correct result would be, yet I recreated your tables in the fiddle and put some data. I believe that your need is to know Contracted…
-
1
votes3
answers261
viewsA: How to send selected data to an ftp server
Step by step: 1- Checks for selected lines on the grid. 2- Traverse the selected lines one by one. 2.1 - Generates the text file, and writes to it with the class TextWriter running through each grid…
-
1
votes1
answer80
viewsA: Open Program with dragging file(PDF) and even recover the path
Just handle the arguments started next to the application. With this you can even call the application from the command line, like this: enviarpdf.exe "c:\pdf\arquivo.pdf" to treat the arguments,…
-
1
votes2
answers64
viewsA: How to add up the amount of records in which the penultimate record enters the Where?
Without the structure of the tables it gets a little complicated, but try so: SELECT COUNT(distinct chmd.num_chamado) FROM chamado AS chmd INNER JOIN complemento AS comp ON comp.num_chamado =…
-
1
votes1
answer279
viewsA: c# change source of picturebox
From what I’ve researched, you’ve added a Control.DataBindings when doing through the graphical interface of Visual Studio. With this, I believe that you can simply clean up the collection and add…
-
0
votes1
answer27
viewsA: Identifier on grid lines
declares a int outside the expression, and place a property with the value within the expression, and increase: int i = 0; var lista = from substituidos in vagaDTO.Substituidos where…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer507
viewsA: Merge two php+mysql query tables
continue using Union, but you should create additional columns: SELECT r.codigo, r.descricao, r.dataVencimento, r.dataEntrada, 0 as pago, r.valor as recebido, 'CR' as tipo FROM contasReceber r WHERE…
-
1
votes1
answer333
viewsA: Connect Pgadmin via SSH Google Cloud
From what I’ve been reading in the google cloud documentation, you can do a firewall release by releasing a range of ips. only for testing, release any ip on the postgresql port: --network…
-
0
votes1
answer342
viewsQ: Circular Foreign Key
I often see database modeled so that foreign keys close a circular reference, to exemplify I used a model with cidade,bairro and cliente. Follows the ER model: I understand that in this format,…
-
2
votes2
answers1323
viewsA: Bring results equal to 0 as blank value in a query in SQL Server
The problem is that the expected return type in the column is int. You can return null or convert column to varchar. Follow example code: select c.id, count(distinct t1.id) as chave1, count(distinct…
-
2
votes3
answers83
viewsA: How to make a max + 1 with lambda or Linq, but with tables from nothing, all null
I believe it can be done like this: var obj = contexto.Balancas.Max(b => b.IdBalanca); int chave = (obj == null ? 1 : obj + 1); return chave;…
c#answered Rovann Linhalis 14,881 -
0
votes1
answer439
viewsA: Excel change only part of a cell text
As your goal is "Automate copy" of the text, not necessarily in excel, I did in C#. Just you access in . NET Fiddle and copy the result. Access . NET Fiddle: https://dotnetfiddle.net/6uViYu Follows…
-
2
votes1
answer26
viewsA: Conversion error when trying to insert into the bank with Entity and c#
dude, your balanca comes from contexto.Balancas; therefore, it is a DbSet. The method inserir expects to receive an object Balanca also did not understand the pq of foreach, but according to your…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer113
viewsA: Linq Return all records when ID is NULL
see if he answers you: retorno = tarefaRep.GetAll(c => c.status == 0 && c.id_empresa == idEmpresa && (idCliente == null ? true : c.id_cliente.ToString().Contains(idCliente))…
-
1
votes1
answer171
viewsA: c# Move image without trace
I believe the problem is, that at each point you move the mouse, you completely redesign the image, I would put a Timer to delay the drawing process, only running it once, at the end of the…
-
4
votes3
answers124
viewsA: Selecting Active Batch
I believe the following query solves your problem: I didn’t put the guys in because it’s irrelevant to the problem, just be added, and only a matter of names, I believe that lot is not the correct…
-
0
votes3
answers671
viewsA: Select that respects all values in a list
All I had to do was invert the query, selecting the assets or that are in the defined companies, and also invert the in to not in. Follow the Query: SELECT x.* FROM mrl_produtoempresa x WHERE…
-
3
votes1
answer52
viewsA: How do I fill in a combo I fill in her Value with wpf and c#
Place the combo source, as the list of your objects, then you access the selected object with the property SelectedValue. Example: In your case, as you explained in the chat, you must fill out the…
-
1
votes1
answer51
viewsA: Select with most messaging users
Just use the count: Select u.id, u.nome, count(m.id) as qtd_mensagens from mensagens m inner join usuario u on u.id = m.uid group by u.id, u.nome order by qtd_mensagens desc Job documentation:…
-
2
votes2
answers219
viewsA: Loop memory and processing optimization
Only a few changes, it is still possible to do more, but I see no need to complicate. rs using System; using System.Collections.Generic; using System.Linq; public class Program { public static void…
-
0
votes1
answer427
viewsA: How to handle calendar in database
Table: Horarioslivre id* |usuario_id | dow | hora_inicial | hora_final 1 1 2 17 20 2 1 3 08 14 where, usuario_id is fk for table of usuarios, and dow is the 'day of week' that is, day of the week,…
-
2
votes1
answer485
viewsA: Conversion from Enum to string
i use the following function to enter a string and return the enum: public static T GetEnum<T>(string s) { Array arr = Enum.GetValues(typeof(T)); foreach (var x in arr) { if…
-
2
votes3
answers69
viewsA: I have this cursor and the Where 'between' gives error. I wanted to select the years 2005 to 2008
The syntax is wrong... has to be WHERE year(OrderDate) between '2005' and '2008'