Exemplo 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);
            }
        }
Exemplo n.º 2
0
 public void ShowSplashScreen()
 {
     if (!SplashScreenService.IsSplashScreenActive)
     {
         SplashScreenService.ShowSplashScreen();
     }
 }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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
        }
Exemplo n.º 5
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);
            }
        }
        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);
            }
        }