Questions tagged as '.net'

2
answers

How to simplify code using a loop?

How can I simplify the code below using a loop, I am in doubt because of the names of the labels that are sequential, as I put something variable in FieldName1, NomeCampo2 , ..., NomeCampoX . lblNomeCampo1.Text = dt.Rows[1][0].To...
asked by 30.10.2017 / 12:18
3
answers

Compare if two date fields are the same in C #

I have form and in this form I have two date fields, campodata1 is populated by user and campodata2 is filled by the database, now I need a code to compare if these two fields have the same information. The fields...
asked by 07.03.2018 / 13:38
1
answer

CRUD Generic in Entity Framework with entity not specified

I'm trying to make a Generic CRUD for my project. However as I used DataBaseFirst I do not see how to have a generic class of Entity that can be inherited. Well it does not make the slightest sense, eventually when I upgrade the bank, it would h...
asked by 17.11.2017 / 13:07
1
answer

Two actions for the same View

I have these two actions: public ActionResult Lista(int PessoaId, string Nome, string Twitter) { Pessoa p = new Pessoa(); p.PessoaId = PessoaId; p.Nome = Nome; p.Twitter = Twitter; return View(p); } public ActionResult...
asked by 21.03.2018 / 15:31
1
answer

Save JSON file information to database

I think about the possibility of a Web system saving information from a register in a JSON file on the client device, and that would later be sent to the DB. This will happen when the client is in an environment where it is not possible to acces...
asked by 24.06.2018 / 23:51
2
answers

How to change position of all matrix elements by changing the row number by column?

I tried this algorithm but the result stays the same after this exchange int[,] array = new int[10,10]; for (int l = 0; l < 10; l++) for (int c = 0; c < 10; c++) { int temp = array[l, c]; array...
asked by 14.07.2017 / 16:09
1
answer

How to create a .bat to run network file

Bat that is locally in a network of several computers, one has a recorder and the other does not, the one that does not have the recorder I use a .bat with the following code via local network, to get the files of the cds. / p> net use d: /del...
asked by 08.05.2017 / 20:46
1
answer

IsGenericType, GetGenericTypeDefinition, and Nullable.GetUnderlyingType

In a snippet of code I was suggested to use these three members in order to check if the properties of an object are Nullable . p.PropertyType.IsGenericType && p.PropertyType.GetGenericTypeDefinition ( ) == typeof( Nullable<&g...
asked by 19.02.2017 / 00:22
1
answer

In this case use switch or if?

I have an exercise to do that consists of the following: The user informs the salary, and depending on the value informed, it gains an increase according to the table. Example: From 1000 to 1500 he gains 10% From 1500 to 2000 he earns 5% 2000...
asked by 17.03.2017 / 05:15
2
answers

Class with method to change a parameter

I have a User class with private attributes like Nome , Endereco and Telefone . This class has a constructor method that receives parameters like nome , endereco and telefone . I'd like to use a construct...
asked by 28.02.2017 / 03:08