コード例 #1
0
        private void ValidChanges_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> bnq_Values = new Dictionary <string, string>()
            {
                { "NumOP", TBNumOP.Text },
                { "NumSerieCheque", TBNumSerCk.Text },
                { "Date", TBDate.Text },
                { "Beneficiaire", TBBeneficiaire.Text },
                { "Reference", TBReference.Text },
                { "Montant", TBMt.Text },
                { "NumBoite", TBNumBoite.Text }
            };

            // Verifier la saisie
            bool allgood = true;
            var  errmsg  = "Veillez remplir le champs";

            foreach (var item in bnq_Values)
            {
                if (item.Key == "Montant")
                {
                    continue;
                }
                if (item.Value == "")
                {
                    switch (item.Key)
                    {
                    case "NumOP":
                        errorProvider1.SetError(TBNumOP, errmsg);
                        allgood = false;
                        break;

                    case "Date":
                        errorProvider1.SetError(TBDate, errmsg);
                        allgood = false;
                        break;

                    case "NumBoite":
                        errorProvider1.SetError(TBNumBoite, errmsg);
                        allgood = false;
                        break;
                    }
                }
            }

            if (!allgood)
            {
                MessageBox.Show("Veillez remplir tous les champs nécessaire!!");
                return;
            }

            //verifier les chagements des colonnes

            Helper.VerifyChanges(bnq_Values, this);


            bnq_Values["NumBoite"] = string.IsNullOrWhiteSpace(TBNumBoite.Text) ? "0" : TBNumBoite.Text;
            bnq_Values["Montant"]  = string.IsNullOrWhiteSpace(Montant) ? "0" : Montant;

            Helper.CheckForQuote(ref bnq_Values);
            // update vente set [Client]= ,[DateFacture]= ,[Numfacture]= ,[NumProjet]= ,[BU]= ,[Numboite]= where [NomDossier]=
            var req    = $"UPDATE banque SET  [NumOP]='{bnq_Values["NumOP"]}' ,[NumSerieCheque]='{bnq_Values["NumSerieCheque"]}' ,[Date]='{bnq_Values["Date"]}' ,[Beneficiaire]='{bnq_Values["Beneficiaire"]}' ,[Reference]='{bnq_Values["Reference"]}' ,[Montant]={bnq_Values["Montant"]} ,[NumBoite]={bnq_Values["NumBoite"]} ,[id_status]=6 ,[id_user_control]={id_user_control},date_control=GETDATE() WHERE [NomDossier]='{NomDoc}' ";
            var constr = ConfigurationManager.ConnectionStrings["StrCon"].ConnectionString;

            using (SqlConnection cnn = new SqlConnection(constr))
            {
                cnn.Open();
                var cmd = new SqlCommand(req, cnn);
                cmd.ExecuteNonQuery();
                //MessageBox.Show("Opération effectué!!");
            }
            // supprimer le document dans le treeView
            controle.UpdateTreeView();
        }
コード例 #2
0
        private void ValidChanges_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> cs_Values = new Dictionary <string, string>()
            {
                { "DatePiece", TBDatePiece.Text },
                { "NumProjet", TBNProjet.Text },
                { "BU", TBBU.Text },
                { "Reference", TBReference.Text },
                { "NumDImatricul", TBNumImm.Text },
                { "Salarie", TBSalarie.Text },
                { "NumBoite", TBNumBoite.Text },
            };

            // Verifier la saisie

            bool allgood = true;
            var  errmsg  = "Veillez remplir le champs";

            foreach (var item in cs_Values)
            {
                if (string.IsNullOrWhiteSpace(item.Value))
                {
                    switch (item.Key)
                    {
                    case "DatePiece":
                        errorProvider1.SetError(TBDatePiece, errmsg);
                        allgood = false;
                        break;

                    case "NumProjet":
                        errorProvider1.SetError(TBNProjet, errmsg);
                        allgood = false;
                        break;

                    case "NumDImatricul":
                        errorProvider1.SetError(TBNumImm, errmsg);
                        allgood = false;
                        break;

                    case "Salarie":
                        errorProvider1.SetError(TBSalarie, errmsg);
                        allgood = false;
                        break;

                    case "NumBoite":
                        errorProvider1.SetError(TBNumBoite, errmsg);
                        allgood = false;
                        break;
                    }
                }
            }

            if (!allgood)
            {
                MessageBox.Show("Veillez remplir tous les champs nécessaire!!");
                return;
            }

            //verifier les chagements des colonnes
            Helper.VerifyChanges(cs_Values, this);

            cs_Values["NumBoite"] = string.IsNullOrWhiteSpace(TBNumBoite.Text) ? "0" : TBNumBoite.Text;
            Helper.CheckForQuote(ref cs_Values);
            // Enregistrer les modifications
            var req    = $"update Caisse set [DatePiece]='{cs_Values["DatePiece"]}' ,[NumProjet]='{cs_Values["NumProjet"]}' ,[BU]='{cs_Values["BU"]}' ,[NumBoite]={cs_Values["NumBoite"]},Reference='{cs_Values["Reference"]}',NumDImatricul='{cs_Values["NumDImatricul"]}',Salarie='{cs_Values["Salarie"]}',id_status=6,id_user_control={id_user_control},date_control=GETDATE() WHERE [NomDossier]='{NomDoc}' ";
            var constr = ConfigurationManager.ConnectionStrings["StrCon"].ConnectionString;

            using (SqlConnection cnn = new SqlConnection(constr))
            {
                cnn.Open();
                var cmd = new SqlCommand(req, cnn);
                cmd.ExecuteNonQuery();
                //MessageBox.Show("Opération effectué!!");
            }
            // supprimer le document dans le treeView
            controle.UpdateTreeView();
        }
コード例 #3
0
        private void validChanges_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> Import_Values = new Dictionary <string, string>
            {
                { "NumDossier", TB_numDoss.Text },
                { "NumFactureFournisseurEtrange", TB_NFactFournEtrange.Text },
                { "NumBonComndEtrnge", TB_numBCmdEtrange.Text },
                { "NomFournisseurEtrange", TB_NomFournEtrange.Text },
                { "RefFactureFournisseurLocal1", TB_refFactFournLocal1.Text },
                { "NumBonComndFournisseurLocal1", TB_numBonCmdFournLocal1.Text },
                { "RefFactureFournisseurLocal2", TB_refFactFournLocal2.Text },
                { "NumBonComndFournisseurLocal2", TB_numBonCmdFournLocal2.Text },
                { "NumEngagementImport", TB_numEngagImport.Text },
                { "NumBoite", TB_numBoite.Text },
            };

            // Verifier les erreurs
            bool allgood = true;
            var  errmsg  = "Veillez remplir le champs";

            foreach (var item in Import_Values)
            {
                if (item.Value == "")
                {
                    switch (item.Key)
                    {
                    case "NumDossier":
                        errorProvider1.SetError(TB_numDoss, errmsg);
                        allgood = false;
                        break;

                    case "NumFactureFournisseurEtrange":
                        errorProvider1.SetError(TB_NFactFournEtrange, errmsg);
                        allgood = false;
                        break;

                    case "NumBonComndEtrnge":
                        errorProvider1.SetError(TB_numBCmdEtrange, errmsg);
                        allgood = false;
                        break;

                    case "NomFournisseurEtrange":
                        errorProvider1.SetError(TB_NomFournEtrange, errmsg);
                        allgood = false;
                        break;

                    case "RefFactureFournisseurLocal1":
                        errorProvider1.SetError(TB_refFactFournLocal1, errmsg);
                        allgood = false;
                        break;

                    case "NumBonComndFournisseurLocal1":
                        errorProvider1.SetError(TB_numBonCmdFournLocal1, errmsg);
                        allgood = false;
                        break;

                    case "RefFactureFournisseurLocal2":
                        errorProvider1.SetError(TB_refFactFournLocal2, errmsg);
                        allgood = false;
                        break;

                    case "NumBonComndFournisseurLocal2":
                        errorProvider1.SetError(TB_numBonCmdFournLocal2, errmsg);
                        allgood = false;
                        break;

                    case "NumEngagementImport":
                        errorProvider1.SetError(TB_numEngagImport, errmsg);
                        allgood = false;
                        break;

                    case "NumBoite":
                        errorProvider1.SetError(TB_numBoite, errmsg);
                        allgood = false;
                        break;
                    }
                }
            }

            if (!allgood)
            {
                MessageBox.Show("Veillez remplir tous les champs nécessaire!!");
                return;
            }


            //verifier les chagements des colonnes
            Helper.VerifyChanges(Import_Values, this);

            Import_Values["NumBoite"] = string.IsNullOrWhiteSpace(TB_numBoite.Text) ? "0" : TB_numBoite.Text;

            Helper.CheckForQuote(ref Import_Values);

            var constr = ConfigurationManager.ConnectionStrings["StrCon"].ConnectionString;

            using (SqlConnection cnn = new SqlConnection(constr))
            {
                cnn.Open();

                // update vente set [Client]= ,[DateFacture]= ,[Numfacture]= ,[NumProjet]= ,[BU]= ,[Numboite]= where [NomDossier]=
                var req = $"UPDATE import SET [NumDossier]='{Import_Values["NumDossier"]}' ,[NumFactureFournisseurEtrange]='{Import_Values["NumFactureFournisseurEtrange"]}' ,[NumBonComndEtrnge]='{Import_Values["NumBonComndEtrnge"]}' ,[NomFournisseurEtrange]='{Import_Values["NomFournisseurEtrange"]}', [RefFactureFournisseurLocal1]='{Import_Values["RefFactureFournisseurLocal1"]}',[NumBonComndFournisseurLocal1]='{Import_Values["NumBonComndFournisseurLocal1"]}' ,[RefFactureFournisseurLocal2]='{Import_Values["RefFactureFournisseurLocal2"]}' ,[NumBonComndFournisseurLocal2]='{Import_Values["NumBonComndFournisseurLocal2"]}', [NumEngagementImport]='{Import_Values["NumEngagementImport"]}' , [NumBoite]={Import_Values["NumBoite"]} ,[id_status]=6 ,[id_user_control]={id_user_control},date_control=GETDATE() WHERE [NomDossier]='{NomDoc}' ";

                var cmd = new SqlCommand(req, cnn);
                cmd.ExecuteNonQuery();
                //MessageBox.Show("Opération effectué!!");
            }
            // supprimer le document dans le treeView
            controle.UpdateTreeView();
            controle.CalculeProdControl();
        }
コード例 #4
0
        private void validChanges_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> cl_Values = new Dictionary <string, string>()
            {
                { "Client", TBClient.Text },
                { "DateFacture", TBDateFacture.Text },
                { "Numfacture", TBNFacture.Text },
                { "NumProjet", TBNumProjet.Text },
                { "BU", TBbu.Text },
                { "NumBoite", TBNumBoite.Text },
            };

            // Verifier la saisie
            bool allgood = true;
            var  errmsg  = "Veillez remplir le champs";

            foreach (var item in cl_Values)
            {
                if (item.Value == "")
                {
                    switch (item.Key)
                    {
                    case "Client":
                        errorProvider1.SetError(TBClient, errmsg);
                        allgood = false;
                        break;

                    case "DateFacture":
                        errorProvider1.SetError(TBDateFacture, errmsg);
                        allgood = false;
                        break;

                    case "Numfacture":
                        errorProvider1.SetError(TBNFacture, errmsg);
                        allgood = false;
                        break;

                    case "NumBoite":
                        errorProvider1.SetError(TBNumBoite, errmsg);
                        allgood = false;
                        break;
                    }
                }
            }

            if (!allgood)
            {
                MessageBox.Show("Veillez remplir tous les champs nécessaire!!");
                return;
            }

            //verifier les chagements des colonnes
            Helper.VerifyChanges(cl_Values, this);

            cl_Values["NumBoite"] = string.IsNullOrWhiteSpace(TBNumBoite.Text) ? "0" : TBNumBoite.Text;

            Helper.CheckForQuote(ref cl_Values);
            // update vente set [Client]= ,[DateFacture]= ,[Numfacture]= ,[NumProjet]= ,[BU]= ,[Numboite]= where [NomDossier]=
            var req    = $"UPDATE vente SET [Client]='{cl_Values["Client"]}' ,[DateFacture]='{cl_Values["DateFacture"]}' ,[Numfacture]='{cl_Values["Numfacture"]}' ,[NumProjet]='{cl_Values["NumProjet"]}' ,[BU]='{cl_Values["BU"]}' ,[NumBoite]={cl_Values["NumBoite"]},id_status=6,id_user_control='{id_user_control}',date_control=GETDATE() WHERE [NomDossier]='{NomDoc}' ";
            var constr = ConfigurationManager.ConnectionStrings["StrCon"].ConnectionString;

            using (SqlConnection cnn = new SqlConnection(constr))
            {
                cnn.Open();
                var cmd = new SqlCommand(req, cnn);
                cmd.ExecuteNonQuery();
                //MessageBox.Show("Opération effectué!!");
            }
            // supprimer le document dans le treeView
            controle.UpdateTreeView();
            controle.CalculeProdControl();
        }