Questions tagged as '.net'

4
answers

Convert string to Time

I have a column in the database that receives a type varchar that corresponds to the hours in my application ( "HH:MM" ). I need to convert this string to a type TIME and then concatenate it with a type DateTime . Ha...
asked by 14.04.2014 / 16:52
2
answers

Get information from the sender object

How does the search for information through the sender object work, and in what situations can I use it, with what types of events? This is to avoid redundancy of events. Where can I explore these possibilities? For example : several buttons fro...
asked by 31.05.2014 / 04:25
1
answer

Write date of inclusion using entity framework

I believe there has been a misinterpretation, I am posting the code to be better understood. I'm using a project for my EF Repository inside it I have: Notice the doubt in //CompanySave.DATA_IND = DateTime.Now; This is possible. using Syste...
asked by 17.09.2015 / 03:06
3
answers

Transform a string into several substrings whose contents are in apostrophes

I am creating a program in C # that reads a text file and one of the lines of this file has the following format: 'Column 1' 'Column 2' 'Column 3' I want to turn this line into an array of strings so that the answer looks like this:...
asked by 25.11.2016 / 18:44
1
answer

Special Characters in StreamWriter with Encoding.ASCII C #

I am writing to a file via StreamWriter using Encoding.ASCII encoding. A situation appeared in which I need to write the letter "Ç". But if I try to do this, the file exits the "?" Character. In this case, I need to use this encoding (I can n...
asked by 02.10.2015 / 14:22
2
answers

Cross-origin request blocked

Hello, I'm trying to load a page from another application inside a div from my application using the jQuery load but my application is not loading the page and it shows the following error message: Cross-origin request blocked: Same Origin Pol...
asked by 07.08.2015 / 17:06
1
answer

What is the "class" constraint in a generic type?

In the line below: public class Tree<TItem> where TItem : IComparable<TItem> This line I'm creating the definition of type TItem where TItem implements the IComparable interface, ie I'm creating a generic ty...
asked by 15.09.2015 / 17:00
1
answer

Random order with Entity Framework

I would like to translate the following SQL statement to a lambda expression: SELECT TOP 1 * FROM tbPessoa order by NEWID() What do I put in the OrderBy that will be accepted? var pessoa = contexto.tbPessoa.OrderBy(???).FirstOrDe...
asked by 04.01.2017 / 14:34
1
answer

Modeling with Code First so you can change databases

If I generate my database for MySQL using the concept of Code First can I change it to SQL Server in the future? Do you need to change the classes or just the config and provider ?     
asked by 17.04.2017 / 15:27
1
answer

Customize message by time

I wanted to customize the greeting message depending on the time. Ex: Hora menor que 12h. "Bom dia" Hora menor que 18h. "Boa tarde" I made with if and else but wanted a better method. //Pegando a hora int hora = DateTime...
asked by 28.03.2017 / 15:19