Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
3
votes2
answers1509
viewsA: Order queue in c#
It is inappropriate to use queue for what you want. In your place, would use a dictionary or a KeyedCollection. First you need to correctly define a data structure for the request. In your code, it…
-
0
votes1
answer55
viewsA: How to publish a project with Database
Missed sending your friend the file .mdf that is hidden in the solution. Check your project directories for the file .mdf and join to the archive .rar, preferably in the directory indicated in the…
-
0
votes1
answer148
viewsA: Use "SUM" in access + Vb.net
It’s not much of a secret: .CommandText = @"SELECT dt, GRUPO, SUM(UNI) AS UNI, SUM(VENDA) as Vendas, SUM(CUPOM) as Cupons FROM RELATORI WHERE dt between @dtInicio and @dtFim GROUP BY dt, Grupo ORDER…
-
4
votes3
answers401
viewsA: SQLSERVER error in C#application
Check two things through SQL Server Management Studio: Since it is SQL Server Express, you may need to specify the instance name: Data Source=192.168.1.1\SQLEXPRESS; Initial Catalog=banco; User…
-
0
votes1
answer836
viewsA: How to use JSON on Asp.net MVC
The code is good. We just have to enrich the interface. Let’s change this code: <script> $(document).ready(function() { $(".inscricao").click(function() { $.ajax({ type: "POST", url:…
-
1
votes1
answer308
viewsA: Problem when publishing a site iis 7
You are using a non-standard procedure to publish. So there is no guarantee that the site is up to date. Use the command Publish to publish your project to the IIS directory.…
-
1
votes1
answer433
viewsA: Text editor for email formatting
I did something like this in a system of my own using Ckeditor. It is the editor with the highest fidelity possible between what appears in the editor and the email actually sent. The Ckeditor has…
-
2
votes1
answer2950
viewsA: Dropdown List from a table in the Database
It’s basically two steps. Upload Instructor data to ViewBag This step is simple. It can be done like this: ViewBag.Instrutores = contexto.Instrutores.ToList() Utilize @Html.DropDownListFor() In the…
-
0
votes1
answer679
viewsA: Doubt with mvc list editing, using checkbox and editable field
Just render your View using the Helpers HTML. For example: @Html.EditorFor(model => model.A) @Html.EditorFor(model => model.B) @Html.EditorFor(model => model.C) @Html.EditorFor(model =>…
-
4
votes1
answer123
viewsA: Stored Proc X Entity - Is this a good decision?
On Entity Framework days, do an MVC project using Stored Procedure is a good way? Not. The purpose of the Entity Framework for development is to save programming effort by modeling the database as a…
-
0
votes2
answers107
viewsA: Application database query made in C#
The recommended by Microsoft is SQL Server Express Localdb. It ships into a single data file an instance of SQL Server, not requiring installation of a database just for the application.…
-
4
votes1
answer897
viewsA: Obtain image data
The most common and free OCR (character recognition) engine I know is the Tesseract. There are two contributions from it to . NET: https://code.google.com/p/tesseractdotnet/…
-
3
votes3
answers203
viewsA: Return Time.zone.now in C#
The equivalent of the Ruby command is Datetime.Now: var dataAtual = DateTime.Now; The problem is that the DateTime does not store information from Timezone, then the god of C# gave this solution…
c#answered Leonel Sanches da Silva 88,623 -
3
votes1
answer721
viewsA: Entity Framework associative table mapping
As I said, the association is incorrect. Some information is missing from the associative table: public class DepartmentServiceRequest: Entitie { [Key] public Guid DepartmentServiceRequestId { get;…
-
2
votes1
answer176
viewsA: Complex mapping Entity Framework
The department providing a service is one thing. A department taking a service is another. You are treating two different things as the same thing. By your explanation, what we have is: public class…
-
2
votes2
answers494
viewsA: Save data group in Post method
The mistake starts here: <div class="new-anexo"> @Html.EditorFor(model => model.Anexos) </div> From what the message says, Anexos is void. Hence the error. Change: <div id="Anexo"…
-
3
votes1
answer398
viewsA: Doubt about mapping in Entity Framework 6. "readonly" properties
Since there is no native update guarantee mechanism only on the first level of data, the way is to make a Viewmodel and carry out manual updates. An implicit operator can be a good option here:…
-
20
votes6
answers14943
viewsQ: JS Mask for Hours Validation
I’m using in a project the jQuery Masked Input. I made a mask like this: <script> $(document).ready(function () { $("#QuantidadeHoras").mask("99:99"); }); </script> The <input>…
-
3
votes4
answers4566
viewsA: How do I update my data in the table using the Entityframework?
You don’t have to Attach for this case. Modify to: public void Atualizar(ContactadoPessoa contactadoPessoa) { // this.Context.ContactadoPessoas.Attach(contactadoPessoa);…
-
0
votes1
answer1532
viewsA: C# framework implementing graph theory
I know two libraries that can be used together: Graph# Quickgraph - Has Nuget Package Graph# is a graphical library for WPF. Quickgraph is a library for generic graphs. There is still the Microsoft…
-
3
votes2
answers1716
viewsA: What is the difference between Idisposable implementations?
Several things. I will translate the first snippet of code to be clearer, and discuss each method: protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO:…
-
3
votes2
answers705
viewsA: Error while deleting using Entity Framework 6 and custom repository
They’re both wrong, this one: public virtual void Excluir(TEntity obj) { var entry = Contexto.Entry(obj); DbSet.Attach(obj); entry.State = EntityState.Deleted; } and this: public virtual void…
-
3
votes1
answer616
viewsA: How to list items per logged-in user in Asp.net MVC
This is obviously wrong: Aluno aluno = db.Alunos.FirstOrDefault(a => a.Usuario == User.Identity.Name); if (aluno != null) return View("MeusCursos", db.Cursos.ToList()); Here: db.Cursos.ToList()…
-
3
votes1
answer28
viewsA: Create files from a template
You will have to create your own Scaffolder for that. This can be done using the Sidewaffle, an extension that creates other extensions for Visual Studio. Here’s a video that can be quite…
visual-studio-2013answered Leonel Sanches da Silva 88,623 -
0
votes1
answer115
viewsA: How to change the list type in Asp.Net MVC
There is not much secret. Just change the layout of the data by grouping by course: <h1>Cursos</h1> @foreach (var item in Model.GroupBy(ac => ac.Curso)) { <table class="table…
-
0
votes1
answer287
viewsA: How to edit a Boolean field in a list in Asp.Net MVC
As far as I can tell, there’s nothing that fires a Action to the Controller, then your View needs some modifications: 1. Identify the CheckBox correctly @foreach (var item in Model) { <tr>…
-
2
votes1
answer659
viewsA: Cause form validation on an Asp.net link mvc 5
Using jQuery Validation, you can do it in two ways: .validate() $("form").validate() .valid() if ($('form').valid()) { // Coloque sua lógica aqui } Make the button call one of them.…
-
1
votes2
answers861
viewsA: Datepicker Asp.Net
I’ll put in steps. jQuery UI Check whether the jQuery UI is installed in your solution. Open Package Manager Console (View > Other Windows > Package Manager Console) and type: PM>…
-
0
votes3
answers130
viewsA: How to implement methods in Json using Serializable?
As already seen by the other answers, it is not recommended to use Webservices, but this does not mean that it is not possible. I memorized your method getUsuario so that it returns a valid JSON…
-
2
votes1
answer260
viewsA: Doubt Postbackurl
<asp:LinkButton> generates a link within a <form> with action = POST. I think a simple link using GET already solves everything: <a href="~/User/Produtos.aspx?Marca=<%#…
-
3
votes1
answer536
viewsA: How to deserialize attributes of the elements of an XML with C#?
What you want is actually a deserialization: transform an XML into an object that can be read and populate variables to persist in your database. Below I detail a script that can serve your problem.…
-
3
votes1
answer384
viewsA: Highlight link from current page
In a system I did here, I used the @section Scripts to set a small action to add a class active in a given item, which highlights the item. @section scripts { <script type="text/javascript">…
-
0
votes2
answers676
viewsA: How to Save Datagridview Items within a Column?
This is a classic case of master-detail. There’s a pretty rich explanation for how to do this here, but we can dig a little deeper into the answer. Access is never very recommended for a database,…
-
1
votes2
answers523
viewsA: How to create progress bar for uploading file via Google Drive API
From what I read in the documentation, InsertMediaUpload drift ResumableUpload<TRequest>. The percentage can be obtained by the method GetProgress. Also as in @Marcusvinicius' reply, it is…
-
2
votes1
answer44
viewsA: Entity Framework 6 error logging in Sqls
You can log not necessarily in console. It can be done in text file, on Event Viewer, in Trace... how the idea is to pass a delegate, to log into text file, you can use: context.Database.Log =…
-
1
votes1
answer169
viewsA: Web.Config Transformations - What to do with connectionString.config if I don’t use Web Deploy?
Yes. Publish to local OSI. Install Web Deploy on your local IIS; Create a website on your IIS; Set up a Deploy file (the link contains the steps); Import the file created in your VS; On the database…
-
1
votes2
answers1180
viewsA: Validationsummary - Asp.Net MVC problems
Notice that: @Html.ValidationSummary(true) I don’t know if you ever pressed Ctrl + Shift + Space to see what that is true there: excludePropertyErrors excludes any and all errors related to…
-
5
votes3
answers1096
viewsA: Pass Viewbag to _Layout
If the code is used on all pages, it is possibly a dynamic layout or menu. Do not use Session for that reason. I will pass a list of steps to create a dynamic menu. 1. Create a Controller common…
-
8
votes1
answer125
viewsA: What are the risks of putting an ASP.NET application in an environment with Load Balancing?
1. Sessions Sessions are a common problem in systems written for a single machine that are run in a partitioned environment. The first approaches to ASP.NET were quite flawed, and were corrected…
-
3
votes1
answer404
viewsA: Problem with Entity Framework Relationship
This isn’t exactly a problem. It’s just a code scrawl that’s been left behind and hasn’t been removed. See here: public class Curso { [Key] public int Id { get; set; } public string Nome_Curso {…
-
9
votes3
answers1704
viewsA: What is the use of Func<T, Tresult>
What use Passing to a method (or a function) another function. It’s a kind of delegate. How to read Func<T, TResult> Function with a type argument T that returns a type value Tresult. I…
-
2
votes2
answers1940
viewsA: Update with select in time table
It’s no secret: update tabelaprincipal set codBarra = temp.codBarra from #tabelatemporaria temp where tabelaprincipal.codProduto = temp.codProduto
sql-serveranswered Leonel Sanches da Silva 88,623 -
4
votes1
answer2293
viewsA: Microsoft.Speech.Recognation and System.Speech.Recognation Plataformnotsupportedexception
In Visual Studio, access the Configuration Manager: Create a new platform: Specify x86 on the platform. The Speech recognition is not yet approved for x64.…
c#answered Leonel Sanches da Silva 88,623 -
0
votes3
answers1950
viewsA: How to Fix File Upload Error?
Error occurs because your file is more than 4 megabytes (is the default IIS configuration). Configure your file Web.config with the following: <configuration> ... <system.web> ...…
-
5
votes1
answer762
viewsA: How to jump line with View Bag?
Do not work because we are returning HTML to the presentation, and no console formatting. You got two good ways to go: 1. Using the CSS <label style="color:red; white-space:…
-
4
votes1
answer841
viewsA: Add Migration and update at runtime Entityframework
This idea doesn’t make much sense. Within the approach Code First, would only make sense if you were creating classes (Models) at runtime also, as well as contexts and the whole structure involved.…
-
1
votes1
answer191
viewsA: Violation of multiple restriction
Check the Attribute [Table] of their Models. Make sure you don’t have any repeats: [Table("Cidades")] public class Cidade { ... }
-
0
votes2
answers158
viewsA: How do I correct this error, and was able to see this other table in my view?
This does not return List<for>: var results = entities.For .Join(entities.Dev, t => t.For_Dev_ID, h => h.Dev_ID, (t, h) => new { t.For_Nome, h.Dev_Nome }) .Where(b => b.Protocolo…
-
3
votes1
answer2242
viewsA: Add Column as Primary Key
Just drop the primary key and create it again: ALTER TABLE horario DROP CONSTRAINT [primary key1] GO ALTER TABLE horario ADD CONSTRAINT [primary key1] PRIMARY KEY CLUSTERED ( [Ano] ASC,…
sql-serveranswered Leonel Sanches da Silva 88,623 -
2
votes1
answer338
viewsA: Get URL value from a Dropdownlist
It’s all right. Just use RouteData.Values instead of Request: <div class="col-md-2"> Tipo Prestação de Contas: @Html.DropDownList("ddlPrestacao", new SelectList(ViewBag.TipoPrestacao,…