/// <summary>
 /// Adds the received <see cref="GenericDeviceData"/> to the <see cref="DevicesData"/> dictionary.
 /// </summary>
 /// <param name="key">The key to be used in the <see cref="DevicesData"/> dictionary.</param>
 /// <param name="deviceData">The <see cref="GenericDeviceData"/> to be added to the <see cref="DevicesData"/> dictionary.</param>
 protected virtual void AddDeviceDataToList(string key, GenericDeviceData deviceData)
 {
     if (DevicesData.ContainsKey(key) == false)
     {
         DevicesData.Add(key, deviceData);
     }
 }
        /// <summary>
        /// Removes all <see cref="GenericDeviceData"/> from <see cref="DevicesData"/> with the name received in the parameters
        /// </summary>
        /// <param name="deviceName">The name of the device to be removed from <see cref="DevicesData"/></param>
        protected void CleanAllWithName(string deviceName)
        {
            var idsToKill = new List <string>();

            foreach (var genericDeviceData in DevicesData)
            {
                if (genericDeviceData.Value.DeviceName == deviceName)
                {
                    idsToKill.Add(genericDeviceData.Key);
                }
            }

            foreach (var key in idsToKill)
            {
                //Debug.Log("CleanAllWithName -> Removing device data: " + key);
                DevicesData.Remove(key);
            }
        }
        /// <summary>
        /// Removes from the <see cref="DevicesData"/> entries that are no long present in the <see cref="GenericDevice"/> of this device.
        /// </summary>
        /// <param name="genericDevice"></param>
        protected void CleanOldObjects(GenericDevice genericDevice)
        {
            var idsToKill = new List <string>();

            var ids = genericDevice.GetDeviceIds();

            foreach (var processData in DevicesData)
            {
                if (processData.Value.DeviceName == genericDevice.DeviceName && ids.Contains(processData.Key) == false)
                {
                    idsToKill.Add(processData.Key);
                }
            }

            foreach (var key in idsToKill)
            {
                //Debug.Log("CleanOldObjects -> Removing device data: " + key);
                DevicesData.Remove(key);
            }
        }
Exemplo n.º 4
0
        private AirBnbDataAccessors()
        {
            // Get all sessions data
            var sessions = AirBnbSessionsData.GetAllAirBnbSessionsRecords(dataFilePath);

            DevicesData    = new DevicesData();
            UserAgentsData = new UserAgentsData();
            SessionsData   = new SessionsData();

            foreach (var airBnbSessionRecord in sessions)
            {
                // Initialize devices data
                DevicesData.AddEntry(airBnbSessionRecord);

                // Initialize UserAgent data
                UserAgentsData.AddEntry(airBnbSessionRecord);

                // Initialize Sessions data
                SessionsData.AddEntry(airBnbSessionRecord);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Destroys the GameObjects associated with <see cref="GenericDeviceData"/> that do not exist in the <see cref="UdpGenericTranslator.Devices"/>
        /// </summary>
        protected virtual void DestroyOld()
        {
            //print("DestroyOld called from GanericDeviceController");
            //var allIds = UdpGenericTranslator.Devices.ContainsKey(DeviceName) ? UdpGenericTranslator.Devices[DeviceName].GetDeviceIds() : new List<string>();
            var idsToRemove = new List <string>();

            foreach (var device in DevicesData)
            {
                //if (allIds.Contains(device.Value.Id)) continue;
                if (device.Value.HasAnyValue())
                {
                    continue;
                }
                idsToRemove.Add(device.Value.Id);
                DestroyImmediate(device.Value.UnityObject);
            }

            foreach (var id in idsToRemove)
            {
                DevicesData.Remove(id);
            }
        }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Naprave";
            Master.Title       = "Podatki naprave";
            if (!Master.Uporabnik.Pravice.Contains("naprava_podatki"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg    = Request.QueryString["msg"] ?? "";
            _sort  = Request.QueryString["sort"] ?? "";
            _id    = Convert.ToInt32(Request.QueryString["id"] ?? "0");
            _DevID = Request.QueryString["id_s"] ?? "";

            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_napravapodatki"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "adModificationDate desc";
                }
            }
            else
            {
                Session["sort_napravapodatki"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_napravapodatki"]) ?? "";

            DataTable dt = DevicesData.Get_d(_DevID);
            if (dt.Rows.Count > 0)
            {
                if (Request.QueryString["a"] == "csv")
                {
                    Response.Clear();
                    byte[] csv = Encoding.Default.GetBytes(Splosno.Csv(dt, "Naprava-podatki"));
                    Response.ContentType = "application/csv; name=Naprava-podatki.csv";
                    Response.AddHeader("content-transfer-encoding", "binary");
                    Response.AddHeader("Content-Disposition", "attachment; filename=Naprava-podatki.csv");
                    Response.OutputStream.Write(csv, 0, csv.Length);
                    Response.Flush();
                    Response.End();
                }
                if (Request.QueryString["a"] == "batch")
                {
                    //new Thread(Skulpture.PosljiPodatke).Start();
                }
                if (Request.QueryString["a"] == "pdf")
                {
                    //DateTime datum_racuna = DateTime.Now;
                    //List<byte[]> pdfs = new List<byte[]>();
                    //int c = 0;
                    //foreach (DataRow r in dt.Select("", "priimek,ime"))
                    //{
                    //    if (c++ > 10) break;
                    //    if (Convert.ToBoolean(r["aktiven"]))
                    //    {
                    //        Response furs_response = new Response();
                    //        string stranka_naziv = Convert.ToString(r["ime"]) + " " + Convert.ToString(r["priimek"]);
                    //        string stranka_naslov = Convert.ToString(r["naslov"]);
                    //        string stranka_posta = Convert.ToString(r["posta"]);
                    //        string stranka_kraj = Convert.ToString(r["kraj"]);
                    //        string stranka_email = Convert.ToString(r["email"]);
                    //        int id_racun = Racuni.Izdaj(0, "gotovinski", "elektronski_racun", datum_racuna, datum_racuna, datum_racuna, "INT", "ONL", "", "", "", Master.Uporabnik.Username, Master.Uporabnik.Davcna, stranka_naziv, stranka_naslov, stranka_kraj, stranka_posta, stranka_email, "", "", new List<Racuni.Vrstica>(new Racuni.Vrstica[] { new Racuni.Vrstica("Letna dovolilnica " + Master.Date.Year, 22, 40.98, 0, "0", 1, "") }), 0, false, false, out furs_response);
                    //        pdfs.Add(Racuni.GetPdf(id_racun, false));
                    //    }
                    //}
                    //pdfs.Reverse();
                    //Response.Clear();
                    //byte[] pdf = (byte[])Pdf.GeneratePdf(pdfs);
                    //Response.ContentType = "application/csv; name=LetneDovolilnice.pdf";
                    //Response.AddHeader("content-transfer-encoding", "binary");
                    //Response.AddHeader("Content-Disposition", "attachment; filename=LetneDovolilnice.pdf");
                    //Response.OutputStream.Write(pdf, 0, pdf.Length);
                    //Response.Flush();
                    //Response.End();
                }
                else
                {
                    r_napravapodatki.DataSource = dt.Select("", _sort).CopyToDataTable();
                    r_napravapodatki.DataBind();
                }
            }


            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }