예제 #1
0
        private void BtnAttribuerBien_Click(object sender, RoutedEventArgs e)
        {
            DirectoryCreator dcr = new DirectoryCreator();
            BiensController  BC  = new BiensController();

            dcr.CreateDirectory3(inputNumAttri.Text);
            AttributionController AC = new AttributionController();

            AC.AjouterAttribution(inputDateAttribution.Text, inputNumClient.Text, inputNumProjet.Text, inputNumProgramme.Text, inputNatureProgramme.Text, inputTypeBien.Text, inputNumIlot.Text, inputNumLot.Text, inputNumBloc.Text, tempIdbien, inputDateDLE.Text, inputDateDLR.Text, inputRefDL.Text);
            BC.ModifierEtat(tempIdbien, inputEtat.Text);
            AddPayementController APC = new AddPayementController();

            APC.AjouterPayement(inputDateAttribution.Text, int.Parse(inputNumAttri.Text), inputNumClient.Text, inputNomClient.Text, inputPrenomClient.Text, inputDateNaissance.Text, inputNumCNI.Text, int.Parse(inputNumProjet.Text), inputNomProjet.Text, int.Parse(inputNumProgramme.Text), inputNomProgramme.Text, inputNumIlot.Text, inputNumLot.Text, inputTypeBien.Text, inputNumBloc.Text, inputNiveau.Text, inputNbrPiece.Text, decimal.Parse(inputSurH.Text), decimal.Parse(inputSurU.Text), decimal.Parse(inputPrixTTC.Text), 0, decimal.Parse(inputPrixTTC.Text));

            string          queryL = "Select NumA from Attribution where NumA=(select MAX(NumA) from attribution)";
            MySqlDataReader rdrL   = null;
            MySqlConnection conL   = null;
            MySqlCommand    cmdL   = null;

            conL = new MySqlConnection(Database.ConnectionString());
            conL.Open();
            cmdL            = new MySqlCommand(queryL);
            cmdL.Connection = conL;
            rdrL            = cmdL.ExecuteReader();

            while (rdrL.Read())
            {
                tempNumAttribution = int.Parse(rdrL["NumA"].ToString());
            }
            MessageBox.Show(tempNumAttribution.ToString());

            string queryL2 = "Select NumPayement from payement where NumAttribution='" + tempNumAttribution + "'";

            MySqlDataReader rdrL2 = null;
            MySqlConnection conL2 = null;
            MySqlCommand    cmdL2 = null;

            conL2 = new MySqlConnection(Database.ConnectionString());
            conL2.Open();
            cmdL2            = new MySqlCommand(queryL2);
            cmdL2.Connection = conL2;
            rdrL2            = cmdL2.ExecuteReader();

            while (rdrL2.Read())
            {
                tempNumPayement = int.Parse(rdrL2["NumPayement"].ToString());
            }
            msh.ExecuteQuery("INSERT INTO `cnl` (`NumCNL`, `NumPayement`, `Etat`, `NumDeci`, `DateDeci`, `MontantCNL`, `DateConservation`, `DateControle`, `DateReserve`) VALUES (NULL, '" + tempNumAttribution + "', 'Non Admis', '', NULL, NULL, NULL, NULL, NULL)");
            msh.ExecuteQuery("INSERT INTO `creditb` (`NumCB`, `NumPayement`, `NumConvBan`, `DateConv`, `NomBanque`, `BIC`, `MontantCb`) VALUES (NULL, '" + tempNumAttribution + "', '', NULL, '', '', NULL)");
            msh.ExecuteQuery("INSERT INTO `fnpos` (`NumFNPOS`, `NumPayement`, `NumDeciF`, `DateDeciF`, `MontantFNPOS`) VALUES (NULL, '" + tempNumAttribution + "', NULL, NULL, NULL)");

            BtnAttribuerBien.IsEnabled = false;


            Attribution A = new Attribution("");

            this.NavigationService.Navigate(A);
        }
예제 #2
0
        private void Btnmodifier_Click(object sender, RoutedEventArgs e)
        {
            AttributionController AC = new AttributionController();

            AC.ModifierAttribution(inputDateAttribution.Text, inputNumClient.Text, inputNumProjet.Text, inputNumProgramme.Text, inputNatureProgramme.Text, inputTypeBien.Text, inputNumIlot.Text, inputNumLot.Text, inputNumBloc.Text, tempIdbien, int.Parse(inputNumAttri.Text), inputDateDLE.Text, inputDateDLR.Text, inputRefDL.Text);

            if (tempIdbien != tempIdbien2)
            {
                BiensController BC = new BiensController();
                BC.ModifierEtat(tempIdbien2, "Libre");
                BC.ModifierEtat(tempIdbien, "Réservé");
            }
            string          queryload = "Select MontantVerse from payement where NumAttribution='" + inputNumAttri.Text + "'";
            MySqlDataReader rdrP      = null;
            MySqlConnection conP      = null;
            MySqlCommand    cmdP      = null;

            conP = new MySqlConnection(Database.ConnectionString());
            conP.Open();
            cmdP            = new MySqlCommand(queryload);
            cmdP.Connection = conP;
            rdrP            = cmdP.ExecuteReader();
            bool oneTimeP = true;

            while (rdrP.Read())
            {
                tempMontantVers = decimal.Parse(rdrP["MontantVerse"].ToString());
            }
            conP.Close();

            tempreste = decimal.Parse(inputPrixTTC.Text) - tempMontantVers;

            AddPayementController APC = new AddPayementController();

            APC.ModifierPayement(int.Parse(inputNumProjet.Text), inputNomProjet.Text, int.Parse(inputNumProgramme.Text), inputNomProgramme.Text, inputNumIlot.Text, inputNumLot.Text, inputTypeBien.Text, inputNumBloc.Text, inputNiveau.Text, inputNbrPiece.Text, decimal.Parse(inputSurH.Text), decimal.Parse(inputSurU.Text), decimal.Parse(inputPrixTTC.Text), tempreste, int.Parse(inputNumAttri.Text));
        }