public GetResults GetSessionID(string Username, string Password, string RequestType)
        {
            var results = new GetResults();

            results.ResultCode        = "99";
            results.ResultDescription = "Authentication Failed. Username or Password Incorrect";

            if (DBClasses.ValidateBank(Username, Password) == false)
            {
                return(results);
            }

            RequestType = RequestType.ToLower();
            string userSecurityStamp = Guid.NewGuid().ToString().Replace("-", "");

            // string AgentID = "123";

            byte[] _time        = BitConverter.GetBytes(DateTime.UtcNow.ToBinary());
            byte[] _key         = Encoding.ASCII.GetBytes(userSecurityStamp.Substring(0, 8));
            byte[] _Password    = Encoding.ASCII.GetBytes(Password.ToString() + userSecurityStamp.Substring(8, 8));
            byte[] _RequestType = Encoding.ASCII.GetBytes(RequestType + userSecurityStamp.Substring(16, 8));
            byte[] data         = new byte[_time.Length + _key.Length + _RequestType.Length + _Password.Length];

            System.Buffer.BlockCopy(_time, 0, data, 0, _time.Length);
            System.Buffer.BlockCopy(_key, 0, data, _time.Length, _key.Length);
            System.Buffer.BlockCopy(_RequestType, 0, data, _time.Length + _key.Length, _RequestType.Length);
            System.Buffer.BlockCopy(_Password, 0, data, _time.Length + _key.Length + _RequestType.Length, _Password.Length);


            results.ResultCode        = "0";
            results.ResultDescription = "Success";
            results.SessionID         = Convert.ToBase64String(data);

            return(results);
        }
Пример #2
0
        public ActionResult ItemSchedules()
        {
            DBClasses dbclass = new DBClasses();

            Models.getItemSchedReturn gret = dbclass.ItemSchedules();
            ViewBag.dtLabel = gret.dLabel;
            return(View(gret.ItemSched));
        }