Exemplo n.º 1
0
 public void reportdel(string id)
 {
     Model.Report report = new Model.Report();
     report.newsid = id;
     BLL.ReportBLL reportBLL = new BLL.ReportBLL();
     reportBLL.DelReport(report);
 }
Exemplo n.º 2
0
        private void InstallReport(Model.Report reportInfo)
        {
            System.Console.WriteLine($"Installing report {reportInfo}");

            Report report = FindExistingReport(reportInfo);

            if (report == null || options.OverwriteExistingReport)
            {
                report = UploadReport(reportInfo);
            }
            else
            {
                System.Console.WriteLine($"Skip upload of the report. The report already exists in target group.");
            }

            reportInfo.Id = report.Id;

            System.Console.WriteLine(
                $"   > Updating data source connection for dataset ID={report.DatasetId}; " +
                $"Server={options.DataSourceConnection.DatabaseServer}; Database={options.DataSourceConnection.DatabaseName}; Username={options.DataSourceConnection.DatabaseUser}");

            UpdateDataSourceConnection(report.DatasetId);

            System.Console.WriteLine($"   > Refreshing the dataset ID={report.DatasetId}");
            client.Datasets.RefreshDatasetInGroupAsync(groupId.ToString(), report.DatasetId);
        }
Exemplo n.º 3
0
        public void Report_InitialisePoints()
        {
            // Arrange
            var report = new Report();

            Assert.Equal(0, report.CalculateReportTotal());
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Model.Report  report    = new Model.Report();
            BLL.ReportBLL reportBLL = new BLL.ReportBLL();

            report.title = Request["search"].ToString().Trim();
            reportBLL.SearchTitle(report);
            this.SqlDataSource1.SelectCommand = report.sql;
        }
Exemplo n.º 5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.Report report = new Model.Report();
     report.newsid     = this.Label1.Text.ToString();
     report.title      = this.Label2.Text.ToString();
     report.contents   = this.txtEditorContents.Text;
     report.reportTime = DateTime.Now.ToLocalTime().ToString();
     BLL.ReportBLL reportBLL = new BLL.ReportBLL();
     reportBLL.AddReport(report);
 }
Exemplo n.º 6
0
 public static void GenerateExcel(string filename, Model.Report report)
 {
     using (var pack = new ExcelPackage())
     {
         SetTabIndicadores(pack.Workbook, report);
         SetTabExpenses(pack.Workbook, report.EntryExpenses, "Despesas");
         SetTabExpenses(pack.Workbook, report.EntryRevenue, "Receitas");
         SetTabAccount(pack.Workbook, report.Accounts);
         SetTabCreditCards(pack.Workbook, report.CreditCards);
         pack.SaveAs(new System.IO.FileInfo(filename));
     }
 }
Exemplo n.º 7
0
        public void UpdateReport(Model.Report report)
        {
            textTurnElapsed.text       = report.turnElapsed.ToString();
            textAttackerUnitCount.text = report.attackerCount.ToString();
            textDefenderUnitCount.text = report.defenderCount.ToString();

            textAttackerDamage.text = report.attackerDamageLastTurn.ToString();
            textDefenderDamage.text = report.defenderDamageLastTurn.ToString();

            textAttackerTotalHp.text = report.attackerTotalHp.ToString();
            textDefenderTotalHp.text = report.defenderTotalHp.ToString();
        }
Exemplo n.º 8
0
        //添加举报
        public bool AddReport(Model.Report report)
        {
            string SQL  = "insert into report values('" + report.newsid + "','" + report.title + "','" + report.contents + "','" + report.reportTime + "')";
            bool   iRet = DBHelper.ExecSql(SQL);

            if (iRet)
            {
                HttpContext.Current.Response.Write("<script>alert('匿名举报成功!');location.href='../../../main.aspx';</script>");
                return(true);
            }
            else
            {
                HttpContext.Current.Response.Write("<script>alert('举报失败,请重试');</script>");
                return(false);
            }
        }
Exemplo n.º 9
0
        //删除举报
        public bool DelReport(Model.Report report)
        {
            string SQL  = "DELETE from report where newsid='" + report.newsid + "'";
            bool   iRet = DBHelper.ExecSql(SQL);

            if (iRet)
            {
                HttpContext.Current.Response.Write("<script>alert('删除成功');location.href='report_check.aspx'</script>");
                return(true);
            }
            else
            {
                HttpContext.Current.Response.Write("<script>alert('删除失败,请重试');</script>");
                return(false);
            }
        }
Exemplo n.º 10
0
        //搜索举报---按title
        public bool SearchTitle(Model.Report report)
        {
            string SQL;

            SQL        = "select * from report where title like '%" + report.title + "%'";
            report.sql = SQL;
            DataSet ds = DBHelper.GetDataSet(SQL);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Check if all the fields are correct and if that is true it ask the insert method to insert the new data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSend_Click(object sender, EventArgs e)
        {
            bool _fieldsCorrect = true;

            epError.Clear();
            // Check all the fields if it is correct
            foreach (Control item in Controls.Cast <Control>())
            {
                if (item is TextBox || item is ComboBox)
                {
                    if (string.IsNullOrWhiteSpace(item.Text) && item != tbInsertion)
                    {
                        _fieldsCorrect = false;
                        epError.SetError(item, "Dit veld is incorrect ingevuld");
                    }
                }
            }
            // Check if it is a real email
            if (!Regex.IsMatch(tbEmail.Text, @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"))
            {
                _fieldsCorrect = false;
                epError.SetError(tbEmail, "Email is incorrect");
            }

            if (_fieldsCorrect)
            {
                Model.Report report = new Model.Report();
                report.FirstName = tbFirstname.Text;
                report.LastName  = tbLastname.Text;
                report.Message   = tbMessage.Text;
                report.Category  = cmbCategory.Text;
                report.Insertion = tbInsertion.Text;
                report.Email     = tbEmail.Text;
                _reportController.InsertReport(report);
                foreach (Control item in Controls.Cast <Control>())
                {
                    if (item is TextBox || item is ComboBox)
                    {
                        item.Text = null;
                    }
                }
                MessageBox.Show("Uw bericht is verzonden en zal zo spoedig mogelijk in handeling worden genomen");
                WriteCSV();
            }
        }
Exemplo n.º 12
0
        private Report UploadReport(Model.Report report)
        {
            var reportFilePath = reportCollection.GetReportFilePath(report);

            using (var pbixFile = File.OpenRead(reportFilePath))
            {
                var import = client.Imports.PostImportWithFileInGroup(
                    groupId.ToString(),
                    pbixFile,
                    report.GetPowerBIReportName(),
                    "CreateOrOverwrite",
                    true);

                // wait for import
                import = WaitImportSucceeded(import);

                return(client.Reports.GetReportInGroup(groupId.ToString(), import.Reports.Single().Id));
            }
        }
Exemplo n.º 13
0
        public void Report_DatabaseFound()
        {
            // First create a report
            var report = new Report();

            // Add that no databases have been found
            DatabaseAccess none = DatabaseAccess.None;

            report.DatabaseFound(none);

            // Get report total which should be equal
            // to the none value for databases found
            Assert.Equal(ReportUtils.DatabaseNoneValue,
                         report.CalculateReportTotal());

            // Add that a database was found but
            // no remote access allowed
            DatabaseAccess remote_denied = DatabaseAccess.Remote_Access_Denied;

            report.DatabaseFound(remote_denied);

            // Again get report total
            Assert.Equal(ReportUtils.DatabaseRemoteAccessDenied, report.CalculateReportTotal());
        }
Exemplo n.º 14
0
 public bool AddReport(Model.Report report)
 {
     return(db.AddReport(report));
 }
Exemplo n.º 15
0
 public bool DelReport(Model.Report report)
 {
     return(db.DelReport(report));
 }
Exemplo n.º 16
0
 public bool SearchTitle(Model.Report report)
 {
     return(db.SearchTitle(report));
 }
Exemplo n.º 17
0
        public MainViewModel(Model.IDutyOfficerRepository _dutyOfficerRepository, Model.IReportRepository _reportRepository, Model.IEmergencySituationRepositiry _emergencySituationRepositiry)
        {
            int i = 0;

            emergencySituationRepositiry = _emergencySituationRepositiry;
            ValueKey                    = new ObservableCollection <KeyValuePair <string, int> >();
            EmergencySituations         = new ObservableCollection <Model.EmergencySituation>();
            EmergenciesInfoByRegionList = new ObservableCollection <KeyValuePair <string, int> >();
            FillOutEmergencySituationsCollection();
            FillOutEmergenciesInfoByRegionList();
            FillOutStatusBarInfo();

            reportRepository      = _reportRepository;
            IsEditEmergencyEnable = false;
            if ((Report = reportRepository.GetByDate(selectedDate)) != null)
            {
                IsAddReportEnable    = false;
                IsDeleteReportEnable = true;
            }
            else
            {
                IsAddReportEnable    = true;
                IsDeleteReportEnable = false;
            }

            Messenger.Default.Register <Model.DutyOfficer>(this, HandleDutyOfficer);
            dutyOfficerRepository = _dutyOfficerRepository;
            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1.0);
            Task taskShowTime = new Task(
                () =>
            {
                timer.Start();
                timer.Tick += (s, e) =>
                {
                    i++;
                    if (i % 180 == 0) //каждые 3 минуты обновляются данные из бд
                    {
                        EmergencySituations.Clear();
                        FillOutEmergencySituationsCollection();
                    }
                    DateTime datetime = DateTime.Now;
                    Time = datetime.ToString("HH:mm:ss");
                };
            });

            taskShowTime.Start();
            ChangeUserCommand = new RelayCommand(() =>
            {
                AuthenticationControl _authenticationControl = new AuthenticationControl();
                DialogWindow _dialogWindow = new DialogWindow(_authenticationControl);
                foreach (Window window in Application.Current.Windows)
                {
                    if ((window as MainWindow) != null)
                    {
                        window.Close();
                    }
                }
                _dialogWindow.Show();
            });
            UserSettingCommand = new RelayCommand(() =>
            {
                UserSettingControl _userSettingControl = new UserSettingControl();
                DialogWindow _dialogWindow             = new DialogWindow(_userSettingControl);
                Messenger.Default.Send(CurrentDutyOfficer);
                _dialogWindow.ShowDialog();
            });
            AddEmergencyCommand = new RelayCommand(() =>
            {
                EmergencySituationControl _emergencySituationControl = new EmergencySituationControl();
                DialogWindow _dialogWindow = new DialogWindow(_emergencySituationControl);
                Messenger.Default.Send(CurrentDutyOfficer);
                Messenger.Default.Send(SelectedDate);
                if ((_dialogWindow.ShowDialog()) == true)
                {
                    EmergencySituations.Clear();
                    FillOutEmergencySituationsCollection();
                }
            });
            EditEmergencyCommand = new RelayCommand(() =>
            {
                EditEmergencySituationControl _editEmergencySituationControl = new EditEmergencySituationControl();
                DialogWindow _dialogWindow = new DialogWindow(_editEmergencySituationControl);
                Messenger.Default.Send(CurrentDutyOfficer);
                Messenger.Default.Send(CurrentEmergency.EmergencyID);
                if ((_dialogWindow.ShowDialog()) == true)
                {
                    EmergencySituations.Clear();
                    FillOutEmergencySituationsCollection();
                }
            });
            AddReportCommand = new RelayCommand(() =>
            {
                OpenFileDialog saveFileDialog = new OpenFileDialog();
                saveFileDialog.Filter         = "Text files (*.doc,*.docx)|*.doc;*.docx|All files (*.*)|*.*";
                if (saveFileDialog.ShowDialog() == true)
                {
                    pathReport          = Path.GetFileName(saveFileDialog.FileName);
                    Report              = new Model.Report();
                    Report.Report1      = File.ReadAllBytes(saveFileDialog.FileName);
                    Report.DateOfReport = SelectedDate;
                    reportRepository.AddReport(Report);
                    IsAddReportEnable    = false;
                    IsDeleteReportEnable = true;
                }
            });
            OpenReportCommand = new RelayCommand(() =>
            {
                pathReport = $"Сводка за {selectedDate.Date.ToShortDateString()} сутки.doc";

                var bytes = Report.Report1;
                try
                {
                    using (FileStream fs = new FileStream(pathReport, FileMode.Create, FileAccess.Write, FileShare.None))
                    {
                        foreach (var b in bytes)
                        {
                            fs.WriteByte(b);
                        }
                    }
                    Process prc            = new Process();
                    prc.StartInfo.FileName = pathReport;
                    //prc.EnableRaisingEvents = true;
                    //prc.Exited += Prc_Exited;
                    prc.Start();
                }
                catch (Exception)
                {
                    MyMessageBox _myMessageBox = new MyMessageBox();
                    Messenger.Default.Send("Данный файл уже открыт");
                    _myMessageBox.Show();
                }
            });
            ReadXMLDocCommand = new RelayCommand(() =>
            {
                StreamWriter fs = new StreamWriter("XML документ.txt", false, Encoding.GetEncoding(1251));
                fs.Write(emergencySituationRepositiry.ReadXMLDoc());
                Process prc            = new Process();
                prc.StartInfo.FileName = "XML документ.txt";
                prc.Start();
            });
            DeleteReportCommand = new RelayCommand(() =>
            {
                reportRepository.DeleteReport(SelectedDate);
                IsAddReportEnable    = true;
                IsDeleteReportEnable = false;
            });
            SelectedDateCommand = new RelayCommand(() =>
            {
                if ((Report = reportRepository.GetByDate(SelectedDate)) != null)
                {
                    IsAddReportEnable    = false;
                    IsDeleteReportEnable = true;
                }
                else
                {
                    IsAddReportEnable    = true;
                    IsDeleteReportEnable = false;
                }
                EmergencySituations.Clear();
                FillOutEmergencySituationsCollection();
            });
            SelectionChangedDataGridCommand = new RelayCommand(() =>
            {
                if (CurrentEmergency == null)
                {
                    IsEditEmergencyEnable = false;
                }
                else
                {
                    IsEditEmergencyEnable = true;
                }
            });
            UnLoadedCommand = new RelayCommand(() =>
            {
                string[] docList = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.doc");
                foreach (var f in docList)
                {
                    try
                    {
                        File.Delete(f);
                    }
                    catch (IOException)
                    {
                        continue;
                    }
                }
                ViewModelLocator.Cleanup();
            });
            DeleteEmergencyCommand = new RelayCommand(() =>
            {
                emergencySituationRepositiry.DeleteEmergencySituation(CurrentEmergency.EmergencyID);
                EmergencySituations.Clear();
                FillOutEmergencySituationsCollection();
            });
            AboutProgrammCommand = new RelayCommand(() =>
            {
                MyMessageBox _myMessageBox = new MyMessageBox();
                Messenger.Default.Send($"Программное средство \nУчет оперативной информации \nо чрезвычайных ситуациях.\nАвтор Северина Н.И.");
                _myMessageBox.Show();
            });
            WriteXMLDocCommand = new RelayCommand(() =>
            {
                emergencySituationRepositiry.WriteXMLDoc();
                MyMessageBox _myMessageBox = new MyMessageBox();
                Messenger.Default.Send($"Информация о ЧС записана в\nEmergencySituations.xml документ");
                _myMessageBox.Show();
            });
        }
Exemplo n.º 18
0
 private Report FindExistingReport(Model.Report reportInfo) => client.Reports.GetReportsInGroup(groupId.ToString()).Value.SingleOrDefault(r => r.Name == reportInfo.GetPowerBIReportName());