コード例 #1
0
        public void RefreshSetting()
        {
            _computerName = Dns.GetHostName(); // System.Environment.MachineName;

            txtComputerName.Text = _computerName;

            BindHSP();
            BindDepartment();
            BindStorage();

            JStationConfig stationConfig = _scm.GetStationInfo(_computerName);

            if (stationConfig == null)
            {
                return;
            }

            if (stationConfig.当前院区编码 != null)
            {
                cbxHspCode.SelectedValue = stationConfig.当前院区编码;
            }
            if (stationConfig.站点所属科室 != null)
            {
                cbxDepartment.SelectedValue = stationConfig.站点所属科室;
            }
            if (stationConfig.站点所属房间 != null)
            {
                cbxRoom.SelectedValue = stationConfig.站点所属房间;
            }
            if (stationConfig.当前检查设备 != null)
            {
                cbxDevice.SelectedValue = stationConfig.当前检查设备;
            }
            if (stationConfig.当前存储设备 != null)
            {
                cbxStorage.SelectedValue = stationConfig.当前存储设备;
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取本机站点信息
        /// </summary>
        /// <param name="dbHelper"></param>
        /// <returns></returns>
        static public StationInfo GetLocateStationInfo(string serverName, IDBProvider dbHelper)
        {
            StationConfigModel scm = new StationConfigModel(dbHelper);

            if (scm == null)
            {
                return(null);
            }

            JStationConfig stationConfig = scm.GetStationInfo(Dns.GetHostName());

            if (stationConfig == null)
            {
                return(null);
            }

            StationInfo si = new StationInfo();

            si.DBServerName = serverName;
            si.DistrictCode = stationConfig.当前院区编码;

            si.DepartmentId   = stationConfig.站点所属科室;
            si.DepartmentName = scm.GetDepartmentNameById(si.DepartmentId);

            si.RoomId   = stationConfig.站点所属房间;
            si.RoomName = scm.GetRoomNameById(si.RoomId);

            si.DeviceId   = stationConfig.当前检查设备;
            si.DeviceName = scm.GetDeviceNameById(si.DeviceId);

            si.StorageId   = stationConfig.当前存储设备;
            si.StorageName = scm.GetStorageNameById(si.StorageId);

            si.StationName = Dns.GetHostName();

            return(si);
        }
コード例 #3
0
        private void butApply_Click(object sender, EventArgs e)
        {
            try
            {
                JStationConfig stationConfig = new JStationConfig();

                if (cbxHspCode.SelectedValue != null)
                {
                    stationConfig.当前院区编码 = cbxHspCode.SelectedValue.ToString();
                }
                if (cbxDepartment.SelectedValue != null)
                {
                    stationConfig.站点所属科室 = cbxDepartment.SelectedValue.ToString();
                }
                if (cbxRoom.SelectedValue != null)
                {
                    stationConfig.站点所属房间 = cbxRoom.SelectedValue.ToString();
                }
                if (cbxDevice.SelectedValue != null)
                {
                    stationConfig.当前检查设备 = cbxDevice.SelectedValue.ToString();
                }
                if (cbxStorage.SelectedValue != null)
                {
                    stationConfig.当前存储设备 = cbxStorage.SelectedValue.ToString();
                }

                _scm.SetStationInfo(stationConfig, _computerName);

                ButtonHint.Start(butApply, "OK");
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }