Beispiel #1
0
        public Login(BDS B, XmlElementoSer C, Globales V)
        {
            try
            {
                InitializeComponent();
                label1.BackColor      = Color.Transparent;
                label2.BackColor      = Color.Transparent;
                pictureBox1.BackColor = Color.Transparent;
                label1.Parent         = pictureBox2;
                label2.Parent         = pictureBox2;
                pictureBox1.Parent    = pictureBox2;

                BD        = B;
                XmlConfig = C;
                Cr        = V;
                BS        = new BindingSource();

                BS.DataSource = BD.Tabla("Usuarios");
                BS.Filter     = "Administrador=true AND VIP='" + V.VVIP + "'";

                CUsuarios.DataSource    = BS;
                CUsuarios.ValueMember   = "Usuario";
                CUsuarios.DisplayMember = "Usuario";
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #2
0
        private void Venta_Click(object sender, EventArgs e)
        {
            compvent = true;
            try
            {
                Send(null, "$" + (char)23 + "\r", true);
                System.Media.SystemSounds.Beep.Play();
                //Clipboard.Clear();
                Pulsado = true;
                OICR    = new Thread(LanzaOICR);
                OICR.Start();

                // Clipboard.SetText("&Dato&%");
                //Thread.Sleep(2000);
                // IDataObject iData = Clipboard.GetDataObject();

                // Determines whether the data is in a format you can use.

                //    Send(null, txt + "$" + (char)30 + "\r", true);
                //MessageBox.Show(Nodo.ChildNodes.Item(0).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));
            }
        }
Beispiel #3
0
        private void PPal_Shown(object sender, EventArgs e)
        {
            try
            {
                Visible = false;

                Variables.VCerrar = false;
                Login Lg = new Login(BD, xml, Variables);
                Lg.ShowDialog();

                if (Variables.VCerrar)
                {
                    Close();
                    return;
                }
                Visible = true;
                Clientes.Agregar(Variables.VNombre, null);
                LUsuarios.Items.Clear();
                LUsuarios.Items.AddRange(Clientes.VNombres);
                FTServerCode();
                THR = new System.Threading.Thread(IniciarSer);
                THR.IsBackground = true;
                THR.Start();
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #4
0
        void acceptCallback(IAsyncResult ar)
        {
            try
            {
                allDone.Set();

                Socket listener = (Socket)ar.AsyncState;
                Socket handler  = listener.EndAccept(ar);

                Usuario Us = new Usuario();
                Us.VSc.workSocket = handler;
                try
                {
                    handler.BeginReceive(Us.VSc.buffer, 0, StateObject.BufferSize, 0,
                                         new AsyncCallback(ReadCallback), Us);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #5
0
 public bool BD(string Sel)
 {
     try
     {
         CloseBD();
         if (Access)
         {
             OleConex.Open();
             OleDbCommand cmd = new OleDbCommand(Sel, OleConex); //Pasa la sentencia a la base de datos.
             cmd.ExecuteNonQuery();                              //Ejecuta la Sentencia en la BD.
             OleConex.Close();                                   //Cierra la Conexion a la Base de Datos
         }
         else
         {
             SQLConex.Open();
             SqlCommand cmd = new SqlCommand(Sel, SQLConex); //Pasa la sentencia a la base de datos.
             cmd.ExecuteNonQuery();                          //Ejecuta la Sentencia en la BD.
             SQLConex.Close();                               //Cierra la Conexion a la Base de Datos
         }
         return(true);
     }
     catch (Exception ex)
     {
         Funciones.Log(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
         return(false);
     }
 }
Beispiel #6
0
        private void InTR(string txt)
        {
            int tam = 0;

            try
            {
                if (LUsuarios.InvokeRequired)
                {
                    DTR MR = new DTR(InTR);
                    this.Invoke(MR, new object[] { txt });
                }
                else
                {
                    if (pictureBox1.Visible)
                    {
                        SP.Play();
                    }
                    tam = TR.TextLength;
                    TR.AppendText(txt + "\n");
                    if (txt.IndexOf("dice:" + (char)31) > -1)
                    {
                        TR.Select(TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase))), TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase)) + 1) - TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase))));
                        TR.SelectionColor = Color.Green;
                    }

                    TR.Refresh();
                }
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #7
0
        private void BEliminar_Click(object sender, EventArgs e)
        {
            DataRow[] DRC;
            DataRow   DR;

            if (TUsuario.TextLength <= 0)
            {
                MessageBox.Show("Escriba Usuario!!!");
                return;
            }


            try
            {
                DRC = BD.Tabla("Usuarios").Select("Usuario='" + TUsuario.Text + "' AND VIP='" + Vp + "'");
                if (DRC.Length > 0)
                {
                    if (MessageBox.Show("Desea eliminar a " + TUsuario.Text, "¡ADVERTENCIA!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (!(BD.BD("DELETE FROM Usuarios WHERE Usuario='" + TUsuario.Text + "'")))
                        {
                            MessageBox.Show("Revise los datos, el registro no puede ser borrado");
                            return;
                        }
                        BD.Eliminar("Usuarios", DRC[0]);
                    }
                    return;
                }
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #8
0
 private void Enviar()
 {
     try
     {
         Funciones.Mail(Xl.VEmail, Mailto, Tit, Tex, Xl.VClave, Xl.VHost, Xl.VPort);
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #9
0
 private void Usuarios_Shown(object sender, EventArgs e)
 {
     try
     {
         BLimpiar_Click(null, null);
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #10
0
 private void Web_Click(object sender, EventArgs e)
 {
     try
     {
         System.Diagnostics.Process.Start(XmlConfig.VURL);
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #11
0
 private void TR_TextChanged(object sender, EventArgs e)
 {
     try
     {
         TR.SelectionStart = TR.Text.Length;
         TR.ScrollToCaret();
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #12
0
 private void BDespedida_Click(object sender, EventArgs e)
 {
     try
     {
         Send(null, "$" + (char)8 + "\r", true);
         System.Media.SystemSounds.Beep.Play();
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #13
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     try
     {
         Usuarios UsA = new Usuarios(BD, Variables.VVIP, xml);
         UsA.ShowDialog();
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #14
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         pictureBox2.Visible = true;
         pictureBox1.Visible = false;
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #15
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     try
     {
         Calendario AcD = new Calendario();
         AcD.ShowDialog();
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #16
0
 private void BLimpiar_Click(object sender, EventArgs e)
 {
     try
     {
         TUsuario.Text   = TMail.Text = TDias.Text = "";
         CHAdmin.Checked = false;
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #17
0
 private void FTServerCode()
 {
     try
     {
         ipEnd = new IPEndPoint(IPAddress.Any, xml.VPorts);
         sock  = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
         sock.Bind(ipEnd);
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #18
0
 private void TClave_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         if (e.KeyChar == 13)
         {
             BAceptar_Click(null, null);
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #19
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));
            }
        }
Beispiel #20
0
 private void BCancela_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("¿Esta seguro que desea Salir?", "ADVERTENCIA!!!", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
         {
             Cr.VCerrar = true;
             Close();
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #21
0
 private void LanzaOICR()
 {
     try
     {
         System.Diagnostics.Process p = new System.Diagnostics.Process();
         p.StartInfo.CreateNoWindow   = true;
         p.StartInfo.WorkingDirectory = Application.StartupPath + "\\OICR";
         p.StartInfo.FileName         = "OICR.exe";
         p.Start();
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #22
0
 private void PPal_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         for (int h = 1; h < Clientes.Length; h++)
         {
             Clientes.ItemArray(h).VSc.workSocket.Shutdown(SocketShutdown.Both);
             Clientes.ItemArray(h).VSc.workSocket.Disconnect(true);
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #23
0
 private void IniciarSer()
 {
     allDone = new ManualResetEvent(false);
     try
     {
         sock.Listen(200);
         while (true)
         {
             allDone.Reset();
             sock.BeginAccept(new AsyncCallback(acceptCallback), sock);
             allDone.WaitOne();
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #24
0
 private void BEnviar_Click(object sender, EventArgs e)
 {
     if (TW.TextLength == 0)
     {
         return;
     }
     SP.Play();
     try
     {
         Send(sock, Clientes.ItemArray(0).VNombre + " dice:" + (char)32 + "\n" + TW.Text + "&\r", true);
         InTR(Clientes.ItemArray(0).VNombre + " dice:" + (char)32 + "\n" + TW.Text);
         TW.Text = "";
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #25
0
        private void SendCallback(IAsyncResult ar)
        {
            try
            {
                // Retrieve the socket from the state object.
                Socket handler = (Socket)ar.AsyncState;

                // Complete sending the data to the remote device.
                int bytesSent = handler.EndSend(ar);
                //MessageBox.Show(string.Format("Sent {0} bytes to client.", bytesSent));

                // handler.Shutdown(SocketShutdown.Both);
                // handler.Close();
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #26
0
 private void TUsuario_TextChanged(object sender, EventArgs e)
 {
     try
     {
         TimeSpan TS = DateTime.Parse(DG.CurrentRow.Cells[8].Value.ToString()) - DateTime.Now.Date;
         if (TS.Days > 0)
         {
             TDias.Text = TS.Days.ToString();
         }
         else
         {
             TDias.Text = "0";
         }
     }
     catch (Exception ex)
     {
         TDias.Text = "0";
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #27
0
        private void InLC(string tx)
        {
            try
            {
                if (LCantidad.InvokeRequired)
                {
                    InL LC = new InL(InLC);
                    this.Invoke(LC, new object[] { tx });
                }
                else
                {
                    LCantidad.Text = tx;
                }
            }

            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
Beispiel #28
0
 private void BDesactiva_Click(object sender, EventArgs e)
 {
     try
     {
         if (BDesactiva.Text == "Desactiva Chat")
         {
             BDesactiva.Text = "Activa Chat";
             Send(Sc, "$" + (char)18 + "\r", true);
         }
         else
         {
             BDesactiva.Text = "Desactiva Chat";
             Send(Sc, "$" + (char)19 + "\r", true);
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #29
0
 private void AList(string[] txt)
 {
     try
     {
         if (LUsuarios.InvokeRequired)
         {
             LIST MR = new LIST(AList);
             this.Invoke(MR, new object[] { txt });
         }
         else
         {
             LUsuarios.Items.Clear();
             LUsuarios.Items.AddRange(Clientes.VNombres);
             LUsuarios.Refresh();
         }
     }
     catch (Exception ex)
     {
         Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
     }
 }
Beispiel #30
0
        public Usuarios(BDS B, bool VVIP, XmlElementoSer X)
        {
            try
            {
                InitializeComponent();
                toolStrip1.BackColor = Color.Transparent;
                groupBox2.BackColor  = Color.Transparent;
                groupBox1.BackColor  = Color.Transparent;
                groupBox2.Location   = new Point(13, 155);

                toolStrip1.Parent = pictureBox1;
                groupBox2.Parent  = pictureBox1;
                groupBox1.Parent  = pictureBox1;


                Xl                    = X;
                Vp                    = VVIP;
                BD                    = B;
                BS                    = new BindingSource();
                BS.DataSource         = BD.Tabla("Usuarios");
                BS.Filter             = "VIP='" + VVIP + "'";
                DG.DataSource         = BS;
                DG.Columns[0].Visible = DG.Columns[2].Visible = DG.Columns[4].Visible = DG.Columns[5].Visible = DG.Columns[7].Visible = false;

                TUsuario.DataBindings.Add(new Binding("Text", BS, "Usuario"));
                TUsuario.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.Never;

                TMail.DataBindings.Add(new Binding("Text", BS, "Correo"));
                TMail.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.Never;

                CHAdmin.DataBindings.Add(new Binding("Checked", BS, "Administrador"));
                CHAdmin.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.Never;
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }