Beispiel #1
0
        private void Signin_Load(object sender, EventArgs e)
        {
            if (File.Exists("token.txt"))
            {
                string             token      = File.ReadAllText("token.txt");
                UserEndPointClient userClient = new UserEndPointClient();
                userDto            user       = userClient.me(token);
                if (user.type == "admin")
                {
                    this.Close();
                    Admin admin = new Admin();
                    admin.Show();
                }
                else
                {
                    this.Close();
                    Dashboard dash = new Dashboard();
                    dash.Show();
                }
            }
            else
            {
                //this.Hide();
                //Signin signIn = new Signin();
                //signIn.Show();
                //Application.Run(new First());

                //Console.WriteLine("File does not exist in the current directory!");
            }
        }
Beispiel #2
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);



                if (File.Exists("token.txt"))
                {
                    string             token      = File.ReadAllText("token.txt");
                    UserEndPointClient userClient = new UserEndPointClient();
                    userDto            user       = userClient.me(token);
                    if (user.type == "admin")
                    {
                        Application.Run(new Admin());
                    }
                    else
                    {
                        Application.Run(new Dashboard());
                    }
                }
                else
                {
                    //this.Hide();
                    //Signin signIn = new Signin();
                    //signIn.Show();
                    Application.Run(new First());

                    //Console.WriteLine("File does not exist in the current directory!");
                }
            }
            catch
            {
                MessageBox.Show("Unknown error", "Connection Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Run(new First());
            }
        }
Beispiel #3
0
        private void Profile_Load(object sender, EventArgs e)
        {
            //
            string             token      = File.ReadAllText("token.txt");
            UserEndPointClient userClient = new UserEndPointClient();
            userDto            user       = userClient.me(token);

            //userDto user = new userDto();
            if (user == null)
            {
            }
            else
            {
                currentUserNow = user;
                username.Text  = currentUserNow.username;
                firstname.Text = currentUserNow.fname;
                lastname.Text  = currentUserNow.lname;
                phone.Text     = currentUserNow.phone;
                email.Text     = currentUserNow.email;
                company.Text   = currentUserNow.company;
                status.Text    = currentUserNow.status.ToString();
            }
        }