コード例 #1
0
        public void Numeric_Item(int Item_No)
        {
            string query = "select quantity,image from item_list where item_no = " + Item_No + ";";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        numericUpDown1.Maximum = Convert.ToInt32(AES.AES_Encryption.DecryptString(dataReader[0].ToString(), LogIn.strpass));
                        pic_add = decode(dataReader[1].ToString());
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #2
0
        public void LII(int ID) // LII = Load Item Info
        {
            string query = "Select * from item_list where item_no = " + ID + "";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    command = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader reader  = command.ExecuteReader();
                    while (reader.Read())
                    {
                        edit_Item1.item_number           = Convert.ToInt32(reader.GetString("item_no"));
                        edit_Item1.item_name.Text        = AES.AES_Encryption.DecryptString(reader.GetString("item_name"), LogIn.strpass);
                        edit_Item1.item_description.Text = AES.AES_Encryption.DecryptString(reader.GetString("description"), LogIn.strpass);
                        edit_Item1.item_quantity.Value   = Convert.ToInt32(AES.AES_Encryption.DecryptString(reader.GetString("quantity"), LogIn.strpass));
                        Image dump = edit_Item1.item_pic.BackgroundImage;
                        if (dump != null)
                        {
                            dump.Dispose();
                        }
                        edit_Item1.item_pic.BackgroundImage       = Image.FromFile(AES.AES_Encryption.DecryptString(reader.GetString("image"), LogIn.strpass));
                        edit_Item1.item_pic.BackgroundImageLayout = ImageLayout.Stretch;
                    }
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #3
0
        public void Populate_ListView(string myquery)
        {
            listView1.Items.Clear();
            ListViewItem iItem;
            string       query = myquery;

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        iItem = new ListViewItem(dataReader[0].ToString());
                        iItem.SubItems.Add(decode(dataReader[1].ToString()));
                        iItem.SubItems.Add(decode(dataReader[2].ToString()));
                        iItem.SubItems.Add(decode(dataReader[3].ToString()));
                        listView1.Items.Add(iItem);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
                listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }
コード例 #4
0
        public void Get_Queue_No()
        {
            string query = "Select count(*) from borrow_list;";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        cpEControl1.queue_no = Convert.ToInt32(dataReader[0].ToString()) + 1;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #5
0
ファイル: queue_list.cs プロジェクト: khrizthero24/SAD_System
        public void getBorrow(string queue)
        {
            string query = "select stud_no from borrow_list where queue = " + queue + ";";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        stud_no = AES.AES_Encryption.DecryptString(dataReader[0].ToString(), LogIn.strpass);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #6
0
ファイル: queue_list.cs プロジェクト: khrizthero24/SAD_System
        public void Populate_ListView()
        {
            listView1.Items.Clear();
            ListViewItem iItem;
            string       query = "select queue, room, date from borrow_list where returned = 'Q/H7q5zh6RijRaImEg3zjg==';";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        iItem = new ListViewItem(dataReader[0].ToString());
                        iItem.SubItems.Add(decode(dataReader[1].ToString()));
                        iItem.SubItems.Add(decode(dataReader[2].ToString()));
                        listView1.Items.Add(iItem);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
                listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }
コード例 #7
0
ファイル: queue_list.cs プロジェクト: khrizthero24/SAD_System
        public void getQuantity(string item)
        {
            string query = "SELECT quantity FROM item_list where item_no = " + item + ";";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    command = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader reader  = command.ExecuteReader();
                    while (reader.Read())
                    {
                        current_quantity = Convert.ToInt32(AES.AES_Encryption.DecryptString(reader[0].ToString(), LogIn.strpass));
                    }
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #8
0
ファイル: queue_list.cs プロジェクト: khrizthero24/SAD_System
        public void Load_Items(int table)
        {
            listView2.Items.Clear();
            ListViewItem iItem;
            string       query = "SELECT * FROM `" + table + "`";

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        iItem = new ListViewItem(dataReader.GetString("item_no"));
                        iItem.SubItems.Add(dataReader.GetString("item_name"));
                        iItem.SubItems.Add(dataReader.GetString("quantity"));
                        listView2.Items.Add(iItem);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
                listView2.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                listView2.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }
コード例 #9
0
ファイル: LendReport.cs プロジェクト: khrizthero24/SAD_System
        public void Populate_ListView(string myquery)
        {
            queue_listView.Items.Clear();
            item_listView.Items.Clear();
            defect_listView.Items.Clear();
            ListViewItem iItem;
            string       query = myquery;

            if (LogIn.OpenConnection())
            {
                try
                {
                    MySqlCommand    cmd        = new MySqlCommand(query, LogIn.conn);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        if (item_all_items.Checked)
                        {
                            iItem = new ListViewItem(dataReader[0].ToString());
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[1].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[2].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[3].ToString(), LogIn.strpass));
                            item_listView.Items.Add(iItem);
                        }
                        else if (queue_returned.Checked)
                        {
                            iItem = new ListViewItem(dataReader[0].ToString(), LogIn.strpass);
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[1].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[2].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[3].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[4].ToString(), LogIn.strpass));
                            queue_listView.Items.Add(iItem);
                        }
                        else if (queue_not_returned.Checked)
                        {
                            iItem = new ListViewItem(dataReader[0].ToString(), LogIn.strpass);
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[1].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[2].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[3].ToString(), LogIn.strpass));
                            iItem.SubItems.Add(AES.AES_Encryption.DecryptString(dataReader[4].ToString(), LogIn.strpass));
                            queue_listView.Items.Add(iItem);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LogIn.CloseConnection();
                }
            }
        }
コード例 #10
0
ファイル: Register.cs プロジェクト: khrizthero24/SAD_System
        private void registerbtn_Click(object sender, EventArgs e)
        {
            if ((string.IsNullOrEmpty(usertxt.Text)) || (string.IsNullOrEmpty(passtxt.Text)) || (string.IsNullOrEmpty(conpasstxt.Text)) || (string.IsNullOrEmpty(idnummask.Text)) ||
                (string.IsNullOrEmpty(acctcmb.Text)))
            {
                MessageBox.Show("Kindly Complete the Information", "Incomplete");
            }
            else
            {
                if (MessageBox.Show("Confirm Registration?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if ((passtxt.Text.Length >= 8) && (conpasstxt.Text.Length >= 8))
                    {
                        if (passtxt.Text == conpasstxt.Text)
                        {
                            en_username = AES.AES_Encryption.EncryptString(usertxt.Text, strpass);
                            en_password = AES.AES_Encryption.EncryptString(passtxt.Text, strpass);
                            en_idnum    = AES.AES_Encryption.EncryptString(idnummask.Text, strpass);
                            en_accttype = AES.AES_Encryption.EncryptString(acctcmb.Text, strpass);
                            string query = "INSERT INTO users (username, password, id_num, user_type) VALUES ('" + en_username + "', '" + en_password + "', '" + en_idnum +
                                           "', '" + en_accttype + "')";

                            if (LogIn.OpenConnection())
                            {
                                try
                                {
                                    MySqlCommand cmd = new MySqlCommand(query, LogIn.conn);
                                    cmd.ExecuteNonQuery();
                                    MessageBox.Show("You're Registered");
                                    Form login = new LogIn();
                                    login.Show();
                                    this.Hide();
                                    usertxt.Text   = null;
                                    passtxt.Text   = null;
                                    idnummask.Text = null;
                                    acctcmb.Text   = null;
                                }
                                catch (MySqlException ex)
                                {
                                    MessageBox.Show(ex.Message);
                                }
                                finally
                                {
                                    LogIn.CloseConnection();
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Password Confirmation didn't Match", "Password Unmatched");
                            conpasstxt.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password Length must be at least 8 characters.", "Password Length Error");
                    }
                }
                else
                {
                }
            }
        }