private void btnLogin_Click(object sender, EventArgs e)
        {
            loginBll.Username = txtusername.Text;

            loginBll.UPassword = txtPassword.Text;



            if (comboBox1.Text == "Admin")
            {
                if (txtusername.Text == "Admin" && txtPassword.Text == "Admin")
                {
                    this.Hide();
                    Users usr = new Users();
                    usr.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Incorrect UserName or Password");
                    txtusername.Text = "";
                    txtPassword.Text = "";
                    return;
                }
            }
            else if (comboBox1.Text == "User")
            {
                if (loginBll.check())
                {
                    int uid;
                    uid = loginBll.selectID();
                    StickyNotes stickynotes = new StickyNotes(uid);
                    MessageBox.Show("Login Successful");
                    this.Hide();
                    stickynotes.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("UserName and Password Donot Match");
                    txtusername.Text = "";
                    txtPassword.Text = "";
                    return;
                }
            }

            else
            {
                MessageBox.Show("Please select UserType");
                return;
            }
        }
Exemple #2
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();

            StickyNotes sticky = new StickyNotes(stickynotesBll.UserID);

            sticky.ShowDialog();
            this.Close();
            parentPanel.Controls.Clear();
            dt        = stickynotesBll.NoteCount();
            dataTable = stickynotesBll.getNote();
            load();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string selectedID;

            selectedID = cmbcategory.SelectedValue.ToString();
            createformBll.CategoryID = int.Parse(selectedID.ToString());
            bool completed;
            bool stickied;

            if (chkCompleted.Checked == true)
            {
                completed = true;
            }
            else
            {
                completed = false;
            }

            if (chkStickied.Checked == true)
            {
                stickied = true;
            }
            else
            {
                stickied = false;
            }


            createformBll.DateCreated = dateTimePicker1.Text;
            createformBll.Completed   = completed;
            createformBll.Sticked     = stickied;
            createformBll.Title       = txttitle.Text;
            createformBll.Contents    = txtnote.Text;
            if (cmbcategory.Text == "")
            {
                return;
            }
            if (txttitle.Text == "")
            {
                return;
            }
            else
            {
                createformBll.insert();
            }
            StickyNotes stickyNotes = new StickyNotes(createformBll.UserID);

            this.Close();
            this.Hide();
            stickyNotes.ShowDialog();
        }
Exemple #4
0
        private void load()
        {
            int x, y;

            x = 50;
            y = 30;
            int j = 1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //childpanel
                Panel childPanel = new Panel();
                childPanel.Location  = new Point(x, y);
                childPanel.BackColor = Color.Red;
                childPanel.Size      = new Size(290, 264);

                //label1
                Label lblCategory = new Label();
                lblCategory.Font          = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                lblCategory.Location      = new System.Drawing.Point(0, 0);
                lblCategory.Size          = new System.Drawing.Size(1, 1);
                lblCategory.Text          = dataTable.Rows[i]["CategoryID"].ToString();
                stickynotesBll.CategoryID = Int32.Parse(lblCategory.Text);
                DataTable dt1 = stickynotesBll.Category();

                //lblNoteid
                Label lblid = new Label();
                lblid.Location = new Point(1, 2);
                lblid.Visible  = false;
                lblid.Text     = dataTable.Rows[i]["NoteID"].ToString();


                Label lblCategoryname = new Label();
                lblCategoryname.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                lblCategoryname.Location = new System.Drawing.Point(3, 7);
                lblCategoryname.Size     = new System.Drawing.Size(130, 16);
                lblCategoryname.Text     = dt1.Rows[0]["CategoryType"].ToString();

                //
                Label lblTitle = new Label();
                lblTitle.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                lblTitle.Location = new System.Drawing.Point(3, 34);
                lblTitle.Size     = new System.Drawing.Size(130, 16);
                lblTitle.TabIndex = 1;
                lblTitle.Text     = dataTable.Rows[i][1].ToString();

                //datapicker
                Label date = new Label();
                date.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                date.Location = new System.Drawing.Point(182, 3);
                date.Size     = new System.Drawing.Size(105, 22);
                date.Text     = dataTable.Rows[i][0].ToString();

                //checkbox1
                CheckBox chk1 = new CheckBox();
                chk1.Text     = "Completed";
                chk1.Location = new Point(6, 235);
                chk1.Size     = new Size(102, 20);
                chk1.Font     = new Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                if (dataTable.Rows[i][4].ToString() == "False")
                {
                    chk1.Checked = false;
                }
                else if (dataTable.Rows[i][4].ToString() == "True")
                {
                    chk1.Checked = true;
                }

                //checkbox2
                CheckBox chk2 = new CheckBox();
                chk2.Text     = "Sticked";
                chk2.Location = new Point(114, 235);
                chk2.Size     = new Size(83, 20);
                chk2.Font     = new Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
                if (dataTable.Rows[i][3].ToString() == "False")
                {
                    chk2.Checked = false;
                }
                else if (dataTable.Rows[i][3].ToString() == "True")
                {
                    chk2.Checked = true;
                }

                //textbox
                RichTextBox textContent = new RichTextBox();
                textContent.Location  = new Point(6, 54);
                textContent.Multiline = true;
                textContent.Size      = new Size(223, 175);
                textContent.BackColor = Color.LightYellow;
                textContent.Font      = new Font("Arial", 11);
                textContent.Text      = dataTable.Rows[i][2].ToString();
                //picUpdate
                PictureBox picUpdate = new PictureBox();
                picUpdate.Image    = global::Utkrishta_StickyNotes.Properties.Resources.edit;
                picUpdate.Location = new Point(245, 54);
                picUpdate.Size     = new Size(35, 51);
                picUpdate.SizeMode = PictureBoxSizeMode.Zoom;
                picUpdate.Cursor   = Cursors.Hand;
                picUpdate.Click   += (s, a) =>
                {
                    stickynotesBll.NoteID   = int.Parse(lblid.Text);
                    stickynotesBll.Contents = textContent.Text;
                    if (chk1.Checked == true)
                    {
                        stickynotesBll.Completed = true;
                    }
                    else
                    {
                        stickynotesBll.Completed = false;
                    }
                    if (chk2.Checked == true)
                    {
                        stickynotesBll.Sticked = true;
                    }
                    else
                    {
                        stickynotesBll.Sticked = false;
                    }


                    stickynotesBll.update();
                    MessageBox.Show("Successfully Edited");
                };
                // picDelete
                PictureBox picDelete = new PictureBox();
                picDelete.Image    = global::Utkrishta_StickyNotes.Properties.Resources.delete;
                picDelete.Location = new Point(245, 120);
                picDelete.Size     = new Size(35, 51);
                picDelete.SizeMode = PictureBoxSizeMode.Zoom;
                picDelete.Cursor   = Cursors.Hand;
                picDelete.Click   += (s, a) =>
                {
                    MessageBox.Show("Deleted");
                    this.Close();
                    this.Hide();
                    StickyNotes sticky = new StickyNotes(stickynotesBll.UserID);
                    stickynotesBll.NoteID = int.Parse(lblid.Text);

                    stickynotesBll.delete();
                    stickynotesBll.getNote();
                    sticky.ShowDialog();
                };


                //add controls
                childPanel.Controls.Add(lblCategory);
                childPanel.Controls.Add(lblTitle);
                childPanel.Controls.Add(lblCategoryname);
                childPanel.Controls.Add(lblCategory);
                childPanel.Controls.Add(picUpdate);
                childPanel.Controls.Add(picDelete);
                childPanel.Controls.Add(textContent);
                childPanel.Controls.Add(chk1);
                childPanel.Controls.Add(chk2);
                childPanel.Controls.Add(date);
                parentPanel.Controls.Add(childPanel);

                if (x + childPanel.Width > parentPanel.Width)
                {
                    x = 50;
                    y = y + childPanel.Width + -5;
                    childPanel.Location = new Point(x, y);
                }
                else
                {
                    childPanel.Location = new Point(x, y);
                }
                parentPanel.Controls.Add(childPanel);

                x = x + childPanel.Width + 21;
                j = j + 1;
            }
        }