Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String designM = lite.stripString(artDesign.Text);

            if (designM == "" || artFamille.Text == "")
            {
                MessageBox.Show("Tous les champs doivent etre remplis", "champ invalide", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            long   refFamille = long.Parse(listeFamille.Rows[artFamille.SelectedIndex][0].ToString());
            int    choixsuivi = int.Parse(typesuivi.Rows[suivistock.SelectedIndex][0].ToString());
            String designArt  = lite.stripString(artDesign.Text);
            String date       = DateTime.Now.Date.ToString("yyyy-MM-dd");
            String request    = @"INSERT INTO F_MATERIEL (MA_DESIGN,MA_DATE,FA_CODE,MA_SUIVISTOCK) 
                        VALUES('{0}','{1}',{2},{3})
                    ";

            request = String.Format(request, designArt.ToUpper(), date, refFamille, choixsuivi);


            SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector());

            cmd.ExecuteNonQuery();
            artDesign.Text           = "";
            artFamille.SelectedIndex = 0;
            //MessageBox.Show(designArt + " " + refFamille, "champ a enregistrer", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        public void updatefamille()
        {
            String design  = lite.stripString(designfam.Text.ToUpper());
            String request = @"UPDATE F_FAMILLE SET FA_INTITULE = '{0}', FA_CODE='{1}' WHERE FA_CODE = '{2}'";

            request = string.Format(request, design, lite.stripString(fa_code), lite.stripString(fa_code));

            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #3
0
        public void updateMat()
        {
            String design    = matdesign.Text.ToUpper();
            int    famId     = int.Parse(listeFamille.Rows[famille.SelectedIndex][0].ToString());
            int    suivstock = int.Parse(typesuivi.Rows[suivistock.SelectedIndex][0].ToString());
            String codefam   = listeFamille.Rows[famille.SelectedIndex][2].ToString();
            //MessageBox.Show(famId + ' ' + design + ' ' + codefam);
            String request = @"UPDATE F_MATERIEL SET MA_DESIGN = '{0}', FA_CODE='{1}',MA_SUIVISTOCK = {3} WHERE MA_NO = {2}";

            request = string.Format(request, lite.stripString(design), lite.stripString(codefam), matId, suivstock);

            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #4
0
        private void validerFamille_Click(object sender, EventArgs e)
        {
            if (familleRef.Text == "" || familleDesign.Text == "")
            {
                MessageBox.Show("Tous les champs sont obligatoires", "champ invalide", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (lite.familleExists(familleRef.Text.ToUpper()))
            {
                MessageBox.Show("Cette reference existe deja", "reference invalide", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            lite.createFamille(lite.stripString(familleRef.Text.ToUpper()), lite.stripString(familleDesign.Text.ToUpper()));
            familleRef.Text    = "";
            familleDesign.Text = "";
            ActiveControl      = familleRef;
        }
        public void ligneMouvInsertion(Double mo_qte, int mo_type, String mo_date, String mo_piece, String mo_motif, int ma_no, int de_no)
        {
            mo_motif = lite.stripString(mo_motif);
            String request = @"
                INSERT INTO F_LIGNEMOUVEMENT (MO_QTE,MO_DATE,MO_TYPE,MO_PIECE,MO_MOTIF,MA_NO,DE_NO)
                VALUES({0},'{1}',{2},'{3}','{4}',{5},{6})
            ";

            request = String.Format(request, mo_qte, mo_date, mo_type, mo_piece, mo_motif, ma_no, de_no);
            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #6
0
        public void recherche(String motif)
        {
            listeMateriauxDatagrid.Rows.Clear();
            SQLiteConnection conn    = lite.getConnector();
            String           request = @"SELECT * FROM F_MATERIEL WHERE MA_DESIGN LIKE '%{0}%'";

            request = String.Format(request, lite.stripString(motif));
            String[] rows;
            using (SQLiteCommand cmd = new SQLiteCommand(request, conn))
            {
                using (SQLiteDataReader sd = cmd.ExecuteReader())
                {
                    while (sd.Read())
                    {
                        Double[] result = getMaterielStock(sd.GetInt64(0));
                        rows    = new string[5];
                        rows[0] = sd.GetInt64(0).ToString();
                        rows[1] = sd.GetString(1);
                        if (result[0] > 0)
                        {
                            rows[2] = result[0].ToString();
                        }
                        if (result[1] > 0)
                        {
                            rows[3] = result[1].ToString();
                        }
                        if (result[2] > 0)
                        {
                            rows[4] = result[2].ToString();
                        }
                        listeMateriauxDatagrid.Rows.Add(rows);
                    }
                }
            }

            if (listeMateriauxDatagrid.SelectedRows.Count > 0)
            {
                listeMateriauxDatagrid.SelectedRows[0].Selected = false;
            }
        }