Posts by iuristona • 3,834 points
89 posts
-
0
votes2
answers343
viewsA: How is crud to update the records in SQL Server by Visual Studio C#?
Use the parameter names (@idLoja, @nomeLoja) in the query instead of the ?. Your update would look like this: string sql = "UPDATE tbLoja SET nomeLoja = @nomeLoja WHERE idLoja = @idLoja";…
-
0
votes2
answers182
viewsA: How to return dates with a zero count
You can do something like this: select p.AcctStartTime, m, substring(date_format(m, '%m.%M'), 1, 6) mes from ( select m from ( select 1 m union all select 2 union all select 3 union all select 4…
-
1
votes3
answers133
viewsA: Where are the elements selected by LINQ stored?
You made a little mess. When it is said that an interface cannot be instantiated, it does not mean that it cannot have an instance. It cannot be instantiated directly. Who will create this instance…
-
1
votes3
answers331
viewsA: Find which items have been marked - Help with logic
You could do using operators bitwise, using its scalar values as demonstrated with var a = 1; var b = 2; var c = 4; var d = 8; var e = 16; var f = 32; The test to save the result of the selected…
-
4
votes1
answer552
viewsA: Required Errormessage dynamic content
An option would be to create a static class and put the different types of messages there: public static class ValidationMessage { public const string Required = "Campo de preenchimento obrigatório!…
-
1
votes2
answers1047
viewsA: Error while running project in Visual Studio
Probably the unconventional error message is caused by the problem pointed out by @Maniero, but there is a problem in your query: select count (*) Usuario where Usuario =@user and Senha=@senha…
-
5
votes2
answers205
viewsQ: From . NET to Java, what technologies or frameworks do you use?
I currently have a . NET-based work infrastructure with Angular JS and a possibility of a new project using Java has emerged. With . NET I use the following technologies: ASP.NET Identity Used for…
-
1
votes1
answer2505
viewsA: Dynamically populate input with angular
I don’t know if I understood what you want right. It would just display the tags, separated by ', ', within an input? Would look like this: <input class="form-control" value="{{…
-
3
votes2
answers848
viewsA: Problems with array in Angularjs
I don’t understand if you really want to create an array or an object. In the example you quoted you are creating an object. In javascript you can access object properties by name. var my_obj =…
-
0
votes3
answers86
viewsA: Error while selecting select text
Thus: $('#txtCidades option').removeAttr('selected').filter("[text='São Lourenço da Mata']").attr('selected', "selected").change();
-
3
votes2
answers1033
viewsA: Make two Directives have the same $Scope at Angular
I’m not very experienced with Angularjs, but as far as I know the default behavior of a directive is to share the controller’s Scope (otherwise we need to create an isolated Scope). You are creating…
-
0
votes3
answers1028
viewsA: File download does not work
I tested your code here and it works normally. Try to change the contenttype like this: //Response.ContentType = "text/plain"; Response.ContentType = "application/force-download";…
-
3
votes1
answer800
viewsA: Jsangular Multiple ng-repeat
You can define a collection of tags for each project. Something like this: <div class="container-fluid" ng-app> <h2>Projetos</h2> <div ng-controller="TagsCtrl"> <div…
-
0
votes3
answers262
viewsA: How to Pass Arguments to a class Ex: Dim t as new TL("string","string","string")
Your class is not called FTP, but Ftpserv, I made some modifications: Public Class FTPServ Dim URIFTP As String = "" Dim SWServidor As WebRequest = FtpWebRequest.Create(URIFTP) Private _Host As…
-
39
votes3
answers4038
viewsA: What is the difference between using virtual property or not in EF?
Lazy Loading Lazy Loading is the mechanism used by persistence frameworks to load demand information. This mechanism makes lighter entities, as their associations are only loaded in the when the…
-
4
votes2
answers3494
viewsA: ASP NET MVC Include Url Parameter on all pages
Suppose you want a url in this pattern: /empresaId/clientes/clienteId That could be translated to: /1/clientes/10 You can create a route: public class RouteConfig { public static void…
-
0
votes5
answers17869
viewsA: How to align the Left fields of an Html table?
A way would be like this: <td class="left-align">@Html.Label("Cep: ")</td> You need a class css: .left-align { text-align: left; } But you don’t need to use a label in this case.…
-
1
votes2
answers958
viewsA: Nullreferenceexception in User Filter
From what I saw in your code, you keep a Ssion with the ID of the User just to recover in filter. It would not be possible to recover the User from the UserName? That way you wouldn’t need to…
-
1
votes2
answers557
viewsA: Format date in Viewbag
If the data is nullable and some argument can have a null value: Would look like this: ViewBag.Ferias = funcionarioFeriasRepository.Lista.Where(r => r.CdMatricula == matricula &&…
-
1
votes4
answers1209
viewsA: Button with pause function
It is possible. Follow the example, based on this article of the MSDN. You will need to create these classes: public class PauseTokenSource { private TaskCompletionSource<bool> m_paused;…
-
1
votes2
answers1398
viewsA: Returning a list using select new with LINQ
In that case the simplest would be: var filial = (from f in base.EntityContext.vw_filial select f).ToList(); Or inline like this: var filial = base.EntityContext.vw_filial.ToList();…
-
1
votes2
answers8286
viewsA: No constructor without parameters has been defined for this object
Yeah, this error occurs because your Ioc container is failing to resolve the dependency on your constructor Controller, while MVC cannot find a constructor version without parameters. I don’t know…
-
1
votes1
answer143
viewsA: Difficulty with Repeater using Asp.net webforms
Try something like that: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <%# (Container.ItemIndex + 4) % 4 == 0 ? "<div class='row'>" : string.Empty %> <div…
-
1
votes1
answer110
viewsA: I cannot assign javascript function only when there is an attachment
It works? <strong> <a <%# Eval("DsPathDocumento") != null && !String.IsNullOrEmpty(Eval("DsPathDocumento").ToString()) ? String.Concat("href='/UpLoads/", Eval("DsPathDocumento"),…
-
1
votes1
answer391
viewsA: Problem accessing dynamically generated ASP.NET field data
With foreach should work: foreach (Control c in forms.Controls) { if (c is TextBox) { TextBox textBox = (TextBox)c; textBox.Text = "Texto"; //acesse aqui } else if (c is RadioButton) { RadioButton…
-
0
votes3
answers3776
viewsA: How to run a jquery/javascript function only in the page load and avoid postback?
Try this: var isPostBack = <%=Page.IsPostBack.ToString().ToLower()%>; // $(document).ready(function () { if (!isPostBack) { accordion(); } }); If you need the Razor version change the…
-
3
votes1
answer230
viewsA: aspnetmvc6 cannot update
Can’t do what you want. Can’t upgrade a MVC 5 project to MVC 6. If you want to test a project with ASP.NET MVC 6, you need to create a new project ASP.NET 5 (vNext). Currently there are 2 templates:…
-
1
votes2
answers601
viewsA: Master Detail with Select2
From what I understand you want every click on #add append a new select with Select2. First of all, I may be wrong, but I only used select2 with an element select and not with input. That’s right,…
-
2
votes1
answer251
viewsA: Handling JSON with Asp.net Web API
I will demonstrate how to return a list with the expected json, try to convert your DataTable to fill this dictionary: public Dictionary<string, object> ListarDatasCalendario() { var lista =…
-
4
votes1
answer554
viewsA: SQL returns two records to a field, how to join them?
I would do something like this: SELECT p.nome_pessoa, a.dt_nascimento, alc.matricula, df.numero_documento as RG, dj.numero_documento as CPF, df.id_tdoc_pessoa as df, dj.id_tdoc_pessoa as dj FROM…
-
1
votes1
answer426
viewsA: How to improve the performance of a foreach
Probably the cause of the slowness is not only the call to the webservice, because even with the data available locally the Entity Framework would continue to check for changes (Detectchanges) for…
-
1
votes1
answer124
viewsA: Navigation using @Renderbody
Yes, the entire page is "mounted" on the server and sent as a single page. All contents of _Layout and @RenderBody is sent to the client at each request. The operation is similar to php or old Asp…
asp.net-mvc-5answered iuristona 3,834 -
1
votes3
answers1099
viewsA: catching Description with Enumdropdownlistfor Asp.net mvc5
I use this Xtension method: public static string GetEnumDescription(this Enum value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes =…
asp.net-mvc-5answered iuristona 3,834 -
2
votes4
answers1684
viewsA: Dynamically check which attributes of a Model have been changed?
If you are using Entity Framework and your attempt is to create a kind of change log, you can override the method SaveChanges() of its implementation of DbContext and check changes in ChangeTracker:…
-
4
votes1
answer345
viewsQ: What measures can we take to protect the issuance of malware slips that alter the digitable line?
In addition to PDF issuance, which can hinder some customers by the lack of PDF viewers, what techniques could we use to protect or detect that the generated billet has been modified by malware?…
-
4
votes1
answer139
viewsQ: How to restrict inherited types from a hierarchy level?
Given the hypothetical model below: public abstract class Veiculo { public Motor Motor { get; set; } } public class Aviao : Veiculo { } public abstract class Motor { } public class MotorCarro :…
-
5
votes1
answer761
viewsQ: How to implement an update LOG with ASP.NET MVC?
I would like ideas on how to implement a generic update LOG in DB (Entity Framework 6+) that allows me to discover information such as: System X user at date Y changed name and date of birth (from,…
-
4
votes3
answers1328
viewsA: Returns Json of object in C# with Entity Framework
Apparently this problem occurs because of references using Lazy loading. Since the Dispose() is called because of the block using, the ERPContext no longer exists. Therefore, when an instance of…
-
4
votes1
answer204
viewsQ: Convert objects: from literal syntax to prototype types
Given a type defined in javascript, for example: var Point = (function () { function Point(x, y) { this.x = x; this.y = y; } Point.prototype.dist = function () { return Math.sqrt(this.x * this.y +…
-
9
votes3
answers2326
viewsQ: CSS Transition top
I’m creating a CSS that simulates cards from a deck, with cards and card hands. When a one-hand card is selected it is highlighted above the others. This works well, but I would like to apply a…
-
2
votes3
answers285
viewsA: "Gambiarra" in C# with XML, I would like suggestions for improvement
I have the impression that you would like to simply fill out the list with Pais containing the list of Consulados, follows my suggestion: var lista = (from p in doc.Root.Elements() select new…
-
7
votes3
answers15338
viewsA: How to validate CPF with Dataannotation on Client and Server?
I make here an add-on to the answer given by @Amir-Raga, which will validate only on the server. Even if the apparent code is being validated on the client, since the error message will be…
-
2
votes3
answers1073
viewsA: C# update XML based on another XML
Using LINQ with XDocument: XDocument doc1 = XDocument.Parse(@" <ROOT> <TES IDTES=""4780"" IDPES=""17522"" /> <TES IDTES=""6934"" IDPES=""12343"" /> <TES IDTES=""4781""…
-
1
votes3
answers3432
viewsA: How to take values from a Session and download them into variables?
First you need to fix that line in your code: //SessaoUtil.SalvarSession("ConexaoTFV", "resultado"); SessaoUtil.SalvarSession("ConexaoTFV", resultado); Then recover with your class, if you are OK…
-
4
votes2
answers1253
viewsA: How to search and sort Templatefields on a Gridview?
These are two different questions, in my opinion it is not as simple a task as it seems, so this answer is not intended to be definitive, but just trying to show a starting point. About the Sorting:…
-
20
votes2
answers25606
viewsQ: What kind of data (double, float or decimal) should I use to represent currency in . NET with C#?
Although I am aware of what would be better to use, I ask this question for educational purposes since I see several examples of people using double in C#. But I’ve had problems with double for coin…
-
8
votes1
answer3070
viewsA: To sort a list of objects by TWO properties
Do with Linq, first make sure to be referencing: using System.Linq; Then use it like this: var ordenada = lista.OrderBy(m => m.Categoria.Nome).ThenBy(m => m.Nome); Use the return list ordenada…
-
8
votes1
answer370
viewsA: Typescript syntax
Typescript is a superset of Javascript, the purpose of the language is to provide strong typing for programmers accustomed to C# to write Javascript in a more "comfortable" way. Typescript code is…
-
9
votes3
answers337
viewsA: Doubt about the responsibility of a get()
In my opinion there is confusion about the concept of getters and setters as being access methods, whose goal is to ensure encapsulation protecting the attributes of a class, and the proposed method…
-
1
votes1
answer1097
viewsA: Clickonce failed to load Crystal Reports
Check if you have set the package Crystal Reports as a prerequisite for publication by Visual Studio. To do this go on Properties of your project (right click) in the tab Publish click on the button…