Пример #1
0
        /// <summary>
        /// 初始化桥接功能
        /// </summary>
        public static bool InitializeBridge()
        {
            bool connected = false;

            try
            {
                string iniFilePath = Application.StartupPath + SqlConfiguration.INI_CFG_PATH;
                //生产环境连接配置
                IWriteSQLConfigValue cfgNormal = new INIFileWriter(iniFilePath);
                //串口设置
                SerialPortConfig.IniFile = iniFilePath;
                SerialPortConfig.Read();
                //设置配置信息
                SqlConfiguration.SetSQLConfig(cfgNormal);
                connected = SqlConfiguration.TestConnection(true);    //测试AdoDirect连接

                PubConstant.SqliteConnstr = "Data Source=" + Application.StartupPath + @"\db\HookData.db";
            }

            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }

            //测试桥接是否成功
            if (false == connected)
            {
                Msg.Warning(TEST_BRIDGE_FAILED);
            }

            return(connected);
        }
Пример #2
0
        //当连接已经配置,显示上次配置的数据
        private void LoadCurrentConfiguration()
        {
            //连接配置保存在INI文件
            IWriteSQLConfigValue writer = new INIFileWriter(Application.StartupPath + SqlConfiguration.INI_CFG_PATH);

            txtDatabase.Text   = writer.InitialCatalog;
            txtPwd.Text        = writer.Password;
            txtServerName.Text = writer.ServerName;
            txtUserName.Text   = writer.UserName;
        }
Пример #3
0
        private void sbtnOK_Click(object sender, EventArgs e)
        {
            string sUserID, sPwd, sBookID = "屠宰管理", sBooksName = "";

            sUserID = tUserID.Text;
            // sUserName = tUserName.Text;
            sPwd = tPwd.Text;

            if (String.IsNullOrEmpty(sUserID))
            {
                YIEternalMIS.Common.Msg.ShowInformation("请输入登录用户名!!!");
                tUserID.Focus();
            }

            if (String.IsNullOrEmpty(sPwd))
            {
                YIEternalMIS.Common.Msg.ShowInformation("请输入登录密码!!!");
                tPwd.Focus();
            }


            IWriteSQLConfigValue cfgNormal = new INIFileWriter(Application.StartupPath + SqlConfiguration.INI_CFG_PATH);

            //设置配置信息
            SqlConfiguration.SetSQLConfig(cfgNormal);
            sPwd = CEncoder.Encode(sPwd.Trim());
            var user = _loginApp.Login(sUserID.Trim(), sPwd);

            if (user == null)
            {
                Msg.ShowInformation("您输入的用户名和密码不匹配!!!");
                return;
            }
            //登录成功
            Loginer.CurrentUser = user;
            //初始化导航条
            MenuHelper.InitMenu();
            DialogResult = System.Windows.Forms.DialogResult.OK;
            //登录策略
            //Business.LoginAuthorization login = new Business.LoginAuthorization();
            //SystemAuthentication.Current = login;
            YIEternalMIS.Common.SystemConfig.CurrentConfig.LoginSave     = true;
            YIEternalMIS.Common.SystemConfig.CurrentConfig.LastLoginPWD  = sPwd;
            YIEternalMIS.Common.SystemConfig.CurrentConfig.LastLoginUser = sUserID;
            YIEternalMIS.Common.SystemConfig.WriteSettings(YIEternalMIS.Common.SystemConfig.CurrentConfig);
            this.Hide();
            this.Close();
        }
Пример #4
0
        private void sbtnOK_Click1(object sender, EventArgs e)
        {
            string sUserID, sPwd, sBookID = "屠宰管理", sBooksName = "库存管理";

            sUserID = tUserID.Text;
            // sUserName = tUserName.Text;
            sPwd = tPwd.Text;

            if (String.IsNullOrEmpty(sUserID))
            {
                Common.Msg.ShowInformation("请输入登录用户名!!!");
                tUserID.Focus();
            }

            if (String.IsNullOrEmpty(sPwd))
            {
                Common.Msg.ShowInformation("请输入登录密码!!!");
                tPwd.Focus();
            }


            IWriteSQLConfigValue cfgNormal = new INIFileWriter(Application.StartupPath + SqlConfiguration.INI_CFG_PATH);

            //设置配置信息
            SqlConfiguration.SetSQLConfig(cfgNormal);
            //Business.LoginAuthorization login = new Business.LoginAuthorization();

            //Common.LoginUser LoginUser = new Common.LoginUser(sUserID, sPwd, sBookID, sBooksName);
            ////登录成功
            //if (LoginAuthor(LoginUser, login))
            //{
            //    //初始化导航条
            //    MenuHelper.InitMenu();
            //    DialogResult = System.Windows.Forms.DialogResult.OK;
            //    //登录策略
            //    SystemAuthentication.Current = login;
            //    Common.SystemConfig.CurrentConfig.LoginSave = true;
            //    Common.SystemConfig.CurrentConfig.LastLoginPWD = Common.CEncoder.Encode(sPwd);
            //    Common.SystemConfig.CurrentConfig.LastLoginUser = sUserID;
            //    Common.SystemConfig.WriteSettings(Common.SystemConfig.CurrentConfig);
            //    this.Hide();
            //    this.Close();
            //}
        }