コード例 #1
0
        private void btn_ValidationBE_Click(object sender, EventArgs e)
        {
            BordereauEnvoi be;

            if (dataGridViewBE.Rows.Count > 0)
            {
                be = new BordereauEnvoi(dataGridViewBE.CurrentRow.Cells[0].Value.ToString(), Convert.ToInt32(dataGridViewBE.CurrentRow.Cells[1].Value), dataGridViewBE.CurrentRow.Cells[2].Value.ToString(), dataGridViewBE.CurrentRow.Cells[4].Value.ToString(), dataGridViewBE.CurrentRow.Cells[5].Value.ToString(), Convert.ToInt32(dataGridViewBE.CurrentRow.Cells[6].Value), BDDPlan.getAllPlanBE(dataGridViewBE.CurrentRow.Cells[0].Value.ToString(), sessionUser.projetModif.code_Projet));
                if (be.Etat == 1)
                {
                    // Validation bordereau envoi
                    BDDBordereauEnvoi.UpdateBordereauEnvoiValidation(be.Code_Bordereau, 2);
                    foreach (Plan plan in be.ListPlan)
                    {
                        // Valid_Archi
                        BDDValidArchi.CreateVA(be.Code_Bordereau, plan.Code_Plan, plan.Indice, 1);
                        // Valid_BC
                        BDDValidBC.CreateVBC(be.Code_Bordereau, plan.Code_Plan, plan.Indice, 1);
                    }
                    LoadBE();
                }
                else
                {
                    MessageBox.Show("Le bordereau " + be.Code_Bordereau + " a déjà été validé !");
                }
            }
        }
コード例 #2
0
        public void loadTabValidation()
        {
            // Charge tous les bordereaux d'envois dans le dataGridViewBE
            List <BordereauEnvoi> listBE = BDDBordereauEnvoi.getAllBEWithDate(sessionUser.projetModif.code_Projet);
            ValidArchi            vA;
            ValidBc vBC;
            int     nbPlan = 0;

            dataGridViewValidation.Rows.Clear();

            if (listBE.Count() != 0)
            {
                foreach (BordereauEnvoi be in listBE)
                {
                    nbPlan = be.ListPlan.Count();
                    if (nbPlan != 0)
                    {
                        foreach (Plan plan in be.ListPlan)
                        {
                            vA  = BDDValidArchi.GetVA(be.Code_Bordereau, plan.Code_Plan, plan.Indice, 1);
                            vBC = BDDValidBC.GetVBC(be.Code_Bordereau, plan.Code_Plan, plan.Indice, 1);
                            this.dataGridViewValidation.Rows.Add(be.Code_Bordereau, be.DateCrea, plan.Code_Plan, plan.Indice, vA.DT_REP_ARCHI, vA.Num_Cour_Arch, vA.Rep_Archi, vBC.Dt_Rep_Bc, vBC.Num_Courrir_Bc, vBC.Rep_Bc);
                        }
                        vA  = null;
                        vBC = null;
                    }
                }
            }
        }
コード例 #3
0
        private void LoadBE()
        {
            // Charge tous les bordereaux d'envois dans le dataGridViewBE
            List <BordereauEnvoi> listBE = BDDBordereauEnvoi.getAllBE(sessionUser.projetModif.code_Projet);
            string listPlans             = "";
            int    nbPlan = 0;

            dataGridViewBE.DataSource = null;
            dataGridViewBE.Rows.Clear();

            if (listBE.Count() != 0)
            {
                foreach (BordereauEnvoi be in listBE)
                {
                    nbPlan = be.ListPlan.Count();
                    if (nbPlan != 0)
                    {
                        foreach (Plan plan in be.ListPlan)
                        {
                            if (listPlans != "")
                            {
                                listPlans += " - " + plan.Numero_Plan;
                            }
                            else
                            {
                                listPlans += plan.Numero_Plan;
                            }
                        }
                    }

                    this.dataGridViewBE.Rows.Add(be.Code_Bordereau, be.Numero_Bordereau, be.Designation, listPlans, be.Exemplaire, be.Version, be.Etat);

                    listPlans = "";
                }
            }
        }
コード例 #4
0
        private void buttonValiderBE_Click(object sender, EventArgs e)
        {
            string      codeBordereau = "", designation = "", exemplaire = "", version = "", messErreur = "";
            int         numeroBordereau = 0, nbLigne = 0, nbdtgv = 0;
            List <Plan> listPlan = new List <Plan>();

            if (textBoxNumeroBordereau.Text != "" && textBoxDesignationBordereau.Text != "" && textBoxExemplaireBordereau.Text != "" && textBoxVersionBordereau.Text != "")
            {
                try
                {
                    numeroBordereau = Convert.ToInt32(textBoxNumeroBordereau.Text);
                }
                catch (Exception err)
                {
                    messErreur = (err.Message);
                }

                foreach (DataGridViewRow row in dataGridViewPlan.Rows)
                {
                    if (Convert.ToBoolean(row.Cells[0].Value))
                    {
                        //nbLigne = BDDBordPlan.CreateBordPlan(codeBordereau, row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value));
                        Plan plan = new Plan(row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value), row.Cells[3].Value.ToString(), Convert.ToInt32(row.Cells[4].Value), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), Convert.ToDateTime(row.Cells[7].Value));
                        listPlan.Add(plan);
                    }
                }
                foreach (DataGridViewRow row in dataGridViewPlan.Rows)
                {
                    if (Convert.ToBoolean(row.Cells[0].Value))
                    {
                        Plan plan = new Plan(row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value), row.Cells[3].Value.ToString(), Convert.ToInt32(row.Cells[4].Value), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), Convert.ToDateTime(row.Cells[7].Value));
                        if (BDDPlan.containsInListPlanByCode(listPlan, plan))
                        {
                            messErreur += "Veuillez à ne pas cocher le même plan : '" + plan.Code_Plan + "' !\n";
                        }
                    }
                }

                if (messErreur == "")
                {
                    designation = textBoxDesignationBordereau.Text;
                    exemplaire  = textBoxExemplaireBordereau.Text;
                    version     = textBoxVersionBordereau.Text;

                    if (this.mode == 1)
                    {
                        // On créé le bordereau_envoi

                        codeBordereau = BDDBordereauEnvoi.GenerateCodeBE(sessionUser.projetModif.code_Projet);

                        nbLigne = BDDBordereauEnvoi.CreateBordereauEnvoi(sessionUser.projetModif.code_Projet, codeBordereau, numeroBordereau, designation, exemplaire, version, 1);

                        if (nbLigne != 0)
                        {
                            // On créé le bord_projet
                            nbLigne = BDDBordProjet.CreateBordereauProjet(sessionUser.projetModif.code_Projet, codeBordereau);
                            // On créé le bord_plan
                            foreach (DataGridViewRow row in dataGridViewPlan.Rows)
                            {
                                if (Convert.ToBoolean(row.Cells[0].Value))
                                {
                                    nbLigne = BDDBordPlan.CreateBordPlan(codeBordereau, row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value));
                                }
                            }

                            MessageBox.Show("Le bordereau à bien été ajouté !");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Erreur lors de l'ajout du bordereau.");
                        }
                    }
                    else
                    {
                        // On modifie le bordereau_envoi
                        codeBordereau = this.be.Code_Bordereau;
                        // Update BE
                        nbLigne = BDDBordereauEnvoi.UpdateBordereauEnvoi(sessionUser.projetModif.code_Projet, codeBordereau, numeroBordereau, designation, exemplaire, version);
                        // Update Bord_Plan
                        foreach (DataGridViewRow row in dataGridViewPlan.Rows)
                        {
                            Plan plan = new Plan(row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value), row.Cells[3].Value.ToString(), Convert.ToInt32(row.Cells[4].Value), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), Convert.ToDateTime(row.Cells[7].Value));
                            // Si le plan est coché
                            if (Convert.ToBoolean(row.Cells[0].Value))
                            {
                                if (!BDDPlan.containsInListPlan(be.ListPlan, plan))
                                {
                                    // On ajoute un bord plan
                                    nbLigne = BDDBordPlan.CreateBordPlan(codeBordereau, row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value));
                                }
                            }
                            else
                            {
                                if (BDDPlan.containsInListPlan(be.ListPlan, plan))
                                {
                                    // DELETE
                                    nbLigne = BDDBordPlan.DeleteBordPlan(codeBordereau, row.Cells[1].Value.ToString(), Convert.ToInt32(row.Cells[2].Value));
                                }
                            }
                        }

                        MessageBox.Show("Le bordereau à bien été modifié !");
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show(messErreur);
                    messErreur = "";
                }
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs !");
            }
        }