private LoginInterface CreateObject(NullHandler oReader)
        {
            LoginInterface oLoginInterface = new LoginInterface();

            MapObject(oLoginInterface, oReader);
            return(oLoginInterface);
        }
Example #2
0
        static void Main(string[] args)
        {
            StudentRepository studentRepository = new StudentRepository();
            LibraryRepository libraryRepository = new LibraryRepository();
            LoansRepository   loansRepository   = new LoansRepository();

            Console.WriteLine("################");
            Console.WriteLine("# de schoolbib #");
            Console.WriteLine("################");

            Console.WriteLine("Druk op toets om door te gaan.");
            Console.ReadKey();


            LoginInterface login = new LoginInterface();

            //Open login interface
            login.ShowLoginInterface();

            //openselfservice
            LoanBookInterface loanBookInterface = new LoanBookInterface(login.LoggedStudent);
            ReturnInterface   returnInterface   = new ReturnInterface(login.LoggedStudent);
            AllLoans          allLoans          = new AllLoans(login.LoggedStudent);
            PayFines          payFines          = new PayFines(login.LoggedStudent);
            char choice;

            do
            {
                Console.Clear();
                Console.WriteLine("###############");
                Console.WriteLine("# Selfservice #");
                Console.WriteLine("###############" + Environment.NewLine);
                Console.WriteLine($"Welcome {login.LoggedStudent.FirstName} {login.LoggedStudent.LastName}!");
                Console.WriteLine("a. Boek Lenen");
                Console.WriteLine("b. Boek Inleveren ");
                Console.WriteLine("c. Overzicht van ontlening bekijken");
                Console.WriteLine("d. Ontlening verlengen");
                Console.WriteLine("e. Boetes betalen");
                Console.WriteLine("x. exit");
                Console.Write("Maak je keuze:");

                choice = Convert.ToChar(Console.ReadLine().ToLower());

                switch (choice)
                {
                case 'a': loanBookInterface.ShowLoanBookInterface(); break;

                case 'b': returnInterface.ReturnBook(); break;

                case 'c': allLoans.GetLoans(); break;

                //case 'd': .ExtendLoan(); break;
                case 'e': payFines.ShowFines(); break;
                }
            } while (choice != 'x');



            Console.ReadKey();
        }
        private async void Button_OnClicked(object sender, EventArgs e)
        {
            Debug.WriteLine("aaaaaaaaaaaaaaaaaaaaaa");

            var login    = TxtUsername.Text;
            var password = TxtPassword.Text;


            var newobj = new LoginInterface
            {
                login = login,
                senha = password
            };

            var j = JsonConvert.SerializeObject(newobj);

            var request = await Http.Post("http://10.41.18.29/portaria/api/usuario/login", newobj);

            var t = request.Content.ReadAsStringAsync();


            Debug.WriteLine(t);

            await Navigation.PushAsync(new PageHome(), true);
        }
Example #4
0
        public JsonResult Add_User(User u)
        {
            bool result = false;

            LoginInterface loginInit = new LoginInterface();

            result = loginInit.AddUser(u);

            return(Json(result));
        }
Example #5
0
        //用户登录
        public JsonResult Validation_User(User u)
        {
            bool result = false;

            LoginInterface loginInit = new LoginInterface();

            result = loginInit.ValidationUser(u);

            return(Json(result));
        }
Example #6
0
    static void LoadLoginService(string serviceName)
    {
        if (serviceName == "null")
        {
            return;
        }

        Type serviceType = Type.GetType(serviceName);

        s_loginService = (LoginInterface)Activator.CreateInstance(serviceType);

        s_loginService.m_callBack = LoginCallBack;
    }
        private void MapObject(LoginInterface oLoginInterface, NullHandler oReader)
        {
            BusinessObject.Factory.SetID(oLoginInterface, new ID(oReader.GetInt32("user_id")));
            oLoginInterface.user_code     = oReader.GetInt32("user_code");
            oLoginInterface.user_fst_name = oReader.GetString("user_fst_name");
            oLoginInterface.user_lst_name = oReader.GetString("user_lst_name");
            oLoginInterface.user_name     = oReader.GetString("user_name");
            oLoginInterface.user_pass     = oReader.GetString("user_pass");
            oLoginInterface.user_type     = (EnumUserType)oReader.GetInt32("user_type");
            oLoginInterface.user_islogon  = oReader.GetBoolean("user_islogon");
            oLoginInterface.user_lock     = oReader.GetBoolean("user_lock");
            oLoginInterface.user_status   = (EnumUserStatus)oReader.GetInt32("user_status");
            //oLoginInterface.IsAuthorise = oReader.GetBoolean("IsAuthorise");

            BusinessObject.Factory.SetObjectState(oLoginInterface, ObjectState.Saved);
        }
Example #8
0
    static void LoadService(SchemeData data)
    {
        s_loginService = (LoginInterface)AnalysisConfig(data.LoginScheme);
        s_ADService    = (ADInterface)AnalysisConfig(data.ADScheme);
        s_payService   = (PayInterface)AnalysisConfig(data.PayScheme);

        s_logServiceList = new List <LogInterface>();
        for (int i = 0; i < data.LogScheme.Count; i++)
        {
            s_logServiceList.Add((LogInterface)AnalysisConfig(data.LogScheme[i]));
        }

        s_otherServiceList = new List <OtherSDKInterface>();
        for (int i = 0; i < data.OtherScheme.Count; i++)
        {
            s_otherServiceList.Add((OtherSDKInterface)AnalysisConfig(data.OtherScheme[i]));
        }
    }
        public LoginInterface Get(LoginInterface oLoginInterface)
        {
            try
            {
                bool   result = true;
                string sUN    = "";
                string sUP    = "";
                //int nUserType = (int) oLoginInterface.user_type;
                sUN = oLoginInterface.user_name;
                //sUP = EMSGlobal.Encrypt(oLoginInterface.Password);
                sUP = oLoginInterface.user_pass;

                //SqlCommand cmd = new SqlCommand("SP_GetUserLoginInfo", _conn);

                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add(new SqlParameter("@user_name", SqlDbType.VarChar)).Value = oLoginInterface.user_name;
                //cmd.Parameters.Add(new SqlParameter("@user_pass", SqlDbType.VarChar)).Value = oLoginInterface.user_pass;
                //cmd.Parameters.Add(new SqlParameter("@MacAddres", SqlDbType.VarChar)).Value = oLoginInterface.MacAddres;
                //if (_conn.State == ConnectionState.Open) { }
                //else { cmd.Connection.Open(); }
                //IDataReader reader = cmd.ExecuteReader();
                //NullHandler oReader = new NullHandler(reader);
                //if (reader.Read())
                //{
                //    oLoginInterface = CreateObject(oReader);
                //}
                //cmd.Dispose();
                //cmd.Connection.Close();

                //if (oLoginInterface.ID.ToInt32 > 0)
                //{
                //    if (oLoginInterface.ObjectID == 1)
                //    { }
                //    else
                //    {
                //        if (oLoginInterface.MacAddres == string.Empty)
                //        {
                //            throw new Exception("Unauthorised Machin. Please contact with admin.");
                //        }
                //        if (oLoginInterface.IsAuthorise == false)
                //        {
                //            throw new Exception("Unauthorised Machin. Please contact with admin.");
                //        }
                //        if (oLoginInterface.user_lock == true)
                //        {
                //            throw new Exception("Account is Locked. Please contact with admin.");
                //        }
                //        if (oLoginInterface.user_status == EnumUserStatus.Suspend)
                //        {
                //            throw new Exception("Account has been suspended. Please contact with admin.");
                //        }
                //        if (oLoginInterface.user_islogon == true)
                //        {
                //            throw new Exception("Someone using this ID. Please Try another ID.");
                //        }
                //        string QueryString3 = "UPDATE User_Table SET user_islogon=1 WHERE user_id=" + oLoginInterface.ObjectID;
                //        ExecuteQueryFunctions.ExeSclr(_conn, QueryString3);
                //    }
                //}
                //else
                //{
                //    throw new Exception("Incorrect User ID. Please type a correct User ID.");
                //}



                string QueryString = "SELECT COUNT(*) FROM User_Table WHERE user_name ='" + sUN + "' AND user_pass ='******'";
                result = ExecuteQueryFunctions.ExeSclr(_conn, QueryString);
                if (result)
                {
                    string      QueryString2 = "SELECT * FROM User_Table WHERE user_name ='" + sUN + "' AND user_pass ='******'";
                    IDataReader reader       = ExecuteQueryFunctions.ExeReader(_conn, QueryString2);
                    NullHandler oReader      = new NullHandler(reader);
                    if (reader.Read())
                    {
                        oLoginInterface = CreateObject(oReader);
                    }
                    reader.Close();

                    //string QueryString3 = "SELECT * FROM tbl_UserSecurity AS TUS WHERE TUS.user_id=" + oLoginInterface.ObjectID;

                    _conn.Close();

                    if (oLoginInterface.ObjectID == 1)
                    {
                    }
                    else
                    {
                        //if ((int)oLoginInterface.user_type != nUserType)
                        //{
                        //    throw new Exception("Yor are not authenticated in this type of user. Please select your area.");
                        //}
                        if (oLoginInterface.user_lock == true)
                        {
                            throw new Exception("Account is Locked. Please contact with admin.");
                        }
                        if (oLoginInterface.user_status == EnumUserStatus.Suspend)
                        {
                            throw new Exception("Account has been suspended. Please contact with admin.");
                        }
                        if (oLoginInterface.user_islogon == true)
                        {
                            throw new Exception("Someone using this ID. Please Try another ID.");
                        }
                        //string QueryString3 = "UPDATE User_Table SET user_islogon=1 WHERE user_id=" + oLoginInterface.ObjectID;
                        //ExecuteQueryFunctions.ExeSclr(_conn, QueryString3);
                    }
                    //ExecuteQueryFunctions.ExeNonQuery(_conn, "EXEC dbo.SP_UpdateCelcInst");
                }
                else
                {
                    throw new Exception("Incorrect User ID. Please type a correct User ID.");
                }
            }
            catch (Exception e)
            {
                throw new ServiceException(e.Message);
            }

            return(oLoginInterface);
        }
Example #10
0
        public void ChangeLoggedAdminPasswordLoginInterfaceTest()
        {
            LoginInterface logInt = new LoginInterface();

            Assert.Fail();
        }
 public ClientSession(LoginInterface login)
 {
     this.login             = login;
     this.eventListenersMap = new Dictionary <int, EventListener>();
 }
Example #12
0
 public LoginBL(LoginInterface login)
 {
     _login = login;
 }
Example #13
0
 public LoginRepo(LoginInterface loginInterface)
 {
     this.loginInterface = loginInterface;
 }