Esempio n. 1
0
        private void ProcessData(object sender, DoWorkEventArgs e)
        {
            ClienteFormasDigitales cf = new ClienteFormasDigitales(txtXML.Text);

            String xmlString = cf.GetXmlString(cf.SellarXML(txtCertificado.Text, txtKey.Text));

            TimbrarCFDIRequest tcr = new TimbrarCFDIRequest();

            accesos acc = new accesos();

            acc.password    = "******";
            acc.usuario     = "pruebasWS";
            tcr.comprobante = xmlString;
            tcr.accesos     = acc;

            WSTimbradoCFDI ws = new WSTimbradoCFDIClient();

            TimbrarCFDIResponse response = ws.TimbrarCFDI(tcr);

            if (response.acuseCFDI.error != null)
            {
                e.Result = response.acuseCFDI.error;
            }
            else
            {
                e.Result = response.acuseCFDI.xmlTimbrado;
            }
        }
Esempio n. 2
0
        private void BtnIngresar_Click(object sender, EventArgs e)
        {
            DataTable Datos = Negocio.nTrabajador.Login(this.TxtUsuario.Text, seg.encriptar(this.TxtPassword.Text));

            //Evaluar si existe el Usuario
            if (Datos.Rows.Count == 0)
            {
                bit.logger("Fallo un inicio de sesion", 1);
                MessageBox.Show("NO Tiene Acceso al Sistema", "Sistema de Ventas", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                List <String> Lista_accesos = new List <String>();

                frmPrincipal frm = new frmPrincipal();
                frm.Idtrabajador = Datos.Rows[0][0].ToString();
                frm.Apellidos    = Datos.Rows[0][1].ToString();
                frm.Nombre       = Datos.Rows[0][2].ToString();
                frm.Acceso       = Datos.Rows[0][3].ToString();
                frm.idioma       = idioma;
                accesos acc = new accesos();
                Lista_accesos       = acc.list_accesps(frm.Idtrabajador);
                frm.Lista_Politicas = Lista_accesos;


                bit.logger("el empleado " + Datos.Rows[0][2].ToString() + " " + Datos.Rows[0][1].ToString() + " se logueo al sistema", 1);
                frm.Show();
                this.Hide();
            }
        }
Esempio n. 3
0
        public ActionResult DeleteConfirmed(long id)
        {
            accesos accesos = db.accesos.Find(id);

            db.accesos.Remove(accesos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        private void LlenarComboPresentacion()
        {
            accesos acc = new accesos();

            cbAcceso.DataSource    = acc.Mostrar();
            cbAcceso.ValueMember   = "id_acceso";
            cbAcceso.DisplayMember = "Nombre_acceso";
        }
Esempio n. 5
0
        //
        // GET: /Accesos/Details/5

        public ActionResult Details(long id = 0)
        {
            accesos accesos = db.accesos.Find(id);

            if (accesos == null)
            {
                return(HttpNotFound());
            }
            return(View(accesos));
        }
Esempio n. 6
0
 public ActionResult Edit(accesos accesos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(accesos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FORMULARIOS_id = new SelectList(db.formularios, "id", "nombre", accesos.FORMULARIOS_id);
     ViewBag.PERMISOS_id    = new SelectList(db.permisos, "id", "nombre", accesos.PERMISOS_id);
     ViewBag.ROL_id         = new SelectList(db.rol, "id", "nombre", accesos.ROL_id);
     return(View(accesos));
 }
Esempio n. 7
0
        //
        // GET: /Accesos/Edit/5

        public ActionResult Edit(long id = 0)
        {
            accesos accesos = db.accesos.Find(id);

            if (accesos == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FORMULARIOS_id = new SelectList(db.formularios, "id", "nombre", accesos.FORMULARIOS_id);
            ViewBag.PERMISOS_id    = new SelectList(db.permisos, "id", "nombre", accesos.PERMISOS_id);
            ViewBag.ROL_id         = new SelectList(db.rol, "id", "nombre", accesos.ROL_id);
            return(View(accesos));
        }
        public ActionResult Create(accesos accesos)
        {
            if (ModelState.IsValid)
            {
                db.accesos.Add(accesos);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.FORMULARIOS_id = new SelectList(db.formularios, "id", "nombre", accesos.FORMULARIOS_id);
            ViewBag.PERMISOS_id = new SelectList(db.permisos, "id", "nombre", accesos.PERMISOS_id);
            ViewBag.ROL_id = new SelectList(db.rol, "id", "nombre", accesos.ROL_id);
            return View(accesos);
        }
Esempio n. 9
0
        private void dataListado_DoubleClick(object sender, EventArgs e)
        {
            accesos acc           = new accesos();
            string  nombre_acceso = acc.get_nombre_acceso(Convert.ToInt32(this.dataListado.CurrentRow.Cells["acceso"].Value));

            this.txtIdtrabajador.Text     = Convert.ToString(this.dataListado.CurrentRow.Cells["idtrabajador"].Value);
            this.txtNombre.Text           = Convert.ToString(this.dataListado.CurrentRow.Cells["nombre"].Value);
            this.txtApellidos.Text        = Convert.ToString(this.dataListado.CurrentRow.Cells["apellidos"].Value);
            this.cbSexo.Text              = Convert.ToString(this.dataListado.CurrentRow.Cells["sexo"].Value);
            this.dtFecha_Nacimiento.Value = Convert.ToDateTime(this.dataListado.CurrentRow.Cells["fecha_nac"].Value);
            this.txtNum_Documento.Text    = Convert.ToString(this.dataListado.CurrentRow.Cells["num_documento"].Value);
            this.txtDireccion.Text        = Convert.ToString(this.dataListado.CurrentRow.Cells["direccion"].Value);
            this.txtTelefono.Text         = Convert.ToString(this.dataListado.CurrentRow.Cells["telefono"].Value);
            this.txtEmail.Text            = Convert.ToString(this.dataListado.CurrentRow.Cells["email"].Value);
            this.cbAcceso.Text            = Convert.ToString(nombre_acceso);
            this.txtUsuario.Text          = Convert.ToString(this.dataListado.CurrentRow.Cells["usuario"].Value);
            this.txtPassword.Text         = Convert.ToString(this.dataListado.CurrentRow.Cells["password"].Value);


            this.tabControl1.SelectedIndex = 1;
        }
Esempio n. 10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //La variable que almacena si se inserto
                //o se modifico la tabla
                string Rpta = "";
                if (this.txtNombre.Text == string.Empty || this.txtApellidos.Text == string.Empty || txtNum_Documento.Text == string.Empty || txtUsuario.Text == string.Empty || txtPassword.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtNombre, "Ingrese un Valor");
                    errorIcono.SetError(txtApellidos, "Ingrese un Valor");
                    errorIcono.SetError(txtNum_Documento, "Ingrese un Valor");
                    errorIcono.SetError(txtUsuario, "Ingrese un Valor");
                    errorIcono.SetError(txtPassword, "Ingrese un Valor");
                }
                else
                {
                    int     id_acceso;
                    accesos acc = new accesos();
                    id_acceso = acc.get_id_acceso(cbAcceso.Text);

                    if (this.IsNuevo)
                    {
                        //Vamos a insertar un Trabajador
                        Rpta = nTrabajador.Insertar(this.txtNombre.Text.Trim().ToUpper(),
                                                    this.txtApellidos.Text.Trim().ToUpper(), cbSexo.Text,
                                                    dtFecha_Nacimiento.Value,
                                                    txtNum_Documento.Text, txtDireccion.Text,
                                                    txtTelefono.Text, txtEmail.Text, id_acceso, txtUsuario.Text, seg.encriptar(txtPassword.Text));
                    }
                    else
                    {
                        //Vamos a modificar un Trabajador
                        Rpta = nTrabajador.Editar(Convert.ToInt32(this.txtIdtrabajador.Text), this.txtNombre.Text.Trim().ToUpper(),
                                                  this.txtApellidos.Text.Trim().ToUpper(), cbSexo.Text,
                                                  dtFecha_Nacimiento.Value,
                                                  txtNum_Documento.Text, txtDireccion.Text,
                                                  txtTelefono.Text, txtEmail.Text, id_acceso, txtUsuario.Text, seg.encriptar(txtPassword.Text));
                    }
                    //Si la respuesta fue OK, fue porque se modifico
                    //o inserto el Cliente
                    //de forma correcta
                    if (Rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOK("Se insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeOK("Se actualizó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        //Mostramos el mensaje de error
                        this.MensajeError(Rpta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                    this.txtIdtrabajador.Text = "";
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }