Ejemplo n.º 1
0
 public Upload_Novel(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
 public Change_Member_Category(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
Ejemplo n.º 3
0
 public Change_Novel_Price(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
Ejemplo n.º 4
0
        // this query will only select novels which the reader or reader&author has yet to purchase. the reader&author members can buy their own work which will cost them money.
        // It is assumed that they will not buy work that they should have already on their own computer.


        public Download_Novel(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
        {
            parent1 = Parent1;
            parent2 = Parent2;
            parent3 = Parent3;
            InitializeComponent();
        }
Ejemplo n.º 5
0
 public List_Members(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
 public Change_Member_Details(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
Ejemplo n.º 7
0
 public List_Members(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
 public Change_Novel_Price(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     InitializeComponent();
 }
Ejemplo n.º 9
0
 public Top_Up_Credit(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     newCreditAmountForDatabase = "";
     InitializeComponent();
 }
Ejemplo n.º 10
0
 public Top_Up_Credit(Hybrid_Controls Parent1, Author_Controls Parent2, Reader_Controls Parent3)
 {
     parent1 = Parent1;
     parent2 = Parent2;
     parent3 = Parent3;
     newCreditAmountForDatabase = "";
     InitializeComponent();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            if (parent1 != null)
            {
                parent1.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    MessageBox.Show("No changes made. You are already an Author and Reader.");
                }
                else if (checkBoxAuthor.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'A','This is an author')");
                    MessageBox.Show("Changes made. You are now an Author");
                    Author_Controls ns = new Author_Controls(parent1.getFirstParent());
                    ns.Show();
                    this.Close();
                }
                else if (checkBoxReader.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now a Reader");
                }
                else
                {
                    MessageBox.Show("No changes Made");
                }
            }
            if (parent2 != null)
            {
                parent2.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'A','This is an author')");
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now an Author and a Reader.");
                }
                else if (checkBoxAuthor.Checked)
                {
                    MessageBox.Show("No changes made. You are already an Author.");
                }
                else if (checkBoxReader.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now a Reader.");
                }
                else
                {
                    MessageBox.Show("No changes Made");
                }
            }
            if (parent3 != null)
            {
                parent3.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'A','This is an author')");
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now an Author and Reader");
                }
                else if (checkBoxAuthor.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                            ",'A','This is an author')");
                    MessageBox.Show("Changes made. You are now an Author.");
                }
                else if (checkBoxReader.Checked)
                {
                    MessageBox.Show("No changes made. You are already a Reader.");
                }
                else
                {
                    MessageBox.Show("No changes Made");
                }
            }

            this.Close();
        }
Ejemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = txtBxUserName.Text.Trim();
            string userpass = txtBxUserPass.Text.Trim();
            string query1   = "SELECT *                                                             " +
                              "FROM Members, Categories                                             " +
                              "WHERE Members.Uname  =                  '" + username + "'       " +
                              "AND Members.password =                  '******'       " +
                              "AND Members.MemID    =                     Categories.MemID          ";

            DataSet da1 = null;
            int     numOfMembersCategories = 0;

            try
            {
                da1 = Utilities.QueryDatabase(query1);



                currentUser.SetMemId(Convert.ToInt32(da1.Tables[0].Rows[0][0].ToString()));
                currentUser.SetUName(da1.Tables[0].Rows[0][1].ToString().Trim());
                currentUser.SetFName(da1.Tables[0].Rows[0][2].ToString().Trim());
                currentUser.SetLName(da1.Tables[0].Rows[0][3].ToString().Trim());
                currentUser.SetEmail(da1.Tables[0].Rows[0][4].ToString().Trim());
                currentUser.SetCredit(float.Parse(da1.Tables[0].Rows[0][5].ToString().Trim()));
                currentUser.SetPassword(da1.Tables[0].Rows[0][7].ToString().Trim());
                currentUser.SetCategoryCode(Convert.ToChar(da1.Tables[0].Rows[0][9].ToString()));                        // I could use the constructor like I did in the CATCH but
                                                                                                                         // this make it easier to read since I'm converting types.



                string query2 = "SELECT COUNT(*)                                                      " +
                                "FROM Categories                                                      " +
                                "WHERE MemID          =                  '" + currentUser.GetMemId() + "' ";
                //Thread.Sleep(2000);
                numOfMembersCategories = Convert.ToInt32(Utilities.QueryDatabase(query2).Tables[0].Rows[0][0].ToString());


                // return;   to jump to end of method


                //int RowCount = da1.Rows.Count;
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());

                MessageBox.Show("Invalid username password combination.\n");
                new currentUser(-1, null, null, null, null, 0, null, '\0');

                da1 = null;
                numOfMembersCategories = 0;
            }

            if (numOfMembersCategories != 0 || da1 != null)
            {
                int MemId = currentUser.GetMemId();

                if (numOfMembersCategories == 2)
                {
                    currentUser.SetCategoryCode('H');
                    //MessageBox.Show("hello author and reader");
                    MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                    Hybrid_Controls ns = new Hybrid_Controls(this);
                    ns.Show();
                    this.Hide();
                }
                else
                {
                    if (currentUser.GetCategoryCode() == 'R')
                    {
                        //MessageBox.Show("hello world");
                        MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                        Reader_Controls ns = new Reader_Controls(this);
                        ns.Show();
                        this.Hide();
                    }
                    else if (currentUser.GetCategoryCode() == 'A')
                    {
                        MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                        Author_Controls ns = new Author_Controls(this);
                        ns.Show();
                        this.Hide();
                    }
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (parent1 != null)
            {
                parent1.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    MessageBox.Show("No changes made. You are already an Author and Reader.");
                }
                else if (checkBoxAuthor.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'A','This is an author')");
                    MessageBox.Show("Changes made. You are now an Author");
                    Author_Controls ns = new Author_Controls(parent1.getFirstParent());
                    ns.Show();
                    this.Close();
                }
                else if (checkBoxReader.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now a Reader");
                }
                else
                    MessageBox.Show("No changes Made");
            }
            if (parent2 != null)
            {
                parent2.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'A','This is an author')");
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                         ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now an Author and a Reader.");
                }
                else if (checkBoxAuthor.Checked)
                {
                    MessageBox.Show("No changes made. You are already an Author.");
                }
                else if (checkBoxReader.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now a Reader.");
                }
                else
                    MessageBox.Show("No changes Made");
            }
            if (parent3 != null)
            {
                parent3.Visible = true;
                if (checkBoxAuthor.Checked == true && checkBoxReader.Checked == true)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'A','This is an author')");
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                         ",'R','This is a reader')");
                    MessageBox.Show("Changes made. You are now an Author and Reader");
                }
                else if (checkBoxAuthor.Checked)
                {
                    Utilities.QueryDatabase("DELETE FROM Categories WHERE MemID = " + currentUser.GetMemId());
                    Utilities.QueryDatabase("INSERT INTO Categories (MemID, CATCODE, Description) VALUES (" + currentUser.GetMemId() +
                                                                                                          ",'A','This is an author')");
                    MessageBox.Show("Changes made. You are now an Author.");
                }
                else if (checkBoxReader.Checked)
                {
                    MessageBox.Show("No changes made. You are already a Reader.");
                }
                else
                    MessageBox.Show("No changes Made");
            }

            this.Close();
        }
Ejemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = txtBxUserName.Text.Trim();
            string userpass = txtBxUserPass.Text.Trim();
            string query1 = "SELECT *                                                             "      +
                            "FROM Members, Categories                                             "      +
                            "WHERE Members.Uname  =                  '"+    username    +"'       "      +
                            "AND Members.password =                  '******'       "      +
                            "AND Members.MemID    =                     Categories.MemID          ";

            DataSet da1 = null;
            int numOfMembersCategories = 0;
            try
            {
                da1                    =                    Utilities.QueryDatabase(query1);

                currentUser.SetMemId(           Convert.ToInt32(    da1.Tables[0].Rows[0][0].ToString())          );
                currentUser.SetUName(                               da1.Tables[0].Rows[0][1].ToString().Trim()    );
                currentUser.SetFName(                               da1.Tables[0].Rows[0][2].ToString().Trim()    );
                currentUser.SetLName(                               da1.Tables[0].Rows[0][3].ToString().Trim()    );
                currentUser.SetEmail(                               da1.Tables[0].Rows[0][4].ToString().Trim()    );
                currentUser.SetCredit(          float.Parse(        da1.Tables[0].Rows[0][5].ToString().Trim())   );
                currentUser.SetPassword(                            da1.Tables[0].Rows[0][7].ToString().Trim()    );
                currentUser.SetCategoryCode(    Convert.ToChar(     da1.Tables[0].Rows[0][9].ToString())          );     // I could use the constructor like I did in the CATCH but
                                                                                                                         // this make it easier to read since I'm converting types.

                string query2 = "SELECT COUNT(*)                                                      " +
                                "FROM Categories                                                      " +
                                "WHERE MemID          =                  '" + currentUser.GetMemId() + "' ";
                //Thread.Sleep(2000);
                numOfMembersCategories = Convert.ToInt32(Utilities.QueryDatabase(query2).Tables[0].Rows[0][0].ToString());

                    // return;   to jump to end of method

                //int RowCount = da1.Rows.Count;

            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());

                MessageBox.Show("Invalid username password combination.\n");
                new currentUser(-1, null, null, null, null, 0 ,null, '\0');

                da1 = null;
                numOfMembersCategories = 0;
            }

            if (numOfMembersCategories != 0 || da1 != null)
            {

                int MemId = currentUser.GetMemId();

                if (numOfMembersCategories == 2)
                {
                    currentUser.SetCategoryCode('H');
                    //MessageBox.Show("hello author and reader");
                    MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                    Hybrid_Controls ns = new Hybrid_Controls(this);
                    ns.Show();
                    this.Hide();
                }
                else
                {

                    if (currentUser.GetCategoryCode() == 'R')
                    {
                        //MessageBox.Show("hello world");
                        MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                        Reader_Controls ns = new Reader_Controls(this);
                        ns.Show();
                        this.Hide();
                    }
                    else if (currentUser.GetCategoryCode() == 'A')
                    {
                        MessageBox.Show("Welcome " + currentUser.GetFName() + " " + currentUser.GetLName());
                        Author_Controls ns = new Author_Controls(this);
                        ns.Show();
                        this.Hide();
                    }
                }
            }
        }