Beispiel #1
0
        private void frmRemotingServer_Load(object sender, EventArgs e)
        {
            frmPortSet fc = new frmPortSet();

            fc.ShowDialog();
            TimeSpan ff = new TimeSpan(0);

            RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            RemotingConfiguration.CustomErrorsEnabled(false);
            System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = ff;
            BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();

            provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            IDictionary props = new Hashtable();

            props["port"] = Port;
            TcpChannel chan = new TcpChannel(props, null, provider);

            ChannelServices.RegisterChannel(chan, false);
            Operater = new Oral();
            ObjRef obj = RemotingServices.Marshal(Operater, "Tcpservice");

            RemotingServices.Unmarshal(obj);
            notifyIcon1.Text = "端口号:" + Port.ToString() + "remoting服务正在运行中";
            this.Visible     = false;

            //DataSet dsdoc = Operater.GetDataSet("select * from t_patient_doc_colb where tid=7017004");
            //string Xmldoc = dsdoc.Tables[0].Rows[0]["CONTENT"].ToString();
            //byte[] imgs = Operater.GetDocImage(Xmldoc);
            //Image tt = imgs[0];
        }
Beispiel #2
0
        public frmRemotingServer()
        {
            InitializeComponent();
            frmPortSet fc = new frmPortSet();

            fc.ShowDialog();
        }
Beispiel #3
0
        private void frmRemotingServer_Load(object sender, EventArgs e)
        {
            //获取配置信息
            string pstr = Environment.GetFolderPath(Environment.SpecialFolder.System);

            //string newStr = System.IO.Path.GetDirectoryName(str);
            //File.Exists();
            filename = pstr + "\\" + "r_emr_regist.txt";

            string link                  = Decrypt(File.ReadAllText("datalink.txt").Split(',')[0]);
            string mysqllink             = Decrypt(File.ReadAllText("mysqldatalink.txt"));
            string orcl_connectionString = string.Format(@"Persist Security Info=False;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))(CONNECT_DATA=(SID={2})));user id={3};password={4}", link.Split(',')[0], link.Split(',')[1], link.Split(',')[2], link.Split(',')[3], link.Split(',')[4]);

            Operater = new DbHelp();
            //Operater.orcl_connectionString = orcl_connectionString;
            Operater.mysql_connectionString = "data source=localhost;database=emrbzb;user id=root;password=111111;pooling=true;charset=utf8;Convert Zero Datetime=True;Allow Zero Datetime=True"; //mysqllink;

            bool yy = Operater.ConnectTest_MySql();

            // DataSet ds = Operater.GetDataSet_MySql("select a.id,a.patient_name as 姓名,a.pid as 住院号,a.section_name as 科室 from t_in_patient a where a.id in (select patient_id from  t_patients_doc where tid in (select tid from t_patient_doc_colb)) order by id desc");
            //DataSet ds = Operater.GetDataSet_MySql("select * from T_ACCOUNT where upper(ACCOUNT_NAME)='FK' and PASSWORD='******'");
            DataSet ds = Operater.GetDataSet_MySql("select n.ACCOUNT_ID,n.ENABLE_START_TIME from t_account n where n.ENABLE_START_TIME is not NULL LIMIT 1");

            if (File.Exists(filename))
            {
                regiestCode = File.ReadAllText(filename).Split(',')[1];

                if (regiestCode != "")
                {
                    if (frmRemotingServer.Encrypt(GetCpuID()) != regiestCode)
                    {
                        File.Delete(filename);
                        MessageBox.Show("注册码被恶意修改,请重新注册!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Application.Restart();
                    }
                }
            }

            if (Port == 0)
            {
                if (!File.Exists(filename))
                {
                    //首次使用
                    DateTime dte = Operater.GetSystemTime().AddDays(100);
                    string   w   = Encrypt(dte.ToString()) + ",";
                    File.WriteAllText(filename, w);

                    //regiestCode = File.ReadAllText(filename).Split(',')[1];
                }
                frmPortSet fc = new frmPortSet();
                fc.ShowDialog();
            }
            timer1.Enabled = true;
            TimeSpan ff = new TimeSpan(0);

            if (RemotingType == "tcp")
            {
                #region TCP模式
                RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
                RemotingConfiguration.CustomErrorsEnabled(false);
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = ff;
                BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
                provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                IDictionary props = new Hashtable();
                props["port"] = Port;

                TcpChannel chan = new TcpChannel(props, null, provider);

                ChannelServices.RegisterChannel(chan, false);

                ObjRef obj = RemotingServices.Marshal(Operater, "Tcpservice");   //Tcpservice
                RemotingServices.Unmarshal(obj);

                #endregion
            }
            else
            {
                #region Http模式
                HttpServerChannel serverChannel = new HttpServerChannel(Port);  //RemoteObject.soap
                ChannelServices.RegisterChannel(serverChannel, false);
                // Expose an object for remote calls.
                RemotingConfiguration.RegisterWellKnownServiceType(
                    typeof(DbHelp), "RemoteObject.soap",
                    WellKnownObjectMode.Singleton);
                #endregion
            }

            notifyIcon1.Text = "端口号:" + Port.ToString() + "remoting服务正在运行中,协议模式" + RemotingType;
            this.Visible     = false;

            lbllimit.Text = "CPUID:" + GetCpuID();
        }
Beispiel #4
0
        private void 还原ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPortSet fc = new frmPortSet();

            fc.ShowDialog();
        }