Esempio n. 1
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            try
            {
                //  m_UsbPwsSupport = ini.ReadValue("USBPSW", "USBPSWSUPPART");
                //MQStartFlag = ini.ReadValue("[MQInfo]", "IsStartFlag") == "1" ? true : false;//判断是否启用MQ

                //打开密码器  丽水松阳项目不使用此密码器  20180227
                //if (m_UsbPwsSupport == "1")
                //{
                //    try
                //    {
                //        int nReturn = usb.USB_OpenDevice(ref phDeviceHandle);
                //        if (nReturn != 0)
                //        {
                //            MessageBox.Show("密码器打开失败!");
                //        }
                //    }
                //    catch (Exception em)
                //    {
                //        MessageBox.Show("密码器打开失败:" + em.Message);
                //    }
                //}


                //初始化签名验签函数

                //int nReturn = scrambler.InitializeLSEB();
                //if (nReturn != 0)
                //{
                //    MessageBox.Show("初始化签名验签失败!");
                //}

                //初始化写日志线程
                string sLogPath = Application.StartupPath + "\\Log";
                if (!Directory.Exists(sLogPath))
                {
                    Directory.CreateDirectory(sLogPath);
                }
                Log.Instance.LogDirectory   = sLogPath + "\\";
                Log.Instance.FileNamePrefix = "EBD_";
                Log.Instance.CurrentMsgType = MsgLevel.Debug;
                Log.Instance.logFileSplit   = LogFileSplit.Daily;
                Log.Instance.MaxFileSize    = 2;
                Log.Instance.InitParam();

                AreaMappingHelper.InitDic();

                AreaMapping.InitDic();
                SingletonInfo.GetInstance().Longitude = ini.ReadValue("INFOSET", "Longitude");
                SingletonInfo.GetInstance().Latitude  = ini.ReadValue("INFOSET", "Latitude");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            gbSetting.Visible = false;
            oLock             = new Object();
            //读取INI文件
            formHeight = this.Height;
            IniFiles ini = new IniFiles(@Application.StartupPath + "\\Config.ini");

            txtServer.Text = ini.ReadValue("Database", "ServerName");
            txtDb.Text     = ini.ReadValue("Database", "DataBase");
            txtDbuser.Text = ini.ReadValue("Database", "LogID");
            txtDbPass.Text = ini.ReadValue("Database", "LogPass");
            this.Height    = formHeight - gbSetting.Height;
        }
Esempio n. 3
0
 private void ServerIPSetForm_Load(object sender, EventArgs e)
 {
     System.Net.IPAddress[] ipArr;
     ipArr = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
     //for (int i = 0; i < ipArr.Length; i++)
     //{
     //    if (ipArr[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
     //    {
     //        cmbServerIP.Items.Add(ipArr[i].ToString());
     //    }
     //}
     cmbServerIP.Items.AddRange(ipArr);
     txtServerPort.Text = ini.ReadValue("INFOSET", "ServerPort");
     cmbServerIP.Text   = ini.ReadValue("INFOSET", "ServerIP");
 }
Esempio n. 4
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            m_UsbPwsSupport = ini.ReadValue("USBPSW", "USBPSWSUPPART");

            //打开密码器
            if (m_UsbPwsSupport == "1")
            {
                try
                {
                    int nReturn = usb.USB_OpenDevice(ref phDeviceHandle);
                    if (nReturn != 0)
                    {
                        MessageBox.Show("密码器打开失败!");
                    }
                }
                catch (Exception em)
                {
                    MessageBox.Show("密码器打开失败:" + em.Message);
                }
            }

            //初始化写日志线程
            string sLogPath = Application.StartupPath + "\\Log";

            if (!System.IO.Directory.Exists(sLogPath))
            {
                System.IO.Directory.CreateDirectory(sLogPath);
            }
            Log.Instance.LogDirectory   = sLogPath + "\\";
            Log.Instance.FileNamePrefix = "EBD_";
            Log.Instance.CurrentMsgType = MsgLevel.Debug;
            Log.Instance.logFileSplit   = LogFileSplit.Daily;
            Log.Instance.MaxFileSize    = 2;
            Log.Instance.InitParam();
        }
Esempio n. 5
0
        private void ComSetForm_Load(object sender, EventArgs e)
        {
            string[] sPortRange = System.IO.Ports.SerialPort.GetPortNames();
            if (sPortRange.Length > 0)
            {
                comboPortName.Items.AddRange(sPortRange);
                comSndPortName.Items.AddRange(sPortRange);
            }
            comboPortName.Text = ini.ReadValue("CMDCOM", "COM");
            comboBaudrate.Text = ini.ReadValue("CMDCOM", "BaudRate");
            txt_DataBits.Text  = ini.ReadValue("CMDCOM", "DataBits");
            cob_Parity.Text    = ini.ReadValue("CMDCOM", "Parity");
            cob_StopBits.Text  = ini.ReadValue("CMDCOM", "StopBits");

            comSndPortName.Text  = ini.ReadValue("AudioCOM", "COM");
            comSndBaudrate.Text  = ini.ReadValue("AudioCOM", "BaudRate");
            txt_SndDataBits.Text = ini.ReadValue("AudioCOM", "DataBits");
            cob_SndParity.Text   = ini.ReadValue("AudioCOM", "Parity");
            cob_SndStopBits.Text = ini.ReadValue("AudioCOM", "StopBits");
        }
Esempio n. 6
0
        private void TmpFolderSetForm_Load(object sender, EventArgs e)
        {
            txtRevTar.Text   = inis.ReadValue("FolderSet", "RevTarFolder");
            txtTarBuild.Text = inis.ReadValue("FolderSet", "SndTarFolder");
            txtUnTar.Text    = inis.ReadValue("FolderSet", "UnTarFolder");
            txtXMLBuild.Text = inis.ReadValue("FolderSet", "XmlBuildFolder");

            txtMedia.Text      = inis.ReadValue("FolderSet", "AudioFileFolder");
            txtBeUnTar.Text    = inis.ReadValue("FolderSet", "BeUnTarFolder");
            txtBeBuildXML.Text = inis.ReadValue("FolderSet", "BeXmlFileMakeFolder");
        }
        //获取数据库连接字符串
        private String GetConnectString()
        {
            string sReturn;
            string sPass;
            string sServer   = ini.ReadValue("Database", "ServerName");
            string sUser     = ini.ReadValue("Database", "LogID");
            string sDataBase = ini.ReadValue("Database", "DataBase");

            sPass = ini.ReadValue("Database", "LogPass");
            if (sPass == "")
            {
                sPass = "******";
            }
            sReturn = "server = " + sServer +
                      ";UID = " + sUser +
                      ";Password ="******";DataBase = " + sDataBase.Trim() + ";"
                      + "MultipleActiveResultSets=True";

            return(sReturn);
        }
        static void Main()
        {
            Ini = new IniFiles(@Application.StartupPath + "\\Config.ini");
            bool flag = Convert.ToBoolean(Ini.ReadValue("LOGIN", "LandingCompletion"));

            flag = false;//测试加入  20180812
            if (!flag)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmLogin());
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.Run(new mainForm(true));
            }
        }
 private void InfoSetForm_Load(object sender, EventArgs e)
 {
     txtSourceID.Text   = inis.ReadValue("INFOSET", "SourceID");
     txtSourceName.Text = inis.ReadValue("INFOSET", "SourceName");
     txtSourceType.Text = inis.ReadValue("INFOSET", "SourceType");
 }
Esempio n. 10
0
 private void ServerSetForm_Load(object sender, EventArgs e)
 {
     // txtYXPlat.Text = inis.ReadValue("INFOSET", "YXURL");
     txtZJPlat.Text = inis.ReadValue("INFOSET", "BJURL");
 }
Esempio n. 11
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtCode.Text.Trim() == "")
            {
                MessageBox.Show("用户编码不能为空,请输入!", "提示");
                txtCode.Focus();
                return;
            }
            ;
            if (txtUser.Text.Trim() == "")
            {
                MessageBox.Show("用户名称不能为空,请输入!", "提示");
                txtUser.Focus();
                return;
            }
            ;
            if (txtPass.Text.Trim() == "")
            {
                MessageBox.Show("用户密码不能为空,请输入!", "提示");
                txtPass.Focus();
                return;
            }
            ;
            dbAccess dA = new dbAccess();

            dA.conn.ConnectionString = GetConnectString();
            try
            {
                if (dA.OpenConn())
                {
                    if (dA.loginJudge(txtCode.Text.Trim(), txtUser.Text.Trim(), txtPass.Text.Trim(), dA) != 1)
                    {
                        MessageBox.Show("登录失败,请重新检查用户编码、用户姓名、登录密码!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtCode.Focus();
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("数据库连接失败,请检查连接设置!", "提示");
                    return;
                }
                bool flag = Convert.ToBoolean(Ini.ReadValue("LOGIN", "LandingCompletion"));
                if (!flag)
                {
                    Ini.WriteValue("LOGIN", "LandingCompletion", "true");
                }
                mainForm sMain = new mainForm();
                mainForm.dba = dA;
                sMain.Show();
                this.Hide();
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message + "\r\n请重新设置数据库连接!", "错误");
                return;
            }
            finally
            {
                if (dA.ConnState == ConnectionState.Open)
                {
                    dA.CloseConn();
                }
                dA = null;
            }
        }