Esempio n. 1
0
 //update srs
 public static void AktualizujPowiazanie(SrsLink powiazanie, Srs Serwis)
 {
     using (SQLiteConnection conn = new SQLiteConnection(connectionString))
     {
         conn.Open();
         using (SQLiteCommand cmd = new SQLiteCommand(conn))
         {
             cmd.CommandText = "UPDATE PowiazaniaSrs "
                               + "SET DataModyfikacjiSerwisu = @Data "
                               + "WHERE Id = @Id";
             cmd.Prepare();
             cmd.Parameters.AddWithValue("@Data", Serwis.SrZ_TS_Mod);
             cmd.Parameters.AddWithValue("@Id", powiazanie.Id);
             try
             {
                 cmd.ExecuteNonQuery();
             }
             catch (SQLiteException e)
             {
                 Console.WriteLine(e.Message + " AktualizujPowiazanie(SrsLink powiazanie, Srs Serwis)");
             }
         }
         conn.Close();
     }
 }
Esempio n. 2
0
        public static async Task <string> StworzNowyEvent(Srs serwis, GraphServiceClient x, string srsTopicTemplate, string srsDescTemplate, string srsCalendarId)
        {
            Microsoft.Graph.Location loc = new Location();
            loc.DisplayName = serwis.SrZ_PodMiasto;
            var newEvent = new Event();

            newEvent.Subject = Parser.ParseSrs(srsTopicTemplate, serwis);
            newEvent.Body    = new ItemBody()
            {
                ContentType = BodyType.Html, Content = Parser.ParseSrs(srsDescTemplate, serwis)
            };
            newEvent.Location = loc;
            newEvent.IsAllDay = true;
            //Console.WriteLine("MGRAPH: ID " + serwis.SrZ_SrZId + " / " + serwis.SrZ_DataPrzyjecia + " / " + serwis.SrZ_DataPrzyjecia);
            newEvent.Start = new DateTimeTimeZone()
            {
                DateTime = Convert.ToDateTime(serwis.SrZ_DataRealizacji).ToString("yyyy-MM-ddTHH:mm:ss.fffffff"), TimeZone = "Europe/Warsaw"
            };
            newEvent.End = new DateTimeTimeZone()
            {
                DateTime = Convert.ToDateTime(serwis.SrZ_DataRealizacji).AddDays(1).ToString("yyyy-MM-ddTHH:mm:ss.fffffff"), TimeZone = "Europe/Warsaw"
            };

            Event xx = await x.Me.Calendars[srsCalendarId].Events.Request().AddAsync(newEvent);

            return(xx.Id);
        }
Esempio n. 3
0
 //dla srs
 public static async Task UpdateEvent(string ID, Srs serwis, GraphServiceClient x, string srsTopicTemplate, string srsDescTemplate)
 {
     try
     {
         await x.Me.Calendar.Events[ID].Request().UpdateAsync(new Event()
         {
             Subject = Parser.ParseSrs(srsTopicTemplate, serwis),
             Body    = new ItemBody()
             {
                 ContentType = BodyType.Html, Content = Parser.ParseSrs(srsDescTemplate, serwis)
             },
             Start = new DateTimeTimeZone()
             {
                 DateTime = Convert.ToDateTime(serwis.SrZ_DataRealizacji).ToString("yyyy-MM-ddTHH:mm:ss.fffffff"), TimeZone = "Europe/Warsaw"
             },
             End = new DateTimeTimeZone()
             {
                 DateTime = Convert.ToDateTime(serwis.SrZ_DataRealizacji).AddDays(1).ToString("yyyy-MM-ddTHH:mm:ss.fffffff"), TimeZone = "Europe/Warsaw"
             },
             Location = new Location()
             {
                 DisplayName = serwis.SrZ_PodMiasto
             }
         });
     }
     catch (Exception xc)
     {
         Console.WriteLine(xc.Message);
     }
 }
Esempio n. 4
0
 public double[] Convert(double[] point, Srs srsFrom, Srs srsTo)
 {
     Util.CheckArray(point, 3);
     double[] res = new double[3];
     BrowserInterop.vtsMapConvert(Handle, point, res, (uint)srsFrom, (uint)srsTo);
     Util.CheckInterop();
     return(res);
 }
Esempio n. 5
0
 public void AggiornaStato()
 {
     Operation = _uo.Operation;
     Srs.AggiornaStato();
     As.AggiornaStato();
     Bcs.AggiornaStato();
     Bbs.AggiornaStato();
     Rs.AggiornaStato();
 }
        public static string ParseSrs(string StringToParse, Srs Serwis)
        {
            string Builder = StringToParse;

            //Aliasy
            Builder = Builder.Replace("[IdZlecenia]", Serwis.SrZ_SrZId);
            Builder = Builder.Replace("[NumerPelnyZlecenia]", Serwis.SrZ_NumerPelny);
            Builder = Builder.Replace("[OpisZlecenia]", Serwis.SrZ_Opis);
            Builder = Builder.Replace("[Lokalizacja]", Serwis.SrZ_PodNazwa1);
            Builder = Builder.Replace("[DataRealizacji]", Convert.ToDateTime(Serwis.SrZ_DataRealizacji).ToString("yyyy-MM-dd HH:mm:ss.fff"));
            Builder = Builder.Replace("[DataZamknięcia]", Serwis.SrZ_DataZamkniecia);

            //Console.WriteLine("Parser: ID " + Serwis.SrZ_SrZId + "  / " + Serwis.SrZ_DataRealizacji);

            //WŁASNA KWERENDA SQL
            if (Builder.Contains("[SQL=>"))
            {
                Builder = ParseSQL(Builder);
            }

            return(Builder);
        }
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            base.onCreate(savedInstanceState);
            ContentView = R.layout.activity_sensor;

            remoteSensor = new Srs();

            if (checkPermission())
            {
                initializeeSRS();
            }
            mServiceManager = new SrsRemoteSensorManager(remoteSensor);

            mBtnUserActivityInfo  = (Button)findViewById(R.id.btn_user_activity);
            mBtnUserActivityValue = (ToggleButton)findViewById(R.id.btn_user_activity_value);
            mBtnPedometerInfo     = (Button)findViewById(R.id.btn_pedometer);
            mBtnPedometerValue    = (ToggleButton)findViewById(R.id.btn_pedometer_value);
            mBtnWearingStateInfo  = (Button)findViewById(R.id.btn_wearing_state);
            mBtnWearingStateValue = (Button)findViewById(R.id.btn_wearing_state_value);

            mTextUserActivityInfo  = (TextView)findViewById(R.id.text_user_activity_info);
            mTextUserActivityValue = (TextView)findViewById(R.id.text_user_activity_value);
            mTextPedometerInfo     = (TextView)findViewById(R.id.text_pedometer_info);
            mTextPedometerValue    = (TextView)findViewById(R.id.text_pedometer_value);
            mTextWearingStateInfo  = (TextView)findViewById(R.id.text_wearing_state_info);
            mTextWearingStateValue = (TextView)findViewById(R.id.text_wearing_state_value);

            mBtnUserActivityInfo.OnClickListener          = this;
            mBtnUserActivityValue.OnCheckedChangeListener = this;
            mBtnPedometerInfo.OnClickListener             = this;
            mBtnPedometerValue.OnCheckedChangeListener    = this;
            mBtnWearingStateInfo.OnClickListener          = this;
            mBtnWearingStateValue.OnClickListener         = this;

            mSensorDataUserActivity = new SensorData();
            mSensorDataPedometer    = new SensorData();
            mSensorDataWearingState = new SensorData();
        }
Esempio n. 8
0
        //pobierz srs
        public static SrsLink PobierzPowiazanieDo(Srs serwis)
        {
            SrsLink la = new SrsLink();

            try
            {
                using (SQLiteConnection conn = new SQLiteConnection(connectionString))
                {
                    conn.Open();
                    string sql = "SELECT * FROM PowiazaniaSrs WHERE IdSerwisu = " + serwis.SrZ_SrZId;

                    using (SQLiteCommand cmd = new SQLiteCommand(sql, conn))
                    {
                        using (SQLiteDataReader reader = cmd.ExecuteReader())
                        {
                            if (reader.Read())
                            {
                                la.Id              = Int32.Parse(reader["Id"].ToString());
                                la.IdSerwisu       = Int32.Parse(reader["IdSerwisu"].ToString());
                                la.EventId         = reader["EventId"].ToString();
                                la.DataModyfikacji = Convert.ToDateTime(reader["DataModyfikacjiSerwisu"].ToString());
                            }
                            else
                            {
                                return(null);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            catch (SQLiteException e)
            {
                Console.WriteLine(e.Message + " PobierzPowiazanieDo(Srs serwis)");
            }
            return(la);
        }
Esempio n. 9
0
 //dodaj srs
 public static void DodajPowiazanie(Srs Serwis, string EventId)
 {
     using (SQLiteConnection conn = new SQLiteConnection(connectionString))
     {
         conn.Open();
         using (SQLiteCommand cmd = new SQLiteCommand(conn))
         {
             cmd.CommandText = "INSERT INTO PowiazaniaSrs(IdSerwisu, EventId, DataModyfikacjiSerwisu) VALUES (@IdSerwisu, @EventId, @DataModyfikacjiSerwisu)";
             cmd.Prepare();
             cmd.Parameters.AddWithValue("@IdSerwisu", Serwis.SrZ_SrZId);
             cmd.Parameters.AddWithValue("@EventId", EventId);
             cmd.Parameters.AddWithValue("@DataModyfikacjiSerwisu", Serwis.SrZ_TS_Mod);
             try
             {
                 cmd.ExecuteNonQuery();
             }
             catch (SQLiteException e)
             {
                 Console.WriteLine(e.Message + " DodajPowiazanie(Srs Serwis, string EventId)");
             }
         }
         conn.Close();
     }
 }
		protected internal override void onCreate(Bundle savedInstanceState)
		{
			base.onCreate(savedInstanceState);
			ContentView = R.layout.activity_sensor;

			remoteSensor = new Srs();

			if (checkPermission())
			{
				initializeeSRS();
			}
			mServiceManager = new SrsRemoteSensorManager(remoteSensor);

			mBtnUserActivityInfo = (Button) findViewById(R.id.btn_user_activity);
			mBtnUserActivityValue = (ToggleButton) findViewById(R.id.btn_user_activity_value);
			mBtnPedometerInfo = (Button) findViewById(R.id.btn_pedometer);
			mBtnPedometerValue = (ToggleButton) findViewById(R.id.btn_pedometer_value);
			mBtnWearingStateInfo = (Button) findViewById(R.id.btn_wearing_state);
			mBtnWearingStateValue = (Button) findViewById(R.id.btn_wearing_state_value);

			mTextUserActivityInfo = (TextView) findViewById(R.id.text_user_activity_info);
			mTextUserActivityValue = (TextView) findViewById(R.id.text_user_activity_value);
			mTextPedometerInfo = (TextView) findViewById(R.id.text_pedometer_info);
			mTextPedometerValue = (TextView) findViewById(R.id.text_pedometer_value);
			mTextWearingStateInfo = (TextView) findViewById(R.id.text_wearing_state_info);
			mTextWearingStateValue = (TextView) findViewById(R.id.text_wearing_state_value);

			mBtnUserActivityInfo.OnClickListener = this;
			mBtnUserActivityValue.OnCheckedChangeListener = this;
			mBtnPedometerInfo.OnClickListener = this;
			mBtnPedometerValue.OnCheckedChangeListener = this;
			mBtnWearingStateInfo.OnClickListener = this;
			mBtnWearingStateValue.OnClickListener = this;

			mSensorDataUserActivity = new SensorData();
			mSensorDataPedometer = new SensorData();
			mSensorDataWearingState = new SensorData();

		}