Example #1
0
        public void ReConfigDataTableByDecryptSingleFieldInfo(ref DataTable varDT, string varFieldName)
        {
            int    itColumnCount       = 0;
            int    itColumnExistSign   = -1;
            string stFieldValue        = "";
            string stDecryptFieldValue = "";

            try
            {
                if (varDT != null)
                {
                    if (varDT.Columns != null)
                    {
                        if (varDT.Columns.Count > 0)
                        {
                            itColumnCount = varDT.Columns.Count;

                            for (int itDRF = 0; itDRF < itColumnCount; itDRF++)
                            {
                                if (varDT.Columns[itDRF].ColumnName.Trim() == varFieldName.Trim())
                                {
                                    itColumnExistSign = itDRF;
                                }
                            }

                            if (itColumnExistSign > -1)
                            {
                                if (varDT.Rows != null)
                                {
                                    if (varDT.Rows.Count > 0)
                                    {
                                        foreach (DataRow dr in varDT.Rows)
                                        {
                                            stFieldValue        = "";
                                            stDecryptFieldValue = "";

                                            if (dr[itColumnExistSign] != null)
                                            {
                                                stFieldValue = dr[itColumnExistSign].ToString();

                                                if (stFieldValue.Trim() != String.Empty)
                                                {
                                                    stDecryptFieldValue = Des.DesDecrypt(stFieldValue.Trim(), "/']zse0-");

                                                    dr[itColumnExistSign] = stDecryptFieldValue;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
Example #2
0
        public void DecryptionSingleFieldStrInfo(string varFieldValue, ref string varDecryptionFieldValue)
        {
            string stDecryptionFieldValue = "";

            try
            {
                if (varFieldValue.Trim() != String.Empty)
                {
                    stDecryptionFieldValue = Des.DesDecrypt(varFieldValue.Trim(), "/']zse0-");
                }

                if (stDecryptionFieldValue != String.Empty)
                {
                    varDecryptionFieldValue = stDecryptionFieldValue;
                }
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }