Solved

C#: Check emails and perform SQL operations

Posted on 2014-04-21
6
411 Views
Last Modified: 2014-04-22
Hello Experts,

I am performing some manual repeated operations in my project and I am planning to make it automatic by creating a tool or program which will remove my extra burden.

I will be receiving emails from client example Check Balance of Clients Account. After receiving such email, I need to run respective SQL query which will provide a set of 10 records as a result. Then I need to export this result in CSV format or excel and save it in my desktop. Then I will reply to client's email which I have received with fixed content in it and will be adding this exported excel doc to this email and will be sending it to the client.

Manual Operations:
Step 1: Open my email account and check for new email with subject as something like 'Check Balance'
Step 2: Note down the Account Number present in the body of the email
Step 3: Get the corresponding SQL query which is present as text file in my local machine.
Step 4: Run this SQL Query by replacing the Account Number at sufficient locations in SQL Server.
Step 5: Export the resultant SQL output to excel file.
Step 6: Attach this excel file to clients reply email.
Step 7: Copy the body content present in text file present in my machine.
Step 8: Send the email to client.

I do not know if I can achieve above all 8 Steps automatically through C# code but I want to cover as many Steps I can to automatic so that it will save my time.

I will be grateful if experts can help me out here with this...

Thanks in Advance...!!
0
Comment
Question by:Md Shah
  • 3
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
Utkarsh Kulkarni earned 500 total points
ID: 40012530
Hi,

A much simple solution would be as follows

Create web or desktop application which will take account number & email as input.
Create or read standard message, create required excel file & email it to customer.

If you need to do this without entering account number & email address then create one email account. In web or windows app fetch email from this new email account & read the content for Account Number.

I hope this gives u an idea. Let me know if you need more details.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 40012578
All of this can be done in C# but it is not the purpose this forum to provide a full solution like the one you are asking!

you need to write some code and ask specific questions about particular steps.

if you are not  a programmer, consider hiring one or use some service like rentacoder to provide you a full solution
0
 
LVL 8

Author Comment

by:Md Shah
ID: 40013165
Thanks Astoutkarsh for your response, it will help me for initial start...

Also I agree with Éric Moreau as this is huge stuff, let me break down into smaller tasks..

Yes I am a C# developer and I know how to interact with SQL Server via ADO.NET and fetch the resultant output into data-table.

Question 1) Now I do not know how to covert this resultant output into .csv or .xlsx sheet..

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28416910.html

Question 2) I do not know how to check NEW emails in my account like GMAIL or YAHOO so..

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28416918.html

Question 3) I have never worked on Windows Service. I want to learn it how to create Windows Service project and how to host this service in my local

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28416928.html

I have created 3 different Questions for this task as I believe 500 points for this solution is not sufficient, so lets make it 1500 points for this task

I will be closing this Question once above 3 Questions are resolved.

Cheers..
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Assisted Solution

by:Utkarsh Kulkarni
Utkarsh Kulkarni earned 500 total points
ID: 40014126
Hi,
I am not in favor of windows service.
Better idea would be creating windows desktop application (.exe) and then creating a schedule task to execute this EXE file at regular interval. You can create a windows service for this EXE file using SC.exe utility like

sc create newservice binpath= "<path_to_the_executable>"
Note : double quotes are part of command.

Ref - http://support.microsoft.com/kb/251192
0
 
LVL 8

Author Comment

by:Md Shah
ID: 40016480
I've requested that this question be closed as follows:

Accepted answer: 0 points for mdshahbrains's comment #a40013165
Assisted answer: 250 points for astroutkarsh's comment #a40012530
Assisted answer: 250 points for astroutkarsh's comment #a40014126

for the following reason:

Thanks for the info !!
0
 
LVL 8

Author Comment

by:Md Shah
ID: 40016476
Done
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL 2014 get SPIDs of users 6 26
sql query 7 35
Data Saving 5 36
MSSQL Frequency of Years From Days Field 2 14
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now