Пример #1
0
        private void btnTZPZ_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cbBoxTZPZ.Text))
            {
                MessageBox.Show("请选择一个听诊器...");
                return;
            }
            var formStetInfo = new FrmStetInfo()
            {
                StetName = cbBoxTZPZ.Text
            };

            formStetInfo.StartPosition = FormStartPosition.CenterParent;
            if (DialogResult.OK == formStetInfo.ShowDialog())
            {
                StetInfoCode stetInfoCode = new StetInfoCode()
                {
                    StetName        = formStetInfo.StetName,
                    StetChineseName = formStetInfo.StetChineseName,
                    SN           = Setting.authorizationInfo.AuthorizationNum,
                    PCName       = CommonUtil.GetMachineName(),
                    MAC          = Setting.authorizationInfo.MachineCode,
                    Owner        = formStetInfo.StetOwner,
                    FuncDescript = formStetInfo.StetFuncDescript,
                    ReMark       = formStetInfo.StetRemark,
                    StetType     = formStetInfo.StetType
                };
                HandleMessage(stetInfoCode);
                if (Setting.isConnected)
                {
                    var code = Newtonsoft.Json.JsonConvert.SerializeObject(stetInfoCode);
                    using (OperationContextScope scope = new OperationContextScope(Mediator.remoteService.InnerChannel))
                    {
                        MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", Setting.authorizationInfo.AuthorizationNum);
                        OperationContext.Current.OutgoingMessageHeaders.Add(header);
                        header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", Setting.authorizationInfo.MachineCode);
                        OperationContext.Current.OutgoingMessageHeaders.Add(header);
                        if (Mediator.remoteService.UpdateStetInfo(code))
                        {
                            Mediator.ShowMsg("新增听诊器 " + formStetInfo.StetName + " 信息,并上传服务器成功...");
                            Mediator.WriteLog(this.Name, "新增听诊器 " + formStetInfo.StetName + " 信息成功...,调用的后台方法是UpdateStetInfo");
                            return;
                        }
                        Mediator.WriteLog(this.Name, "新增听诊器 " + formStetInfo.StetName + " 信息失败...");
                        Mediator.ShowMsg("新增听诊器 " + formStetInfo.StetName + " 信息,并上传服务器失败...,调用的后台方法是UpdateStetInfo");
                    }
                }
            }
        }
Пример #2
0
        public void ConfigStet(string StetName)
        {
            var info         = Setting.GetStetInfoByStetName(StetName);
            var formStetInfo = new FrmStetInfo()
            {
                StetOwner        = info.Owner,
                StetName         = info.StetName,
                StetChineseName  = info.StetChineseName,
                StetFuncDescript = info.FuncDescript,
                StetRemark       = info.ReMark,
                StetType         = info.StetType
            };

            formStetInfo.StartPosition = FormStartPosition.CenterParent;
            if (DialogResult.OK == formStetInfo.ShowDialog())
            {
                StetInfoCode stetInfoCode = new StetInfoCode()
                {
                    StetName        = formStetInfo.StetName,
                    StetChineseName = formStetInfo.StetChineseName,
                    SN           = Setting.authorizationInfo.AuthorizationNum,
                    PCName       = CommonUtil.GetMachineName(),
                    MAC          = Setting.authorizationInfo.MachineCode,
                    Owner        = formStetInfo.StetOwner,
                    FuncDescript = formStetInfo.StetFuncDescript,
                    ReMark       = formStetInfo.StetRemark,
                    StetType     = formStetInfo.StetType
                };
                var code = Newtonsoft.Json.JsonConvert.SerializeObject(stetInfoCode);
                using (OperationContextScope scope = new OperationContextScope(Mediator.remoteService.InnerChannel))
                {
                    MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", Setting.authorizationInfo.AuthorizationNum);
                    OperationContext.Current.OutgoingMessageHeaders.Add(header);
                    header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", Setting.authorizationInfo.MachineCode);
                    OperationContext.Current.OutgoingMessageHeaders.Add(header);

                    if (Mediator.remoteService.UpdateStetInfo(code))
                    {
                        HandleMessage(stetInfoCode);
                        Mediator.ShowMsg("新增听诊器 " + formStetInfo.StetName + " 信息,并上传服务器成功...");
                        return;
                    }
                    Mediator.ShowMsg("新增听诊器 " + formStetInfo.StetName + " 信息,并上传服务器失败...");
                }
            }
            LoadStetInfoTZPZ();
        }
Пример #3
0
        void dgvTZQPZ_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                var stetName = dgvTZQPZ.Rows[e.RowIndex].Cells[0].Value.ToString();
                var stetInfo = Setting.GetStetInfoByStetName(stetName);
                switch (dgvTZQPZ.Columns[e.ColumnIndex].Name)
                {
                case "dgvTZQPZEdit":
                {
                    var formStetInfo = new FrmStetInfo()
                    {
                        StetName         = stetName,
                        StetChineseName  = stetInfo.StetChineseName,
                        StetOwner        = stetInfo.Owner,
                        StetFuncDescript = stetInfo.FuncDescript,
                        StetRemark       = stetInfo.ReMark,
                        StetType         = stetInfo.StetType
                    };
                    formStetInfo.StartPosition = FormStartPosition.CenterParent;
                    if (DialogResult.OK == formStetInfo.ShowDialog())
                    {
                        StetInfoCode stetInfoCode = new StetInfoCode()
                        {
                            StetName        = formStetInfo.StetName,
                            StetChineseName = formStetInfo.StetChineseName,
                            SN           = Setting.authorizationInfo.AuthorizationNum,
                            MAC          = Setting.authorizationInfo.MachineCode,
                            Owner        = formStetInfo.StetOwner,
                            PCName       = CommonUtil.GetMachineName(),
                            FuncDescript = formStetInfo.StetFuncDescript,
                            ReMark       = formStetInfo.StetRemark,
                            StetType     = formStetInfo.StetType
                        };
                        HandleMessage(stetInfoCode);
                        if (Setting.isConnected)
                        {
                            var code = Newtonsoft.Json.JsonConvert.SerializeObject(stetInfoCode);
                            using (OperationContextScope scope = new OperationContextScope(Mediator.remoteService.InnerChannel))
                            {
                                MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", Setting.authorizationInfo.AuthorizationNum);
                                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                                header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", Setting.authorizationInfo.MachineCode);
                                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                                if (Mediator.remoteService.UpdateStetInfo(code))
                                {
                                    Mediator.ShowMsg("编辑听诊器 " + stetName + " 信息,并上传服务器成功...");
                                    Mediator.WriteLog(this.Name, "编辑听诊器 " + formStetInfo.StetName + " 信息成功...,调用的后台方法是UpdateStetInfo");
                                    return;
                                }
                                Mediator.ShowMsg("编辑听诊器 " + stetName + " 信息,并上传服务器失败...");
                                Mediator.WriteLog(this.Name, "编辑听诊器 " + formStetInfo.StetName + " 信息失败...,调用的后台方法是UpdateStetInfo");
                            }
                        }
                    }
                }
                break;

                case "dgvTZQPZDelete":
                {
                    if (DialogResult.OK == MessageBox.Show("您确定要清空此听诊器信息?", "删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                    {
                        var code = new StetInfoDelCode()
                        {
                            StetName = stetName,
                            MAC      = Setting.authorizationInfo.MachineCode
                        };
                        HandleMessage(code);
                        if (Setting.isConnected)
                        {
                            string sql = "update StethoscopeManager set IfDel=1  where StetName={0}  and MAC={1} and IfDel=0";
                            using (OperationContextScope scope = new OperationContextScope(Mediator.remoteService.InnerChannel))
                            {
                                MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", Setting.authorizationInfo.AuthorizationNum);
                                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                                header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", Setting.authorizationInfo.MachineCode);
                                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                                if (Mediator.remoteService.ExecuteNonQuery(sql, new string[] { stetName, Setting.authorizationInfo.MachineCode }) > 0)
                                {
                                    Mediator.ShowMsg("删除听诊器 " + stetName + " 信息成功...");
                                    Mediator.WriteLog(this.Name, "删除听诊器 " + stetName + " 信息成功...执行的SQL是:" + sql + "参数是:" + stetName + Setting.authorizationInfo.MachineCode);
                                    return;
                                }
                                Mediator.ShowMsg("删除听诊器 " + stetName + " 信息失败...");
                                Mediator.WriteLog(this.Name, "删除听诊器 " + stetName + " 信息成功...");
                            }
                        }
                    }
                }
                break;

                case "dgvTZQPZConn":
                {
                    var stetNo = dgvTZQPZ.Rows[e.RowIndex].Cells[0].Value + "";
                    if (!string.IsNullOrEmpty(stetNo))
                    {
                        var b = StethoscopeManager.StethoscopeList.Where(s => s.Name == stetNo && s.IsConnected).Any();
                        //if (stethoscopes.Any()) return;
                        //var stethoscope = stethoscopes.First();
                        if (!b)
                        {
                            OpenStethoscope(stetNo);
                        }
                        else
                        {
                            CloseStethoscope(stetNo);
                        }

                        LoadStetInfoTZPZ();
                    }
                }
                break;
                }
            }
        }