Beispiel #1
0
        private void FrmShowDay_Load(object sender, EventArgs e)
        {
            string        AppFile = Application.StartupPath + "\\";
            StringBuilder temp    = new StringBuilder(255);

            CommFunction.GetPrivateProfileString("显示天数设置", "天数", "", temp, 255, AppFile + "ShowDay.ini");
            textBox1.Text = temp.ToString();
            CommFunction.GetPrivateProfileString("默认药品温度设置", "药品温度", "", temp, 255, AppFile + "ShowDay.ini");
            textBox2.Text = temp.ToString();
            CommFunction.GetPrivateProfileString("打印设置", "是否打印", "", temp, 255, AppFile + "ShowDay.ini");
            string print = temp.ToString();

            if (print == "")
            {
                print = "FALSE";
            }
            checkBox1.Checked = Boolean.Parse(print.ToString());
            if ((textBox1.Text.Trim() == "") || (textBox1.Text == null))
            {
                textBox1.Text = "3";
            }
            if ((textBox2.Text.Trim() == "") || (textBox2.Text == null))
            {
                textBox2.Text = "0";
            }
        }
Beispiel #2
0
        public static string WM_ConnString;//WM连接字符串



        public static bool MakeDBConn_temp()
        {
            const string CryptStr = "sp";
            bool         result;

            result = false;

            string AppFile = Application.ExecutablePath;//应用程序路径(包括名称)

            AppFile = AppFile.ToLower();
            AppFile = AppFile.Replace(".exe", ".ini");

labReadIni:
            StringBuilder temp = new StringBuilder(255);

            CommFunction.GetPrivateProfileString("temp连接数据库", "服务名", "", temp, 255, AppFile);
            string datasource = temp.ToString();

            CommFunction.GetPrivateProfileString("temp连接数据库", "用户", "", temp, 255, AppFile);
            string user = temp.ToString();

            CommFunction.GetPrivateProfileString("temp连接数据库", "口令", "", temp, 255, AppFile);
            string pwd = temp.ToString();

            pwd = CommFunction.DeCryptStr(pwd, CryptStr);


            string newconnstr = "";

            newconnstr = newconnstr + "data source=" + datasource + ";";
            newconnstr = newconnstr + "User ID=" + user + ";";
            newconnstr = newconnstr + "Password="******";";
            newconnstr = newconnstr + "Provider=OraOLEDB.Oracle.1";//WIN7下一定要先这样,MSDAORA.1:才连得上,太怪了!
            OleDbConnection odbconn = new OleDbConnection(newconnstr);

            try
            {
                odbconn.Open();
                result = true;
            }
            catch
            {
                result = false;
            }
            if (result == false)
            {
                string ss = "服务名" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) +
                            "用户" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) +
                            "口令" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "1" + CryptStr + Convert.ToChar(0x3);


                if (CommFunction.ShowOptionForm("temp连接数据库", "temp连接数据库", ss, AppFile))
                {
                    goto labReadIni;
                }
                else
                {
                    Application.Exit();
                }
            }

            return(true);
        }
Beispiel #3
0
        ///<summary>
        ///程序启动必需的WMS数据库连接设置
        ///</summary>
        ///<param name=""></param>
        ///<returns></returns>
        public static bool MakeDBConn_HCWL()
        {
            const string CryptStr = "sp";
            bool         result;

            result = false;

            string AppFile = Application.ExecutablePath;//应用程序路径(包括名称)

            AppFile = AppFile.ToLower();
            AppFile = AppFile.Replace(".exe", ".ini");

labReadIni:
            StringBuilder temp = new StringBuilder(255);

            CommFunction.GetPrivateProfileString("HCWL连接数据库", "服务名", "", temp, 255, AppFile);
            string datasource = temp.ToString();

            CommFunction.GetPrivateProfileString("HCWL连接数据库", "用户", "", temp, 255, AppFile);
            string user = temp.ToString();

            CommFunction.GetPrivateProfileString("HCWL连接数据库", "口令", "", temp, 255, AppFile);
            string pwd = temp.ToString();

            pwd = CommFunction.DeCryptStr(pwd, CryptStr);


            string newconnstr = "";

            newconnstr = newconnstr + "data source=" + datasource + ";";
            newconnstr = newconnstr + "User ID=" + user + ";";
            newconnstr = newconnstr + "Password="******";";
            newconnstr = newconnstr + "Provider=MSDAORA.1:";//Unicode=True;//OraOleDb.Oracle
            OleDbConnection odbconn = new OleDbConnection(newconnstr);

            try
            {
                odbconn.Open();
                result = true;
                CommFunction.cfServerName        = datasource;
                CommFunction.cfUserID            = user;
                CommFunction.cfPassword          = pwd;
                LoginCs.LoginClass.ConnectString = newconnstr;//传递给登录模块以便登录

                CommFunction.ConnectString = newconnstr;
            }
            catch
            {
                result = false;
            }
            if (result == false)
            {
                string ss = "服务名" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) +
                            "用户" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + Convert.ToChar(0x3) +
                            "口令" + Convert.ToChar(0x2) + "Edit" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "0" + Convert.ToChar(0x2) + Convert.ToChar(0x2) + "1" + CryptStr + Convert.ToChar(0x3);


                if (CommFunction.ShowOptionForm("HCWL连接数据库", "HCWL连接数据库", ss, AppFile))
                {
                    goto labReadIni;
                }
                else
                {
                    Application.Exit();
                }
            }

            return(true);
        }