예제 #1
0
        private void Docked(object sender, EventArgs e)
        {
            DateTime CallTime = DateTime.ParseExact("28-10-2014 09:45:00", "dd-MM-yyyy HH:mm:ss", null);
            Print MyPrintDialog = new Print();
            MyPrintDialog.ShowDialog();
            // Init MyService to the Web Service
            bc MyService = new bc(); 
            SqlCeConnection Myconnection = null;
            SqlCeDataReader dbReader = null;
            Myconnection = new SqlCeConnection(connStr);
            Myconnection.Open();

            SqlCeCommand cmd = Myconnection.CreateCommand();
            cmd.CommandText = "SELECT LastUpdate FROM Setup";
            dbReader = cmd.ExecuteReader();
            
            if (dbReader.Read())
            {
                try
                {
                    CallTime = dbReader.GetDateTime(0);
                }
                catch
                {
                    MessageBox.Show("Fejl i dato");
                }
            }
            try
            {
                DataSet CentralList = MyService.StoreData(ds, copies, BarcodePrint, CallTime.ToUniversalTime());
                MessageBox.Show(CentralList.Tables[0].Rows.Count.ToString() + " stregkoder hentet");
                SyncDatabase(CentralList);
                
            }
            catch {
                MessageBox.Show("Kommunikations fejl");
            
            }
            try
            {
                CallTime = DateTime.Now;
                string LastSync = CallTime.AddHours(-3).ToString("MM/dd/yy HH:mm:ss");
                cmd.CommandText = "UPDATE Setup SET LastUpdate = '" + LastSync + "'";
                cmd.ExecuteNonQuery();
                FlushLocalData();
                Myconnection.Close();
                dbReader.Close();
                Myconnection = null;
                dbReader = null;
            }
            catch {
                MessageBox.Show("Fejl ved opdatering af data");
            }
            
            
        }
예제 #2
0
        private void menuItemReprint_Click(object sender, EventArgs e)
        {

            bc MyService = new bc();
            if (MyService.RePrint(RePrint, copies, BarcodePrint))
                MessageBox.Show("Stregkoder bliver udskrevet...");
            else
                MessageBox.Show("Stregkoder bliver udskrevet...");

        }