Exemple #1
0
 private void bLogin_Click(object sender, EventArgs e)
 {
     if (checkInputs() >= 0)
     {
         NoteMakingApp.Models.Account acc = new NoteMakingApp.Models.Account()
         {
             username = iUsername.Text,
             password = iPassword.Text
         };
         if (checkData(acc))
         {
             Console.WriteLine("login step");
             DataHandle.id = acc.id;
             Form1.setID(DataHandle.id);
             Form1.IDname = acc.username; // here
             Form1.getInstance().setLoggedIn(true);
             NewNote.User_ID     = acc.id;
             NewToDoList.User_ID = acc.id;
             NewReminder.User_ID = acc.id;
             NewProject.User_ID  = acc.id;
             ListProject.user_id = acc.id;
         }
         else
         {
             ePassword.Visible = true;
             ePassword.Text    = "ID or password incorrect";
         }
     }
 }
Exemple #2
0
 private bool checkData(NoteMakingApp.Models.Account acc)
 {
     if (DataHandle.getInstance().doesAccountExit(acc))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
        public void SaveChanges()
        {
            foreach (EditionItem i in this.pnlEditors.Controls)
            {
                switch (i.function)
                {
                case 0:
                    break;

                case 1:
                    DataHandle.getInstance().deleteDetail(i.getOriginalDetail());
                    break;

                case 2:
                    if (!i.isGeneralDetail)
                    {
                        DataHandle.getInstance().updateDetail(i.getOriginalDetail(), i.generateDetail());
                    }
                    else
                    {
                        switch (i.originDetail.subcategory)
                        {
                        case "Introduction":
                            person.introduction = i.GetContent();
                            DataHandle.getInstance().UpdatePerson(person);
                            break;

                        case "Name":
                            person.name = i.GetContent();
                            DataHandle.getInstance().UpdatePerson(person);
                            break;

                        case "Password":
                            password = i.GetAccount();
                            DataHandle.getInstance().UpdateAccount(password);
                            break;
                        }
                    }

                    break;
                }
            }
        }