示例#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);
        }
示例#2
0
        public void initFamille()
        {
            SQLiteConnection conn    = lite.getConnector();
            String           request = @"SELECT * from F_FAMILLE";
            String           famcode = getFamCodeFromMat();
            int cpt = 0;

            using (SQLiteCommand cmd = new SQLiteCommand(request, conn))
            {
                using (SQLiteDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        if (famcode == dr.GetString(2))
                        {
                            index = cpt;
                            cpt   = -1;
                        }
                        listeFamille.Rows.Add(dr.GetInt64(0), dr.GetString(1), dr.GetString(2));
                        if (cpt >= 0)
                        {
                            cpt++;
                        }
                    }
                }
            }
        }
示例#3
0
        public void loadMateriaux()
        {
            listeMateriauxDatagrid.Rows.Clear();
            SQLiteConnection conn    = lite.getConnector();
            String           request = @"SELECT *
                               FROM F_MATERIEL";

            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);
                    }
                }
            }
        }
示例#4
0
        public void ligneMouvInsertion(Double mo_qte, int mo_type, String mo_date, String mo_piece, String mo_motif, int ma_no, int de_no)
        {
            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();
            }
        }
示例#5
0
        public void loadMateriaux()
        {
            String request = @"
                SELECT * FROM F_MATERIEL ORDER BY MA_DESIGN ASC
            ";

            String[] row;
            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                using (SQLiteDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        listMateriaux.Rows.Add(dr.GetInt64(0), dr.GetString(1));
                    }
                }
            }
        }
示例#6
0
        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();
            }
        }
示例#7
0
        public void updatedepot()
        {
            String design = intitule.Text.ToUpper(), adress = adr.Text.ToUpper();
            String request = @"UPDATE F_DEPOT SET DE_DESIGN = '{0}', DE_ADR='{1}' WHERE DE_NO = {2}";

            request = string.Format(request, design, adress, refDepot);

            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                cmd.ExecuteNonQuery();
            }
        }
示例#8
0
        public void processLigneDocument(long mat_ref, int typedoc)
        {
            dataGridView1.Rows.Clear();
            qteTotale.Text = "";
            String request = @"
                SELECT MA_DESIGN,MO_QTE,MO_DATE,MO_PIECE
                FROM F_MATERIEL,F_LIGNEMOUVEMENT
                WHERE F_MATERIEL.MA_NO = F_LIGNEMOUVEMENT.MA_NO
                    AND MO_TYPE = {0} AND F_LIGNEMOUVEMENT.MA_NO = {1}
                    AND MO_DATE >= '{2}' AND MO_DATE <= '{3}'
            ";

            request = String.Format(request, typedoc, mat_ref, debut, fin);
            string[] row;
            Double   total = 0;

            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                using (SQLiteDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        row    = new string[4];
                        row[0] = dr.GetString(3);
                        row[1] = dr.GetString(0);
                        row[2] = dr.GetString(2);
                        row[3] = dr.GetDouble(1).ToString();
                        total += dr.GetDouble(1);
                        dataGridView1.Rows.Add(row);
                    }
                }
            }

            if (dataGridView1.SelectedRows.Count > 0)
            {
                dataGridView1.ClearSelection();
            }

            qteTotale.Text = total.ToString();
        }
        public void loadDataTable()
        {
            listeMateriaux.Rows.Clear();
            SQLiteConnection conn    = lite.getConnector();
            String           request = @"SELECT * FROM F_MATERIEL";

            using (SQLiteCommand cmd = new SQLiteCommand(request, conn))
            {
                using (SQLiteDataReader sd = cmd.ExecuteReader())
                {
                    while (sd.Read())
                    {
                        listeMateriaux.Rows.Add(sd.GetInt64(0), sd.GetString(1));
                    }
                }
            }
        }
示例#10
0
        public void getAllDocuments()
        {
            ligneStock.Rows.Clear();

            String request = @"
                SELECT MO_TYPE,MO_PIECE,MO_MOTIF,MA_DESIGN,MO_DATE,MO_QTE
                FROM F_LIGNEMOUVEMENT,F_MATERIEL
                WHERE F_LIGNEMOUVEMENT.MA_NO = F_MATERIEL.MA_NO AND MO_DATE BETWEEN '{0}' AND '{1}'
            ";

            if (choixDocument > 0)
            {
                request += String.Format(" AND MO_TYPE = {0}", choixDocument);
            }
            request = string.Format(request, dateDebutFiltre, dateFinFiltre);
            String[] row;
            long     type;

            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                using (SQLiteDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        row    = new string[6];
                        type   = dr.GetInt64(0);
                        row[0] = codeType(type);
                        row[1] = dr.GetString(1);
                        row[2] = dr.GetString(3);
                        row[3] = dr.GetString(4);
                        row[4] = dr.GetDouble(5).ToString();
                        row[5] = dr.GetString(2);

                        ligneStock.Rows.Add(row);
                    }
                }
            }
            if (formLoaded == 1 && ligneStock.RowCount > 0)
            {
                ligneStock.SelectedRows[0].Selected = false;
            }
        }
示例#11
0
        public void getMateriaux()
        {
            dataGridView1.Rows.Clear();
            String request = @"
                SELECT F_MATERIEL.MA_NO,MA_DESIGN,ST_QTESTOCK,ST_HORSERVICE
                FROM F_MATERIEL,F_MATSTOCK
                WHERE F_MATERIEL.MA_NO = F_MATSTOCK.MA_NO 
            ";

            if (choixRupture == 1)
            {
                request += " AND ST_QTESTOCK <= ST_QTEMIN";
            }
            else
            {
                request += " AND ST_QTESTOCK > ST_QTEMIN AND ST_QTESTOCK <= (ST_QTEMIN + (ST_QTEMIN * 1.5))";
            }
            String[] row;
            using (SQLiteCommand cmde = new SQLiteCommand(request, lite.getConnector()))
            {
                using (SQLiteDataReader dr = cmde.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        row    = new string[4];
                        row[0] = dr.GetInt64(0).ToString();
                        row[1] = dr.GetString(1);
                        row[2] = dr.GetDouble(2).ToString();
                        row[3] = dr.GetDouble(3).ToString();

                        dataGridView1.Rows.Add(row);
                    }
                }
            }

            if (dataGridView1.SelectedRows.Count > 0)
            {
                dataGridView1.ClearSelection();
            }
        }
示例#12
0
        public void fetchAllDepots()
        {
            listeDepotDatagrid.Rows.Clear();
            String request = @"
                SELECT * FROM F_DEPOT
            ";

            String[] row;
            using (SQLiteCommand cmd = new SQLiteCommand(request, lite.getConnector()))
            {
                using (SQLiteDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        row    = new string[3];
                        row[0] = dr.GetInt64(0).ToString();
                        row[1] = dr.GetString(1);
                        row[2] = dr.GetString(2);
                        listeDepotDatagrid.Rows.Add(row);
                    }
                }
            }
        }