示例#1
0
        public void loadData()
        {
            var    dbconnect = new dbConnector();
            string query     = "select * from studentprofile inner join studdetails on studentprofile.idstudentprofile = studdetails.idstddet WHERE studentprofile.Status = 1;";

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                MySqlDataAdapter ad   = new MySqlDataAdapter(query, dbconnection);
                DataSet          data = new DataSet();
                ad.Fill(data);
                dataGridView1.DataSource = data.Tables[0];

                dataGridView1.Columns["idstudentprofile"].Visible = true;
                dataGridView1.Columns["FirstName"].Visible        = true;
                dataGridView1.Columns["LastName"].Visible         = true;
                dataGridView1.Columns["MiddleName"].Visible       = true;
                dataGridView1.Columns["DateOfBirth"].Visible      = true;
                dataGridView1.Columns["PlaceOfBirth"].Visible     = false;
                dataGridView1.Columns["Sex"].Visible         = true;
                dataGridView1.Columns["Religion"].Visible    = false;
                dataGridView1.Columns["Nickname"].Visible    = false;
                dataGridView1.Columns["idstuddet"].Visible   = false;
                dataGridView1.Columns["Status"].Visible      = false;
                dataGridView1.Columns["department"].Visible  = false;
                dataGridView1.Columns["level"].Visible       = false;
                dataGridView1.Columns["school_year"].Visible = false;
                dataGridView1.Columns["idstddet"].Visible    = false;
                dataGridView1.Columns["section"].Visible     = true;
                dataGridView1.Columns["sectionid"].Visible   = false;
                dataGridView1.Columns["image_path"].Visible  = false;

                dataGridView1.Columns["idstudentprofile"].ReadOnly = true;
                dataGridView1.Columns["FirstName"].ReadOnly        = true;
                dataGridView1.Columns["LastName"].ReadOnly         = true;
                dataGridView1.Columns["MiddleName"].ReadOnly       = true;
                dataGridView1.Columns["DateOfBirth"].ReadOnly      = true;
                dataGridView1.Columns["PlaceOfBirth"].ReadOnly     = true;
                dataGridView1.Columns["Sex"].ReadOnly         = true;
                dataGridView1.Columns["Religion"].ReadOnly    = true;
                dataGridView1.Columns["Nickname"].ReadOnly    = true;
                dataGridView1.Columns["idstuddet"].ReadOnly   = true;
                dataGridView1.Columns["Status"].ReadOnly      = true;
                dataGridView1.Columns["department"].ReadOnly  = true;
                dataGridView1.Columns["level"].ReadOnly       = true;
                dataGridView1.Columns["school_year"].ReadOnly = true;
                dataGridView1.Columns["idstddet"].ReadOnly    = true;
                dataGridView1.Columns["section"].ReadOnly     = true;
                dataGridView1.Columns["sectionid"].ReadOnly   = true;
                dataGridView1.Columns["image_path"].ReadOnly  = true;

                dataGridView1.Columns["idstudentprofile"].HeaderText = "Student ID No.";
                dataGridView1.Columns["level_dummyval"].HeaderText   = "Level";
                dataGridView1.Columns["FirstName"].HeaderText        = "First Name";
                dataGridView1.Columns["LastName"].HeaderText         = "Last Name";
                dataGridView1.Columns["MiddleName"].HeaderText       = "Middle Name";
                dataGridView1.Columns["DateOfBirth"].HeaderText      = "Date of Birth";
            }
            dbconnection.Close();
        }
示例#2
0
        private void btnAdd2_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Confirm Order Creation!", "CONFIRM ACTION!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (res == DialogResult.OK)
            {
                var dbconnect = new dbConnector();
                using (dbconnection = dbconnect.connector())
                {
                    using (var command = new MySqlCommand("INSERT INTO orderlist(date_created, date, vendor, quantity, quantity_delivered, status, item_id) VALUES(@date_created, @date, @vendor, @quantity, @quantity_delivered, @status, @item_id);", dbconnection))
                    {
                        dbconnection.Open();
                        command.Parameters.AddWithValue("@item_name", itemname);
                        command.Parameters.AddWithValue("@date_created", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        command.Parameters.AddWithValue("@date", dateDate.Value.Date.ToString("yyyy-MM-dd"));
                        command.Parameters.AddWithValue("@vendor", txtvendor.Text);
                        command.Parameters.AddWithValue("@quantity", txtquantity2.Text);
                        command.Parameters.AddWithValue("@quantity_delivered", 0);
                        command.Parameters.AddWithValue("@status", 1);
                        command.Parameters.AddWithValue("@item_id", itemid);
                        command.ExecuteNonQuery();
                    }
                }
                MessageBox.Show("Order Succssesfully Created!");
                txtboxdeleter();
                readData();
                readDataOrderList();
            }
        }
 private void btnAddFee_Click(object sender, EventArgs e)
 {
     if (textboxvalidate())
     {
         DialogResult res = MessageBox.Show("PROCEED WITH CREATING VOUCHER?", "WARNING!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             var dbconnect = new dbConnector();
             using (dbconnection = dbconnect.connector())
             {
                 dbconnection.Open();
                 string query2 = "INSERT INTO disbursement(Voucher_Number, Amount, Details, Date_recorded, empID, syear) VALUES(@vn, @amnt, @details, @date, @eid, @syear);";
                 using (var command2 = new MySqlCommand(query2, dbconnection))
                 {
                     command2.Parameters.AddWithValue("@vn", SerialMaker());
                     command2.Parameters.AddWithValue("@amnt", textBox2.Text);
                     command2.Parameters.AddWithValue("@details", textBox1.Text);
                     command2.Parameters.AddWithValue("@date", DateTime.Now.ToString("yyyy-MM-dd"));
                     command2.Parameters.AddWithValue("@eid", empId);
                     command2.Parameters.AddWithValue("@syear", syear);
                     command2.ExecuteNonQuery();
                 }
             }
             MessageBox.Show("Voucher Created Sucessfully");
             this.Close();
             reference.loadDisbursementtbl();
         }
     }
     else
     {
         MessageBox.Show("PLEASE FILL ALL NECESSARY FIELDS!", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#4
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (dataOrderList.SelectedRows.Count > 0)
     {
         DialogResult res = MessageBox.Show("Confirm Order Cancellation!", "CONFIRM ACTION!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (res == DialogResult.OK)
         {
             var dbconnect = new dbConnector();
             using (dbconnection = dbconnect.connector())
             {
                 using (var command = new MySqlCommand("UPDATE orderlist SET status = @stat WHERE id = @ayd;", dbconnection))
                 {
                     dbconnection.Open();
                     command.Parameters.AddWithValue("@stat", 0);
                     command.Parameters.AddWithValue("@ayd", ordid);
                     command.ExecuteNonQuery();
                 }
             }
             MessageBox.Show("Order Succssesfully Cancelled!");
             readData();
             readDataOrderList();
             readDataOrderListCanceled();
             readDataOrderListCompl();
             dataOrderList.ClearSelection();
         }
     }
     else
     {
         MessageBox.Show("There is no item currently selected", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void updater2()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                string query2 = "UPDATE payment SET paymentStatus = @status WHERE pid = @ayd";
                using (var command2 = new MySqlCommand(query2, dbconnection))
                {
                    if (comboBox1.Text == "Validated")
                    {
                        command2.Parameters.AddWithValue("@status", 1);
                    }
                    else if (comboBox1.Text == "Pending")
                    {
                        command2.Parameters.AddWithValue("@status", 2);
                    }
                    else
                    {
                        command2.Parameters.AddWithValue("@status", 3);
                    }
                    command2.Parameters.AddWithValue("@ayd", dict["pid"]);
                    command2.ExecuteNonQuery();
                }
            }
        }
        private Boolean studentcheck2(string fn, string ln, string mn)
        {
            var connect = new dbConnector();

            using (MySqlConnection conn = connect.connector())
            {
                string query = "SELECT * FROM studentprofile WHERE FirstName = '" + fn + "' " +
                               "AND idstudentprofile <> '" + idstud + "' " +
                               "AND MiddleName = '" + mn + "' " +
                               "AND idstudentprofile <> '" + idstud + "' " +
                               "AND LastName = '" + ln + "' " +
                               "AND idstudentprofile <> '" + idstud + "';";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("STUDENT WITH THE SAME NAME HAS ALREADY BEEN ENROLLED!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#7
0
        public Boolean statusFlag()
        {
            var dbconnector = new dbConnector();

            using (dbconnect = dbconnector.connector())
            {
                dbconnect.Open();
                MySqlCommand query = new MySqlCommand("SELECT * from usertable inner join employee on " +
                                                      "usertable.idemp = employee.empID " +
                                                      "where usertable.username = '******' " +
                                                      "and usertable.password = '******' and usertable.status = 1;", dbconnect);
                MySqlDataAdapter listener = new MySqlDataAdapter(query);
                DataTable        holder   = new DataTable();
                listener.Fill(holder);

                //MessageBox.Show(perm.Substring(0,1));

                if (holder.Rows.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#8
0
 private void btnconfirm_Click(object sender, EventArgs e)
 {
     if (!itemcheck(txtitemname.Text, txtdesc.Text))
     {
         DialogResult res = MessageBox.Show("CONFIRM ITEM CREATION!", "CONFIRM!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             var dbconnect = new dbConnector();
             using (dbconnection = dbconnect.connector())
             {
                 using (var command = new MySqlCommand("INSERT INTO itemdetails(item_code, date_of_creation, description, itemstatus, itemname) VALUES(@item_code, @date_of_creation, @description, @itemstatus, @itemname);", dbconnection))
                 {
                     dbconnection.Open();
                     command.Parameters.AddWithValue("@item_code", txtitemcode.Text);
                     command.Parameters.AddWithValue("@date_of_creation", DateTime.Now.ToString("yyyy-MM-dd"));
                     command.Parameters.AddWithValue("@description", txtdesc.Text);
                     command.Parameters.AddWithValue("@itemstatus", 1);
                     command.Parameters.AddWithValue("@itemname", txtitemname.Text);
                     command.ExecuteNonQuery();
                 }
             }
             MessageBox.Show("Item Successfully Created!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
             reference.Show();
             reference.readData();
         }
     }
 }
示例#9
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (checkifcheckerchecked())
     {
         DialogResult res = MessageBox.Show("SELECTED STUDENT/S WILL BE REMOVED FROM CURRENT SECTIONS!", "WARNING!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (res == DialogResult.OK)
         {
             idlistgrabber();
             var dbconnect = new dbConnector();
             using (dbconnection = dbconnect.connector())
             {
                 dbconnection.Open();
                 foreach (string id in stdlistid)
                 {
                     string query2 = "UPDATE studdetails SET section = @sec, sectionid = @secid WHERE idstddet = @idstud;";
                     using (var command2 = new MySqlCommand(query2, dbconnection))
                     {
                         command2.Parameters.AddWithValue("@sec", null);
                         command2.Parameters.AddWithValue("@secid", null);
                         command2.Parameters.AddWithValue("@idstud", id);
                         command2.ExecuteNonQuery();
                     }
                 }
             }
             loadData();
             loadData2();
         }
     }
 }
示例#10
0
        private void flagtoclearorderlist()
        {
            var a = 0;
            var b = 0;

            using (MySqlConnection conn = connect.connector())
            {
                conn.Open();
                string query = "SELECT * FROM orderlist WHERE id = '" + orderlistID + "';";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                a = Convert.ToInt32(dt.Rows[0]["quantity_delivered"].ToString());
                b = Convert.ToInt32(dt.Rows[0]["quantity"].ToString());
            }
            if (a == b)
            {
                var dbconnect = new dbConnector();
                using (dbconnection = dbconnect.connector())
                {
                    dbconnection.Open();
                    using (var com = new MySqlCommand("UPDATE orderlist SET status = @stat WHERE id = '" + orderlistID + "';", dbconnection))
                    {
                        com.Parameters.AddWithValue("@stat", 2);
                        com.ExecuteNonQuery();
                    }
                }
                MessageBox.Show("ORDER DELIVERY HAS BEEN COMPLETED!, PLEASE REFER TO ORDER LIST MANAGEMENT FOR LIST OF COMPELETED ORDERS", "ATTENTION!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
            }
        }
示例#11
0
        private Int32 counters()
        {
            var    dbconnect = new dbConnector();
            string query     = "SELECT COUNT(idstudentprofile) FROM studentprofile;";

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                var cmd = new MySqlCommand(query, dbconnection);
                return(Convert.ToInt32(cmd.ExecuteScalar()));
            }
        }
        private void deactivator()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                using (var command = new MySqlCommand("UPDATE inventory SET status = 0, invID = @ayd;", dbconnection))
                {
                    dbconnection.Open();
                    command.Parameters.AddWithValue("@ayd", invid);
                    command.ExecuteNonQuery();
                }
            }
        }
示例#13
0
        private void updateorderlist()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("UPDATE orderlist SET quantity_delivered = @qdel WHERE id = '" + orderlistID + "';", dbconnection))
                {
                    com.Parameters.AddWithValue("@qdel", solver().ToString());
                    com.Parameters.AddWithValue("@status", 1);
                    com.ExecuteNonQuery();
                }
            }
        }
        private void updatevalue()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                studdetails(comboBox3.Text, comboBox2.Text);
                //MessageBox.Show(studdet["dept"]);
                using (var command = new MySqlCommand("UPDATE studentprofile set FirstName = @fn, LastName = @ln, MiddleName = @mn, DateOfBirth = @dof, PlaceOfBirth = @pof, Sex = @sex, Religion = @rel, Nickname = @nickname, image_path = @imgpt WHERE idstudentprofile = @ayd;", dbconnection))
                {
                    command.Parameters.AddWithValue("@ayd", idstud);
                    command.Parameters.AddWithValue("@fn", txtfn.Text);
                    command.Parameters.AddWithValue("@ln", txtln.Text);
                    command.Parameters.AddWithValue("@mn", txtmn.Text);
                    command.Parameters.AddWithValue("@dof", dateTimePicker1.Value.ToString("yyyy-MM-dd"));
                    command.Parameters.AddWithValue("@pof", txtbp.Text);
                    command.Parameters.AddWithValue("@sex", comboBox1.Text);
                    if (comboBox4.Text == "Others")
                    {
                        command.Parameters.AddWithValue("@rel", textBox1.Text);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@rel", comboBox4.Text);
                    }
                    command.Parameters.AddWithValue("@nickname", txtnn.Text);
                    command.Parameters.AddWithValue("@imgpt", imgpath);
                    command.ExecuteNonQuery();
                }
                using (var command = new MySqlCommand("UPDATE studdetails SET level_dummyval = @lvldval, department = @dept, level = @lvl WHERE idstddet = @ayd", dbconnection))
                {
                    command.Parameters.AddWithValue("@ayd", idstud);
                    command.Parameters.AddWithValue("@dept", studdet["dept"]);
                    command.Parameters.AddWithValue("@lvl", studdet["level"]);
                    //command.Parameters.AddWithValue("@sy", lblsy.Text);
                    command.Parameters.AddWithValue("@lvldval", comboBox2.Text);
                    //need to update query to insert department integer value
                    command.ExecuteNonQuery();
                }
                using (var command = new MySqlCommand("UPDATE accountdetails SET fid = @fid WHERE spid = @ayd", dbconnection))
                {
                    command.Parameters.AddWithValue("@ayd", idstud);
                    command.Parameters.AddWithValue("@fid", studdet["feelevel"]);
                    command.ExecuteNonQuery();
                }
            }
        }
示例#15
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (lblsy.Text != "NO S.Y. SELECTED")
            {
                var dbconnector = new dbConnector();
                using (dbconnect = dbconnector.connector())
                {
                    dbconnect.Open();
                    MySqlCommand query = new MySqlCommand("SELECT * from usertable inner join employee on " +
                                                          "usertable.idemp = employee.empID " +
                                                          "where usertable.username = '******' " +
                                                          "and usertable.password = '******';", dbconnect);
                    MySqlDataAdapter listener = new MySqlDataAdapter(query);
                    DataTable        holder   = new DataTable();
                    listener.Fill(holder);

                    //MessageBox.Show(perm.Substring(0,1));

                    if (holder.Rows.Count > 0)
                    {
                        string perm = holder.Rows[0]["restrictions"].ToString();
                        //string[] split = perm.Split(' ')
                        if (statusFlag())
                        {
                            uname = holder.Rows[0]["last_name"].ToString() + ", " + holder.Rows[0]["first_name"].ToString();
                            MessageBox.Show("WELCOME TO SILA SCHOOL MANAGEMENT SYSTEM!", "WELCOME!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            frmmain            = new frmMain(uname, perm);
                            frmmain.schoolyear = lblsy.Text;
                            frmmain.Show();
                            frmmain.reference = this;
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("This Account is no longer active", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("WRONG CREDENTIALS!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("There is no currently opened School Year!", "WARNING!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void updateinv()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                using (var command = new MySqlCommand("UPDATE inventory SET quantity = @quantity, stock_out_date = @sod WHERE invID = @ayd;", dbconnection))
                {
                    dbconnection.Open();
                    command.Parameters.AddWithValue("@quantity", quantityadder());
                    command.Parameters.AddWithValue("@sod", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    command.Parameters.AddWithValue("@ayd", invid);
                    command.ExecuteNonQuery();
                }
            }
        }
示例#17
0
        private Boolean doublenamecheck(string fn, string ln, string mn)
        {
            var connect = new dbConnector();

            using (MySqlConnection conn = connect.connector())
            {
                string query = "";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                }
            }
            return(false);
        }
示例#18
0
        private void updateInventory()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("UPDATE inventory SET stock_in_date = @stock_in_date, Quantity = @Quantity, status = @status WHERE item_id = @itemayd AND status <> 0;", dbconnection))
                {
                    com.Parameters.AddWithValue("@itemayd", itemid);
                    com.Parameters.AddWithValue("@stock_in_date", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@Quantity", inventorysolver().ToString());
                    com.Parameters.AddWithValue("@status", 1);
                    com.ExecuteNonQuery();
                }
            }
        }
示例#19
0
        private void insertintoInventory()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("INSERT INTO inventory(item_id, stock_in_date, Quantity, status) VALUES(@item_id, @stock_in_date, @Quantity, @status)", dbconnection))
                {
                    com.Parameters.AddWithValue("@item_id", itemid);
                    com.Parameters.AddWithValue("@stock_in_date", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@Quantity", txtEnter.Text);
                    com.Parameters.AddWithValue("@status", 1);
                    com.ExecuteNonQuery();
                }
            }
        }
        private string SerialMaker()
        {
            Int32  a;
            string date      = DateTime.Now.ToString("yyyyMMdd");
            string query2    = "SELECT COUNT(*) FROM disbursement";
            var    dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                using (var command2 = new MySqlCommand(query2, dbconnection))
                {
                    dbconnection.Open();
                    a = Convert.ToInt32(command2.ExecuteScalar().ToString());
                }
            }

            return(date + a.ToString("20000"));
        }
示例#21
0
        private void createfunction2()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                string query3 = "INSERT INTO accountdetails(paid_amount, spid, fid) VALUES(@paid_amount, @spid, @fid);";
                IDictionary <string, string> dic = comboboxpicker();
                using (var command3 = new MySqlCommand(query3, dbconnection))
                {
                    command3.Parameters.AddWithValue("@paid_amount", 0);
                    command3.Parameters.AddWithValue("@spid", counters().ToString());
                    command3.Parameters.AddWithValue("@fid", dic["feelevel"]);
                    command3.ExecuteNonQuery();
                }
            }
        }
        private void insertstkout()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("INSERT INTO stkout(inventory_id, stockout_date, quantity, statusout) VALUES(@invid, @date, @quan, @sout)", dbconnection))
                {
                    com.Parameters.AddWithValue("@invid", invid);
                    com.Parameters.AddWithValue("@date", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@quan", textBox2.Text);
                    com.Parameters.AddWithValue("@sout", comboBox1.Text);

                    com.ExecuteNonQuery();
                }
            }
        }
示例#23
0
        private void insertstkin()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("INSERT INTO stkin(inventory_id, date, quantity_delivered, orderlistID) VALUES(@invid, @date, @quantity_delivered, @orderlistID)", dbconnection))
                {
                    com.Parameters.AddWithValue("@invid", inventorycount().ToString());
                    com.Parameters.AddWithValue("@quantity_delivered", txtEnter.Text);
                    //com.Parameters.AddWithValue("@quantity_remaining", quantity_remaining.ToString());
                    //MessageBox.Show(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@date", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@orderlistID", orderlistID);
                    com.ExecuteNonQuery();
                }
            }
        }
示例#24
0
        public void loadData2()
        {
            var    dbconnect = new dbConnector();
            string query     = "select * from sectionnames;";

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                MySqlDataAdapter ad   = new MySqlDataAdapter(query, dbconnection);
                DataSet          data = new DataSet();
                ad.Fill(data);
                dataGridView2.DataSource = data.Tables[0];
                dataGridView2.Columns["idsnames"].Visible        = false;
                dataGridView2.Columns["department"].Visible      = false;
                dataGridView2.Columns["gradelevel"].HeaderText   = "LEVEL";
                dataGridView2.Columns["section_name"].HeaderText = "SECTION NAME";
            }
            dbconnection.Close();
        }
示例#25
0
        private void createdefault()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                string query2 = "INSERT INTO studdetails(level_dummyval, department, level, school_year) VALUES(@lvldval, @dpt, @lvl, @sy);";
                IDictionary <string, string> dic = comboboxpicker();
                using (var command2 = new MySqlCommand(query2, dbconnection))
                {
                    command2.Parameters.AddWithValue("@dpt", dic["dept"]);
                    command2.Parameters.AddWithValue("@lvl", dic["level"]);
                    command2.Parameters.AddWithValue("@sy", lblsy.Text);
                    command2.Parameters.AddWithValue("@lvldval", comboBox2.Text);
                    command2.ExecuteNonQuery();
                }
                string query1 = "INSERT INTO studentprofile(FirstName, LastName, MiddleName, DateOfBirth, PlaceOfBirth, Sex, Religion, Nickname, image_path, Status, idstuddet)" +
                                " VALUES(@fn, @ln, @mn, @dof, @pof, @sex, @rel, @nickname, @ipath, @stat, @ayd2);";
                using (var command = new MySqlCommand(query1, dbconnection))
                {
                    command.Parameters.AddWithValue("@fn", txtfn.Text);
                    command.Parameters.AddWithValue("@ln", txtln.Text);
                    command.Parameters.AddWithValue("@mn", txtmn.Text);
                    command.Parameters.AddWithValue("@dof", dateTimePicker1.Value.ToString("yyyy-MM-dd"));
                    command.Parameters.AddWithValue("@pof", txtbp.Text);
                    command.Parameters.AddWithValue("@sex", comboBox3.Text);
                    if (comboBox4.Text == "Others")
                    {
                        command.Parameters.AddWithValue("@rel", txtrel.Text);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@rel", comboBox4.Text);
                    }
                    command.Parameters.AddWithValue("@nickname", txtnn.Text);
                    command.Parameters.AddWithValue("@ipath", imgpath);
                    command.Parameters.AddWithValue("@stat", 1);
                    command.Parameters.AddWithValue("@ayd2", stdetid);
                    command.ExecuteNonQuery();
                }
            }
        }
示例#26
0
        private void button1_Click(object sender, EventArgs e)
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var command = new MySqlCommand("UPDATE studentprofile set Status = @stat WHERE idstudentprofile = @ayd;", dbconnection))
                {
                    command.Parameters.AddWithValue("@stat", 1);
                    command.Parameters.AddWithValue("@ayd", ayd);
                    command.ExecuteNonQuery();
                }
            }
            MessageBox.Show("STUDENT ACTIVATED!");
            txtstatus.Clear();
            loaddata1();
            loaddata2();
            btnEnabler();
        }
示例#27
0
        private void altertable()
        {
            var dbconnect = new dbConnector();

            using (dbconnection = dbconnect.connector())
            {
                //int a = int.Parse(studid);
                dbconnection.Open();
                using (var command = new MySqlCommand("alter table studentprofile auto_increment =" + studid + ";", dbconnection))
                {
                    //command.Parameters.AddWithValue("@count", studid);
                    command.ExecuteNonQuery();
                }
                using (var command2 = new MySqlCommand("alter table studdetails auto_increment = " + studid + ";", dbconnection))
                {
                    //command2.Parameters.AddWithValue("@count", studid);
                    command2.ExecuteNonQuery();
                }
            }
        }
示例#28
0
        private Boolean itemcheck(string itemname, string description)
        {
            var connect = new dbConnector();

            using (MySqlConnection conn = connect.connector())
            {
                string query = "SELECT * FROM itemdetails WHERE itemname = '" + itemname + "' AND description = '" + description + "';";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("An Item Has Already Been Added With The Same Item!", "CAUTION!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#29
0
        private Boolean studentcheck(string fn, string ln, string mn)
        {
            var connect = new dbConnector();

            using (MySqlConnection conn = connect.connector())
            {
                string query = "SELECT * FROM studentprofile WHERE FirstName = '" + fn + "' AND LastName = '" + ln + "' AND MiddleName = '" + mn + "';";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("A Student Has Already Been Enrolled With The Same Name!", "CAUTION!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#30
0
        private void deactivator()
        {
            DialogResult res = MessageBox.Show("Confirm Item Deactivation?", "Confirm Action!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res == DialogResult.Yes)
            {
                var dbconnect = new dbConnector();
                using (dbconnection = dbconnect.connector())
                {
                    dbconnection.Open();
                    string query2 = "UPDATE itemdetails SET itemstatus = @istatus WHERE itemID = @ayd;";
                    using (var command2 = new MySqlCommand(query2, dbconnection))
                    {
                        command2.Parameters.AddWithValue("@istatus", 0);
                        command2.Parameters.AddWithValue("@ayd", id);
                        command2.ExecuteNonQuery();
                    }
                }
                MessageBox.Show("ITEM/S DEACTIVATED!", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Error);
                readData2();
            }
        }