Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string pwd = textBox1.Text;

            if (pwd == "123")
            {
                INIHelper.getInstance().IniWriteValue("EQUIPMENT", "LOGID", "123");
            }
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string Return_Value;

            System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = false;//线程处理后的错误处理控件任然可以赋值
            Return_Value = INIExists(inifile);
            if (!String.IsNullOrEmpty(Return_Value))
            {
                MessageBox.Show(Return_Value);
            }
            StringBuilder objStrBd = new StringBuilder(256);

            GetPrivateProfileString("EQUIPMENT", "INSTRUMENTID", "", objStrBd, 256, FileName);
            instrument_id = objStrBd.ToString();

            textBox2.Text = INIHelper.getInstance().IniReadValue("EQUIPMENT", "Encode");
            string orgID = INIHelper.getInstance().IniReadValue("EQUIPMENT", "Agencies");
            string sql   = "select 资源id,简称 from 机构 where 资源id='in_机构id'";

            sql = sql.Replace("in_机构id", orgID);
            DataTable orgName = OracleHelper.GetDataTable(sql);

            if (orgName.Rows.Count > 0)
            {
                textBox1.Text = orgName.Rows[0]["简称"].ToString();
            }
            using (OracleConnection _connection = new OracleConnection(OracleHelper.GetConnectionstring()))
            {
                DataTable    dt   = new DataTable();
                ListViewItem item = new ListViewItem();
                try
                {
                    _connection.Open();
                    OracleDataAdapter da = new OracleDataAdapter();
                    da.SelectCommand = new OracleCommand("select id,名称 from 检验仪器 where instr('" + instrument_id + "',id)>0", _connection);
                    da.Fill(dt);
                    bolLongin = true;
                }
                catch (Exception exs)
                {
                    LoginForm log = new LoginForm();
                    if (log.ShowDialog() == DialogResult.OK)
                    {
                        bolLongin = true;
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                finally { _connection.Close(); }

                lv_Device.Items.Clear();
                foreach (DataRow i in dt.Rows)
                {
                    item     = lv_Device.Items.Add(i["名称"].ToString(), 1);
                    item.Tag = i["id"].ToString();
                    lv_Device.Columns[2].Text = "0";
                }
            }

            if (lv_Device.Items.Count > 0)
            {
                but_begin.Enabled = false;
                but_end.Enabled   = true;
                bolCon            = true;
                backgroundWorker1.RunWorkerAsync();
            }

            this.WindowState         = FormWindowState.Minimized;
            this.Visible             = false;
            this.notifyIcon1.Visible = true;
            this.SizeChanged        += new System.EventHandler(this.Form1_SizeChanged);
        }