Ejemplo n.º 1
0
        /// <summary>
        /// 更新服务状态到数据库
        /// </summary>
        public virtual void UpdateServerStatus()
        {
            try
            {
                SplashScreenService.ShowSplashScreen();
                string sqlStr;
                if (serverState == "O")
                {
                    serverState = "C";
                }
                else
                {
                    serverState = "O";
                }

                sqlStr = $"UPDATE tb_ServerConfig SET ServerStatus='{serverState}'";
                if (SQLHelper.UpDateSQL(sqlStr))
                {
                    SetServerStatus();
                }

                SplashScreenService.HideSplashScreen();
            }
            catch (Exception ex)
            {
                SplashScreenService.HideSplashScreen();
                MessageBoxService.ShowMessage($"更新服务状态出错:{ex.Message}", "提示信息", MessageButton.OK, MessageIcon.Error);
            }
        }
Ejemplo n.º 2
0
        public MainViewModel(PageService pageService,
                             DbContextLoader contextLoader,
                             ClientPipeHanlder pipeHanlder,
                             EventBus eventBus,
                             ConnectorService connectorService,
                             ValuteGetterService valuteGetter,
                             SplashScreenService splashScreenService,
                             SourceService sourceService,
                             Services.UpdateHandlerService handlerService, IConfiguration configuration)
        {
            this.pageService         = pageService;
            this.contextLoader       = contextLoader;
            this.pipeHanlder         = pipeHanlder;
            this.eventBus            = eventBus;
            this.updaterService      = connectorService;
            this.valuteGetter        = valuteGetter;
            this.splashScreenService = splashScreenService;
            this.sourceService       = sourceService;
            this.handlerService      = handlerService;
            this.configuration       = configuration;
            pageService.PageChanged += PageService_PageChanged;

            splashScreenService.OverlapScreen += SplashScreenService_OverlapScreen;
            splashScreenService.ShowPromtBtn  += SplashScreenService_ShowPromtBtn;
            splashScreenService.ClearScreen   += SplashScreenService_ClearScreen;


            Init();
        }
Ejemplo n.º 3
0
 public void HideSplashScreen()
 {
     if (SplashScreenService.IsSplashScreenActive)
     {
         SplashScreenService.HideSplashScreen();
     }
 }
Ejemplo n.º 4
0
        public virtual void Copy()
        {
            var ii             = new ImageOperator();
            var destinationDir = new DirectoryInfo(ResultPath);
            var dirList        = new List <string>();

            if (UnInstallationFolder)
            {
                dirList.Add("Фото_демонтажа");
            }
            if (InstallationFolder)
            {
                dirList.Add("Фото_монтажа");
            }
            if (ConnectionFolder)
            {
                dirList.Add("Фото_подключения");
            }
            if (RepairsFolder)
            {
                dirList.Add("Фото_ремонта");
            }
            if (LightFolder)
            {
                dirList.Add("Фото_свет");
            }
            WindowService.Hide();
            SplashScreenService.ShowSplashScreen();
            ii.CopyByNumbers(SourceDir, destinationDir, UNIUs, dirList, RenameToSubdirs, CopyToSubdirs, OverlayText);
            SplashScreenService.HideSplashScreen();
            WindowService.Close();
        }
Ejemplo n.º 5
0
 public void ShowSplashScreen()
 {
     if (!SplashScreenService.IsSplashScreenActive)
     {
         SplashScreenService.ShowSplashScreen();
     }
 }
Ejemplo n.º 6
0
        private void InitBindings()
        {
            MVVMContext.RegisterXtraMessageBoxService();
            MVVMContext.RegisterXtraDialogService();

            mvvmContext1.ViewModelType = typeof(BusinessPartnerViewModel);
            var fluentAPI = mvvmContext1.OfType <BusinessPartnerViewModel>();

            //mvvmContext1.RegisterService(new NewAgentFrm());
            mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1));
            fluentAPI.SetBinding(gridControl1, gv => gv.DataSource, x => x.Agents);

            fluentAPI.WithEvent <ColumnView, FocusedRowObjectChangedEventArgs>(gridView1, "FocusedRowObjectChanged")
            .SetBinding(x => x.SelectedAgent,
                        args => args.Row as Agent,
                        (gView, entity) =>
            {
                gView.FocusedRowHandle = gView.FindRow(entity);
                if (entity != null)
                {
                    gpcPush.Enabled  = entity.bit_synPush;
                    gpcQuery.Enabled = entity.bit_synQuery;
                    gpcSync.Enabled  = entity.bit_synOpen;
                }
            });

            fluentAPI.SetBinding(txtAgentName, x => x.EditValue, x => x.SelectedAgent.vchar_AGname);
            fluentAPI.SetBinding(txtContactor, x => x.EditValue, x => x.SelectedAgent.vchar_AGLinkMan);
            fluentAPI.SetBinding(txtContactNum, x => x.EditValue, x => x.SelectedAgent.vchar_AGcontect);
            fluentAPI.SetBinding(txtAgentCode, x => x.EditValue, x => x.SelectedAgent.vchar_AGcode);
            fluentAPI.SetBinding(txtAgentType, x => x.EditValue, x => x.SelectedAgent.int_AGtype);

            fluentAPI.SetBinding(cbxOpenSyncServer, x => x.EditValue, x => x.SelectedAgent.bit_synOpen);
            fluentAPI.SetBinding(cbxSearchService, x => x.EditValue, x => x.SelectedAgent.bit_synQuery);
            fluentAPI.SetBinding(cbxOpenPushServer, x => x.EditValue, x => x.SelectedAgent.bit_synPush);

            fluentAPI.SetBinding(txtVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_synVerify);
            fluentAPI.SetBinding(txtSearchVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_QueryVerify);
            fluentAPI.SetBinding(txtPushServerVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_PushVerify);
            fluentAPI.SetBinding(txtPushUser, x => x.EditValue, x => x.SelectedAgent.vchar_PushUser);

            fluentAPI.SetBinding(txtKeyWords, x => x.EditValue, x => x.SelectedAgent.vchar_synStopKeyWord);
            fluentAPI.SetBinding(txtSyncTimSpan, x => x.EditValue, x => x.SelectedAgent.int_synSpacing);


            fluentAPI.BindCommand(btnAdd, x => x.AddAgentInfo());
            fluentAPI.BindCommand(btnDelete, x => x.DeleteSelectedAgent());
            fluentAPI.BindCommand(btnSave, x => x.SaveAgentInfo());

            fluentAPI.SetBinding(gpcSync, x => x.Enabled, x => x.IsGPCSync);
            fluentAPI.SetBinding(gpcQuery, x => x.Enabled, x => x.IsGPCQuery);
            fluentAPI.SetBinding(gpcPush, x => x.Enabled, x => x.IsGPCPush);

            fluentAPI.WithEvent <EventArgs>(txtAgentType, "SelectedIndexChanged").EventToCommand(x => x.AgentTypeChanged());
        }
Ejemplo n.º 7
0
 private void RegisterServices()
 {
     MVVMContext.RegisterXtraDialogService();
     mvvmContextMain.RegisterService(new SettingsWindowService());
     mvvmContextMain.RegisterService(new TextEditorFontChangeService());
     mvvmContextMain.RegisterService(new ConnectionWindowService());
     mvvmContextMain.RegisterService(new QueryBuilderService());
     mvvmContextMain.RegisterService(new BackupViewService());
     mvvmContextMain.RegisterService(App.Skins);
     mvvmContextMain.RegisterService(SplashScreenService.Create(splashScreenManagerMainWait));
 }
Ejemplo n.º 8
0
        public void Calculate()
        {
#if SILVERLIGHT
            SplashScreenService.ShowSplashScreen().ContinueWith(x => {
                Thread.Sleep(TimeSpan.FromSeconds(5));
                SplashScreenService.HideSplashScreen();
            });
#else
            SplashScreenService.ShowSplashScreen();
            Thread.Sleep(TimeSpan.FromSeconds(5));
            SplashScreenService.HideSplashScreen();
#endif
        }
Ejemplo n.º 9
0
 public HomeViewModel(PageService pageservice,
                      EventBus eventBus,
                      SplashScreenService splashScreen,
                      ConnectorService connectorService,
                      UserService userService,
                      SourceService sourceService) : base(pageservice)
 {
     this.eventBus       = eventBus;
     this.splashScreen   = splashScreen;
     this.updaterService = connectorService;
     this.userService    = userService;
     this.sourceService  = sourceService;
     Init();
 }
Ejemplo n.º 10
0
 public TourDetailsViewModel(PageService pageservice,
                             IConfiguration config,
                             EventBus eventBus,
                             ToursService toursService,
                             SplashScreenService splashScreen,
                             OrderService orderService, ValuteGetterService valuteGetter) : base(pageservice)
 {
     this.config       = config;
     this.eventBus     = eventBus;
     this.toursService = toursService;
     this.splashScreen = splashScreen;
     this.orderService = orderService;
     this.valuteGetter = valuteGetter;
     Init();
 }
Ejemplo n.º 11
0
        private void InitBindings()
        {
            MVVMContext.RegisterMessageBoxService();

            mvvmContext1.ViewModelType = typeof(LoginViewModel);
            var fluentAPI = mvvmContext1.OfType <LoginViewModel>();

            mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1));
            fluentAPI.SetBinding(txtUserName, t => t.EditValue, x => x.CurrentUser);

            var loginFrm = this;

            fluentAPI.WithEvent <KeyEventArgs>(txtUserName, "KeyDown").EventToCommand(x => x.KeyDown(null), x => loginFrm, e => (e.KeyCode == Keys.Enter));
            fluentAPI.WithEvent <EventArgs>(btnLogin, "Click").EventToCommand(x => x.Login(null), x => loginFrm);
        }
Ejemplo n.º 12
0
        private void InitBindings()
        {
            MVVMContext.RegisterMessageBoxService();

            mvvmContext1.ViewModelType = typeof(NewAgentViewModel);
            var fluentAPI = mvvmContext1.OfType <NewAgentViewModel>();

            mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1));
            fluentAPI.SetBinding(txtAgentName, x => x.EditValue, x => x.Agent.vchar_AGname);
            fluentAPI.SetBinding(txtContactor, x => x.EditValue, x => x.Agent.vchar_AGLinkMan);
            fluentAPI.SetBinding(txtContactNum, x => x.EditValue, x => x.Agent.vchar_AGcontect);
            fluentAPI.SetBinding(txtAgentCode, x => x.EditValue, x => x.Agent.vchar_AGcode);
            fluentAPI.SetBinding(txtAgentType, x => x.EditValue, x => x.Agent.int_AGtype);

            fluentAPI.SetBinding(cbxOpenSyncServer, x => x.EditValue, x => x.Agent.bit_synOpen);
            fluentAPI.SetBinding(cbxSearchService, x => x.EditValue, x => x.Agent.bit_synQuery);
            fluentAPI.SetBinding(cbxOpenPushServer, x => x.EditValue, x => x.Agent.bit_synPush);

            fluentAPI.SetBinding(txtVerifyCode, x => x.EditValue, x => x.Agent.vchar_synVerify);
            fluentAPI.SetBinding(txtSearchVerifyCode, x => x.EditValue, x => x.Agent.vchar_QueryVerify);
            fluentAPI.SetBinding(txtPushServerVerifyCode, x => x.EditValue, x => x.Agent.vchar_PushVerify);
            fluentAPI.SetBinding(txtPushUser, x => x.EditValue, x => x.Agent.vchar_PushUser);

            fluentAPI.SetBinding(txtKeyWords, x => x.EditValue, x => x.Agent.vchar_synStopKeyWord);
            fluentAPI.SetBinding(txtSyncTimSpan, x => x.EditValue, x => x.Agent.int_synSpacing);
            var viewModel = mvvmContext1.GetViewModel <NewAgentViewModel>();

            if (Parent is NewAgentFrm)
            {
                viewModel.NewAgentFrm = Parent as NewAgentFrm;
            }


            fluentAPI.SetBinding(gpcSync, x => x.Enabled, x => x.IsGPCSync);
            fluentAPI.SetBinding(gpcQuery, x => x.Enabled, x => x.IsGPCQuery);
            fluentAPI.SetBinding(gpcPush, x => x.Enabled, x => x.IsGPCPush);

            fluentAPI.BindCommand(btnSave, x => x.SaveAgentInfo());

            fluentAPI.WithEvent <EventArgs>(txtAgentType, "SelectedIndexChanged").EventToCommand(x => x.AgentTypeChanged());
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取服务器运行的日志信息
        /// </summary>
        public virtual void GetServerLogs()
        {
            try
            {
                SplashScreenService.ShowSplashScreen();
                string sqlStr = $"SELECT [dttm],[result] FROM [db_SFI].[dbo].[tb_SystemLog] WHERE [AGid]=1 AND (CONVERT(varchar(10),dttm,112) = '{ServerLogDate.ToString("yyyyMMdd")}') ORDER BY int_id DESC ";

                IEnumerable <SystemLog> logs = SQLHelper.GetObject <SystemLog>(sqlStr);
                foreach (SystemLog log in logs)
                {
                    Logs.Add(log);
                }
                GetServerStatus();
                SplashScreenService.HideSplashScreen();
            }
            catch (Exception ex)
            {
                SplashScreenService.HideSplashScreen();
                MessageBoxService.ShowMessage($"刷新日志信息出错:{ex.Message}", "提示信息", MessageButton.OK, MessageIcon.Error);
            }
        }
Ejemplo n.º 14
0
        private void InitBindings()
        {
            mvvmContext1.ViewModelType = typeof(CheckPointServerMgrViewModel);
            var fluentAPI = mvvmContext1.OfType <CheckPointServerMgrViewModel>();

            MVVMContext.RegisterMessageBoxService();
            mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1));
            var agents = fluentAPI.ViewModel.CBXAgents.ToList();

            cbxAgentName.Properties.Items.AddRange(agents);

            fluentAPI.SetBinding(cbxAgentName, cbx => cbx.EditValue, x => x.SelectedAgent);
            fluentAPI.SetBinding(serverLogdate, date => date.EditValue, x => x.ServerLogDate);

            fluentAPI.SetBinding(gridControl1, gc => gc.DataSource, x => x.Logs);

            fluentAPI.BindCommand(btnRefresh, x => x.GetServerLogs());

            fluentAPI.SetBinding(lblServerStatus, lbl => lbl.Text, x => x.ServerStatus);
            fluentAPI.SetBinding(lblServerStatus, lbl => lbl.BackColor, x => x.ServerStatusBackColor);

            fluentAPI.SetBinding(btnStartServer, btn => btn.Text, x => x.BtnStartServerText);
            fluentAPI.BindCommand(btnStartServer, x => x.UpdateServerStatus());
        }
Ejemplo n.º 15
0
        private void InitializeBindings()
        {
            var fluent = mvvmContextConnectionWindowView.OfType <ConnectionWindowViewModel>();

            mvvmContextConnectionWindowView.RegisterService(SplashScreenService.Create(splashScreenManager));


            fluent.BindCommand(simpleButtonCreateNewString, x => x.GoToConnectionBuilder());
            fluent.BindCommand(simpleButtonCancelCreateConnection, x => x.GoToConnectionManager());
            fluent.BindCommand(simpleButtonCancel, x => x.Cancel());
            fluent.BindCommand(simpleButtonSaveAndTest, x => x.TestAndSave());
            fluent.BindCommand(simpleButtonConnect, x => x.Connect());
            fluent.BindCommand(simpleButtonQueryInstances, x => x.GetInstances());

            fluent.SetBinding(textEditNickName, x => x.EditValue, y => y.NickName);
            fluent.SetBinding(textEditPassword, x => x.EditValue, y => y.Password);
            fluent.SetBinding(textEditUserName, x => x.EditValue, y => y.UserId);
            fluent.SetBinding(lookUpEditSavedConnections.Properties, x => x.DataSource,
                              vm => vm.SavedConnections);
            fluent.SetBinding(lookUpEditSavedConnections, x => x.EditValue, y => y.SelectedConnection);
            fluent.SetBinding(checkEditWindowsAuthentication, x => x.EditValue, y => y.UseWindowsAuthentication);
            fluent.SetBinding(spinEditConnectionTimeout, x => x.EditValue, y => y.ConnectTimeout);
            fluent.SetItemsSourceBinding(comboBoxEditInstances.Properties, cb => cb.Items, x => x.Instances,
                                         (i, e) => Equals(i.Value, e), entity => new ImageComboBoxItem(entity), null, null);
            fluent.SetBinding(comboBoxEditInstances, x => x.EditValue, vm => vm.DataSource);
            fluent.SetBinding(simpleButtonConnect, x => x.Enabled, vm => vm.CanConnect);
            fluent.SetBinding(checkEditShowOnStartup, x => x.Checked, x => x.ShowOnStartup);


            fluent.SetTrigger(x => x.WindowState, state =>
            {
                switch (state)
                {
                case ConnectionWindowViewModel.State.Open:
                    break;

                case ConnectionWindowViewModel.State.ConnectionManager:
                    ShowConnectionManager();
                    break;

                case ConnectionWindowViewModel.State.ConnectionBuilder:
                    ShowConnectionBuilder();
                    break;

                case ConnectionWindowViewModel.State.Exit:
                    Close();
                    break;

                default:
                    break;
                }
            });

            fluent.SetTrigger(x => x.UseWindowsAuthentication, state =>
            {
                switch (state)
                {
                case false:
                    textEditPassword.Enabled = true;
                    textEditUserName.Enabled = true;
                    break;

                case true:
                    textEditPassword.Enabled = false;
                    textEditUserName.Enabled = false;
                    break;

                default:
                    break;
                }
            });
        }
Ejemplo n.º 16
0
        public virtual void SaveAgentInfo()
        {
            try
            {
                #region 验证重复
                if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGname))
                {
                    MessageBoxService.ShowMessage("商业伙伴名称不能为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                    return;
                }

                if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGcontect))
                {
                    MessageBoxService.ShowMessage("联系方式不能为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                    return;
                }

                if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGLinkMan))
                {
                    MessageBoxService.ShowMessage("联系人不能为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                    return;
                }

                if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGcode))
                {
                    MessageBoxService.ShowMessage("商业伙伴代码不能为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                    return;
                }
                string sqlStr = string.Empty;

                if (SelectedAgent.bit_synOpen)
                {
                    if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_synVerify) || string.IsNullOrWhiteSpace(SelectedAgent.vchar_synStopKeyWord))
                    {
                        MessageBoxService.ShowMessage("检查点同步信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                        return;
                    }
                    sqlStr = $"SELECT [vchar_AGcode],[vchar_synVerify] FROM [dbo].[tb_Agent] WHERE [vchar_AGcode]='{SelectedAgent.vchar_AGcode}' OR [vchar_synVerify]='{SelectedAgent.vchar_synVerify}'";
                    IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList();
                    if (agents.Count != 0)
                    {
                        Agent agent = agents.FirstOrDefault();
                        if (SelectedAgent.vchar_AGcode == agent.vchar_AGcode)
                        {
                            MessageBoxService.ShowMessage("与其他商业伙伴代码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error);
                            return;
                        }
                        if (SelectedAgent.vchar_synVerify == agent.vchar_synVerify)
                        {
                            MessageBoxService.ShowMessage("与其他商业伙伴同步接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error);
                            return;
                        }
                    }
                }
                if (SelectedAgent.bit_synQuery)
                {
                    if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_QueryVerify))
                    {
                        MessageBoxService.ShowMessage("检查点查询信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                        return;
                    }
                    sqlStr = $"SELECT [vchar_QueryVerify] FROM [dbo].[tb_Agent] WHERE [vchar_QueryVerify]='{SelectedAgent.vchar_QueryVerify}'";
                    IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList();
                    if (agents.Count != 0)
                    {
                        Agent agent = agents.FirstOrDefault();
                        if (SelectedAgent.vchar_QueryVerify == agent.vchar_QueryVerify)
                        {
                            MessageBoxService.ShowMessage("与其他商业伙伴查询接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error);

                            return;
                        }
                    }
                }
                if (SelectedAgent.bit_synPush)
                {
                    if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_PushUser) || string.IsNullOrWhiteSpace(SelectedAgent.vchar_PushVerify))
                    {
                        MessageBoxService.ShowMessage("检查点推送信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error);
                        return;
                    }

                    sqlStr = $"SELECT [vchar_PushUser],[vchar_PushVerify] FROM [dbo].[tb_Agent] WHERE [vchar_PushUser]='{SelectedAgent.vchar_PushUser}' OR [vchar_PushVerify]='{SelectedAgent.vchar_PushVerify}'";

                    IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList();
                    if (agents.Count != 0)
                    {
                        Agent agent = agents.FirstOrDefault();

                        if (SelectedAgent.vchar_PushUser == agent.vchar_PushUser)
                        {
                            MessageBoxService.ShowMessage("与其他商业伙伴推送接口用户重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error);
                            return;
                        }
                        if (SelectedAgent.vchar_PushVerify == agent.vchar_PushVerify)
                        {
                            MessageBoxService.ShowMessage("与其他商业伙伴推送接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error);
                            return;
                        }
                    }
                }

                #endregion
                #region 插入数据
                SplashScreenService.ShowSplashScreen();
                if (SelectedAgent.int_AGid == 0)
                {
                    if (SelectedAgent.int_AGtype == "检查点提供方")
                    {
                        sqlStr = $"INSERT INTO tb_Agent (vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype, bit_synOpen, vchar_synVerify,vchar_synStopKeyWord,int_synSpacing)VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}', N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 0, {(SelectedAgent.bit_synOpen ? 1 : 0)}, '{SelectedAgent.vchar_synVerify}', N'{SelectedAgent.vchar_synStopKeyWord}',{SelectedAgent.int_synSpacing}) ";
                    }
                    else if (SelectedAgent.int_AGtype == "检查点查询方")
                    {
                        sqlStr = $"INSERT INTO tb_Agent(vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype, bit_synQuery, vchar_QueryVerify)VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}',N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 1, {(SelectedAgent.bit_synQuery ? 1 : 0)}, '{SelectedAgent.vchar_QueryVerify}') ";
                    }
                    else if (SelectedAgent.int_AGtype == "检查点推送接收方")
                    {
                        sqlStr = $"INSERT INTO tb_Agent(vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype,bit_synPush, vchar_PushUser, vchar_PushVerify) VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}', N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 2, {(SelectedAgent.bit_synPush ? 1 : 0)}, '{SelectedAgent.vchar_PushUser}', '{SelectedAgent.vchar_PushVerify}') ";
                    }

                    if (SQLHelper.UpDateSQL(sqlStr))
                    {
                        MessageBoxService.ShowMessage("保存成功", "提示信息", MessageButton.OK, MessageIcon.Information);
                    }
                    else
                    {
                        MessageBoxService.ShowMessage("保存失败", "提示信息", MessageButton.OK, MessageIcon.Error);
                    }

                    Agents.Add(SelectedAgent);
                }
                else
                {
                    if (SelectedAgent.int_AGtype == "检查点提供方")
                    {
                        sqlStr = $"UPDATE tb_Agent SET vchar_AGcode = '{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan = N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect = '{SelectedAgent.vchar_AGcontect}',int_AGtype = 0, bit_synOpen = {(SelectedAgent.bit_synOpen ? 1 : 0)}, vchar_synVerify = '{SelectedAgent.vchar_synVerify}', vchar_synStopKeyWord = N'{SelectedAgent.vchar_synStopKeyWord}', bit_synQuery = 0,vchar_QueryVerify = NULL, bit_synPush = 0, vchar_PushUser = NULL, vchar_PushVerify = NULL,int_synSpacing= {SelectedAgent.int_synSpacing}  WHERE [int_AGid]={SelectedAgent.int_AGid}";
                    }
                    else if (SelectedAgent.int_AGtype == "检查点查询方")
                    {
                        sqlStr = $"UPDATE tb_Agent SET vchar_AGcode = '{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan = N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect = '{SelectedAgent.vchar_AGcontect}', int_AGtype = 1, bit_synOpen = 0, vchar_synVerify = NULL, vchar_synStopKeyWord = NULL, bit_synQuery = {(SelectedAgent.bit_synQuery ? 1 : 0)}, vchar_QueryVerify =  '{SelectedAgent.vchar_QueryVerify}', bit_synPush = 0, vchar_PushUser = NULL, vchar_PushVerify = NULL WHERE [int_AGid]={SelectedAgent.int_AGid}";
                    }
                    else if (SelectedAgent.int_AGtype == "检查点推送接收方")
                    {
                        sqlStr = $"UPDATE tb_Agent SET vchar_AGcode ='{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan =  N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect ='{SelectedAgent.vchar_AGcontect}',int_AGtype =2, bit_synOpen = 0, vchar_synVerify = NULL, vchar_synStopKeyWord = NULL, bit_synQuery = 0, vchar_QueryVerify = NULL, bit_synPush = {(SelectedAgent.bit_synPush ? 1 : 0)}, vchar_PushUser = '******', vchar_PushVerify = '{SelectedAgent.vchar_PushVerify}' WHERE [int_AGid]={SelectedAgent.int_AGid}";
                    }

                    if (SQLHelper.UpDateSQL(sqlStr))
                    {
                        MessageBoxService.ShowMessage("保存成功", "提示信息", MessageButton.OK, MessageIcon.Information);
                    }
                    else
                    {
                        MessageBoxService.ShowMessage("保存失败", "提示信息", MessageButton.OK, MessageIcon.Error);
                    }

                    var item = Agents.FirstOrDefault(a => a.int_AGid == SelectedAgent.int_AGid);
                    if (item != null)
                    {
                        item = SelectedAgent;
                    }
                }
                SplashScreenService.HideSplashScreen();
                #endregion
            }
            catch (Exception ex)
            {
                SplashScreenService.HideSplashScreen();
                MessageBoxService.ShowMessage($"保存失败:{ex.Message}", "提示信息", MessageButton.OK, MessageIcon.Error);
            }
        }