예제 #1
0
        public void Bind()
        {
            IPFinder __Ip = new IPFinder();

            __Ip.IPDetails();
            Check __Ckh = new Check();

            Country     = __Ip.Country;
            CountryCode = __Ip.CountryCode;
            MobileCode  = __Ckh.stringCheck("select top 1 MobileCode from Country where Country_Name='" + __Ip.Country + "'");
            CountryIcon = __Ckh.stringCheck("select top 1 Country_Icon from Country where Country_Name='" + __Ip.Country + "'");
        }
예제 #2
0
        private List <HttpCookie> _Add(string Log_id, string Reg_id, string Device)
        {
            __IPFinder.IPDetails();
            var Country     = __IPFinder.Country;
            var TimeZone    = __IPFinder.TimeZone;
            var IP          = __IPFinder.IP;
            var Offset      = __Check.stringCheck("select Offset from TimeZone where Time_Zone='" + TimeZone + "' ");
            int RememberMax = 7;

            _Random.DatabaseEntry = false;
            _Random.ApperCase     = true;
            _Random.Number        = true;
            _Random.TotalString   = 15;
            var Key = _Random.RandomStringNumber("Cookies_Key");

            __Encrypt.EncryptCode = Key;
            _Random.DatabaseEntry = true;
            _Random.ApperCase     = false;
            _Random.Number        = false;
            _Random.Hexadecimal   = true;
            _Random.TotalString   = 10;
            var SessionID  = _Random.RandomStringNumber("Sesion_ID");
            var RememberMe = _RememberMe == true ? "true" : "false";

            /*-----------------------------
             * key          in - 0
             * Session ID   in - 1
             * Active       in - 2
             * Country      in - 3
             * Time Zone    in - 4
             * ip           in - 5
             * Offset       in - 6
             * Remember me  in - 7
             * Reg id       in - 8
             * Login id     in - 9
             * ------------------------------*/
            _Cookies_Value_Encrypt = new string[] {
                Key,
                __Encrypt.HashCode(SessionID),
                __Encrypt.HashCode(Country),
                __Encrypt.HashCode(TimeZone),
                __Encrypt.HashCode(IP),
                __Encrypt.HashCode(Offset),
                __Encrypt.HashCode(RememberMe),
                __Encrypt.HashCode(Reg_id),
                __Encrypt.HashCode(Log_id),
                __Encrypt.HashCode("true")
            };
            _Cookies_Value = new string[] {
                Key,
                SessionID,
                Country,
                TimeZone,
                IP,
                Offset,
                RememberMe,
                Reg_id,
                Log_id,
                "true",
            };
            DateTimeZone __DateTime         = new DateTimeZone(Offset);
            DateTimeZone __BD_DateTime_Zone = new DateTimeZone("+06:00");

            this.SessionID = SessionID;
            var  UserCurrentDate = __DateTime.DateTimeResult("MM/dd/yyyy hh:mm:ss:fff tt");
            bool updateActive    = __Check.ExcutionNonQuery("update System_Session set Active='false' where Reg_ID='" + Reg_id + "' ");
            bool chkExcute       = __Check.ExcutionNonQuery(string.Format(@"insert into System_Session 
      (Session_id
      ,Active
      ,Country
      ,TimeZone
      ,IP
      ,Offset
      ,Rememberme
      ,Reg_ID
      ,Login_ID
      ,Decrypt_Key
      ,Machine_DateTime
      ,User_DateTime
      ,BD_DateTime
      ,ExpireDateTime
      ,Device
      ,DeviceFullDetails)
      
 values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',{7},{8},'{9}','{10}','{11}','{12}','{13}','{14}','{15}')
", SessionID, "true", Country, TimeZone, IP, Offset, RememberMe, Reg_id, Log_id, Key,
                                                                          DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss:fff tt"), UserCurrentDate,
                                                                          __BD_DateTime_Zone.DateTimeResult("MM/dd/yyyy hh:mm:ss:fff tt"), _RememberMe == true?__DateTime.DateTimes().AddDays(7).ToString("MM/dd/yyyy hh:mm:ss:fff tt"): UserCurrentDate,
                                                                          CurrentDevice(Device), Device));
            int i = 0;

            foreach (string Name in _Cookies_Name)
            {
                HttpCookie Cookiess = new HttpCookie(Name, _Cookies_Value_Encrypt[i]);
                if (_RememberMe)
                {
                    Cookiess.Expires = __DateTime.DateTimes().AddDays(RememberMax);
                }
                _Cookies.Add(Cookiess);

                i++;
            }
            if (!chkExcute)
            {
                ErrorMessage = "Excute Error: " + __Check.Messege;
            }
            if (!updateActive)
            {
                ErrorMessage += "update Error: " + __Check.Messege;
            }

            return(_Cookies);
        }