Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.ServiceModel.Activation;
- using System.Collections.Generic;
- using System.Text;
- using System.Data;
- using System.Data.SqlClient;
- using System.Collections;
- using System.Data.OracleClient;
- using System.IO;
- using Sources;
- using FC_2010;
- namespace FC_2010
- {
- [ServiceContract(Namespace = "")]
- [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
- public class Service1
- {
- private classOracle co;
- public string DB_connect()
- {
- co = new classOracle();
- co.Base = "Annexe4";
- co.User = "crc";
- co.Password = "crc";
- if (co.connect())
- {
- return "Connexion avec succès";
- }
- else
- {
- return co.Erreur;
- }
- }
- public string DB_disconnect()
- {
- if (co.deconnect())
- {
- return "Déconnexion avec succès";
- }
- else
- {
- return co.Erreur;
- }
- }
- [OperationContract]
- public BindingUtilisateur authentification(String _login, String _pwd)
- {
- /*DB_connect();
- Object[,] res = executeCmd("SELECT * FROM PDF_USERS WHERE USER_LOGIN='" + _login + "' AND USER_PASSWORD='" + _pwd + "'");
- if (res.GetLength(0) == 0)
- {
- log = "";
- }
- else
- {
- log = _login;
- }
- DB_disconnect();*/
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- Facturation.APP_UTILISATEURRow u = (Facturation.APP_UTILISATEURRow)Gestion_Droit.Identification_Utilisateur(_login, _pwd);
- if (u == null)
- return new BindingUtilisateur();
- else
- return new BindingUtilisateur(u);
- }
- public Object[,] executeCmd(String cmd)
- {
- return co.getQueryResult(cmd);
- }
- [OperationContract]
- public string getTest()
- {
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- Facturation.FC_FACTUREDataTable table = new Facturation.FC_FACTUREDataTable();
- FC_FACTURE.SELECT_FC_FACTURE(table, true);
- int count = table.Rows.Count;
- return ""+count;
- }
- [OperationContract]
- public StreamReader testDTStream()
- {
- DataTable dt = new DataTable("Facture");
- dt.Rows.Add();
- dt.Rows.Add();
- dt.Rows.Add();
- dt.Rows.Add();
- dt.Rows.Add();
- dt.Rows.Add();
- dt.WriteXml("C:\\Facture.xml");
- StreamReader s = new StreamReader("C:\\Facture.xml");
- return s;
- }
- [OperationContract]
- public List<BindingFC_FACTURE> getFC_FACTURELists()
- {
- //chaine de connexion
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- //récupération de la dataTable
- Facturation.FC_FACTUREDataTable table = new Facturation.FC_FACTUREDataTable();
- FC_FACTURE.SELECT_FC_FACTURE(table, false);
- List<BindingFC_FACTURE> retour = new List<BindingFC_FACTURE>();
- remplirListeGenerique(retour,null, table);
- return retour;
- }
- [OperationContract]
- public List<BindingRESEAU_AGENCE> getRESEAU_AGENCELists(BindingUtilisateur _u)
- {
- //chaine de connexion
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- /* Test USER */
- StreamWriter sw = new StreamWriter("C:\\user.txt");//création du fichier
- String text = "User : " + _u.get_CODE_FRANCHISE() + " " + _u.get_UTIL_ID() + " " + _u.get_PROFIL_ID();
- sw.WriteLine("{0}", text);//enregistrement du message dans le fichier
- sw.Close();
- //récupération de la dataTable
- Facturation.RESEAU_AGENCEDataTable table = new Facturation.RESEAU_AGENCEDataTable();
- Reseau_Agence.SELECT_AGENCE(_u.get_CODE_FRANCHISE(), _u.get_UTIL_ID(),_u.get_PROFIL_ID(), ref table, false);
- Reseau_Agence.SELECT_RESEAU_AGENCE(_u.get_CODE_FRANCHISE(), Convert.ToInt32(_u.get_UTIL_ID()), Convert.ToInt32(_u.get_PROFIL_ID()), false).WriteXml("C:\\leXML.xml");
- List<BindingRESEAU_AGENCE> retour = new List<BindingRESEAU_AGENCE>();
- remplirListeGenerique(null,retour, table);
- return retour;
- }
- /*
- [OperationContract]
- public List<BindingFC_FRANCHISE> getFC_FRANCHISELists()
- {
- //chaine de connexion
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- //récupération de la dataTable
- Facturation.FC_FACTUREDataTable table = new Facturation.FC_FACTUREDataTable();
- FC_FACTURE.SELECT_FC_FACTURE(table, false);
- List<BindingFC_FACTURE> retour = new List<BindingFC_FACTURE>();
- remplirListe(retour, table);
- return retour;
- }
- */
- public void remplirListeGenerique(List<BindingFC_FACTURE> _list_BindingFC_FACTURE,List<BindingRESEAU_AGENCE> _list_BindingRESEAU_AGENCE, DataTable _table)
- {
- if (_list_BindingFC_FACTURE != null)
- {
- _list_BindingFC_FACTURE.Clear();
- for (int i = 0; i < _table.Rows.Count; i++)
- {
- _list_BindingFC_FACTURE.Add(new BindingFC_FACTURE(_table.Rows[i][0].ToString(), _table.Rows[i][30].ToString(), _table.Rows[i][1].ToString(), _table.Rows[i][2].ToString(), _table.Rows[i][3].ToString(), _table.Rows[i][4].ToString(), _table.Rows[i][49].ToString()));
- }
- }
- if (_list_BindingRESEAU_AGENCE != null)
- {
- StreamWriter sw = new StreamWriter("C:\\texte.txt");//création du fichier
- String text = "Rows.count " + _table.Rows.Count;
- sw.WriteLine("{0}", text);//enregistrement du message dans le fichier
- sw.Close();
- _list_BindingRESEAU_AGENCE.Clear();
- Facturation.RESEAU_AGENCERow _row;
- for (int i = 0; i < _table.Rows.Count; i++)
- {
- _row = (Facturation.RESEAU_AGENCERow) _table.Rows[i];
- _list_BindingRESEAU_AGENCE.Add(new BindingRESEAU_AGENCE(_row));
- //_list_BindingRESEAU_AGENCE.Add(new BindingRESEAU_AGENCE(_table.Rows[i][0].ToString(), _table.Rows[i][1].ToString(), _table.Rows[i][2].ToString(), _table.Rows[i][3].ToString(), _table.Rows[i][4].ToString(), _table.Rows[i][5].ToString(), _table.Rows[i][6].ToString(), _table.Rows[i][7].ToString(), _table.Rows[i][8].ToString(), _table.Rows[i][9].ToString(), _table.Rows[i][10].ToString(), _table.Rows[i][11].ToString(), _table.Rows[i][11].ToString(), _table.Rows[i][12].ToString(), _table.Rows[i][13].ToString(), (DateTime)_table.Rows[i][14], (DateTime) _table.Rows[i][15], _table.Rows[i][16].ToString(), _table.Rows[i][17].ToString(), _table.Rows[i][18].ToString(), _table.Rows[i][19].ToString(), _table.Rows[i][20].ToString(), _table.Rows[i][21].ToString(), _table.Rows[i][22].ToString(), _table.Rows[i][23].ToString(), _table.Rows[i][24].ToString(), _table.Rows[i][25].ToString(), (int) _table.Rows[i][26], (int) _table.Rows[i][27], (int) _table.Rows[i][28], (int) _table.Rows[i][29], _table.Rows[i][30].ToString(), _table.Rows[i][31].ToString(), _table.Rows[i][32].ToString(), _table.Rows[i][33].ToString(), _table.Rows[i][34].ToString(), _table.Rows[i][35].ToString(), _table.Rows[i][36].ToString(), _table.Rows[i][37].ToString(), _table.Rows[i][38].ToString(), _table.Rows[i][39].ToString(), _table.Rows[i][40].ToString(), _table.Rows[i][41].ToString(), _table.Rows[i][42].ToString(), _table.Rows[i][43].ToString(), _table.Rows[i][44].ToString(), _table.Rows[i][45].ToString(), (int) _table.Rows[i][46], _table.Rows[i][47].ToString()));
- }
- }
- }
- [OperationContract]
- public bool updateFC_FACTURELists(List<BindingFC_FACTURE> _inList)
- {
- //chaine de connexion
- CADO.ConnectionString = "Password=crc;User ID=crc;Data Source=Annexe4";
- //récupération de la dataTable
- Facturation.FC_FACTUREDataTable table = new Facturation.FC_FACTUREDataTable();
- FC_FACTURE.SELECT_FC_FACTURE(table, false);
- bool retour = updateTableFromFactureList(table, _inList);
- return retour;
- }
- /**
- * mise à jour des factures dans la BDD
- * ajout des nouvelles lignes
- * mise à jour des anciennes
- *
- */
- public bool updateTableFromFactureList(Facturation.FC_FACTUREDataTable _table, List<BindingFC_FACTURE> _list)
- {
- bool b = false;
- try
- {
- foreach (BindingFC_FACTURE _l in _list)
- {
- int i = Int32.Parse(_l.get_FACT_ID());
- int s = Int32.Parse(_l.get_SOLDE());
- FC_FACTURE.UPDATE_FC_FACTURE_SOLDE(i, s);
- }
- b = true;
- }
- catch(Exception e)
- {
- b = false;
- }
- return b;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement