Esempio n. 1
0
        static void Main(string[] args)
        {
            // вставить данные
            InsertData.Insert();

            // other part
            LRUCache h = new LRUCache(10);

            Console.WriteLine("sdsd");
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            data       d = new data();
            InsertData i = new InsertData();

            i.uname = "admin";
            i.pass  = "******";
            i.type  = "Admin";
            Auth a = new Auth();

            d = a.CheckLogin(i);
            Console.WriteLine(d.id);
            Console.WriteLine(d.msg);
            Console.WriteLine(d.username);
        }
Esempio n. 3
0
        public data CheckLogin(InsertData i)
        {
            data d = new data();

            try
            {
                if (string.Equals(i.type, "Admin"))
                {
                    var res = es.AdminRegistrations.Where(x => x.Admin_Name == i.uname && x.Admin_Password == i.pass).SingleOrDefault();
                    if (res == null)
                    {
                        d.msg = false;
                    }
                    else
                    {
                        d.msg      = true;
                        d.id       = res.Admin_ID;
                        d.username = res.Admin_Name;
                    }
                    return(d);
                }
                if (string.Equals(i.type, "User"))
                {
                    var res = es.Owner_Registration.Where(x => x.Owner_UserName == i.uname && x.Owner_Password == i.pass).SingleOrDefault();
                    if (res == null)
                    {
                        d.msg = false;
                    }
                    else
                    {
                        d.msg      = true;
                        d.id       = res.Owner_ID;
                        d.username = res.Owner_FirstName + " " + res.Owner_Lastname;
                    }
                    return(d);
                }
                else
                {
                    d.msg = false;
                    return(d);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }