private void btnsynchro_Click(object sender, EventArgs e)
        {
            if (ShowMessageHelper.ShowBoxMsg("是否要同步数据?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            //异步执行开始
            worker.RunWorkerAsync();

            //显示进度窗体
            FrmProgressBar frm = new FrmProgressBar(this.worker);

            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog(this);
            //异步处理完将改变isSync值,以弹出提示
            if (isSync)
            {
                ShowMessageHelper.ShowBoxMsg("数据同步成功!");
                isSync = false;
            }
            else
            {
                ShowMessageHelper.ShowBoxMsg("数据同步失败,请检查系统配置!");
            }
            BindData();
        }
Esempio n. 2
0
        /// <summary>对照项目
        ///
        /// </summary>
        /// <param name="Hrow">医院选中行</param>
        /// <param name="Drow">达安选中行</param>
        /// <returns>是否成功</returns>
        private bool Save(DataGridViewRow Hrow, DataGridViewRow Drow)
        {
            bool b = true;

            try
            {
                VDAListests      Hosptest    = Hrow.DataBoundItem as VDAListests;
                DADicttestitem   Daantest    = Drow.DataBoundItem as DADicttestitem;
                List <DATestmap> testmapList = new List <DATestmap>();
                DATestmap        testmap     = new DATestmap();
                //取出列表值,用于保存
                testmap.Customertestcode = Hosptest.Testcode;
                testmap.Customertestname = Hosptest.Testname;
                testmap.Datestcode       = Daantest.Datestcode;
                testmap.Datestname       = Daantest.Datestname;
                testmapList.Add(testmap);
                if (testmapBll.SaveDATestmapList(testmapList))
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照成功!");
                    cacheMapList = new DATestmapBLL().GetDATestmapList(null);
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照失败!");
                    b = false;
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("保存对照出错:" + ex.Message);
                b = false;
            }
            return(b);
        }
        /// <summary>
        /// 判断是否已经运行了程序
        /// </summary>
        private static void GlobalMutex()
        {
            // 是否第一次创建mutex
            bool   newMutexCreated = false;
            string mutexName       = "Global\\" + "Daan.PDFToImage";

            try
            {
                mutex = new Mutex(false, mutexName, out newMutexCreated);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                System.Threading.Thread.Sleep(1000);
                Environment.Exit(1);
            }

            // 第一次创建mutex
            if (newMutexCreated)
            {
                Console.WriteLine("程序已启动");
                //todo:此处为要执行的任务
            }
            else
            {
                ShowMessageHelper.ShowBoxMsg("另一个窗口已在运行,不能重复运行。");
                System.Threading.Thread.Sleep(1000);
                Environment.Exit(1);//退出程序
            }
        }
        //测试
        private void btnTest_Click(object sender, EventArgs e)
        {
            string sitecode = "gz";                          //tbxSiteCode.Text.ToString();//分点代码
            string strUrl   = tbxWebAddress.Text.ToString(); //"http://ky.daanlab.com:8000/NIP/webservice/lisService"; //tbxWebAddress.Text.ToString();//调用webservice地址
            string username = tbxUserName.Text.ToString();   //登录用户名
            string password = tbxPassWrod.Text.ToString();   //登录用户密码


            WebServiceUtils.SetIsUpdate(strUrl);

            //设置调用webservice登录方法的参数
            string[] par = new string[] { sitecode, username, password, "医院LIS服务" };

            //返回登录验证信息:1|SID,0|errorMsg
            string[] loginMsg = WebServiceUtils.ExecuteMethod("Login", par).Split('|');

            if (loginMsg[0] == "0") //登录失败
            {
                ShowMessageHelper.ShowBoxMsg("连接失败!" + loginMsg[1].ToString());
                return;
            }
            else
            {
                ShowMessageHelper.ShowBoxMsg("连接成功!");
            }
        }
Esempio n. 5
0
        private bool Cencel(VDAListests _test)
        {
            bool b = true;

            try
            {
                if (ShowMessageHelper.ShowBoxMsg("您是否要取消该项目的对照关系?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                {
                    return(false);
                }
                if (testmapBll.DelTestmapByID(_test.Testcode) > 0)
                {
                    ShowMessageHelper.ShowBoxMsg("取消对照成功!");
                    cacheMapList = new DATestmapBLL().GetDATestmapList(null);
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("取消对照失败!");
                    b = false;
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("取消对照出错:" + ex.Message);
                b = false;
            }
            return(b);
        }
        /// <summary>
        /// 页面加载...
        /// </summary>
        void InitData(ref bool b)
        {
            DAConfig config;

            try
            {
                config = new DAConfigBLL().SelectyDAConfigInfo(cid);
            }
            catch (Exception)
            {
                ShowMessageHelper.ShowBoxMsg("数据库获取失败,请先配置好数据库连接!");
                b = false;
                return;
            }


            if (config != null)
            {
                tbxHospName.Text   = config.Hospname;
                tbxWebAddress.Text = config.Address;
                tbxUserName.Text   = config.Username;
                tbxPassWrod.Text   = config.Password;
                tbxInterval.Text   = config.Interval;
                tbxSiteCode.Text   = config.Sitecode;

                lblID.Text = config.DaConfigid.ToString();
            }

            BindGridDate();
        }
Esempio n. 7
0
        //显示窗体MDI
        public Form LoadMdiForm(Form mainDialog, System.Type formType)
        {
            DockContent form = null;

            try
            {
                bool flag = false;
                foreach (DockContent form2 in mainDialog.MdiChildren)
                {
                    if (form2.GetType() == formType)
                    {
                        flag = true;
                        form = form2;
                        break;
                    }
                }
                if (!flag)
                {
                    form           = (DockContent)Activator.CreateInstance(formType);
                    form.MdiParent = mainDialog;
                    form.Show(this.dockPanel);
                }
                form.BringToFront();
                form.Activate();
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("页面加载错误!" + ex.Message);
            }
            return(form);
        }
Esempio n. 8
0
        //双击项目往下面列表加入数据
        private void gvDaanItem_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //双击表头
            if (e.RowIndex == -1)
            {
                return;
            }
            DataGridViewRow selRow = gvDaanItem.SelectedRows[0];

            if (selRow == null)
            {
                return;
            }
            DADicttestitem curItem = (DADicttestitem)bsDaan.Current;

            //检查双击的项目是否已经存在
            foreach (DADicttestitem item in cacheInDaList)
            {
                if (item.Datestcode == curItem.Datestcode)
                {
                    ShowMessageHelper.ShowBoxMsg("该项目已存在!");
                    return;
                }
            }
            //不存在添加一行
            bsDaanIn.Add(curItem);
            RefreshTips();
        }
Esempio n. 9
0
 private void DoLoginWeb()
 {
     try
     {
         //获取系统参数
         decimal cid = DefaultConfig.DACONFIGID;
         //转换不成功
         if (!decimal.TryParse(ConfigurationManager.AppSettings["DaConfigID"], out cid))
         {
             ShowMessageHelper.ShowBoxMsg("请先维护好配置ID!");
             return;
         }
         config = configBll.SelectyDAConfigInfo(cid);
         if (config == null)
         {
             ShowMessageHelper.ShowBoxMsg("没有ID为[" + cid + "]的配置记录");
             return;
         }
         if (config != null)
         {
             LoginWebservice();
         }
         else
         {
             ShowMessageHelper.ShowBoxMsg("获取系统参数配置失败,请检查数据库表配置!");
             return;
         }
     }
     catch (Exception ex)
     {
         ShowMessageHelper.ShowBoxMsg("登录的过程中发生了错误,错误信息:" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 判断是否已经运行了程序
        /// </summary>
        private static void GlobalMutex()
        {
            // 是否第一次创建mutex
            bool   newMutexCreated = false;
            string mutexName       = "Global\\" + "Daan.Interface.Services";

            try
            {
                mutex = new Mutex(false, mutexName, out newMutexCreated);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                System.Threading.Thread.Sleep(1000);
                Environment.Exit(1);
            }

            // 第一次创建mutex
            if (newMutexCreated)
            {
                Console.WriteLine("程序已启动");
                //todo:此处为要执行的任务
            }
            else
            {
                if (ConfigurationManager.AppSettings["IsRunMore"].ToString() == "0")
                {
                    ShowMessageHelper.ShowBoxMsg("另一个窗口已在运行,不能重复运行。");
                    System.Threading.Thread.Sleep(1000);
                    Environment.Exit(1);//退出程序
                }
            }
        }
        //删除选定项
        private void btnDel_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection selRow = gvUser.SelectedRows;

            if (selRow.Count < 1)
            {
                ShowMessageHelper.ShowBoxMsg("请选择要删除的数据!");
                return;
            }
            else
            {
                string userCode = selRow[0].Cells["UserCode"].Value.ToString();
                if (ShowMessageHelper.ShowBoxMsg("是否要删除选定的数据?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                int userID = 0;
                int.TryParse(selRow[0].Cells["DictUserId"].Value.ToString(), out userID);
                if (userBll.DeleteDADictuser(userID.ToString()) > 0)
                {
                    ShowMessageHelper.ShowBoxMsg("删除成功!");
                    BindData();
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("删除失败");
                }
            }
        }
        /// <summary>
        /// 程序运行时进去
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ee = e.ExceptionObject as Exception;
            //string strMsg="错误时间:" + DateTime.Now.ToString() + "\n错误消息:" + ee.Message + "\n" + (ee.InnerException == null ? "" : ee.InnerException.Message) + "\n错误方法:" + ee.TargetSite + "\n错误对象:" + ee.Source;
            string strMsg = ee.ToString();

            ShowMessageHelper.ShowBoxMsg(strMsg);
            saveErrorMsg(strMsg);
        }
        /// <summary>
        /// 调试时进去
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            Exception ee = e.Exception;
            //string strMsg = "错误时间:" + DateTime.Now.ToString() + "\n错误消息:" + ee.Message + "\n" + (ee.InnerException == null ? "" : ee.InnerException.Message) + "\n错误方法:" + ee.TargetSite + "\n错误对象:" + ee.Source;
            string strMsg = ee.ToString();

            ShowMessageHelper.ShowBoxMsg(strMsg);
            saveErrorMsg(strMsg);
        }
Esempio n. 14
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSearch_Click(object sender, EventArgs e)
 {
     //开始时间是否大于结束时间
     if (this.dtpBeginDate.Value.Date > this.dtpEndDate.Value.Date)
     {
         ShowMessageHelper.ShowBoxMsg("结束时间应大于开始时间!"); return;
     }
     DataBind();
 }
Esempio n. 15
0
        /// <summary>
        /// 测试数据库连接是否正常
        /// </summary>
        /// <param name="conPath">XML路径文件名</param>
        /// <param name="strMessage">弹出错误信息,指明是哪个数据连接出错</param>
        /// <returns></returns>
        public bool IsConnect(string conPath, string strMessage)
        {
            string       testsql = string.Empty;
            DataBaseinfo info    = XMLHelper.ReadDataBase(conPath);

            if (info.databasetype == "0")
            {
                testsql = "select 1 from dual";
            }
            else
            {
                testsql = "select 1";
            }
            bool istrue = false;
            //测试链接
            bool           connetctionStatus = false;
            bool           timeOut           = false;
            TimeoutChecker timeout           = new TimeoutChecker(
                delegate
            {
                ISqlMapper mapper = null;
                try
                {
                    //获取ISqlMapper尝试连接
                    mapper     = mapperobj.NewMapper(info);
                    DataSet ds = new DataSet();
                    mapper.OpenConnection();
                    IDbCommand command  = mapper.LocalSession.CreateCommand(CommandType.Text);
                    command.CommandText = testsql;        //"SELECT 1 FROM DA_CONFIG";
                    mapper.LocalSession.CreateDataAdapter(command).Fill(ds);
                    connetctionStatus = true;
                    //ShowMessageHelper.ShowBoxMsg("数据库连接成功!");
                    istrue = true;
                }
                catch
                {
                    //如果没有超时
                    if (!timeOut)
                    {
                        connetctionStatus = true;
                        ShowMessageHelper.ShowBoxMsg(string.Format("{0}连接失败,数据库不存在或用户名、密码错误,请检查数据库配置!", strMessage));
                    }
                }
            },
                delegate
            {
                //如果没有链接上
                if (!connetctionStatus)
                {
                    timeOut = true;
                    ShowMessageHelper.ShowBoxMsg(string.Format("{0}连接超时,请检查数据库配置!", strMessage));
                }
            });

            timeout.Wait(5000);
            return(istrue);
        }
Esempio n. 16
0
 private void tsbExit_Click(object sender, EventArgs e)
 {
     if (ShowMessageHelper.ShowBoxMsg("您确定要退出系统吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Cancel)
     {
         return;
     }
     closeTag = true;
     this.Close();
 }
Esempio n. 17
0
        // 扫描医院条码 显示匹配信息
        private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
        {
            //是否回车
            if (e.KeyChar != (char)Keys.Enter)
            {
                return;
            }

            string cusbarcode = string.Empty;

            if (this.dtpBeginDate.Value.Date > this.dtpEndDate.Value.Date)
            {
                ShowMessageHelper.ShowBoxMsg("结束时间应大于开始时间!"); return;
            }
            cusbarcode = this.txtBarcode.Text.Trim();
            if (cusbarcode == "")
            {
                ShowMessageHelper.ShowBoxMsg("医院条码或样本号不能为空!"); return;
            }
            this.txtBarcode.Text = string.Empty;
            Hashtable ht = new Hashtable();

            if (chxHosNumer.Checked == false)
            {
                ht.Add("Hospsampleid", cusbarcode);
            }
            else
            {
                ht.Add("dtpBeginDate", Convert.ToDateTime(this.dtpBeginDate.Value).ToString("yyyy-MM-dd"));
                ht.Add("dtpEndDate", Convert.ToDateTime(this.dtpEndDate.Value.AddDays(+1)).ToString("yyyy-MM-dd"));
                ht.Add("Hospsamplenumber", cusbarcode);
            }

            //是否输入条码值
            // if (message == "") { return; }

            //绑定医院条码相关信息
            //实现List排序,否则无法点击表头按列重新排序 fenghp
            BindingCollection <VDaLisrequest> list = new BindingCollection <VDaLisrequest>();

            foreach (VDaLisrequest lst in new VDALisrequestBLL().GetVDaLisrequestList(ht))
            {
                list.Add(lst);
            }

            if (list.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("无医院条码或样本信息!"); return;
            }

            this.bgSource1.DataSource = list;

            VDaLisrequest vda = (VDaLisrequest)gvLisrequest.Rows[gvLisrequest.CurrentCell.RowIndex].DataBoundItem;

            BindRightData(vda);
        }
Esempio n. 18
0
 //设置系统参数信息
 private void setSystemConfig()
 {
     if (config != null)
     {
         SystemConfig.Config = config;
     }
     else
     {
         ShowMessageHelper.ShowBoxMsg("初始化系统参数失败,请检查服务端系统参数配置!");
     }
 }
Esempio n. 19
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!closeTag)
     {
         if (ShowMessageHelper.ShowBoxMsg("您确定要退出系统吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Cancel)
         {
             e.Cancel = true;
             return;
         }
         closeTag = true;
     }
 }
Esempio n. 20
0
        private void btnVOK_Click(object sender, EventArgs e)
        {
            //验证
            if (!CheckViewInput())
            {
                return;
            }

            try
            {
                //读取视图配置文件重新给值,保存
                XmlDocument XD = new XmlDocument();
                XD.Load(DefaultConfig.VIEWDATABASENAME);
                XmlNode xn = XD.ChildNodes[0];
                for (int j = 0; j < xn.ChildNodes.Count; j++)
                {
                    XmlNode clxn = xn.ChildNodes[j];
                    switch (clxn.Name)
                    {
                    case "databasetype":
                        clxn.InnerText = radVSQLServer.Checked ? "2" : "0";
                        break;

                    case "userid":
                        clxn.InnerText = radVSQLServer.Checked ? tbxVSQLUserName.Text : tbxVOracleUserName.Text;
                        break;

                    case "password":
                        clxn.InnerText = radVSQLServer.Checked ? tbxVSQLPwd.Text : tbxVOraclePwd.Text;
                        break;

                    case "dataname":
                        clxn.InnerText = radVSQLServer.Checked ? tbxVDatabase.Text : tbxVSID.Text;
                        break;

                    case "datasource":
                        clxn.InnerText = radVSQLServer.Checked ? tbxVSQLService.Text : tbxVOracleService.Text;
                        break;

                    default:
                        break;
                    }
                }
                XD.Save(DefaultConfig.VIEWDATABASENAME);
                //释放缓存,以获取新的连接串
                mapperobj.clearMapper();
                ShowMessageHelper.ShowBoxMsg("保存成功!");
            }
            catch
            {
                ShowMessageHelper.ShowBoxMsg("保存失败!");
            }
        }
        /// <summary>
        /// 下载EXCEL导入模版
        /// </summary>
        private void DownLoad()
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "Execl files (*.xls)|*.xls|(*.xlsx)|*.xlsx";
            dlg.FilterIndex      = 0;
            dlg.RestoreDirectory = true;
            //dlg.CreatePrompt = true;
            dlg.Title    = "保存为Excel文件";
            dlg.FileName = "项目对照导入模版";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //下载路径
                string path     = Application.StartupPath + "\\importtemplate\\项目对照模版.xls";
                string fileName = path.Substring(path.LastIndexOf("\\") + 1);
                try
                {
                    WebRequest request = WebRequest.Create(path);
                }
                catch
                {
                    ShowMessageHelper.ShowBoxMsg("项目对照导入模版下载失败!");
                    return;
                }

                try
                {
                    //通过WebClient下载
                    WebClient client = new WebClient();
                    client.DownloadFile(path, "项目对照导入模版");
                    FileStream   fs     = new FileStream(path, FileMode.Open, FileAccess.Read);
                    BinaryReader br     = new BinaryReader(fs);
                    byte[]       myByte = br.ReadBytes((int)fs.Length);

                    string     strFilePath = dlg.FileName;
                    FileStream fsStr       = new FileStream(strFilePath, FileMode.OpenOrCreate, FileAccess.Write);
                    fsStr.Write(myByte, 0, (int)fs.Length);
                    fsStr.Close();

                    if (ShowMessageHelper.ShowBoxMsg("模版下载完成, 是否打开模版文件?", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        //打开文件
                        System.Diagnostics.Process.Start(strFilePath);
                    }
                }
                catch
                {
                    ShowMessageHelper.ShowBoxMsg("项目对照导入模版下载失败!");
                    return;
                }
            }
        }
Esempio n. 22
0
 private bool CheckViewInput()
 {
     if (radVOracle.Checked == true)
     {
         if (tbxVSID.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("SID不能为空!");
             tbxVSID.Focus();
             return(false);
         }
         if (tbxVOracleUserName.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("用户名不能为空!");
             tbxVOracleUserName.Focus();
             return(false);
         }
         if (tbxVOraclePwd.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("密码不能为空!");
             tbxVOraclePwd.Focus();
             return(false);
         }
     }
     else
     {
         if (tbxVSQLService.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("服务器不能为空!");
             tbxVSQLService.Focus();
             return(false);
         }
         if (tbxVDatabase.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("数据库不能为空!");
             tbxVDatabase.Focus();
             return(false);
         }
         if (tbxVSQLUserName.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("用户名不能为空!");
             tbxVSQLUserName.Focus();
             return(false);
         }
         if (tbxVSQLPwd.Text == string.Empty)
         {
             ShowMessageHelper.ShowBoxMsg("密码不能为空!");
             tbxVSQLPwd.Focus();
             return(false);
         }
     }
     return(true);
 }
Esempio n. 23
0
        //系统托盘右键退出事件,打开验证密码窗体,输入密码正确,关闭主窗体
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.btnStop.Enabled)
            {
                ShowMessageHelper.ShowBoxMsg("请先点击 [停止服务] 再 [关闭] !");
                notifyIcon1_MouseDoubleClick(null, null);
                return;
            }

            //this.Close();
            Exit ex = new Exit(notifyIcon1);

            ex.ShowDialog();
        }
Esempio n. 24
0
        //对照:把需要保存的匹配信息加到下面两个列表后,保存到数据库表DATestmap
        private void btnSave_Click(object sender, EventArgs e)
        {
            //验证
            if (gvMapHospital.Rows.Count == 0 || gvMapDaan.Rows.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("请选择要保存对照的项目!");
                return;
            }

            //单项只能对照一个单项
            if (gvMapHospital.Rows[0].Cells["gvMapHospitalGroup"].Value.ToString() == "0" && gvMapDaan.Rows.Count != 1)
            {
                ShowMessageHelper.ShowBoxMsg("医院单项只能对应一个达安单项!");
                return;
            }

            try
            {
                List <DATestmap> testmapList = new List <DATestmap>();
                for (int i = 0; i < gvMapDaan.Rows.Count; i++)
                {
                    DATestmap testmap = new DATestmap();
                    //已经存在对应 修改操作
                    //if (gvMapHospital.Rows[0].Cells[0].Value != null)
                    //{
                    //    testmap.Testmapid = Convert.ToDecimal(gvMapHospital.Rows[0].Cells[0].Value.ToString());
                    //}
                    //取出列表值,用于保存
                    testmap.Customertestcode = gvMapHospital.Rows[0].Cells["gvMapHoapitalTestCode"].Value.ToString();
                    testmap.Customertestname = gvMapHospital.Rows[0].Cells["gvMapHoapitalTestName"].Value.ToString();
                    testmap.Datestcode       = gvMapDaan.Rows[i].Cells["gvMapDaanDaTestCode"].Value.ToString();
                    testmap.Datestname       = gvMapDaan.Rows[i].Cells["gvMapDaanDaTestName"].Value.ToString();
                    testmap.Createtime       = DateTime.Now;
                    testmapList.Add(testmap);
                }
                if (testmapBll.SaveDATestmapList(testmapList))
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照成功!");
                    doFilter();
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照失败!");
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("保存对照出错:" + ex.Message);
            }
        }
Esempio n. 25
0
        //定位:根据名称找到右上角对应的项目
        private void btnPosition_Click(object sender, EventArgs e)
        {
            if (gvItemHospital.Rows.Count <= 0)
            {
                ShowMessageHelper.ShowBoxMsg("请选择要定位的医院项目!");
                return;
            }
            DataGridViewRow selRow = gvItemHospital.SelectedRows[0];

            if (selRow == null)
            {
                ShowMessageHelper.ShowBoxMsg("请选择要定位的医院项目!");
                return;
            }
            if (selRow.Cells["TestName"].Value == null || selRow.Cells["TestName"].Value.ToString() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("无法定位相匹配的达安项目,医院项目名称为空!");
                return;
            }
            //获取要定位的项目名字
            string testnameStr = selRow.Cells["TestName"].Value.ToString();
            //获取最匹配的值
            decimal maxDe = 0;

            decimal[] array = new decimal[gvDaanItem.Rows.Count];
            for (int i = 0; i < gvDaanItem.Rows.Count; i++)
            {
                array[i] = GetSimilarityWith(testnameStr, gvDaanItem.Rows[i].Cells["gvDaanTestName"].Value.ToString());
                //获取数组最大值,则为最匹配值
                maxDe = array.Max();
            }

            //若最匹配值为0,则没有匹配项
            if (maxDe == 0)
            {
                ShowMessageHelper.ShowBoxMsg("无法定位相匹配的达安项目,请人工进行对照!");
                return;
            }
            //先清空再选中
            gvDaanItem.ClearSelection();
            for (int i = 0; i < array.Length; i++)
            {
                if (maxDe == array[i])
                {
                    gvDaanItem.Rows[i].Selected = true;
                    gvDaanItem.FirstDisplayedScrollingRowIndex = i;
                }
            }
        }
Esempio n. 26
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //验证
            if (desencrypt.getMd5Hash(tbxOldUserPwd.Text.ToString()) != password)
            {
                ShowMessageHelper.ShowBoxMsg("旧密码错误,请重新输入!");
                tbxOldUserPwd.Focus();
                return;
            }
            if (tbxUserPwd.Text.Contains(" "))
            {
                ShowMessageHelper.ShowBoxMsg("密码不能存在空格!");
                tbxUserPwd.Focus();
                return;
            }
            if (tbxUserPwd.Text == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("密码不能为空!");
                tbxUserPwd.Focus();
                return;
            }
            if (tbxUserPwd.Text.Trim().Length < 6)
            {
                ShowMessageHelper.ShowBoxMsg("密码过于简单,请输入大于6位的密码!");
                return;
            }
            if (tbxPwdOK.Text.ToString() != tbxUserPwd.Text.ToString())
            {
                ShowMessageHelper.ShowBoxMsg("两次输入的密码不一致,请重新输入!");
                tbxPwdOK.Focus();
                return;
            }

            DADictuser user = new DADictuser();

            user.Usercode = UserCode;
            user          = userBll.GetDADictuserInfoByUserCode(user);
            user.Password = desencrypt.getMd5Hash(tbxPwdOK.Text.ToString());
            if (userBll.Save(user))
            {
                ShowMessageHelper.ShowBoxMsg("修改成功!");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                ShowMessageHelper.ShowBoxMsg("修改失败!");
            }
        }
Esempio n. 27
0
        //登录
        private void btLogin_Click(object sender, EventArgs e)
        {
            if (tbxUserName.Text.Trim() == "")
            {
                ShowMessageHelper.ShowBoxMsg("帐号不能为空,请输入!");
                tbxUserName.Focus();
                return;
            }
            if (tbxPwd.Text.Trim() == "")
            {
                ShowMessageHelper.ShowBoxMsg("密码不能为空,请输入!");
                tbxPwd.Focus();
                return;
            }

            //检查数据库表连接
            if (!IsConnect(DefaultConfig.DATABASENAME, "数据库表"))
            {
                return;
            }
            //检查数据库视图连接
            if (!IsConnect(DefaultConfig.VIEWDATABASENAME, "医院LIS数据库"))
            {
                return;
            }

            //版本检测,有自动更新启动才进行版本检测
            if (isAutoRun)
            {
                CheckVersion();
            }

            //开始检查用户名密码登录
            if (radDaan.Checked == true)//达安帐号
            {
                DoLoginWeb();
            }
            else//本地
            {
                //登录
                DoLogin();
            }
            //登录成功设置系统参数信息 检测数据库版本
            if (bLogin)
            {
                setSystemConfig();
            }
        }
Esempio n. 28
0
        /// 检查对照项目
        private void btnCheckTest_Click(object sender, EventArgs e)
        {
            string           str = "";
            List <DATestmap> map = new DATestmapBLL().GetDATestmapCheckList();

            if (map.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("没找到异常的对照项目,请到同步【达安项目】窗口 点击[同步]之后再来确认查看"); return;
            }

            foreach (DATestmap item in map)
            {
                str += string.Format("医院项目 [{0}] 编码[{1}] 需要重新对应对照\n", item.Customertestname, item.Customertestcode);
            }
            ShowMessageHelper.ShowBoxMsg(str);
        }
Esempio n. 29
0
 //保存
 private void btnOK_Click(object sender, EventArgs e)
 {
     //验证
     if (!CheckInput())
     {
         return;
     }
     if (SaveConfig())
     {
         ShowMessageHelper.ShowBoxMsg("保存成功!");
     }
     else
     {
         ShowMessageHelper.ShowBoxMsg("保存失败!");
     }
 }
        public bool IsConnect(DataBaseinfo info, string testsql)
        {
            bool istrue = false;
            //测试链接
            bool           connetctionStatus = false;
            bool           timeOut           = false;
            TimeoutChecker timeout           = new TimeoutChecker(
                delegate
            {
                ISqlMapper mapper = null;
                try
                {
                    //获取ISqlMapper尝试连接
                    mapper     = mapperobj.NewMapper(info);
                    DataSet ds = new DataSet();
                    mapper.OpenConnection();
                    IDbCommand command  = mapper.LocalSession.CreateCommand(CommandType.Text);
                    command.CommandText = testsql;
                    mapper.LocalSession.CreateDataAdapter(command).Fill(ds);
                    connetctionStatus = true;
                    ShowMessageHelper.ShowBoxMsg("数据库连接成功!");
                    istrue = true;
                }
                catch (Exception ex)
                {
                    WriteLog(ex.ToString());
                    //如果没有超时
                    if (!timeOut)
                    {
                        connetctionStatus = true;
                        ShowMessageHelper.ShowBoxMsg(ex.Message + "数据库不存在或用户名、密码错误,请重新输入!");
                    }
                }
            },
                delegate
            {
                //如果没有链接上
                if (!connetctionStatus)
                {
                    timeOut = true;
                    ShowMessageHelper.ShowBoxMsg("连接超时");
                }
            });

            timeout.Wait(5000);
            return(istrue);
        }