Exemple #1
0
        private void btnViewReport_Click(object sender, EventArgs e)
        {
            if (lsvSessions.SelectedItems != null && lsvSessions.Items.Count > 0)
            {
                try
                {
                    foreach (ListViewItem selectedItem in lsvSessions.SelectedItems)
                    {
                        var film = (cFilm)selectedItem.Tag;

                        Cursor = Cursors.WaitCursor;
                        mPhysicalStudio.DevelopFilm(film);
                        var reportFilm = (cFilm)film.Clone();
                        mPhysicalStudio.ClearFilm(film);
                        Cursor = Cursors.Default;

                        var sf = new StatsReport();
                        sf.userId = mUserId;
                        sf.BindFormData(reportFilm);

                        Thread.Sleep(500);

                        sf.ShowDialog(this);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Something went wrong while generating the report", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            else
            {
                MessageBox.Show("You have to select one item from the list in order to view the report!", "Select one item!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Exemple #2
0
        private void btnLog_Click(object sender, EventArgs e)
        {
            if (mUserId <= 0)
            {
                MessageBox.Show("You must login with a valid username and password before you can log!", "Cannot Log", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int totalLoggedCases             = 0;
            ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"];
            var data = new cDataAccess(setting.ConnectionString);

            data.evNewCaseLogged           += data_NewCaseLogged;
            data.evNewCaseLoggedError      += data_NewCaseLoggedError;
            data.evNewCasePreviouslyLogged += data_NewCasePreviouslyLogged;

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                if (lsvSessions.SelectedItems.Count > 0 && lsvSessions.Items.Count > 0)
                {
                    if (lsvSessions.SelectedItems.Count > 1)
                    {
                        if (MessageBox.Show("You have selected " + lsvSessions.SelectedItems.Count + " sessions to log. Are you sure you want to continue?", "Multi session Log mode", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            return;
                        }
                    }

                    foreach (ListViewItem selectedItem in lsvSessions.SelectedItems)
                    {
                        var film = (cFilm)selectedItem.Tag;

                        int   numberLoggedCases;
                        int   previouslyLogged;
                        cFilm reportFilm;
                        if (data.logNewCases(film, mUserId, mImagePath, out numberLoggedCases, out reportFilm, out previouslyLogged))
                        {
                            totalLoggedCases += numberLoggedCases;

                            var sf = new StatsReport();
                            sf.userId = mUserId;
                            sf.BindFormData(reportFilm);
                            sf.Show(this);

                            //Process vosi list
                            data.logVosiFile(film);

                            if (!string.IsNullOrEmpty(film.pStatsFileName))
                            {
                                FileInfo fileInfo         = new FileInfo(film.pStatsFileName);
                                var      encStatsFileList = data.ReadStatsFile(fileInfo);
                                data.SubmitStatsFile(encStatsFileList);
                            }

                            Application.DoEvents();

                            int sessionLogged;
                            data.checkLoggedSessions(film, out sessionLogged);
                            selectedItem.BackColor = sessionLogged == 1 ? Color.Purple : Color.Green;
                        }

                        if (data.pError.Length > 0)
                        {
                            if (film.getFirstValidPictureFile() != null)
                            {
                                MessageBox.Show("ERROR with logging film " + film.getFirstValidPictureFile().pFormattedSession + " - " + data.pError, "Log Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                MessageBox.Show("ERROR with logging film <SESSION READ ERROR> - " + data.pError, "Log Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }

                        mPhysicalStudio.ClearFilm(film);
                    }
                }
                else
                {
                    MessageBox.Show("You must select a session with encrypted files before you can log!", "Cannot Log", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show("The system logged " + totalLoggedCases.ToString() + " new cases!", "Logged Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                lblInfo.Text = "The system logged " + totalLoggedCases + " new cases!";
            }
        }