Esempio n. 1
0
        public void GetPosData(string numpos)
        {
            try {
                //Ouverture de la connexion DB
                string connsqlstring = string.Format ("Server=10.1.2.71;Database=ANDSYS_JET;User Id=sa;Password=jb;");
                Data.sqlconn = new SqlConnection (connsqlstring);
                Data.sqlconn.Open ();
                int i = 0;
                DBRepository dbr = new DBRepository ();
                //SqlConnection sqlconn;
                //string connsqlstring = string.Format("Server=10.1.2.71;Database=ANDSYS_JET;User Id=sa;Password=jb;");
                //sqlconn = new SqlConnection(connsqlstring);
                //sqlconn.Open();
                string queryString = "select OTSCOMTIECODE, OTSTRSCODE, OTSTIENOM, OTSREF, OTSARRNOM, OTSCOL, OTSPAL, OTSPDS, OTSMEMO, OTSARRADR1, OTSARRUSRVILCP, OTSARRUSRVILLIB, OTSDEPADR1, OTSDEPUSRVILCP, OTSDEPUSRVILLIB from ORDRE where OTSNUM='" + numpos + "'";

                SqlCommand sqlcmd = new SqlCommand (queryString, Data.sqlconn);

                var result = sqlcmd.ExecuteReader ();
                while (result.Read ()) {
                    var resultinsert = dbr.InsertPosition (numpos, Convert.ToString (result [0]), Convert.ToString (result [1]), Convert.ToString (result [2]), Convert.ToString (result [3]), Convert.ToString (result [4]), Convert.ToString (result [5]), Convert.ToString (result [6]), Convert.ToString (result [7]), Convert.ToString (result [8]), Convert.ToString (result [9]), Convert.ToString (result [10]), Convert.ToString (result [11]), Convert.ToString (result [12]), Convert.ToString (result [13]), Convert.ToString (result [14]), "", "");
                    i++;
                    insertdone = true;
                }
                if(i==0){
                    insertgowrong = true;
                }
                result.Close ();
                Data.sqlconn.Close ();

            } catch (Exception e) {
                Console.Write (e.Message);
                insertgowrong = true;
            }
        }
Esempio n. 2
0
        public void initapp()
        {
            //Connexion à la base interne
            string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
                (Environment.SpecialFolder.Personal), "ormDMS.db3");

            var db = new SQLiteConnection(dbPath);

            //Crétion de la base de donnée
            DBRepository dbr = new DBRepository ();
            var creadb = dbr.CreateDB ();
            createdb = true;

            var creatable = dbr.CreateTable ();
            createtable = true;
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.Menu);
            iniView ();
            Button ajout = FindViewById<Button> (Resource.Id.ajouttournee);

            //TEST
            //editText = FindViewById<EditText>(Resource.Id.passwordfield);

            bodyListView = FindViewById<ListView> (Resource.Id.bodylist);
            bodyItems = new List<TablePosition> ();

            adapter = new ListViewAdapterMenu (this, bodyItems);
            bodyListView.Adapter = adapter;

            initListView ("SELECT * FROM TablePosition");

            ajout.Click += delegate {
                Dialog dialog = new Dialog (this);
                dialog.Window.RequestFeature (WindowFeatures.NoTitle);
                dialog.Window.SetBackgroundDrawableResource (Resource.Drawable.bktransbox);
                dialog.SetContentView (Resource.Layout.Boxajout);
                Button cree = dialog.FindViewById<Button> (Resource.Id.btn_cree);
                EditText codeeditText = dialog.FindViewById<EditText> (Resource.Id.codetournee);
                cree.Click += delegate {
                    ShowProgress (progress => AndHUD.Shared.Show (this, "Création... " + progress + "%", progress, MaskType.Clear));
                    Thread thread = new Thread (() => CreateVoyage (codeeditText.Text));
                    thread.Start ();
                    while (thread.IsAlive) {
                        iniView ();
                    }
                    dialog.Dismiss ();
                };
                cree.LongClick += delegate {
                    DBRepository dbr = new DBRepository ();
                    dbr.DropTableStatut ();
                    initListView("SELECT * FROM TablePosition");
                    iniView ();
                };
                dialog.SetCancelable (true);
                dialog.Show ();
            };

            //SIMULATION D'insert
            Button btntest = FindViewById<Button> (Resource.Id.nomtournee);
            btntest.Click += delegate {
                ShowProgressInsert (progress => AndHUD.Shared.Show (this, "Insertion ... " + progress + "%", progress, MaskType.Clear));
                Thread threadinsert = new Thread (() => GetPosData ("1406026994"));
                threadinsert.Start ();

                //GetPosData (stringbuilder.ToString());

            };
        }
Esempio n. 4
0
 public void CreateVoyage(string codetournée)
 {
     DBRepository dbr = new DBRepository ();
     dbr.InsertVoyage (Data.User, "A", "123456789", codetournée, DateTime.Now);
     insertvoyage = true;
 }
Esempio n. 5
0
        public void iniView()
        {
            Button btnfintournee = FindViewById<Button> (Resource.Id.btnfintournee);
            Button nomtournee = FindViewById<Button> (Resource.Id.nomtournee);
            DBRepository dbr = new DBRepository ();

            string countVoyage = dbr.CountVoyage ();

            switch (countVoyage) {
            case "0":
                btnfintournee.Visibility = ViewStates.Invisible;
                nomtournee.Visibility = ViewStates.Invisible;
                break;
            case "1":
                btnfintournee.Visibility = ViewStates.Visible;
                nomtournee.Visibility = ViewStates.Visible;
                var resultsel = dbr.SelectData ("0", "", Data.User);
                nomtournee.Text = resultsel;
                break;
            case "2":
                break;
            default:
                break;
            }
        }