Exemplo n.º 1
0
 //buscar clientes
 private void Buscar(string opcion)
 {
     if (!string.IsNullOrEmpty(opcion))
     {
         TBL_CLIENTE _infoClientes = new TBL_CLIENTE();
         var         task          = Task.Run(() => LogicaCliente.getClientsDni(opcion));
         task.Wait();
         _infoClientes = task.Result;
         if (_infoClientes != null)
         {
             lblID.Text        = _infoClientes.cli_id.ToString();
             lblDni.Text       = _infoClientes.cli_identificacion;
             lblApellidos.Text = _infoClientes.cli_apellidos;
             lblNombres.Text   = _infoClientes.cli_nombres;
             lblTelefono.Text  = _infoClientes.cli_telefono;
             lblMensaje.Text   = "Cliente encontrado";
         }
         else
         {
             lblMensaje.Text = "No se encontro resultado";
             mensaje();
         }
     }
     else
     {
         lblMensaje.Text = "Escriba un DNI";
         mensaje();
     }
 }
Exemplo n.º 2
0
        private TBL_PEDIDO savePedido(TBL_CLIENTE _infoCliente, string subtotal, string total, EcommerceEntities dbEstatica)
        {
            try
            {
                TBL_PEDIDO _infoPedido = new TBL_PEDIDO();
                _infoPedido.PED_SUBTOTAL       = Convert.ToDecimal(subtotal);
                _infoPedido.PED_TOTAL          = Convert.ToDecimal(total);
                _infoPedido.CLI_ID             = _infoCliente.CLI_ID;
                _infoPedido.CLI_IDENTIFICACION = _infoCliente.CLI_IDENTIFICACION;
                _infoPedido.PED_IDENTIFICACION = "172341516510001";
                _infoPedido.PED_CLIENTE        = _infoCliente.CLI_NOMBRES + " " + _infoCliente.CLI_APELLIDOS;
                _infoPedido.PED_DIRECCION      = _infoCliente.CLI_DIRECCION;
                _infoPedido.PED_TELEFONO       = _infoCliente.CLI_TELEFONO;

                Task <bool> _taskSave2 = Task.Run(() => LogicaCliente.savePedido(_infoPedido, dbEstatica));
                _taskSave2.Wait();
                var resultado2 = _taskSave2.Result;
                if (!resultado2)
                {
                    throw new ArgumentException("No se guardado Pedido");
                }
                return(_infoPedido);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error: " + ex.Message);
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> DeleteConfirmed(long id)
        {
            TBL_CLIENTE tBL_CLIENTE = await db.TBL_CLIENTE.FindAsync(id);

            db.TBL_CLIENTE.Remove(tBL_CLIENTE);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "cli_id,cli_identificacion,cli_tipoidentificacion,cli_apellidos,cli_nombres,cli_genero,cli_fechanacimiento,cli_telefono,cli_celurar,cli_email,cli_status,cli_fechacreacion")] TBL_CLIENTE tBL_CLIENTE)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tBL_CLIENTE).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tBL_CLIENTE));
        }
Exemplo n.º 5
0
        // GET: CLIENTE/Delete/5
        public async Task <ActionResult> Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TBL_CLIENTE tBL_CLIENTE = await db.TBL_CLIENTE.FindAsync(id);

            if (tBL_CLIENTE == null)
            {
                return(HttpNotFound());
            }
            return(View(tBL_CLIENTE));
        }
Exemplo n.º 6
0
        public static async Task <bool> updateCliente(TBL_CLIENTE _infoCliente)
        {
            try
            {
                bool resultado = false;
                _infoCliente.CLI_FECHA_CREACION = DateTime.Now;

                //Actualizar Datos
                await db.SaveChangesAsync();

                resultado = true;
                return(resultado);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error : " + ex.Message);
            }
        }
Exemplo n.º 7
0
        public static async Task <bool> saveCliente(TBL_CLIENTE _infoCliente, EcommerceEntities dbEstatica)
        {
            try
            {
                bool resultado = false;
                _infoCliente.CLI_ESTADO         = "A";
                _infoCliente.CLI_FECHA_CREACION = DateTime.Now;
                dbEstatica.TBL_CLIENTE.Add(_infoCliente);

                //Actualizar Datos
                await dbEstatica.SaveChangesAsync();

                resultado = true;
                return(resultado);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error : " + ex.Message);
            }
        }
Exemplo n.º 8
0
        //guardar cliente
        public static async Task <bool> saveClients(TBL_CLIENTE _infoCliente)
        {
            try
            {
                bool resultado = false;
                _infoCliente.cli_id            = getNextSequence();
                _infoCliente.cli_status        = "A";
                _infoCliente.cli_fechacreacion = DateTime.Now;
                db.TBL_CLIENTE.Add(_infoCliente);

                //actualiza el contexto de datos
                await db.SaveChangesAsync();

                resultado = true;
                return(resultado);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Error al guardar cliente");
            }
        }
Exemplo n.º 9
0
        private void saveCliente()
        {
            EcommerceEntities dbEstatica = new EcommerceEntities();
            var dbContextTransaction     = dbEstatica.Database.BeginTransaction();

            try
            {
                TBL_CLIENTE _infoCliente = new TBL_CLIENTE();
                _infoCliente.CLI_NOMBRES          = txt_nombres.Text;
                _infoCliente.CLI_APELLIDOS        = txt_apellidos.Text;
                _infoCliente.CLI_FECHA_NACIMIENTO = Convert.ToDateTime(txt_fecha_nacimiento.Text);
                _infoCliente.CLI_IDENTIFICACION   = txt_identificacion.Text;
                _infoCliente.CLI_CORREO           = txt_correo.Text;
                _infoCliente.CLI_TELEFONO         = txt_telefono.Text;
                _infoCliente.CLI_DIRECCION        = txt_direccion.Text;
                string      select    = raPagos.SelectedValue;
                Task <bool> _taskSave = Task.Run(() => LogicaCliente.saveCliente(_infoCliente, dbEstatica));
                _taskSave.Wait();
                var resultado = _taskSave.Result;
                if (!resultado)
                {
                    throw new ArgumentException("No se guardado Cliente");
                }
                TBL_PEDIDO pedidoSave = savePedido(_infoCliente, txt_subtotal.Text, txt_total.Text, dbEstatica);
                if (pedidoSave != null)
                {
                    saveDetallePedido(pedidoSave, _listCart, dbEstatica);
                    savePago(pedidoSave, txt_total.Text, select, dbEstatica);
                    dbContextTransaction.Commit();
                    lblMessage.Text = "Exito en el guardado";
                }
            }
            catch (Exception ex)
            {
                dbContextTransaction.Rollback();
                lblMessage.Text = ex.Message + "linea: " + ex.Source;
            }
        }
Exemplo n.º 10
0
 //guardar clientes
 private void saveClients()
 {
     try
     {
         TBL_CLIENTE _infoClientes = new TBL_CLIENTE();
         _infoClientes.cli_identificacion     = txtIdentificacion.Text;
         _infoClientes.cli_tipoidentificacion = char.ToString('C');
         _infoClientes.cli_apellidos          = txtApellidos.Text;
         _infoClientes.cli_nombres            = txtNombres.Text;
         _infoClientes.cli_fechanacimiento    = DateTime.Parse(txtFechNac.Text);
         _infoClientes.cli_genero             = char.ToString('M');
         _infoClientes.cli_telefono           = txtTelefono.Text;
         _infoClientes.cli_email = txtEmail.Text.ToLower();
         Task <bool> _taskSaveClients = Task.Run(() => LogicaCliente.saveClients(_infoClientes));
         _taskSaveClients.Wait();
         var resultado = _taskSaveClients.Result;
         if (resultado)
         {
             //lblMensaje.Text = "Cliente Guardado Correctamente";
             List <clsCliente> _listaClientes = new List <clsCliente>();
             _listaClientes = (List <clsCliente>)Session["Cliente"];
             clsCliente _infoClientes1 = new clsCliente();
             _infoClientes1.idCliente             = int.Parse(_infoClientes.cli_id.ToString());
             _infoClientes1.identificacionCliente = txtIdentificacion.Text;
             _infoClientes1.apellidosCliente      = txtApellidos.Text;
             _infoClientes1.nombresCliente        = txtNombres.Text;
             _infoClientes1.telefonoCliente       = txtTelefono.Text;
             _listaClientes.Add(_infoClientes1);
             Session["Cliente"] = _listaClientes;
             Response.Redirect("wfmPedido.aspx", true);
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = "" + ex.Message;
     }
 }