Esempio n. 1
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());
     }
 }
 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;
     }
 }
Esempio n. 3
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;
                }
            }
        }
Esempio n. 4
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();
            }
        }
Esempio n. 6
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;
                }
            }
        }
Esempio n. 7
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;
     }
 }
 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;
     }
 }
 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;
     }
 }
Esempio n. 10
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;
     }
 }
Esempio n. 11
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;
     }
 }
Esempio n. 12
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;
     }
 }
 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;
     }
 }
        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;
            }
        }
Esempio n. 15
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());
            }
        }