Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string fff  = FormatDate("30012015", "", "ddMMyyyy", "yyyyMMdd");
            string fff2 = FormatDate("11/3/2015 3:03:31 PM", "", "M/d/yyyy h:m:ss tt", "yyyyMMddhhmmss");

            //testXML();

            Logger.InitializeLogger();

            NCR.Core.Encryption.EncryptionHelper _encrypt = new NCR.Core.Encryption.EncryptionHelper();

            //string encVal = _encrypt.EncryptTripleDESWithWeakKey("0E329232EA6D0D730E329232EA6D0D730E329232EA6D0D73", "1234");

            //string encVal = _encrypt.EncryptTripleDESWithWeakKey("230119581201196930041982", "1234");

            // string encVal = _encrypt.EncryptTripleDESWithWeakKey("C72F3875A7AEECD020B9E3D9D0D5750DC72F3875A7AEECD0", "D56DFBA7B14CD528B0B81E08C88D934E");

            string encValHex = _encrypt.EncryptHexTripleDES("C72F3875A7AEECD020B9E3D9D0D5750DC72F3875A7AEECD0", "D56DFBA7B14CD528B0B81E08C88D934E");

            //string cleaseVal = _encrypt.DecryptHexTripleDES("C72F3875A7AEECD020B9E3D9D0D5750DC72F3875A7AEECD0", encValHex);
            string clearKey = _encrypt.DecryptHexTripleDES("C72F3875A7AEECD020B9E3D9D0D5750DC72F3875A7AEECD0", "D56DFBA7B14CD528B0B81E08C88D934E");
            string IWK      = clearKey + clearKey.Substring(0, 16);

            NCR.EAI.PINManagement.PINManager _pinManager = new NCR.EAI.PINManagement.PINManager();
            //string pinBlock = _pinManager.CreateANSIPINBlock("4192360521191211", "1234");
            //string pinBlock = _pinManager.CreateANSIPINBlock("4192340077930006", "1234");
            string pinBlock       = _pinManager.CreateANSIPINBlock("4192360934425644", "8536");
            string encHexPINBlock = _encrypt.EncryptHexTripleDES(IWK, pinBlock);

            encHexPINBlock = encHexPINBlock.ToUpper();
            //string cleaseVal = _encrypt.DecryptTripleDESWithWeakKey("0E329232EA6D0D730E329232EA6D0D730E329232EA6D0D73", "AFCC357F09BF6303");
            //string cleaseVal = _encrypt.DecryptTripleDESWithWeakKey("0E329232EA6D0D730E329232EA6D0D730E329232EA6D0D73", encVal);
            //string cleaseVal = _encrypt.DecryptTripleDESWithWeakKey("230119581201196930041982", encVal);

            ////ChannelProxyServiceClient client = new ChannelProxyServiceClient();
            ////ChannelProxyService.CustomerAdvanceSearchRequest search = new CustomerAdvanceSearchRequest();

            ////search.cifName = "Hashim";
            ////search.cifNo = "9090909";

            ////ChannelProxyService.Header header = new Header();
            ////header.ChannelID = "0909090";

            ////wsCustomerDTO[] _wsCustomerDTO;
            ////client.CustomerAdvanceSearch(ref header, out _wsCustomerDTO, search);

            ////MessageBox.Show( _wsCustomerDTO[0].cifTypeBriefDescArab.ToString());

            ////client.Close();
            while (true)
            {
                callService();
            }
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string fullname   = typeof(NCR.EAI.AUB.BPE.NIInspectorConfigurationSection).AssemblyQualifiedName;
            string parameters = "";

            string[] paramArray = parameters.Split(',');

            NCR.Core.Encryption.EncryptionHelper _enchelper = new NCR.Core.Encryption.EncryptionHelper();
            _enchelper.EncryptTripleDES("230119581201196930041982", "1234");

            TestVBEncryption.EncryptionVB _vbEncrypt = new TestVBEncryption.EncryptionVB();
            _vbEncrypt.TripleDES("1234");

            //GeneratePinBlock("4250580000001234", "1234");
            GeneratePinBlock("4192360934425644", "8536");

            NCR.EAI.AUB.Entity.CustomerProduct.Cards.CreditCardSAF creditcardsaf = new NCR.EAI.AUB.Entity.CustomerProduct.Cards.CreditCardSAF();
            creditcardsaf.recordid      = 1;
            creditcardsaf.ni1_tran_type = "test";

            try
            {
                NCR.EAI.Utilities.Utility _utility = new NCR.EAI.Utilities.Utility();
                string xml  = _utility.SerializeObjectAsXML(typeof(NCR.EAI.AUB.Entity.CustomerProduct.Cards.CreditCardSAF), creditcardsaf, Encoding.Default);
                int    idex = xml.IndexOf(Environment.NewLine);
                //xml = xml.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");
                XDocument _xdoc = new XDocument();
                //_xdoc = XDocument.Parse("<CreditCardSAF><ni1_tran_type>test</ni1_tran_type><recordid>1</recordid><retry_count>0</retry_count></CreditCardSAF>");
                //_xdoc = new XDocument();
                //_xdoc = XDocument.Parse("<CreditCardSAF><ni1_tran_type>test</ni1_tran_type><recordid>1</recordid><retry_count>0</retry_count></CreditCardSAF>");
                _xdoc = XDocument.Parse(xml);
                //XmlDocument _xdoc = new XmlDocument();
                //_xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-16\"?><CreditCardSAF><ni1_tran_type>test</ni1_tran_type><recordid>1</recordid><retry_count>0</retry_count></CreditCardSAF>");
                //_xdoc.LoadXml("<test><subtest>tett</subtest></test>");
                //_xdoc.LoadXml(xml);
                XElement _xele = _xdoc.Root;
            }
            catch (Exception ex)
            {
            }

            List <XElement> _testList = new List <XElement>();

            _testList.Add(new XElement("element1"));
            _testList.Add(new XElement("element2"));
            string testResult = String.Join(",", _testList.Select(a => a.Name.LocalName));


            string   sFNSOfflineStartTime = "23:00:00";
            string   sFNSOfflineEndTime   = "05:00:00";
            bool     isOffline            = false;
            DateTime _fnsOfflineStartTime = Convert.ToDateTime(sFNSOfflineStartTime);
            DateTime _fnsOfflineEndTime   = Convert.ToDateTime(sFNSOfflineEndTime);

            int compareStartEnd = _fnsOfflineStartTime.CompareTo(_fnsOfflineEndTime);

            if (compareStartEnd > 0)
            {
                _fnsOfflineStartTime = _fnsOfflineStartTime.AddDays(-1);
            }

            DateTime _currentDateTime = DateTime.Now;

            int compareStart = _currentDateTime.CompareTo(_fnsOfflineStartTime);
            int compareEnd   = _currentDateTime.CompareTo(_fnsOfflineEndTime);

            if (compareStart >= 0 && compareEnd <= 0)
            {
                isOffline = true;
            }
            else
            {
                isOffline = false;
            }

            AssemblyName _asemblyName = System.Reflection.AssemblyName.GetAssemblyName(@"F:\Hashim\AUB\NXP\AUB\AUBBPELibrary\bin\Debug\NCR.EAI.AUB.BPE.dll");

            Assembly _asmBPETest = Assembly.LoadFile(@"F:\Hashim\AUB\NXP\AUB\AUBBPELibrary\bin\Debug\NCR.EAI.AUB.BPE.dll");
            Type     tBPEAsm     = _asmBPETest.GetType("NCR.EAI.AUB.BPE.AUBBPELibrary", false, true);

            try
            {
                var _objInstance = _asmBPETest.CreateInstance(tBPEAsm.ToString(), true);

                object _objValue = null;
                _objValue = _objInstance.GetType().GetProperty("testProperty").GetValue(_objInstance, null);

                List <XElement> _list = new List <XElement>();
                XElement        _xle  = new XElement("Firstpushedbycaller");
                _list.Add(_xle);
                _objInstance.GetType().GetProperty("InternalMessageElements").SetValue(_objInstance, _list, null);


                MethodInfo _methodInfoBPE = tBPEAsm.GetMethod("testElement");
                object     output         = _methodInfoBPE.Invoke(_objInstance, null);

                object _objValue2 = null;
                _objValue2 = _objInstance.GetType().GetProperty("InternalMessageElements").GetValue(_objInstance, null);
                _list      = (List <XElement>)_objValue2;

                _xle = new XElement("Secondpushedbycaller");
                _list.Add(_xle);
                _objInstance.GetType().GetProperty("InternalMessageElements").SetValue(_objInstance, _list, null);

                _list      = null;
                _objValue2 = null;
                _objValue2 = _objInstance.GetType().GetProperty("InternalMessageElements").GetValue(_objInstance, null);
            }
            catch (Exception ex)
            {
                string expp = ex.Message;
            }
            System.Collections.BitArray _bitArray = new System.Collections.BitArray(16, false);
            for (int i = 0; i < _bitArray.Length; i++)
            {
                _bitArray.Set(i, false);
            }
            _bitArray.Set(0, true);
            _bitArray.Set(2, true);
            _bitArray.Set(9, true);

            string bitMap = "";

            for (int i = 0; i < _bitArray.Length; i++)
            {
                bitMap += _bitArray[i].ToString();
            }

            byte[] _byteArray = new byte[2];
            _bitArray.CopyTo(_byteArray, 0);

            string hexRep = BitConverter.ToString(_byteArray);

            hexRep = hexRep.Replace("-", "");

            bitMap = System.Text.Encoding.ASCII.GetString(_byteArray);

            string ttt = "Format(1)";

            string[] splittt = ttt.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            //string formattedDate = DateTime.ParseExact("20150101", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy");
            string formattedDate = DateTime.ParseExact("23-AUG-2015", "d-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy");
            //DateTime dt = DateTime.ParseExact("20150101", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
            Assembly _asm = Assembly.LoadFile(@"F:\Hashim\AUB\NXP\AUB\DynamicTest\bin\Debug\dynamicTest.dll");
            Type     t    = _asm.GetType("DynamicTest.DynamicTestClass", false, true);
            var      obj  = _asm.CreateInstance(t.ToString());


            object T = new object();
            //MethodInfo _methodInfo = typeof(TestClient.Form1).GetMethod("testDynamicMethod");
            MethodInfo _methodInfo = t.GetMethod("testDynamicMethod");

            object[] _objParams = new object[2];
            _objParams[0] = "test";
            _objParams[1] = "RefRequest";

            try
            {
                //object output = _methodInfo.Invoke(T, _objParams);
                object output = _methodInfo.Invoke(obj, _objParams);
            }
            catch (Exception ex)
            {
            }
        }