Example #1
0
        /// <summary>
        /// 配置
        /// </summary>
        /// <returns></returns>
        private bool GetConfigValue()
        {
            bool ret = true;

            ///取得配置信息
            NCLogger.GetInstance().WriteInfoLog("GetConfigValue Start");
            NdnXmlConfig xmlConfig;

            xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig());
            if (!xmlConfig.ReadXmlData("config", "ftpserver", ref ftpserver))
            {
                ret = false;
            }
            if (!xmlConfig.ReadXmlData("config", "ftpuser", ref userName))
            {
                ret = false;
            }
            if (!xmlConfig.ReadXmlData("config", "ftppassword", ref password))
            {
                ret = false;
            }
            password = NCCryp.Decrypto(password);

            NCLogger.GetInstance().WriteInfoLog("GetConfigValue end");
            return(ret);
        }
Example #2
0
 /// <summary>
 /// 行选择
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         txtUser.Text     = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
         txtName.Text     = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
         txtPassword.Text = NCCryp.Decrypto(dataGridView1.SelectedRows[0].Cells[2].Value.ToString());
         cmbType.Text     = db.UserRightTable[dataGridView1.SelectedRows[0].Cells[3].Value.ToString()].ToString();
     }
 }
Example #3
0
        /// <summary>
        /// 取得数据库连接
        /// </summary>
        /// <returns></returns>
        protected bool GetConnectionString()
        {
            NdnXmlConfig xmlConfig;

            xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig());
            string strConnectionString = null;
            string str = "ConnectionString";

            if (xmlConfig.ReadXmlData("database", str, ref strConnectionString))
            {
                string[] temp = strConnectionString.Split(';');
                if (temp.Length > 0)
                {
                    for (int idx = 0; idx < temp.Length; idx++)
                    {
                        if (temp[idx].IndexOf("Password="******"Password="******"");
                            strPassword = NCCryp.Decrypto(temp[idx]);
                        }
                        else if (temp[idx].IndexOf("Data Source=") > -1)
                        {
                            temp[idx]     = temp[idx].Replace("Data Source=", "");
                            strDataSource = temp[idx];
                        }
                        else if (temp[idx].IndexOf("Initial Catalog=") > -1)
                        {
                            temp[idx] = temp[idx].Replace("Initial Catalog=", "");
                            strDbName = temp[idx];
                        }
                        else if (temp[idx].IndexOf("User ID=") > -1)
                        {
                            temp[idx]   = temp[idx].Replace("User ID=", "");
                            strUserName = temp[idx];
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }