Taking input in c sharp program from another screen - c#

I have to develop a data base for calling center, they have a software provided by the company. when ever they get a call the number of caller is shown in a minor screen inside that calling program.
I have to take that caller ID as input for my database in order to save and search the address and other information about user.
A friend told me about Auto IT that you can take this type of input but i want to create it in c #, i dont even know what to search for it. can someone point me to right direction ? or share some example
Edit: suggestion given by one as i have to use the image processing. Thats the only way to solve this problem. No other solution yet.
What about the auto IT, can we do it easily from that ? i really dont want to get in to image processing.

Related

Is a database or a file more suitable to store varying user input and then retrieve values to find average or sum?

This is a stand alone application, and the data doesn't need to be saved for a later time, and data will not be shared between users, it's for one user to input their data and carry out an assessment, the user can then note down the results, but none of this needs to be stored into the app for a later time.
It's a 2 stage assessment, the first stage requires the user to fill out a number of forms with structural details of columns, depending on how many columns they have, and the second stage needs to sum some of those column values and some will need to be averaged, to then display the final values of the assessment, onto a final form.
Only numbers are entered into each form, and results will also be in the form of numbers which are then displayed on a graph. There are around 30 text boxes of user input, which are input into a input form that pops of from a button from the parent form, stage one of the assessment is then carried out for each column on each parent form. Each parent form renderred onto a new tab using this EasyTabs solution Creating a C# Application with Chrome-Style Tabs using EasyTabs in WinForms - YouTube[^] that I found online.
I'm an absolute beginner on C# , so I couldn't figure out how I would take a value from each form and display the sum or average onto the final form, if I don't know how many forms there will be for each user during run time, as each user will have a different amount, I was thinking it's maybe some sort of loop during run time, but I'm just not sure what that would look like.
After speaking to a friend, they recommended a single form, with a save and refresh button, where the data gets saved onto a file, and then gets retrieved would be better, but there are say 10 different user input values that need to be picked up from each form, and then averaged or summed, I started learning about StreamReader and StreamWriter and how files work in C#, but it was really difficult to figure out how to lay out the data in the file, how to get C# to sum the correct values together etc etc.
What would be the best way to approach this problem?
Thank you for your help.
If by "Form" you mean the WinForms definition of Form (Basically a new window), then I advise you to have a look at this post describing how to get data from one Form to the other.
To make a TextBox only accept numbers, you can use the a regular expression validation ^[0-9]*$ if you want to allow empty inputs or ^[0-9]+$ if you want at least one digit. if you want to allow negative numbers as well it is ^(\+|-)?[0-9]$. Note: all those will allow leading zeroes. For decimals you need to allow periods as well. ^(\+|-)?[0-9]*(\.[0-9]+)?$. Read up on regular expressions if you need anythin else. This website can help you design and test them.
To get a number from your text box you need to parse the text in the textbox. dotNet has plenty of functions for that already. For example Int32.TryParse() or if you want it to throw an exception Int32.Parse(). Others are similar. Have a look at the MSDN documentation to see how to use them.
As for averaging: Making a database, connecting to it and then using it to calculate the average of a number does seem like a pretty roundabout way of doing things. In programming you tell the computer what to do. So if someone told you to calculate an average, would you write the numbers in a book an then send them off to someone to calculate for you? Surely not.
You can just add all the numbers together in your code and divide by the amount of numbers. But there is an even easier solution. Add all your numbers to a List<int> and call it's .Sum() method and then divide by the return of it's .Count() method.
Saving the data to a file is only needed if you want to shut off the program between the user inputs or want to document the inputs.
Writing and reading numbers from a file is fairly straight forward though. Have a look at these tutorials provided by Microsoft: Write to file, Read from file, Read file one line at a Time. Writing to files uses the exact same methods as System.Console, just that you use a file stream instead of StdIO.
As for data layouts, there are several sane variants. For something simple you can just make your own (i.e. the position in the file dictates where the data goes, or each data point comes with a descriptor before it, for example inputA: 24). For more complex data, I would consider creating a class for your data and then serialize the data, for example using the popular Newtonsoft JSON library or XML and don't worry about how the file is structured.

Need some inspiration on how to generate and stream images efficiently on Azure with C#

I have a situation where I need to display an image to an end user following the below method.
When the user request the image from a URL, the C# code behind should start by looking in an azure blob/cdn to see if the image is there. If the image is there and less than x days old, it should pass the image to the end user in the most efficient way (preferably without spending too many resources (memory & cpu) passing it to the user.
If the image is not there or more than a week old, the image will be generated based on the parameters supplied in the url the user requested, after which it is stored on the blob/cdn and displayed to the end user.
My problem is how, I in the most efficient way on azure, can generate a lot of images simultaneously as well as being able to pass the data from the cdn while still being able to first check if it is too "old" and needs to be regenerated or if it isn't there and needs to be generated before being displayed to the user. Since the second I pass the image through the c# code will loose the cdn's strengths.
There are many ways to do things on azure. You will need to look through the extensive azure documentation and determine what will best fit your needs.
If you want to get something working quickly azure blobs can be served directly to a client (straight to their browser) - see the doco keep in mind anonymous access is not secure.

Real time editor for Cloud Storage System

I am working on cloud storage system in ASP.Net MVC5. In which I made a file manager that handles cut,copy,download multiple files,edit and preview of files, but I want to edit documents like word files in real time (collaborative editing)..is there any api that can help me accordingly.
Thank you in advance.
you should use Signal R for real time applications...it may be possible with the help of application user interface but its better to write your own code according to your choice...
[http://signalr.net/][1]
dev_express and syncfusion may be your solution..try these..
This is turning into a huge comment, so I'll just explain my point of view in an answer. I'll remove it, if I see an actual answer appears.
I am suggesting you start writing your own code for collaborative editing and the reason is quite simple. You need at least slightly different processing for almost each file type, which suggests there will never be a single API to support collaborative editing for all file types, unless somebody makes it their goal to maintain it and keep up with every one created.
Start it simple, text (or hex) editing. Define how changes are made and implemented on other clients and then work your way to add as many file types (and methods that go with them) as you need.
You could use source code of 1 of these open source collaborative text editors (you'll have to find download / Github links on their websites) to get a general idea how to do it, but you will still have to put in some work and won't go far without creating your own code.
Collaborative editing requires user 1's (who just started editing) client to send either one of these:
Data pointing to changes made in file
Full file, and user 2's client (or central "server") should be able to calculate the changes made from there and implement them.
One of the problems is to overwrite only that portion of the file changes were made to (and avoid overwriting the other user 2's work).
And the biggest problem (the reason you can't have "1 for all" method/API) is each file type has its own structure meaning that different file types will have different data representing changes in file. If you try to write raw data it might work, but you'd still need to calculate and lock away specific portions of file, that contain general information, rather than data of your file.

How to read and write data from a LPT in C#?

I did some research around, some of the answers suggest using inpout32.dll, I tried it in C#, it always return 255 whenever I read from any address. sample code.
All I want to do is to read from 0x379 when my printer is power on and off, see if I can get two sets of different data, hence I can tell the printer is on or off!(I don't know if this will work, let me know if u know it won't work!)
If u happens to know any other way around to accomplish the task, please share it with me.

Email address format

I have an email address in a sql table in the following format:
clerk#weavers.org.uk
How can I convert it to the proper format?
I see it displays perfectly on a webpage but anywhere else it's like this. I am assuming it's codes for alphabets etc. (html) which get converted, but how do I update my table with the proper emails?
Thank you.
Take a look at the HttpServerUtility.HtmlDecode method, you should be able to write a loop to process all your data or write an extended stored procedure and call it from SQL.
If it's a small amount - you can use a tool like this: http://www.web2generators.com/html/entities
You can use the information found at http://www.lookuptables.com/ to write code to decode it yourself, or like Tony has suggested; use HttpServerUtility.HtmlDecode
I don't know of any good way to do this in with SQL - I'd write a small app to process the data.
If you're looking for a one-time fix for this one record: As you say it displays correctly on the screen, then cool: Display it on whatever screen that is, then copy and paste that value back into a database update, either a screen or a one-shot query.
If you're software is putting these escapes into the email address before saving to the database, I'd say: Don't. This is a bad idea, because then you can't search it or manipulate it. Store all values in "real" text. Do your HTML escaping when you are laying out a screen. Actually in ASP.NET I think most of the display functions do this automatically; some have flags to tell it to NOT HTML escape.
Addendum: I see Tony's answer assumes all your email addresses look like this. Is this correct, or is it just one? If it's all, then my suggestion for fixing one is impractical, you do indeed want to write a little program that loops through the db and fixes them all with HtmlDecode.

Categories