Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //id là key mã hóa md5
            HashMD5 hm      = new HashMD5("id@");
            String  encript = hm.Encrypt(txtCode.Text);

            if (encript.Equals(accessCode))
            {
                frmMain f = new frmMain(accessCode);
                this.Hide();
                f.ShowDialog();
                this.Show();
                txtCode.ResetText();
            }
            else
            {
                MessageBox.Show("Mật khẩu sai");
            }
        }
Пример #2
0
        public frmUpdateValues(string db, string tb)
        {
            keyHash = db;
            InitializeComponent();
            this.db       = db;
            this.tb       = tb;
            rF            = new readFile();
            dt            = new data_table();
            wF            = new writeFile();
            myField       = rF.read_File_Infor(tb, db);
            myPK_index    = getListPrimaryKey(myField);
            myContents_FK = new List <String[]>();
            datatype      = new Datatypes();
            myDatatype    = new List <String>();
            getDataType();

            isUpdate = true;
            hash     = new HashMD5(keyHash);
        }
Пример #3
0
        public List <String[]> read_Table_Contents(String tableName, String DbName, List <Field> myField)
        {
            HashMD5 hash = new HashMD5(DbName);

            List <String[]> myReturnList = new List <String[]>();
            // đọc nội dung của file ra 1 danh sách
            List <String> myFileContents = read_Contents("database/" + DbName + "/" + tableName + ".txt");

            foreach (String lines in myFileContents)
            {
                int      n         = myField.Count;
                int      nStr      = 0;
                String[] newString = new String[n];
                newString[nStr] = "";
                String temp = lines.Substring(1, lines.Length - 1);

                while (temp.Length > 0)
                {
                    if (temp[0] != '\'')
                    {
                        newString[nStr] += temp[0];
                        temp             = temp.Substring(1, temp.Length - 1);
                    }
                    else
                    {
                        newString[nStr] = newString[nStr];
                        //  newString[nStr] = hash.Decrypt(newString[nStr]);
                        temp = temp.Substring(1, temp.Length - 1);
                        nStr++;
                        newString[nStr] = "";
                    }
                }
                // newString[newString.Length-1] = hash.Decrypt(newString[newString.Length - 1]);
                myReturnList.Add(newString);
            }
            return(myReturnList);
        }