TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Robson Amaral
NA
132
17.1k
Questions regarding reading files
Apr 20 2018 7:47 AM
I have my service code already ready, but inside it, I should get the first file containing the extension .cpv, in case I read this file, inside the file it contains several vouchers with its due information, however, I need to save the data it contains on each voucher, such as date and time, document value, as soon as I finish processing this file, I have to move those files to another folder. How could I be initiating this coding of this application? Because in my windows service project, I already have two classes LogService and Program.cs, already ready, as it is a windows service, how could I apply these requirements in this windows functionality, to read those files in that directory? Would you kindly help me, friend?
Here's my service code:
Service1.cs
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Diagnostics;
using
System.IO;
using
System.Linq;
using
System.ServiceProcess;
using
System.Text;
using
System.Threading.Tasks;
using
System.Timers;
namespace
ServicoProcessamentoComprovantes
{
public
partial
class
Service1: ServiceBase
{
private
Timer timer1 =
null
;
public
Service1 ()
{
InitializeComponent ();
}
protected
override
void
OnStart (
string
[] args)
{
LogService.writeEventLog (
"The timer is set to 10 seconds"
);
timer1 =
new
Timer ();
// 1000 = one seconds
this
.timer1.Interval = 1000;
// 10 seconds
this
.timer1.Elapsed + =
new
ElapsedEventHandler (
this
.timer_tick);
this
.timer1.Enabled =
true
;
LogService.writeEventLog (
"Starting Banestes service"
);
}
private
void
timer_tick (
object
sender, ElapsedEventArgs e)
{
// ALL:
LogService.writeEventLog (
"The timer and some operations are running ..."
);
// ALL:
LogService.writeEventLog (
"Operation completed successfully"
);
}
protected
override
void
OnStop ()
{
LogService.writeEventLog (
"******** --Event: Idle-- ********"
);
LogService.writeEventLog (
"Attempt to Stop Service"
);
timer1.Stop ();
timer1 =
null
;
LogService.writeEventLog (
"Service stopped by user"
);
}
private
void
ListArchives ()
{
string
extension = Path.GetExtension (
""
);
DirectoryInfo Dir =
new
DirectoryInfo (@
"\\ S3A601 \ ftp @ sefaz \ BANESTES \ Output_SDPJ \ test"
);
}
}
}
Reply
Answers (
0
)
Unable to cast object of type 'System.Web.UI.LiteralControl'
using arrayList as DataSource for Gridview