Пример #1
0
        public PPal()
        {
            try
            {
                aux     = false;
                Pulsado = false;
                InitializeComponent();
                Botones.BackColor     = Color.Transparent;
                pictureBox1.BackColor = Color.Transparent;
                pictureBox2.BackColor = Color.Transparent;
                pictureBox3.BackColor = Color.Transparent;
                pictureBox4.BackColor = Color.Transparent;
                Botones.Parent        = pictureBox5;
                pictureBox1.Parent    = pictureBox5;
                pictureBox2.Parent    = pictureBox5;
                pictureBox3.Parent    = pictureBox5;
                pictureBox4.Parent    = pictureBox5;

                xml       = new XmlElementoSer();
                BD        = new BDS();
                Variables = new Globales();
                xml.Open(true, ref aux);
                Variables.VVIP = aux;
                BD.Open(xml.VConex, true, xml.VTablas);
                BD.BD("DELETE FROM Noticias WHERE Fecha<'" + string.Format("{0:yyyy/MM/dd HH:mm}", FechNY2()) + "'");
                System.Threading.Thread.Sleep(200);
                BD.Open(xml.VConex, true, xml.VTablas);
                BS                            = new BindingSource();
                BS.DataSource                 = BD.Tabla("Usuarios");
                BS.Filter                     = "VIP='" + Variables.VVIP + "'";
                Clientes                      = new CUsuarios();
                SP                            = new System.Media.SoundPlayer("Sonido.wav");
                pictureBox2.Visible           = false;
                DGNot.DataSource              = BD.Tabla("Noticias");
                DGNot.Columns[0].Visible      = false;
                DGNot.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                DGNot.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                DocConf.Load("Config.xml");
                n = DocConf.SelectSingleNode("Config");
                if (n != null)
                {
                    version = Convert.ToInt16(n.ChildNodes.Item(3).InnerText);
                }
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Пример #2
0
        public static int Login(CUsuarios Us, BDS Base, string txt, ref string Nom, ref string cl)
        {
            string[] res;

            res = Captura(txt);

            if (res.Length == 2)
            {
                Nom = res[0];
                cl  = res[1];
            }
            else
            {
                return(0);
            }

            DataRow[] DRC;
            try
            {
                if (Us.Exist(Nom))
                {
                    return(4);
                }
                DRC = Base.Tabla("Usuarios").Select("Usuario='" + Nom + "' AND VIP='false'");
                if (DRC.Length > 0)
                {
                    TimeSpan duracion = DateTime.Parse(DRC[0].ItemArray[8].ToString()) - DateTime.Today;
                    if (duracion.Days < 0)
                    {
                        return(1);
                    }
                    if (DRC[0].ItemArray[2].ToString() == Encriptar(cl))
                    {
                        return(2);
                    }
                }
                else
                {
                    return(0);
                }
                return(0);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }