コード例 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtTittle.Text == "")
            {
                MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            if (DataHandle.getInstance().checkTittleNote(txtTittle.Text) == false)
            {
                MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataHandle.getInstance().CreateNewNote(
                    new Notes()
                {
                    Tittle  = txtTittle.Text,
                    Content = txtContent.Text,
                    user_id = User_ID
                });

                DataHandle.getInstance().ShowNote();
                this.Dispose();
            }
        }
コード例 #2
0
        public void setComplete()
        {
            double x = 0;
            double y = 0;

            Projects p = DataHandle.getInstance().GetDataProject();

            foreach (ItemProjects i in p.item)
            {
                if (i.check == true)
                {
                    x++;
                }
                y++;
            }
            double a = y - x;

            x = ((x / y) * 100);
            if (x.ToString().Length > 5)
            {
                z = x.ToString().Substring(0, 5);
            }
            else
            {
                save = Convert.ToInt32(y - x);
                z    = x.ToString();
            }

            Form1.getInstance().ShowProject(p.Tittle, p.item, z, p.deadline, Convert.ToInt32(a));
        }
コード例 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtTittle.Text == "")
     {
         MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     if (DataHandle.getInstance().checkTittleReminder(txtTittle.Text) == false)
     {
         MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DataHandle.getInstance().CreateNewReminder(
             new Reminders()
         {
             Tittle  = txtTittle.Text,
             Content = txtContent.Text,
             Time    = dateTimePicker1.Value.ToString(),
             Check   = Convert.ToInt32(checkBox.Checked),
             User_id = User_ID
         });
         DataHandle.getInstance().ShowNote();
         this.Dispose();
     }
 }
コード例 #4
0
 private bool checkData(NoteMakingApp.Models.Account acc)
 {
     if (DataHandle.getInstance().doesAccountExit(acc))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #5
0
 private void Register_Click(object sender, EventArgs e)
 {
     if (checkUsername() && checkPassword() && checkConfirmation())
     {
         DataHandle.getInstance().saveAccount(
             new NoteMakingApp.Models.Account()
         {
             username = iUsername.Text,
             password = iPassword.Text,
             creator  = 0
         });
         nullifyField();
         Form1.getInstance().setWindow("Login");
     }
 }
コード例 #6
0
 public ListProject()
 {
     InitializeComponent();
     instance = this;
     this.flowLayoutPanel1.Controls.Clear();
     DataHandle.getInstance().GetDataFromProject();
     AddProject(0, "New Project");
     foreach (Projects t in DataHandle.prjs)
     {
         if (t.user_id == user_id)
         {
             AddProject(t.id, t.Tittle);
         }
     }
 }
コード例 #7
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtTittle.Text == "")
     {
         MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     if (DataHandle.getInstance().checkEditReminderNote(txtTittle.Text) == false)
     {
         MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DataHandle.getInstance().EditReminder(txtTittle.Text, txtContent.Text, dateTimePicker1.Value.ToString(), Convert.ToInt16(checkBox.Checked));
         DataHandle.getInstance().ShowNote();
         this.Dispose();
     }
 }
コード例 #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            if(button2.Text == "Terminate Server")
            {
                Connection.peer.Close();
                button2.Text = "Generate Server";
                lbSServerIP.Text = "___";
                lbSServerName.Text = "___";
            }
            else
            {
                Form1.connection.startServer();
                button2.Text = "Terminate Server";
                lbSServerIP.Text = Connection.endpoint.Address.ToString();

                lbSServerName.Text = DataHandle.getInstance().getRecentAccount().username;
            }
            
        }
コード例 #9
0
 private void TextBox_TextChanged(object sender, EventArgs e)
 {
     DataHandle.getInstance().EditNote(this.Text, this.TextBox.Text);
     DataHandle.getInstance().ShowNote();
 }
コード例 #10
0
 private void bSave_Click(object sender, EventArgs e)
 {
     this.Visible = false;
     DataHandle.getInstance().EditAvt(ImagePath, _id_);
     Form1.UpdateAvt();
 }
コード例 #11
0
        public void button_Click(object sender, EventArgs e)
        {
            switch (fun)
            {
            case 1:
                Form1.getInstance().ShowTypeNote();
                //Form1.getInstance().NewNote();
                break;

            case 2:     //edit
                if (Form1.type == 0)
                {
                    MessageBox.Show("Vui lòng thử lại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    switch (Form1.type)
                    {
                    case 1:
                        Notes a = DataHandle.getInstance().GetDataFromNote();
                        Form1.getInstance().editNote(a.Tittle, a.Content);
                        break;

                    case 2:
                        ToDoLists b = DataHandle.getInstance().GetDataToDoList();
                        if (b == null)
                        {
                            MessageBox.Show("Choose note to edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            Form1.getInstance().editToDoList(b.Tittle, b.item);
                        }
                        break;

                    case 3:
                        Reminders c = DataHandle.getInstance().GetDateReminder();
                        if (c == null)
                        {
                            MessageBox.Show("Choose note to edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            Form1.getInstance().EditReminder(c.Tittle, c.Content, c.Time, c.Check);
                        }
                        break;
                    }
                }


                break;

            case 3:     //delete

                if (Form1.type == 0)
                {
                    MessageBox.Show("Vui lòng thử lại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    switch (Form1.type)
                    {
                    case 1:
                        DataHandle.getInstance().DeleteNote();
                        DataHandle.getInstance().ShowNote();
                        break;

                    case 2:
                        DataHandle.getInstance().DeleteToDoList();
                        DataHandle.getInstance().ShowNote();
                        break;

                    case 3:
                        DataHandle.getInstance().DeleteReminder();
                        DataHandle.getInstance().ShowNote();
                        break;
                    }
                }
                break;

            case 4:
                if (Form1.type == 0)
                {
                    MessageBox.Show("Vui lòng thử lại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    switch (Form1.type)
                    {
                    case 1:         //note
                        Notes a = DataHandle.getInstance().GetDataFromNote();
                        if (Connection.clientStatus == -1)
                        {
                            MessageBox.Show("No connection is found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if (Connection.clientStatus == 0)
                        {
                            Connection.DistributeNote(a);
                        }
                        else
                        {
                            Form1.connection.CSendNote(a);
                        }
                        break;

                    case 2:        //tdl
                        break;

                    case 3:        //rmd
                        Reminders rmd = DataHandle.getInstance().GetDateReminder();
                        if (Connection.clientStatus == -1)
                        {
                            MessageBox.Show("No connection is found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if (Connection.clientStatus == 0)
                        {
                            Connection.DistributeReminder(rmd);
                        }
                        else
                        {
                            Form1.connection.CSendReminder(rmd);
                        }
                        break;
                    }
                }
                break;
            }
        }
コード例 #12
0
 private static void initData()
 {
     data = DataHandle.getInstance();
 }
コード例 #13
0
        public void setWindow(string option = "")
        {
            if (loggedIn == true)
            {
                Console.WriteLine(option);
                switch (option)
                {
                case "Login":
                    this.loginPanel1.Hide();
                    this.navigationBar.username.Text = IDname;
                    this.navigationBar.setID(ID);
                    this.navigationBar.Show();
                    this.mainDomain1.Show();
                    this.accountSubwindow2.Visible = false;
                    DataHandle.getInstance().ShowNote();
                    this.navigationBar.LoadAvt(DataHandle.getInstance().GetAvt(ID));
                    break;

                case "Logout":
                    this.loginPanel1.Show();
                    this.navigationBar.Hide();
                    this.mainDomain1.Hide();
                    this.accountSubwindow2.Visible = false;
                    this.networkSubWindow1.Visible = false;
                    DataHandle.getInstance().ShowNote();
                    this.navigationBar.LoadAvt(DataHandle.getInstance().GetAvt(ID));
                    break;

                case "ACCOUNT":
                    this.accountSubwindow2.Visible = true;
                    networkSubWindow1.Visible      = false;

                    this.mainDomain1.Hide();
                    break;

                case "HOME":
                    this.mainDomain1.Show();
                    networkSubWindow1.Visible      = false;
                    this.accountSubwindow2.Visible = false;
                    networkSubWindow1.Visible      = false;

                    break;

                case "SETTINGS":
                    networkSubWindow1.Visible      = true;
                    this.accountSubwindow2.Visible = false;

                    this.mainDomain1.Hide();
                    break;
                }
            }
            else
            {
                switch (option)
                {
                case "Login":
                    this.registerPanel.Hide();
                    this.loginPanel1.Show();
                    break;

                case "Register":
                    this.loginPanel1.Hide();
                    this.registerPanel.Show();
                    break;
                }
            }
        }