Exemplo n.º 1
0
 public main_screen()
 {
     InitializeComponent();
     File_Operation.getp_csv(people, Personpath);
     File_Operation.getn_csv(notelist, Notespath);
     show_userlist();
 }
Exemplo n.º 2
0
        private void btn1_Click(object sender, EventArgs e)
        {
            string username = txt_1.Text;
            string password = Encryption.ComputeSha256Hash(txt_2.Text);
            bool   remember = false;
            bool   usertype = false;

            for (int i = 0; i < userlist.Count; i++)
            {
                User user = userlist[i];

                if (user.IsValid(username, password))
                {
                    MessageBox.Show("User is already exist");
                    txt_1.Clear();
                    txt_2.Clear();
                    txt_3.Clear();
                }
                else
                {
                    User user1 = new User(username, password, remember, usertype);
                    userlist.Add(user1);
                    File_Operation.set_csv(userlist, Userpath);
                    log_lbl.Visible   = true;
                    log_lbl.Text      = "Loading Successfull";
                    log_lbl.ForeColor = Color.Green;
                    t_register.Start();
                    return;
                }
            }
        }
Exemplo n.º 3
0
        private void pbook_del_btn_Click(object sender, EventArgs e)
        {
            string name        = name_txt.Text;
            string surname     = surname_txt.Text;
            string phonenumber = phone_txt.Text;
            string address     = address_txt.Text;
            string email       = mail_txt.Text;
            string description = description_txt.Text;

            Person person = new Person(name, surname, phonenumber, address, description, email);

            for (int i = 0; i < people.Count; i++)
            {
                Person person1 = people[i];

                if (person1.IsValidP(name, surname, phonenumber))
                {
                    people.RemoveAt(people.IndexOf(person1));
                    File_Operation.setp_csv(people, Personpath);
                }
            }

            show_userlist();

            personlist.SelectedItems[0].SubItems[0].Text = name;
            personlist.SelectedItems[0].SubItems[1].Text = surname;
            personlist.SelectedItems[0].SubItems[2].Text = phonenumber;
            personlist.SelectedItems[0].SubItems[3].Text = address;
            personlist.SelectedItems[0].SubItems[4].Text = description;
            personlist.SelectedItems[0].SubItems[5].Text = email;
        }
Exemplo n.º 4
0
        private void note_save_Click_1(object sender, EventArgs e)
        {
            notelist.Clear();

            string nname = notename_txt.Text;
            string note  = note_txt.Text;

            Notes notee = new Notes(nname, note);

            notelist.Add(notee);
            File_Operation.setn_csv(notelist, Notespath);
            show_userlist();
        }
Exemplo n.º 5
0
        private void pbook_add_btn_Click(object sender, EventArgs e)
        {
            string name        = name_txt.Text;
            string surname     = surname_txt.Text;
            string phonenumber = phone_txt.Text;
            string address     = address_txt.Text;
            string email       = mail_txt.Text;
            string description = description_txt.Text;
            Person person      = new Person(name, surname, phonenumber, address, description, email);

            people.Add(person);
            File_Operation.setp_csv(people, Personpath);
            show_userlist();
        }
Exemplo n.º 6
0
        private void update_btn_Click(object sender, EventArgs e)
        {
            confirm_lb.Visible = false;
            string username = txt_1.Text;
            string password = User_login.getIntance().User.Password;
            bool   remmber  = false;
            string cb       = usertype_cb.Text;
            bool   usertype = cb == "Admin" ? true : false;

            listView_user.SelectedItems[0].SubItems[0].Text = username;
            listView_user.SelectedItems[0].SubItems[1].Text = cb;

            User user = new User(username, password, remmber, usertype);

            userlist.Add(user);
            File_Operation.set_csv(userlist, Userpath);
            show_userlist();
        }
Exemplo n.º 7
0
        private void login_Click(object sender, EventArgs e)
        {
            string username   = txt_1.Text;
            string password   = Encryption.ComputeSha256Hash(txt_2.Text);
            bool   rememberMe = checkB_1.Checked;

            for (int i = 0; i < userlist.Count; i++)
            {
                User user = userlist[i];

                if (user.IsValid(username, password))
                {
                    user.RememberMe = rememberMe;
                    User_login.getIntance().User = user;
                    File_Operation.set_csv(userlist, Userpath);

                    lb_1.Visible   = true;
                    lb_1.Text      = "Succesfull";
                    lb_1.ForeColor = Color.Green;


                    if (user.Usertype == true)
                    {
                        progressBar1.Visible = true;
                        t_2.Enabled          = true;
                        return;
                    }
                    else
                    {
                        progressBar1.Visible = true;
                        t_1.Enabled          = true;
                        return;
                    }
                }
                else
                {
                    lb_1.Visible = true;
                }
                lb_1.Text      = "Failed";
                lb_1.ForeColor = Color.Red;
            }
        }
Exemplo n.º 8
0
        private void add__Click(object sender, EventArgs e)
        {
            confirm_lb.Visible = false;
            listView_user.Items.Clear();

            string username = txt_1.Text;
            string password = Encryption.ComputeSha256Hash(txt_2.Text);
            bool   remember = false;
            string cb       = usertype_cb.Text;
            bool   usertype = cb == "Admin" ? true : false;

            foreach (User user in userlist)
            {
                if (user.IsValid(username, password))
                {
                    confirm_lb.Visible = true;
                    confirm_lb.Text    = "User is already exist";
                    txt_1.Clear();
                    txt_2.Clear();
                    show_userlist();
                    return;
                }
            }
            if (username == "" || password == "")
            {
                confirm_lb.Visible = true;
                confirm_lb.Text    = "unfilled area";
                show_userlist();
                return;
            }
            User user1 = new User(username, password, remember, usertype);

            userlist.Add(user1);
            File_Operation.set_csv(userlist, Userpath);
            txt_1.Clear();
            txt_2.Clear();
            show_userlist();
            confirm_lb.Text    = "Loading Successfull";
            confirm_lb.Visible = true;
            return;
        }
Exemplo n.º 9
0
 public regster_screen()
 {
     InitializeComponent();
     File_Operation.get_csv(userlist, Userpath);
 }
Exemplo n.º 10
0
 public admin_screen()
 {
     InitializeComponent();
     File_Operation.get_csv(userlist, Userpath);
     show_userlist();
 }
Exemplo n.º 11
0
 public login_screen()
 {
     InitializeComponent();
     File_Operation.get_csv(userlist, Userpath);
     Check_Remmber();
 }