Ejemplo n.º 1
0
        public Szerk(MdTermekek termekek)
        {
            rs            = new RktServ();
            this.termekek = termekek;
            InitializeComponent();

            button1.DialogResult = DialogResult.OK;

            NameHolder.setText(termekek.getTNev());

            PriceHolder.setText(termekek.getTar().ToString());

            AmmountHolder.setText(termekek.getTkeszl().ToString());

            UnitHolder.setText(termekek.getMert());

            CodeHolder.setText(termekek.getTkatkod().ToString());


            VonCodeHolder.setText(termekek.getTvonkod().ToString());
            dateTimePicker1.Value = termekek.getSzavido();



            bool eg = false;

            if (termekek.getTegalizalte() == true)
            {
                eg = true;
                checkBox1.CheckState = CheckState.Checked;
            }
        }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 1)
            {
                dataGridView1.ClearSelection();
                return;
            }
            bool teg = false;
            int  id  = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());

            if (dataGridView1.SelectedRows[0].Cells[8].Value.ToString() == "True")
            {
                teg = true;
            }
            MdTermekek termekek = new MdTermekek(
                Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString())
                , dataGridView1.SelectedRows[0].Cells[1].Value.ToString()
                , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[2].Value.ToString())
                , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[3].Value.ToString())
                , dataGridView1.SelectedRows[0].Cells[4].Value.ToString()
                , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[5].Value.ToString())
                , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[6].Value.ToString())
                , Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[7].Value.ToString())
                , teg);

            dataGridView1.DataSource = rs.moveToNotImportant(termekek, id);
        }
Ejemplo n.º 3
0
        internal void addNewItem(int id, MdTermekek termekek)
        {
            MySqlConnection connect = new MySqlConnection(conG);

            try
            {
                connect.Open();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                throw new Exception("Sikertelen adatbázismegnyitás.");
            }

            DateTime dt = termekek.getSzavido();


            string uj = dt.toMysqlFormat();



            string       query = "INSERT INTO `termekek` (`Tkod`, `Tnev`, `Tar`, `Tkeszl`, `Tmert`, `Tkatkod`, `Tvonkod`, `Tszavido`, `Tegalizalte`) VALUES ('" + termekek.getTkod() + "', '" + termekek.getTNev() + "', '" + termekek.getTar() + "', '" + termekek.getTkeszl() + "', '" + termekek.getMert() + "', '" + termekek.getTkatkod() + "', '" + termekek.getTvonkod() + "', '" + uj + "', '" + termekek.getTegalizalte() + "')";
            MySqlCommand cmd   = new MySqlCommand(query, connect);

            cmd.ExecuteNonQuery();
            connect.Close();
        }
Ejemplo n.º 4
0
        public void update(int id, MdTermekek t)
        {
            MySqlConnection connect = new MySqlConnection(conG);

            connect.Open();



            DateTime dt = t.getSzavido();

            string uj = dt.toMysqlFormat();



            string query = "UPDATE `termekek` SET `Tkod`=" + t.getTkod() + ",`Tnev`='" + t.getTNev() + "',`Tar`=" + t.getTar() + ",`Tkeszl`=" + t.getTkeszl() + ",`Tmert`='" + t.getMert() + "',`Tkatkod`=" + t.getTkatkod() + ",`Tvonkod`=" + t.getTvonkod() + ",`Tszavido`='" + uj + "',`Tegalizalte`=" + t.getTegalizalte() + " WHERE Tkod=" + id + "";
            //a lekérdezés jó. máshol van a hiba



            MySqlCommand cm = new MySqlCommand(query, connect);

            cm.ExecuteNonQuery();



            connect.Close();
        }
Ejemplo n.º 5
0
        internal void MoveToOld(MdTermekek termekek)
        {
            MySqlConnection connect = new MySqlConnection(conG);

            try
            {
                connect.Open();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                throw new Exception("Sikertelen adatbázismegnyitás.");
            }

            DateTime dt = termekek.getSzavido();


            string uj = dt.toMysqlFormat();



            string       dquery = "DELETE FROM `termekek` WHERE Tkod=" + termekek.getTkod() + "";
            MySqlCommand cmd    = new MySqlCommand(dquery, connect);

            cmd.ExecuteNonQuery();
            connect.Close();
        }
Ejemplo n.º 6
0
        public DataTable editDataSrc(int id, MdTermekek termekek)
        {
            ops = new DBOperation();



            foreach (MdTermekek product in productsList)
            {
                if (product.getTkod() == id)
                {
                    product.setTkod(id);
                    product.setTnev(termekek.getTNev());

                    product.setTar(termekek.getTar());
                    product.setTkeszl(termekek.getTkeszl());
                    product.setTmert(termekek.getMert());

                    product.setTkatkod(termekek.getTkatkod());
                    product.setTvonkod(termekek.getTvonkod());
                    product.setTSzavido(termekek.getSzavido());
                    product.setTegaliz(termekek.getTegalizalte());
                }
            }
            ops.update(id, termekek);

            return(getToDataTable());
        }
Ejemplo n.º 7
0
        private void fillProductListFromDataTable()
        {
            ops = new DBOperation();
            Adatbazis a = new Adatbazis();
            MySQLDatabaseInterface mdi = a.kapcsolodas();

            mdi.open();
            string query = "SELECT * FROM termekek ";

            dtCustomer = mdi.getToDataTable(query);
            mdi.close();
            dtCustomer = ops.getFullDt("termekek");
            try
            {
                foreach (DataRow row in dtCustomer.Rows)
                {
                    int    Tkod    = Convert.ToInt32(row["Tkod"].ToString());
                    string Tnev    = row["Tnev"].ToString();
                    int    Tar     = Convert.ToInt32(row["Tar"].ToString());
                    int    Tkeszl  = Convert.ToInt32(row["Tkeszl"].ToString());
                    string Tmert   = row["Tmert"].ToString();
                    int    Tkatkod = Convert.ToInt32(row["Tkatkod"].ToString());
                    int    Tvonkod = Convert.ToInt32(row["Tvonkod"].ToString());

                    DateTime Tszavido = Convert.ToDateTime(row["Tszavido"].ToString());


                    bool       Tegalizalte = Convert.ToBoolean(row["Tegalizalte"].ToString());
                    MdTermekek c           = new MdTermekek(Tkod, Tnev, Tar, Tkeszl, Tmert, Tkatkod, Tvonkod, Tszavido, Tegalizalte);
                    productsList.Add(c);
                }
            }
            catch {
            }
        }
Ejemplo n.º 8
0
        public DataTable modifyData(int id, MdTermekek termekek)
        {
            DataTable dt = new DataTable();

            dt = t.editDataSrc(id, termekek);
            return(dt);
        }
Ejemplo n.º 9
0
        internal DataTable addNewItem(int id, MdTermekek t)
        {
            ops = new DBOperation();

            ops.addNewItem(id, t);
            productsList.Add(t);
            return(getToDataTable());
        }
Ejemplo n.º 10
0
        public bool checkExist(MdTermekek newT)
        {
            ops = new DBOperation();
            foreach (MdTermekek c in productsList)
            {
                if (c.getTkod() == newT.getTkod())
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 11
0
        public DataTable addNewItem()
        {
            bool eg = false;

            if (checkBox1.Checked)
            {
                eg = true;
            }
            else
            {
                eg = false;
            }



            MdTermekek t = new MdTermekek(_Sid, NameHolder.Text, Convert.ToInt32(PriceHolder.Text), Convert.ToInt32(AmmountHolder.Text), UnitHolder.Text, Convert.ToInt32(CodeHolder.Text), Convert.ToInt32(VonCodeHolder.Text), dateTimePicker1.Value, eg);

            return(rs.addNewItem(id, t));
        }
Ejemplo n.º 12
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows.Count > 1)
                {
                    dataGridView1.ClearSelection();
                    return;
                }
                bool teg = false;

                if (dataGridView1.SelectedRows[0].Cells[8].Value.ToString() == "True")
                {
                    teg = true;
                }
                MdTermekek termekek = new MdTermekek(
                    Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString())
                    , dataGridView1.SelectedRows[0].Cells[1].Value.ToString()
                    , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[2].Value.ToString())
                    , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[3].Value.ToString())
                    , dataGridView1.SelectedRows[0].Cells[4].Value.ToString()
                    , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[5].Value.ToString())
                    , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[6].Value.ToString())
                    , Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[7].Value.ToString())
                    , teg);
                sz = new Szerk(termekek);
                sz.ShowDialog();
                if (sz.DialogResult == DialogResult.OK)
                {
                    try
                    {
                        dataGridView1.DataSource = null;

                        dataGridView1.DataSource = sz.raktnak();
                    }
                    catch (Exception d) {  }
                    /*rs.modifyData(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()), termekek);*/
                }
            }
            catch (Exception a) { MessageBox.Show("nem jelöltél ki semmit");
                                  button1_Click(sender, e); }
        }
Ejemplo n.º 13
0
        internal DataTable moveTo(MdTermekek termekek, int id)
        {
            ops = new DBOperation();
            int i = 0;

            while (i < productsList.Count)
            {
                if (termekek.getTkod() == productsList[i].getTkod())
                {
                    var selected = termekek;

                    od.AddNew(new Regitermekek(selected.getTkod(), selected.getTNev(), selected.getTar(), selected.getTkeszl(), selected.getMert(), selected.getTkatkod(), selected.getTvonkod(), selected.getSzavido(), selected.getTegalizalte()));

                    ops.MoveToOld(termekek);
                    productsList.RemoveAt(id - 1);
                }
                i++;
            }

            return(ops.getPrdcts());
        }
Ejemplo n.º 14
0
 internal void addProduct(MdTermekek newCustomer)
 {
     ops = new DBOperation();
     productsList.Add(newCustomer);
 }
Ejemplo n.º 15
0
 internal DataTable addNewItem(int id, MdTermekek h)
 {
     return(t.addNewItem(id, h));
 }
Ejemplo n.º 16
0
 public DataTable moveToNotImportant(MdTermekek termekek, int id)
 {
     return(t.moveTo(termekek, id));
 }