private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int ref_id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[2].Value);

            string command = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

            if (command == "Edit")
            {
                Edit_References er = new Edit_References(ref_id);
                er.userID = userid;
                this.Close();
                er.Show();
            }
            else if (command == "Delete")
            {
                try
                {
                    string      qry   = "delete from tbl_References where Ref_Id=" + ref_id;
                    DatabaseCon dbcon = new DatabaseCon();
                    dbcon.Query = qry;
                    dbcon.ExecuteQuery();
                    MessageBox.Show("Data deleted successfully");

                    loadReferences();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
 private void loadReferences()
 {
     try
     {
         string qry;
         if (Tag == null)
         {
             qry            = "select * from tbl_References where UserId =" + userid;
             txtHeader.Text = " References you have added ";
         }
         else
         {
             this.txtSearch.Hide();
             this.pictureBox2.Hide();
             qry = "select * from [tbl_References] where UserId=" + userid + " and Title like '%"
                   + Tag + "%' or Authors_Fname like '%" + Tag + "%' or Authors_Lname like '%" + Tag
                   + "%' or Document_type like '%" + Tag + "%' or Year like '%" + Tag
                   + "%' or Publisher like '%" + Tag + "%' or Abstract like '%" + Tag
                   + "%' or Name like '%" + Tag + "%' or Issue like '%" + Tag + "%' or Volume like '%"
                   + Tag + "%' or Notes like '%" + Tag + "%'";
             txtHeader.Text = " References that are tagged in ";
         }
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 private void viewAllReferences_Load(object sender, EventArgs e)
 {
     try
     {
         string qry;
         if (Tag == null)
         {
             qry            = "select * from [tbl_References]";
             txtHeader.Text = " References added by every user ";
         }
         else
         {
             qry = "select * from [tbl_References] where Title like '%" + Tag
                   + "%' or Authors_Fname like '%" + Tag + "%' or Authors_Lname like '%"
                   + Tag + "%' or Document_type like '%" + Tag + "%' or Year like '%"
                   + Tag + "%' or Publisher like '%" + Tag + "%' or Abstract like '%"
                   + Tag + "%' or Name like '%" + Tag + "%' or Issue like '%" + Tag
                   + "%' or Volume like '%" + Tag + "%' or Notes like '%" + Tag + "%'";
             txtHeader.Text = " References that are tagged in ";
         }
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 4
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string command = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            int    tag_Id  = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value);

            if (command == "Tagged Article")
            {
                try
                {
                    string      qry   = "select Tag from [tbl_Tags] where Tag_Id =" + tag_Id;
                    DatabaseCon dbcon = new DatabaseCon();
                    dbcon.Query = qry;
                    DataTable dt  = dbcon.GetData();
                    string    Tag = dt.Rows[0]["Tag"].ToString();

                    viewAllReferences var = new viewAllReferences();
                    var.Tag = Tag;
                    var.Show();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemplo n.º 5
0
        private void Home_Load(object sender, EventArgs e)
        {
            try
            {
                string      qry   = "select First_Name from [tbl_User] where ID =" + userId;
                DatabaseCon dbcon = new DatabaseCon();
                dbcon.Query = qry;
                DataTable dt = dbcon.GetData();

                Label lbl_welcome = new Label();
                lbl_welcome.AutoSize = true;
                lbl_welcome.Font     = new System.Drawing.Font("Century Gothic", 13.8F, System.Drawing.FontStyle.Bold,
                                                               System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                lbl_welcome.Location = new System.Drawing.Point(20, 45);
                lbl_welcome.Size     = new System.Drawing.Size(188, 43);
                lbl_welcome.Text     = "Welcome, " + dt.Rows[0]["First_Name"].ToString() + "!!!";
                this.Controls.Add(lbl_welcome);

                combo_style.Items.Add("Harvard");
                combo_style.Items.Add("APA");
                combo_style.Items.Add("Chicago");
                combo_style.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Edit_References_Load(object sender, EventArgs e)
        {
            string      qry   = "select * from tbl_References where Ref_Id =" + referenceId;
            DatabaseCon dbcon = new DatabaseCon();

            dbcon.Query = qry;
            DataTable dt = dbcon.GetData();

            if (dt.Rows.Count > 0)
            {
                txtTitle.Text         = dt.Rows[0]["Title"].ToString();
                txtAuthors_Fname.Text = dt.Rows[0]["Authors_Fname"].ToString();
                txtAuthors_Lname.Text = dt.Rows[0]["Authors_Lname"].ToString();
                txtDocumenttype.Text  = dt.Rows[0]["Document_type"].ToString();
                txtYear.Text          = dt.Rows[0]["Year"].ToString();
                txtPublisher.Text     = dt.Rows[0]["Publisher"].ToString();
                txtCity.Text          = dt.Rows[0]["Publisher"].ToString();
                txtAbstract.Text      = dt.Rows[0]["Abstract"].ToString();
                txtName.Text          = dt.Rows[0]["Name"].ToString();
                txtIssue.Text         = dt.Rows[0]["Issue"].ToString();
                txtVolume.Text        = dt.Rows[0]["Volume"].ToString();
                txtPageno.Text        = dt.Rows[0]["Page_no"].ToString();
                txtNotes.Text         = dt.Rows[0]["Notes"].ToString();
            }
        }
Exemplo n.º 7
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string gender = "";

            if (radioMale.Checked)
            {
                gender = "Male";
            }
            else if (radioFemale.Checked)
            {
                gender = "Female";
            }
            else if (radioOthers.Checked)
            {
                gender = "Others";
            }
            else
            {
                MessageBox.Show("Please choose your gender.");
            }

            UserValidation uv = new UserValidation();

            if (uv.emptyValidation(txtFname.Text) == true && uv.emptyValidation(txtSurname.Text) == true)
            {
                if (!string.IsNullOrEmpty(gender))
                {
                    try
                    {
                        string qry = "update tbl_User set First_Name ='" + txtFname.Text + "', Surname ='"
                                     + txtSurname.Text + "', Address ='" + txtAddress.Text + "', Gender ='" + gender
                                     + "', Phone ='" + txtPhone.Text + "', Dob ='" + Datetimepicker_dob.Value.Date
                                     + "' where ID = " + userid;
                        DatabaseCon dbcon = new DatabaseCon();
                        dbcon.Query = qry;
                        dbcon.ExecuteQuery();
                        MessageBox.Show("Data Edited");
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Please choose your gender.");
                    radioMale.Focus();
                }
            }
            else
            {
                MessageBox.Show("Please Enter Your Full Name");
                txtFname.Focus();
            }
        }
Exemplo n.º 8
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string command = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            int    tag_Id  = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[3].Value);

            if (command == "Edit")
            {
                Edit_Tags et = new Edit_Tags(tag_Id);
                et.UserID = userId;
                this.Close();
                et.Show();
            }
            else if (command == "Delete")
            {
                try
                {
                    string      qry   = "delete from [tbl_Tags] where Tag_Id =" + tag_Id;
                    DatabaseCon dbcon = new DatabaseCon();
                    dbcon.Query = qry;
                    dbcon.ExecuteQuery();
                    MessageBox.Show("Data deleted successfully");

                    loadTag();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else if (command == "Tagged Article")
            {
                try
                {
                    string      qry   = "select Tag from [tbl_Tags] where Tag_Id =" + tag_Id;
                    DatabaseCon dbcon = new DatabaseCon();
                    dbcon.Query = qry;
                    DataTable dt  = dbcon.GetData();
                    string    Tag = dt.Rows[0]["Tag"].ToString();

                    View_myReferences vr = new View_myReferences(userId);
                    vr.Tag = Tag;
                    this.Close();
                    vr.Show();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemplo n.º 9
0
 private void loadTag()
 {
     try
     {
         string      qry   = "select * from tbl_Tags where UserId =" + userId;
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
 public DataTable login(string email, string pw)
 {
     try
     {
         string      qry   = "select * from tbl_User where Email= '" + email + "' and Password = '******'";
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 11
0
 public DataTable userdata(int userid)
 {
     try
     {
         string      qry   = "select * from tbl_User where ID =" + userid;
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 12
0
 public bool insertTag()
 {
     try
     {
         string      qry   = "insert into tbl_Tags values ('" + Tag + "'," + UserId + ")";
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         dbcon.ExecuteQuery();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 13
0
 private void ViewAllTags_Load(object sender, EventArgs e)
 {
     try
     {
         string      qry   = "select * from [tbl_Tags]";
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 14
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            loginUserdata l  = new loginUserdata();
            DataTable     dt = l.userdata(userid);

            if (dt.Rows[0]["Password"].ToString() == txtCurrentpw.Text)
            {
                if (txtNewpw.Text == txtConfirmpw.Text)
                {
                    DialogResult result1 = MessageBox.Show("Are you sure you want to Change password?",
                                                           "The Question", MessageBoxButtons.YesNo,
                                                           MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (result1 == DialogResult.Yes)
                    {
                        try
                        {
                            string qry = "Update tbl_User set Password ='******' where ID ="
                                         + userid;
                            DatabaseCon dbcon = new DatabaseCon();
                            dbcon.Query = qry;
                            dbcon.ExecuteQuery();

                            MessageBox.Show("Password changed sucessfully.",
                                            "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Close();
                            Profile p = new Profile(userid);
                            p.Show();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }
                    else
                    {
                        //nothing
                    }
                }
                else
                {
                    MessageBox.Show("Password and Confirm Password doesn't match.");
                }
            }
            else
            {
                MessageBox.Show("Incorrect Current Password.");
            }
        }
Exemplo n.º 15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string      qry   = "update tbl_Tags set Tag='" + txtTag.Text + "' where Tag_Id= " + tagId;
                DatabaseCon dbcon = new DatabaseCon();
                dbcon.Query = qry;
                dbcon.ExecuteQuery();
                MessageBox.Show("Done");

                this.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 16
0
 public bool insert()
 {
     try
     {
         string qry = "insert into tbl_References values ('" + Title + "','" + Authors_Fname + "','"
                      + Authors_Lname + "','" + Document_type + "','" + Year + "','" + Publisher + "','"
                      + City + "','" + Abstract + "','" + Name + "','" + Issue + "','" + Volume + "',"
                      + Pageno + ",'" + Notes + "'," + Userid + ")";
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         dbcon.ExecuteQuery();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 17
0
 private void Edit_Tags_Load(object sender, EventArgs e)
 {
     try
     {
         string      qry   = "select * from tbl_Tags where Tag_Id =" + tagId;
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         if (dt.Rows.Count > 0)
         {
             txtTag.Text = dt.Rows[0]["Tag"].ToString();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 18
0
 private void Export_Load(object sender, EventArgs e)
 {
     combo_Export.Items.Add("Harvard");
     combo_Export.Items.Add("APA");
     combo_Export.Items.Add("Chicago");
     combo_Export.SelectedIndex = 0;
     try
     {
         string      qry   = "select * from tbl_References where UserId =" + userId;
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ReferencesValidation rv = new ReferencesValidation();

            string[] parameters = new string[] { txtTitle.Text, txtAuthors_Fname.Text, txtAuthors_Fname.Text,
                                                 txtDocumenttype.Text, txtYear.Text, txtPublisher.Text, txtAbstract.Text, txtName.Text,
                                                 txtIssue.Text, txtVolume.Text, txtPageno.Text };
            if (rv.checkEmpty(parameters) == true)
            {
                if (rv.numberValid(txtPageno.Text) == true)
                {
                    try
                    {
                        string qry = "update tbl_References set Title ='" + txtTitle.Text
                                     + "', Authors_Fname ='" + txtAuthors_Fname.Text + "', Authors_Lname ='"
                                     + txtAuthors_Lname.Text + "', Document_type ='" + txtDocumenttype.Text
                                     + "', Year ='" + txtYear.Text + "', Publisher ='" + txtPublisher.Text
                                     + "', City ='" + txtCity.Text + "', Abstract ='" + txtAbstract.Text
                                     + "', Name ='" + txtName.Text + "', Issue ='" + txtIssue.Text + "', Volume ='"
                                     + txtVolume.Text + "', Page_no =" + int.Parse(txtPageno.Text) + ", Notes ='"
                                     + txtNotes.Text + "' where Ref_Id =" + referenceId;
                        DatabaseCon dbcon = new DatabaseCon();
                        dbcon.Query = qry;
                        dbcon.ExecuteQuery();
                        MessageBox.Show("Done.");
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    MessageBox.Show("Please enter numberic value for Page number.");
                    txtPageno.Focus();
                }
            }
            else
            {
                MessageBox.Show("Don't leave any field with * empty.");
            }
        }
 private void pictureBox2_Click(object sender, EventArgs e)
 {
     try
     {
         string search = txtSearch.Text;
         string qry    = "select * from [tbl_References] where UserID = " + userid + "and Title like '%"
                         + search + "%' or Authors_Fname like '%" + search + "%' or Authors_Lname like '%"
                         + search + "%' or Document_type like '%" + search + "%' or Year like '%" + search
                         + "%' or Publisher like '%" + search + "%' or Abstract like '%" + search
                         + "%' or Name like '%" + search + "%' or Issue like '%" + search + "%' or Volume like '%"
                         + search + "%' or Notes like '%" + search + "%'";
         DatabaseCon dbcon = new DatabaseCon();
         dbcon.Query = qry;
         DataTable dt = dbcon.GetData();
         dataGridView1.DataSource = dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 21
0
        public bool CheckEmail(string Email)
        {
            try
            {
                DatabaseCon dbcon = new DatabaseCon();
                string      qry   = "select Email from [tbl_User]";
                dbcon.Query = qry;
                DataTable dt = dbcon.GetData();

                foreach (DataRow dr in dt.Rows)
                {
                    if (Email == (string)dr["Email"])
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 22
0
        private void viewreference(string style, string query)
        {
            try
            {
                string qry = "";
                if (!string.IsNullOrEmpty(query))
                {
                    qry = query;
                }
                else
                {
                    qry = "select * from tbl_References where UserId =" + userId;
                }
                DatabaseCon dbcon = new DatabaseCon();
                dbcon.Query = qry;
                DataTable dt = dbcon.GetData();
                panel1.Controls.Clear();

                int y = 10;
                foreach (DataRow dr in dt.Rows)
                {
                    string title        = (string)dr["Title"];
                    string authorsFname = (string)dr["Authors_Fname"];
                    string authorsLname = (string)dr["Authors_Lname"];
                    string documentType = (string)dr["Document_type"];
                    string year         = (string)dr["Year"];
                    string Publisher    = (string)dr["Publisher"];
                    string City         = (string)dr["City"];
                    string Abstract     = (string)dr["Abstract"];
                    string name         = (string)dr["Name"];
                    string issue        = (string)dr["Issue"];
                    string volume       = (string)dr["Volume"];
                    int    pageno       = Convert.ToInt32(dr["Page_no"].ToString());
                    authorsFname = authorsFname.Substring(0, 1);


                    RichTextBox txt1 = new RichTextBox();
                    txt1.BorderStyle = BorderStyle.None;
                    txt1.Location    = new Point(90, y);
                    txt1.Width       = 1000;
                    txt1.Height      = 30;
                    txt1.ReadOnly    = true;
                    txt1.Font        = new Font(FontFamily.GenericSansSerif, 16, FontStyle.Regular);
                    y = y + 30;

                    if (style == "Harvard")
                    {
                        if (documentType == "Book")
                        {
                            //Last name, First initial. (Year published).Title. City published: Publisher, Page(s).
                            txt1.Text = authorsLname + ", " + authorsFname + ". " + "(" + year + ")." + name
                                        + ". " + City + ": " + Publisher + ", " + pageno + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Journal")
                        {
                            //Last name, First initial. (Year published). Article title. Journal, Volume (Issue),
                            //Page(s).
                            txt1.Text = authorsLname + ", " + authorsFname + ". " + "(" + year + ")." + title + ". "
                                        + name + ", " + volume + "(" + issue + ")" + pageno + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Conference Processing")
                        {
                            //Last name, First initial. (Conference Year). Title of Paper or Proceedings.
                            //In: Name or Title of Conference. City: Publisher of the Proceedings, pages.
                            txt1.Text = authorsLname + ", " + authorsFname + ". " + "(" + year + ")." + title
                                        + ". In:" + name + ". " + City + ":" + Publisher + ", " + pageno + ".";
                            this.makeItalic(name, txt1);
                        }
                    }

                    else if (style == "APA")
                    {
                        if (documentType == "Book")
                        {
                            //Author, A. (Year of Publication). Title of work. Publisher City : Publisher.
                            txt1.Text = authorsLname + "," + authorsFname + "." + "(" + year + "). " + name
                                        + ". " + City + ":" + Publisher + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Journal")
                        {
                            //Last, FN. (Year Published). Article title. Journal Name, Volume(Issue),  Pages.
                            txt1.Text = authorsLname + ", " + authorsFname + ". " + "(" + year + ")." + title
                                        + ". " + name + ", " + volume + "(" + issue + ")" + pageno + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Conference Processing")
                        {
                            //Last name, FN. (Year published). Title of Paper or Proceedings, Title of Conference,
                            //Issue. Place of publication: Publisher.
                            txt1.Text = authorsLname + ", " + authorsFname + ". " + "(" + year + ")." + title
                                        + ", " + name + ", " + issue + ", " + City + ": " + Publisher + ".";
                            this.makeItalic(name, txt1);
                            this.makeItalic(volume, txt1);
                        }
                    }

                    else if (style == "Chicago")
                    {
                        if (documentType == "Book")
                        {
                            //Last Name, First Name. Title of Book. Publisher City: Publisher Name, Year Published.
                            txt1.Text = authorsLname + "," + authorsFname + ". " + name + ". " + City + ": "
                                        + Publisher + ", " + year + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Journal")
                        {
                            //Last name, First name. “Article Title.” Journal Title, volume, no. issue
                            //(year of publication). Pages.
                            txt1.Text = authorsLname + "," + authorsFname + ". '" + title + ".' " + name + ", "
                                        + volume + ", " + issue + "(" + year + "). " + pageno + ".";
                            this.makeItalic(name, txt1);
                        }
                        else if (documentType == "Conference Processing")
                        {
                            //Last name, First name. “Title of the Paper.” Paper presented at the Title of
                            //the Conference, Location of Conference, Year of Conference.
                            txt1.Text = authorsLname + "," + authorsFname + ". '" + title + ".' " + name
                                        + ", " + City + ", " + year + ".";
                        }
                    }

                    else
                    {
                        MessageBox.Show("Please select valid referencing style.");
                    }
                    panel1.Controls.Add(txt1);
                    panel1.AutoScroll = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }