Example #1
0
        public void acomodarNotificaciones(string respuestaString)
        {
            //ConfigurationUserLevel.None.WriteLine("Me ejecuto"+respuestaString);
            flowLayoutPanel1.Controls.Clear();
            var respuestaJSON = JsonConvert.DeserializeObject <List <Notificacion> >(respuestaString);

            if (Properties.Settings.Default["configuracionoffline"].ToString() != "")
            {
                var leerlocal = JsonConvert.DeserializeObject <DatosOffline>(Properties.Settings.Default["configuracionoffline"].ToString());

                leerlocal.notificaciones = respuestaJSON;
                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(leerlocal);

                Properties.Settings.Default.Save();
            }
            else
            {
                DatosOffline temp = new DatosOffline();
                temp.notificaciones = respuestaJSON;

                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(temp);
                Properties.Settings.Default.Save();
            }

            for (int i = 0; i < respuestaJSON.Count; i++)
            {
                iniciarComponentes(respuestaJSON[i].Contenido);
            }
        }
Example #2
0
        public void acomodarHorario(string respuestaString)
        {
            //  Console.WriteLine("Se ejecuta horario"+respuestaString);
            this.tableLayoutPanel1.Visible = false;
            this.tableLayoutPanel1.Controls.Clear();
            this.tableLayoutPanel1.Controls.Add(this.panel16, 0, 9);
            this.tableLayoutPanel1.Controls.Add(this.panel15, 0, 7);
            this.tableLayoutPanel1.Controls.Add(this.panel14, 0, 6);
            this.tableLayoutPanel1.Controls.Add(this.panel13, 0, 5);
            this.tableLayoutPanel1.Controls.Add(this.panel11, 0, 8);
            this.tableLayoutPanel1.Controls.Add(this.panel10, 0, 3);
            this.tableLayoutPanel1.Controls.Add(this.panel6, 5, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel5, 4, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel4, 3, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel3, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel2, 1, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel8, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.panel9, 0, 2);
            this.tableLayoutPanel1.Controls.Add(this.panel12, 0, 4);


            var respuestaJSON = JsonConvert.DeserializeObject <List <DatosHorario> >(respuestaString);

            if (Properties.Settings.Default["configuracionoffline"].ToString() != "")
            {
                var leerlocal = JsonConvert.DeserializeObject <DatosOffline>(Properties.Settings.Default["configuracionoffline"].ToString());

                leerlocal.horario = respuestaJSON;
                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(leerlocal);

                Properties.Settings.Default.Save();
            }
            else
            {
                DatosOffline temp = new DatosOffline();
                temp.horario = respuestaJSON;

                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(temp);
                Properties.Settings.Default.Save();
            }
            for (int i = 0; i < respuestaJSON.Count; i++)
            {
                for (int k = 0; k < respuestaJSON[i].clase.Count; k++)
                {
                    tableLayoutPanel1.Controls.Add(new Label {
                        Text      = respuestaJSON[i].clase[k].materia + "\n" + respuestaJSON[i].clase[k].grupo + " " + respuestaJSON[i].clase[k].salon,
                        Anchor    = AnchorStyles.None,
                        AutoSize  = true,
                        ForeColor = System.Drawing.Color.White,
                        Font      = new System.Drawing.Font("Lato", 8F,
                                                            System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                    },
                                                   i + 1, obtenerPosTabla(respuestaJSON[i].clase[k].hora));
                }
            }
            //  Console.WriteLine("debug:" + ConfigurationManager.AppSettings["configuracionoffline"]);
            this.tableLayoutPanel1.Visible = true;
        }
Example #3
0
        public void acomodarComboBox(string respuestaString)
        {
            string[] portNames = System.IO.Ports.SerialPort.GetPortNames();
            comboBox2.Items.Clear();
            if (portNames.Length != 0)
            {
                foreach (string PortAvailable in portNames)
                {
                    comboBox2.Items.Add(PortAvailable);
                }
                comboBox2.SelectedIndex = 0;
            }
            actualizarAsistenciasGuardadas();
            var respuestaJSON = JsonConvert.DeserializeObject <List <Clases> >(respuestaString);

            if (Properties.Settings.Default["configuracionoffline"].ToString() != "")
            {
                var leerlocal = JsonConvert.DeserializeObject <DatosOffline>(Properties.Settings.Default["configuracionoffline"].ToString());

                leerlocal.clase = respuestaJSON;
                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(leerlocal);

                Properties.Settings.Default.Save();
            }
            else
            {
                DatosOffline temp = new DatosOffline();
                temp.clase = respuestaJSON;

                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(temp);
                Properties.Settings.Default.Save();
            }


            var tempJSON = JsonConvert.DeserializeObject <List <Clases> >(JsonConvert.SerializeObject(respuestaJSON));

            tempJSON.Clear();

            for (int i = 0; i < respuestaJSON.Count; i++)
            {
                if (respuestaJSON[i].dia == (int)fecha.DayOfWeek)
                {
                    tempJSON.Add(respuestaJSON[i]);
                }
            }

            this.comboBox1.DataSource    = tempJSON;
            this.comboBox1.DisplayMember = "materia";
            this.comboBox1.ValueMember   = "ID";
        }
Example #4
0
        public void acomodarCuenta(string respuestaString)
        {
            // Console.WriteLine(respuestaString);
            var respuestaJSON = JsonConvert.DeserializeObject <DatosCuenta>(respuestaString);

            if (Properties.Settings.Default["configuracionoffline"].ToString() != "")
            {
                var leerlocal = JsonConvert.DeserializeObject <DatosOffline>(Properties.Settings.Default["configuracionoffline"].ToString());

                leerlocal.cuenta = respuestaJSON;
                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(leerlocal);

                Properties.Settings.Default.Save();
            }
            else
            {
                DatosOffline temp = new DatosOffline();
                temp.cuenta = respuestaJSON;

                Properties.Settings.Default["configuracionoffline"] = JsonConvert.SerializeObject(temp);
                Properties.Settings.Default.Save();
            }

            this.labelTextoNombre.Text   = respuestaJSON.Nombre + " " + respuestaJSON.Apellido;
            this.labelTextoNomina.Text   = respuestaJSON.Nomina + "";
            this.labelTextoDivision.Text = respuestaJSON.Division;
            if (respuestaJSON.Foto != "")
            {
                //Avatar
                try{
                    var request = WebRequest.Create("https://storage.googleapis.com/wiscko-249904.appspot.com/avatares/" + respuestaJSON.Foto);

                    using (var response = request.GetResponse())
                        using (var stream = response.GetResponseStream())
                        {
                            this.picAvatar.Image = Bitmap.FromStream(stream);
                        }
                }
                catch (Exception ex) {
                }
            }
        }