private void userLoginClick(object sender, RoutedEventArgs e)//登录日志
        {
            try
            {
                listType            = _listType.ope1;
                AIS.IsChecked       = false;
                radar.IsChecked     = false;
                fuse.IsChecked      = false;
                login.IsChecked     = false;
                operation.IsChecked = false;
                alarm.IsChecked     = false;
                device.IsChecked    = false;

                login.IsChecked = true;
                long startTime = dataTime()[0]; //开始时间
                long endTime   = dataTime()[1]; //结束时间

                AISList.Visibility       = Visibility.Collapsed;
                radarList.Visibility     = Visibility.Collapsed;
                fuseList.Visibility      = Visibility.Collapsed;
                userLoginList.Visibility = Visibility.Visible;
                operateList.Visibility   = Visibility.Collapsed;
                alarmList.Visibility     = Visibility.Collapsed;
                deviceList.Visibility    = Visibility.Collapsed;

                opep = new dataAnadll.OperationLogProvider();
                int allpage = 0;
                opep.SearchLog(1, getTimeStamp(startTime), getTimeStamp(endTime), out PageIndex.Total);
                var a = getTimeStamp(startTime);
                var b = getTimeStamp(endTime);
                List <dataAnadll.OperationLog> list;

                PageIndex.Current = 1;

                loginDataList.Clear();
                for (int j = 0; j < PageIndex.Total; j++)
                {
                    opep.GetPage(1 + j, out list);
                    for (int i = 0; i < list.Count; i++)
                    {
                        loginData loginTarget = new loginData();

                        loginTarget.logNumber = (j * 1000 + i).ToString();
                        loginTarget.userName  = list[i].UserName;
                        loginTarget.operate   = list[i].OptionName;
                        loginTarget.time      = list[i].OptionTime.ToString();
                        loginTarget.result    = list[i].Result.ToString();
                        loginTarget.other     = list[i].Note;
                        loginTarget.ip        = list[i].IP.ToString();
                        loginTarget.type      = logNumber[list[i].LogType];
                        loginDataList.Add(loginTarget);
                    }
                }
                userLoginList.DataContext = loginDataList;
            }
            catch (Exception ee)
            {
            }
        }
        private void operationLogClick(object sender, RoutedEventArgs e)//界面操作日志
        {
            try
            {
                listType            = _listType.ope2;
                AIS.IsChecked       = false;
                radar.IsChecked     = false;
                fuse.IsChecked      = false;
                login.IsChecked     = false;
                operation.IsChecked = false;
                alarm.IsChecked     = false;
                device.IsChecked    = false;

                operation.IsChecked = true;
                long startTime = dataTime()[0]; //开始时间
                long endTime   = dataTime()[1]; //结束时间

                AISList.Visibility       = Visibility.Collapsed;
                radarList.Visibility     = Visibility.Collapsed;
                fuseList.Visibility      = Visibility.Collapsed;
                userLoginList.Visibility = Visibility.Collapsed;
                operateList.Visibility   = Visibility.Visible;
                alarmList.Visibility     = Visibility.Collapsed;
                deviceList.Visibility    = Visibility.Collapsed;

                opep = new dataAnadll.OperationLogProvider();
                int allpage;
                opep.SearchLog(2, getTimeStamp(startTime), getTimeStamp(endTime), out PageIndex.Total);
                List <dataAnadll.OperationLog> list;
                opep.GetPage(1, out list);
                PageIndex.Current = 1;
                operateDataList.Clear();
                for (int i = 0; i < list.Count; i++)
                {
                    operateData operateTarget = new operateData();

                    operateTarget.logNumber = i.ToString();
                    operateTarget.userName  = list[i].UserName.ToString();
                    operateTarget.operate   = list[i].OptionName.ToString();
                    operateTarget.time      = list[i].OptionTime.ToString();
                    operateTarget.result    = list[i].Result;
                    operateTarget.other     = list[i].Note.ToString();
                    operateTarget.ip        = list[i].IP.ToString();
                    operateTarget.type      = logType[list[i].LogType];
                    operateDataList.Add(operateTarget);
                }
                currentPage.Text        = PageIndex.Current.ToString();
                totalPages.Text         = PageIndex.Total.ToString();
                operateList.DataContext = operateDataList;
                numberRule.Max          = PageIndex.Total;
            }
            catch (Exception ee)
            {
            }
        }
        private void exportClick(object sender, RoutedEventArgs e)//导出
        {
            try
            {
                if (string.IsNullOrWhiteSpace(filePathText.Text))
                {
                    MessageBoxX.Show("导出提示", "未设置文件路径");
                    return;
                }
                long   startTime = dataTime()[0]; //开始时间
                long   endTime   = dataTime()[1]; //结束时间
                int    allPage   = 0;
                int    cnt       = 0;
                string filePath  = "";
                if (listType == _listType.ais)
                {
                    //List<dataAnadll.FUS_ICD_MySql.AISMsg_SS> list = MainWindow.data.AIS(startTime, endTime, MainWindow.mycon, 1, 10);

                    dataAnadll.AISDataProvider dataprovider = new dataAnadll.AISDataProvider((uint)startTime, (uint)endTime);
                    dataprovider.GetPageNum(out allPage);
                    List <dataAnadll.FUS_ICD_MySql.AISMsg_SS> list;

                    for (int i = 0; i < allPage; i++)
                    {
                        dataprovider.GetPage(i + 1, out list);
                        //alldata.Add();
                        cnt += dataAnadll.SaveToExcel.Save_AISdata(filePathText.Text + "\\ais.xls", list, AIStitle, 14);
                    }
                    filePath = "AIS.xls";
                }
                else if (listType == _listType.radar)
                {
                    dataAnadll.RadarDataProvider radarp = new dataAnadll.RadarDataProvider((uint)startTime, (uint)endTime);

                    radarp.GetPageNum(out allPage);
                    List <dataAnadll.FUS_ICD_MySql.RdDetectMsg_SS> list;
                    for (int i = 0; i < allPage; i++)
                    {
                        radarp.GetPage(i + 1, out list);
                        cnt += dataAnadll.SaveToExcel.Save_Radardata(filePathText.Text + "\\radar.xls", list, radartitle, 6);
                    }
                    filePath = "radar.xls";
                }
                else if (listType == _listType.fus)
                {
                    dataAnadll.FUSDataProvider radarp = new dataAnadll.FUSDataProvider((uint)startTime, (uint)endTime);

                    radarp.GetPageNum(out allPage);
                    List <dataAnadll.FUS_ICD_MySql.FusTarget_SS> list;
                    for (int i = 0; i < allPage; i++)
                    {
                        radarp.GetPage(i + 1, out list);
                        //SaveToExcel.Save_Fusedata(filePathText.Text + "/radar.xls", list, radartitle, 6);
                        cnt += dataAnadll.SaveToExcel.Save_Fusedata(filePathText.Text + "\\fuse.xls", list, fusetitle, 15);
                    }
                    //List<dataAnadll.FUS_ICD_MySql.FusTarget_SS> list = MainWindow.data.Fuse(startTime, endTime, MainWindow.mycon);
                    filePath = "fuse.xls";
                }
                else if (listType == _listType.ope1)
                {
                    dataAnadll.OperationLogProvider radarp = new dataAnadll.OperationLogProvider();
                    radarp.SearchLog(1, DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime), out allPage);

                    List <dataAnadll.OperationLog> list;
                    List <string[]> loginList = new List <string[]>();
                    for (int i = 0; i < allPage; i++)
                    {
                        radarp.GetPage(i + 1, out list);
                        for (int j = 0; j < list.Count; j++)
                        {
                            string[] str = new string[8];
                            // str[0] = "#############";
                            str[0] = list[j].UserName.ToString();
                            str[1] = list[j].OptionName.ToString();
                            str[2] = list[j].OptionTime.ToString();
                            str[3] = list[j].Result.ToString();
                            str[4] = list[j].Note.ToString();
                            str[5] = list[j].IP.ToString();
                            str[6] = logNumber[list[j].LogType].ToString();
                            loginList.Add(str);
                        }
                    }
                    cnt     += dataAnadll.SaveToExcel.Save_Optionlog(filePathText.Text + "\\login.xls", loginList, logintitle, 7);
                    filePath = "login.xls";
                }
                else if (listType == _listType.ope2)
                {
                    dataAnadll.OperationLogProvider radarp = new dataAnadll.OperationLogProvider();
                    radarp.SearchLog(2, DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime), out allPage);

                    List <dataAnadll.OperationLog> list;
                    List <string[]> opeList = new List <string[]>();
                    for (int i = 0; i < allPage; i++)
                    {
                        radarp.GetPage(i + 1, out list);
                        for (int j = 0; j < list.Count; j++)
                        {
                            string[] str = new string[7];
                            //str[0] = "#############";
                            str[0] = list[j].UserName.ToString();
                            str[1] = list[j].OptionName.ToString();
                            str[2] = list[j].OptionTime.ToString();
                            str[3] = list[j].Result.ToString();
                            str[4] = list[j].Note.ToString();
                            str[5] = list[j].IP.ToString();
                            str[6] = logNumber[list[j].LogType].ToString();
                            opeList.Add(str);
                        }
                    }
                    cnt     += dataAnadll.SaveToExcel.Save_Optionlog(filePathText.Text + "\\operate.xls", opeList, opearatetitle, 7);
                    filePath = "operate.xls";
                }
                else if (listType == _listType.alarm)
                {
                    dataAnadll.AlarmLogProvider radarp = new dataAnadll.AlarmLogProvider(DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime));
                    radarp.GetPageNum(out allPage);

                    List <dataAnadll.AlarmLog> list;
                    List <string[]>            loginList = new List <string[]>();
                    for (int i = 0; i < allPage; i++)
                    {
                        radarp.GetPage(i + 1, out list);
                        for (int j = 0; j < list.Count; j++)
                        {
                            string[] str = new string[8];
                            //str[0] = "###############";

                            alarmData alarmTarget = new alarmData();
                            string    a           = "";

                            if (list[j].alarm_area_num == 201)
                            {
                                a = alarmType[0];
                            }
                            else if (list[j].alarm_area_num == 202)
                            {
                                a = alarmType[1];
                            }
                            else if (list[j].alarm_area_num == 203)
                            {
                                a = alarmType[2];
                            }
                            else if (list[j].alarm_area_num >= 210 && list[j].alarm_area_num <= 215)
                            {
                                a = alarmType[3];
                            }
                            else if (list[j].alarm_area_num >= 220 && list[j].alarm_area_num <= 225)
                            {
                                a = alarmType[4];
                            }
                            else if (list[j].alarm_area_num == 255)
                            {
                                a = alarmType[5];
                            }
                            alarmTarget.alarmNumber  = a;
                            alarmTarget.time         = list[j].time.ToString();
                            alarmTarget.radarNumber  = list[j].radar_batch_id.ToString();
                            alarmTarget.radarNumber2 = list[i].radar_batch_id2.ToString();//告警日志添加雷达2 批号

                            alarmTarget.IMO = list[j].ais_batch_id.ToString();
                            switch (list[j].alarm_type)
                            {
                            case 1:
                                alarmTarget.alarmString = "驶入";
                                break;

                            case 2:
                                alarmTarget.alarmString = "驶出";
                                break;

                            default:
                                alarmTarget.alarmString = "未知报警";
                                break;
                            }
                            switch (list[j].country)
                            {
                            case 412:
                            case 413:
                                alarmTarget.country = "中国";
                                break;

                            case 574:
                            case 576:
                                alarmTarget.country = "越南";
                                break;

                            case 533:
                                alarmTarget.country = "马拉西亚";
                                break;

                            default:
                                alarmTarget.country = "其他";
                                break;
                            }
                            alarmTarget.Atrrib = state[list[j].iff_attrib];
                            str[0]             = alarmTarget.time;
                            str[1]             = alarmTarget.radarNumber; // list[j].radar_batch_id.ToString();
                            str[2]             = alarmTarget.radarNumber2;
                            str[3]             = alarmTarget.IMO;         // list[j].ais_batch_id.ToString();
                            str[4]             = alarmTarget.alarmNumber; // list[j].alarm_area_num.ToString();
                            str[5]             = alarmTarget.alarmString; // list[j].alarm_type.ToString();
                            str[6]             = alarmTarget.country;     // list[j].country.ToString();
                            str[7]             = alarmTarget.Atrrib;      // list[j].iff_attrib.ToString();
                            loginList.Add(str);
                        }
                    }
                    cnt     += dataAnadll.SaveToExcel.Save_AlarmLog(filePathText.Text + "\\alarm.xls", loginList, alarmtitle, 8);
                    filePath = "alarm.xls";
                }
                else if (listType == _listType.dev)
                {
                    dataAnadll.SystemLogProvider sysp = new dataAnadll.SystemLogProvider(DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime));
                    sysp.GetPageNum(out allPage);
                    List <dataAnadll.SystemLog> list;
                    List <string[]>             sysList = new List <string[]>();
                    for (int i = 0; i < allPage; i++)
                    {
                        sysp.GetPage(i + 1, out list);

                        for (int j = 0; j < list.Count; j++)
                        {
                            string[] str = new string[6];
                            //str[0] = "###########";
                            str[0] = list[j].machine_IP.ToString();
                            str[1] = list[j].machine_Name.ToString();
                            str[2] = type[list[j].machine_Network];
                            str[3] = type[list[j].machine_Workstate];
                            str[4] = list[j].machine_time.ToString();
                            str[5] = list[j].reason.ToString();
                            sysList.Add(str);
                        }
                    }
                    cnt     += dataAnadll.SaveToExcel.Save_SystemLog(filePathText.Text + "\\device.xls", sysList, devicetitle, 6);
                    filePath = "device.xls";
                }
                if (cnt > 0)
                {
                    MessageBoxX.Show("导出提示", string.Format("导出至{0}!", filePath));
                }
                else
                {
                    MessageBoxX.Show("导出提示", string.Format("数据为空,导出失败"));
                }
            }
            catch (Exception ee)
            {
            }
        }