Exemple #1
0
        public void Start()
        {
            errorWriting = new ErrorLogging();
            errorWriting.WriteErrorLog("Service has started on " + Environment.MachineName);

            ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"];

            dataAccess = new cDataAccess(setting.ConnectionString);


            bool success = dataAccess.getImagePath(Environment.MachineName, out mImagePath);

            if (!success)
            {
                errorWriting.WriteErrorLog("Invalid Image path. Please check the computer name!");
                Stop();
            }

            try
            {
                _scheduler = StdSchedulerFactory.GetDefaultScheduler();

                _scheduler.Start();

                // define the job and tie it to our HelloJob class
                IJobDetail job = JobBuilder.Create <ProcessJob>()
                                 .Build();

                IJobDetail job2 = JobBuilder.Create <ProcessJob>()
                                  .Build();

                // Trigger the job to run now, and then repeat 0
                ITrigger trigger = TriggerBuilder.Create()
                                   .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(6, 0))
                                   .Build();

                // Tell quartz to schedule the job using our trigger
                _scheduler.ScheduleJob(job, trigger);

                ITrigger trigger2 = TriggerBuilder.Create()
                                    .StartNow()
                                    .Build();

                _scheduler.ScheduleJob(job2, trigger2);
            }
            catch (SchedulerException ex)
            {
                errorWriting.WriteErrorLog(ex.Message);
            }
        }
Exemple #2
0
        public void Execute(IJobExecutionContext context)
        {
            errorWriting = new ErrorLogging();
            try
            {
                retryCounter += 1;
                errorWriting.WriteErrorLog("iAutoLog Job has started on machine " + Environment.MachineName);
                var configurationCore = new TMT.Core.Camera.Interfaces.Configuration();

                var redRoomConfiguration = new cConfiguration();

                List <cCamera> cameras = redRoomConfiguration.GetCameras(Path.Combine(DefaultPath(), "Config"), "CameraConfig.xml");
                mPhysicalStudio = new cPhysicalStudio();

                // mPhysicalStudio.evFilmAdded += mPhysicalStudioFilmAdded;
                foreach (cCamera abstractCamera in cameras)
                {
                    mPhysicalStudio.Register(abstractCamera);
                }

                ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"];

                dataAccess = new cDataAccess(setting.ConnectionString);
                errorWriting.WriteErrorLog("Get Server Time.");
                serverDateTime = dataAccess.GetDatabaseDate();

                dataAccess.evNewCaseLoggedError += data_NewCaseLoggedError;

                bool success = dataAccess.getImagePath(Environment.MachineName, out mImagePath);
                if (!success)
                {
                    errorWriting.WriteErrorLog("Invalid Image path. Please check the computer name!");
                }

                errorWriting.WriteErrorLog("StartProcessing");
                StartProcessing();
            }
            catch (Exception ex)
            {
                errorWriting.WriteErrorLog(ex.Message);
                if (retryCounter <= 2)
                {
                    Thread.Sleep(60000);
                    Execute(context);
                }
            }
        }
Exemple #3
0
        private void btnLoginLogout_Click(object sender, EventArgs e)
        {
            if (btnLoginLogout.Text == "Logout")
            {
                mUserId             = -1;
                mImagePath          = "";
                btnLoginLogout.Text = "LogIn";
                lblLogin.Text       = "You are not Logged In";
            }
            else
            {
                bool success;
                if (App.AuthenticatedUser != null)
                {
                    mUserId = (int)App.AuthenticatedUser.UserData.ID;
                }

                ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"];

                var data = new cDataAccess(setting.ConnectionString);

                if (data.pError.Length > 0)
                {
                    MessageBox.Show("ERROR with Login Procedure! - " + data.pError, "Log Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (mUserId <= 0)
                {
                    if (App.AuthenticatedUser == null)
                    {
                        success = data.validateUser(txtUserName.Text, txtPassword.Text, out mUserId);

                        if (!success || mUserId < 0)
                        {
                            MessageBox.Show("Invalid User name or Password. Remeber, its case sensitive!" + " - " + data.pError, "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }

                if (mImagePath == string.Empty)
                {
                    success = data.getImagePath(txtMachineName.Text, out mImagePath);

                    if (!success)
                    {
                        MessageBox.Show("Invalid Image path. Please check the computer name!", "Invalid Image Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        mUserId = -1;
                        return;
                    }

                    //MessageBox.Show("You are now logged in Please proceed to log!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    btnLoginLogout.Text = "Logout";
                    lblLogin.Text       = "Logged In, User Id: " + mUserId;
                }
            }

            if (lsvSessions.Items.Count > 0)
            {
                loadFilms();
            }
        }