Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
2
votes3
answers183
viewsA: Insert values from table B in table A if they do not exist
Stay like this: INSERT INTO tabelaA ( column1, column2, someInt, someVarChar ) SELECT tabelaB.column1, tabelaB.column2, 8, 'some string etc.' FROM tabelaB where not exists (select 1 from tabelaA a2…
sqlanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer113
viewsA: Is there a problem using multi-thread software with Sqlite?
There are problems using multi-threaded software with an Sqlite database? Not. Worth reading this document that explains how to set up your bank to support multithreading. The Sqlite library is able…
-
3
votes1
answer505
viewsA: I am unable to extract a zip file to a folder
You don’t need to use Ionic.Zip to perform an extraction. The . NET itself already has support for this: public void AUTOALIZAR_Click(object sender, EventArgs e) { var wc = new WebClient(); string…
-
1
votes2
answers468
viewsA: What is the equivalent of if($_POST) on . Net (ASP.Net MVC)?
Complementing @Fernando’s response, there are some other equivalents, but that do not necessarily provide a form to be submitted via GET: 1. Request.Form Request.Form any and all value coming of the…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
13
votes6
answers15200
viewsA: What is and how does Bootstrap work?
...it’s like a template right? It’s a little more than that. It’s a template that forces you to work at a certain level of discipline in order to display your site on virtually any device with any…
-
1
votes1
answer595
viewsA: Recover property of Object Anonymous C# Razor
The code is already correct. You can perform some extra checks to avoid NullReferenceException when accessing the property: dynamic responsavel = item.responsavel; var prop =…
-
2
votes2
answers262
viewsA: What is the difference between authorizecore and onauthorization
AuthorizeCore It is the method that effectively makes the decision whether the user is authorized or not to access a given context. Here we check the roles, the normal rules, the special rules, and…
-
2
votes1
answer773
viewsA: Show only positive delay days in SQL query?
Seems pretty simple to solve: select * from ( select a.* , b.tipododocumento , b.contacontabil , d.nome , b.descricao , a.formapagamentoA , a.formapagamentoB , a.data_inc , a.data_alt , a.letranota…
-
0
votes1
answer145
viewsA: How to start a Consoleapplication that manages all database objects equal to Codefirst
This already exists. Flame ASP.NET Mvcscaffolding, but the project was abandoned because Microsoft abandoned DTE support in Visual Studio 2013, privileging generation through Visual Studio context…
-
1
votes3
answers1378
viewsA: Datetime field display in View with hours, minutes, day/month/year?
If using Razor, you can use @Html.TextBoxFor() specifying a date format: @Html.TextBoxFor(model => model.MinhaData, "hh:mm dd/MM/yyyy", new { @class = "form-control" }) Note: the class…
-
0
votes1
answer133
viewsA: Component to replace Gridview
Depending on the degree of replacement, the jQuery Datatables can be an option. The problem is that your approach would shift to pure HTML, which could take some work.…
-
7
votes2
answers1138
viewsA: Why can’t the implemented methods of an interface be private?
'Cause it doesn’t make sense. The function of an interface is to expose methods through a contract to other entities and systems. Therefore, there is no need for these other entities to know private…
-
2
votes1
answer118
viewsA: How to work with @Html.Dropdownlist?
In jQuery, your function would look like this: <script > function BuscarCaminho() { //Pega o elemento 'select' var select = $("#idFoto"); //Altera o valor do atributo 'src' da imagem para…
-
3
votes1
answer791
viewsA: problem with update Entity Framework 6
In fact it will not work for editing. When you do: PoiContatoModel model1 = new PoiContatoModel(); model1.t0031_id_poi = 56; model1.t0033_id_contato = 6; model1.t0033_nome_contato = "TESTE UPDATE";…
-
10
votes2
answers531
viewsA: Translation of the word flush
It’s not a very nice translation, but in the strict sense, it would be "unloading". In programming, meaning is extended to the emptying of a content, such as a memory buffer. Streams files are the…
-
0
votes2
answers599
viewsA: SQL to bd connection on the network
Check in the database properties if the following option is checked: Instead, it would not use integrated authentication. Still, if you want to use it, make sure the IIS user has permission in the…
-
1
votes2
answers943
viewsA: Capture SOAP request
An alternative is to enable tracing your application. Add to file .config of your Web Service the following: <system.diagnostics> <trace autoflush="true" /> <sources> <source…
-
4
votes1
answer326
viewsA: What is the difference between Ienumerable<T> and Ienumerable?
What’s the difference between IEnumerable<T> and IEnumerable? In theory there should be no such distinction. The problem is that in . NET 1.0 was implemented first IEnumerable. Generic types…
c#answered Leonel Sanches da Silva 88,623 -
6
votes1
answer954
viewsA: How to create a foreign key in a table where data already exists, in Entityframework with Code-First?
It’s three steps. 1. Create relationship allowing null and void The entity Movimentacao would look like this: public class Movimentacao { public int MovimentacaoId { get; set; } public int?…
-
1
votes1
answer1159
viewsA: Suggestion to update Windowsform application
Use the Wix Toolset to generate an MSI installer for your application. After that, set up a GPO on the Windows domain to silently install the application on the user’s machine when they log in. See…
-
5
votes3
answers2029
viewsA: Save to Notepad C#
Only complementing the response of @Joãopaulopulga, as StreamWriter derives from TextWriter, and TextWriter implements IDisposable, the following code implements the Close and the correct disposal…
c#answered Leonel Sanches da Silva 88,623 -
4
votes1
answer61
viewsA: Starting in the language C#
Use Blend for Visual Studio to model your application; Use Visual Studio Community 2013 to develop the Back End; To ask questions here about this type of development, use the tags wpf and shaman;…
c#answered Leonel Sanches da Silva 88,623 -
3
votes1
answer268
viewsA: Questions under development of Desktop C#
I started a project in Blend for Visual Studio 2013 generating the message by dialog. On the home screen I put an unnamed button with the inscription "Test": After that, I selected the button and…
-
3
votes1
answer444
viewsA: How to get resolution of an image?
If it’s height and width, it’s pretty simple: string path = @"C:\caminho\qualquer\minha_imagem.jpg"; var img = Image.FromFile(path); // img.Width é a largura // img.Height é a altura Now, if you…
c#answered Leonel Sanches da Silva 88,623 -
2
votes2
answers1688
viewsA: Display control in Partial View conditionally
The ideal is that the control of this Partial be done by View who calls this Partial: @if (condicao) { @Html.Partial("_smart_actions", item) } This is due to the fact that its Partial will always…
-
5
votes1
answer104
viewsA: Generic CRUD or Sqls specifics
The best approach always depends on the goal set on the horizon. The development model based on the creation of Cruds will always take advantage of the speed of development, considering that many…
databaseanswered Leonel Sanches da Silva 88,623 -
1
votes2
answers780
viewsA: Multi-tenant system with the possibility of "customization"
Using the isolated model the DBMS would be with many databases. What would be the possible implications of this? It would take one publication per client. It would take a little work, but with a…
-
1
votes2
answers279
viewsA: Set name property anonymous object and Resources
I implemented the following extension method that creates a dynamic object with variable property names. Basically, it takes any object and transforms it into a dynamic object: public static…
-
9
votes1
answer658
viewsA: How to login to the site using Instagram, Twitter or Google+ account on Platform . NET (C#)
Start with an example ASP.NET Identity system. In this answer I teach step by step. Two automatic files should be created in the process: Startup.cs (root directory); App_Start/Startup.Auth.cs.…
-
4
votes1
answer398
viewsA: How to work with Database Views on ASP.NET MVC?
Is totally wrong work on ASP.NET MVC and Entity Framework without using primary keys. Using Entity Framework presupposes the use of primary keys in all entities. It is a Framework design feature…
-
3
votes1
answer337
viewsA: Is it advisable to have a Users table relating to others?
Yeah, no problem at all. For example, I could associate users to companies using foreign keys: CREATE TABLE EMPRESA ( EMPRESA_ID INT PRIMARY KEY, -- Coloque aqui as colunas que você gostaria que…
-
2
votes1
answer941
viewsA: How to integrate a Mysql database with a C#application?
How can I set up the Connection string correctly? You can use a file udl for that reason. Mysql client needs to be properly installed on your machine. After the string has been configured and the…
-
2
votes2
answers428
viewsA: How to insert an array into a variable?
There are some little problems. For example: while (i < 9): These parentheses are not required. These also do not: cell = cells[(i)] I don’t understand what that means: a(k) = item I think that a…
-
7
votes2
answers385
viewsA: In which scenario is it recommended to use Keyedcollection instead of a Dictionary?
In fact the KeyedCollection is a Dictionary where you choose how to build the index. Notice that in the example of the mentioned answer I use something like this: public class MortoCollection :…
-
5
votes3
answers10876
viewsA: Recognize duplicate items in a list
The Morelinq package has the great list extension called DistinctBy: var distinctList = Itens.DistinctBy(x => x.UmaPropriedadeQualquer).ToList(); Now, if you want to know just who repeated, it…
-
1
votes1
answer406
viewsA: NF-e 3.10 Does MG do how to receive the return of Nfeautorizacaoloteasybc?
You are not getting the return from Webservice. Try the following: Option Infer On With NfeRecepcaoMG .Url = "https://nfe.fazenda.mg.gov.br/nfe2/services/NfeAutorizacao?wsdl" .nfeCabecMsgValue =…
vb.netanswered Leonel Sanches da Silva 88,623 -
2
votes1
answer46
viewsA: Enable delete
WillCascadeOnDelete() defined with false must solve: protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);…
-
2
votes1
answer1577
viewsA: Doubt about X-Frame-Options
X-Frame-Options serves to indicate to the browser if and when your site may appear within a <iframe> from another site. The documentation is here. A priori, configuration is done on the…
-
2
votes1
answer1309
viewsA: Add values from object list columns in Razor
If I were you, I’d use one more <tr> to sum up, more or less like this: <tbody> @*Variáveis para somar os totais dos campos*@ @{ double totalContribuinte = 0; double totalMunicipio = 0;…
-
8
votes3
answers2007
viewsA: How to obtain information from an SSL Certificate via C#?
Thus: var certificate = new X509Certificate("C:\Caminho\Do\Arquivo", "senhadocertificado"); A SSL certificate is a certificate of type X509. It is also the same type of certificate used for digital…
-
0
votes3
answers749
viewsA: How to optimize the query in a remote bank using Clientdataset?
Use the property PacketRecords to carry his TClientDataSet incrementally. From experience, 500 is a good value. -1 serves to bring a single block (your case) and 0 brings only metadata on the query…
-
1
votes2
answers949
viewsA: How to know the current state of the form?
You would have to put two events in your form to annotate their state in a variable. For example: Private formAtivo As Boolean Private Sub meuForm_Activated(sender As Object, e As EventArgs) Handles…
-
0
votes1
answer190
viewsA: Show content in textboxfor
I have a feeling I already answered that in another question, but come on. Since the sum (or subtraction) field is not recorded in a bank, the ideal is to make a class that is very similar to the…
-
2
votes2
answers151
viewsA: How to get IIS information via c#?
Information about your OSI can be obtained using the ADSI provider. The examples are from IIS 6, but there would be no reason not to work in later versions of IIS. In this article there are examples…
-
2
votes1
answer485
viewsA: Upload system with rotate image automatically as in windows 8.1 or facebook
Using the class EXIFExtractor implemented and explained here, thus: var bmp = new Bitmap(pathToImageFile); var exif = new EXIFextractor(ref bmp, "n"); if (exif["Orientation"] != null) {…
-
3
votes1
answer265
viewsA: Compare TXT with Table in database
If I were you, I’d make two KeyedCollection to index the CPF: one to your Model, another for extraction from the archive: ... using System.Collections.ObjectModel; ... public class MortoCollection :…
asp.net-mvc-5answered Leonel Sanches da Silva 88,623 -
2
votes2
answers3063
viewsA: Pass values from a form to a method in the Model and return the result to another textbox in the Form
There are some meaningless things in your example. Let’s go to them: private static Conta _conta = new Conta(); You don’t need to initialize one Model out of a Action of a Controller. There is no…
-
1
votes2
answers878
viewsA: Select with null Postgresql field
Switch to the next: SELECT u FROM User u WHERE lower(u.fullname) LIKE '%:pesquisa%' OR lower(u.username) LIKE '%:pesquisa%' OR lower(u.email) LIKE '%:pesquisa%'
postgresqlanswered Leonel Sanches da Silva 88,623 -
2
votes1
answer226
viewsA: How to force an Exception when trying to delete a Master record that already contains relationship in a Child Record?
It’s a standard behavior? Yeah. Notice your Master (the parent record) can be null on the child (it is called the "orphan record"), so there would be no reason to generate an exception since your…
c# sql-server entity-framework entity-framework-6 relationshipanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer1855
viewsA: Tortoisesvn revert to an earlier version
Make a branch of this version 6. Give an easy to identify name; Make your modifications on branch, perform commit; If you wish, go back to the trunk and make a merge from your branch. Some more…
tortoisesvnanswered Leonel Sanches da Silva 88,623