/// <summary> Inserta un cliente. </summary> /// <param name="tobjCliente"> Un objeto del tipo cliente. </param> /// <returns> Un string que indica si se ejecuto o no la operación. </returns> public string gmtdInsertar(tblCliente tobjCliente) { if (tobjCliente.dtmFechaIng == null) { return("- Debe de ingresar la fecha de ingreso."); } if (tobjCliente.strCodigoCli == "") { return("- Debe de ingresar el código del cliente. "); } if (tobjCliente.strContacto == "") { return("- Debe de ingresar el contacto donde el cliente. "); } if (tobjCliente.strDireccion == "") { return("- Debe de ingresar la dirección. "); } if (tobjCliente.strEmpresa == "") { return("- Debe de ingresar el nombre de la empresa o del cliente si es un particular. "); } if (tobjCliente.strTelefono == "") { return("- Debe de ingresar el número telefonico. "); } if (tobjCliente.strTipoDoc == "") { return("- Debe de ingresar el tipo de documento. "); } tblCliente cli = new daoCliente().gmtdConsultar(tobjCliente.strCodigoCli); if (cli.strCodigoCli == null) { tobjCliente.bitAnulado = false; tobjCliente.dtmFechaAnu = Convert.ToDateTime("01/01/1900"); tobjCliente.log = metodos.gmtdLog("Ingresa el cliente " + tobjCliente.strCodigoCli, tobjCliente.strFormulario); return(new daoCliente().gmtdInsertar(tobjCliente)); } else { return("- Este registro ya aparece ingresado."); } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty((String)(Session["usuario"]))) { btnIniciarSesion.Text = "Cerrar Sesion"; daoCarrito = new daoCarrito(); daoCliente = new daoCliente(); dgvPedido.DataSource = daoCarrito.obtenerTodos((String)(Session["usuario"])); dgvPedido.DataBind(); } else { Response.Redirect("LoginAdmin.aspx", true); } }
/// <summary> Elimina un cliente de la base de datos. </summary> /// <param name="tobjCliente"> Un objeto del tipo tblCliente. </param> /// <returns> Un string que indica si se ejecuto o no el metodo. </returns> public String gmtdEliminar(tblCliente tobjCliente) { if (tobjCliente.strCodigoCli == "0") { return("- Debe de ingresar el código del ahorrador a eliminar."); } tblCliente aho = new daoCliente().gmtdConsultar(tobjCliente.strCodigoCli); if (aho.strCodigoCli == null) { return("- Este registro no aparece ingresado."); } else { tobjCliente.log = metodos.gmtdLog("Elimina el cliente " + tobjCliente.strCodigoCli, tobjCliente.strFormulario); return(new daoCliente().gmtdEliminar(tobjCliente)); } }
//METODO PARA LLENAR LA TABLA public void obtenerPedidos() { List <pedidoAdmin> pedidos = new List <pedidoAdmin>(); // Create new DataTable and DataSource objects. DataTable table = new DataTable(); // Declare DataColumn and DataRow variables. DataColumn column; DataRow row; DataView view; column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "ID"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "USUARIO"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "DIRECCION"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "PEDIDO"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "TOTAL"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "ESTADO"; table.Columns.Add(column); dgvPedidos.Columns.Clear(); pedidos = new daoCarrito().obtenerTodosAdmin("PENDIENTE"); // Create new DataRow objects and add to DataTable. foreach (pedidoAdmin p in pedidos) { row = table.NewRow(); row["ID"] = p.ID; row["USUARIO"] = new daoCliente().obtenerUno(p.ID_CLIENTE).nombre; row["DIRECCION"] = p.DIRECCION; row["PEDIDO"] = p.PEDIDO; row["TOTAL"] = p.TOTAL; row["ESTADO"] = p.ESTADO; table.Rows.Add(row); } // Create a DataView using the DataTable. view = new DataView(table); // Set a DataGrid control's DataSource to the DataView. dgvPedidos.DataSource = view; //CICLO USADO PARA COLOCAR LOS BOTONES DENTRO DE LA TABLA PRODUCTOS foreach (DataColumn dc in table.Columns) { ButtonField bf = new ButtonField(); bf.CommandName = dc.ColumnName.ToString(); bf.DataTextField = dc.ColumnName; bf.ButtonType = ButtonType.Image; bf.ImageUrl = "https://i.ibb.co/372MhgM/11875166141558096434-32.png"; dgvPedidos.Columns.Add(bf); break; } dgvPedidos.DataBind(); }
public List <ClienteBO> Listar() { daoCliente dao = new daoCliente(); return(dao.Listar()); }
public string Eliminar(string dto) { daoCliente dao = new daoCliente(); return(dao.Eliminar(dto)); }
public string Insert(ClienteBO dto) { daoCliente dao = new daoCliente(); return(dao.Insertar(dto)); }
public string Actualizar(ClienteBO dto) { daoCliente dao = new daoCliente(); return(dao.Actualizar(dto)); }
public bool EliminarCliente(String idCliente) { daoCliente dao = new daoCliente(); return(dao.eliminarCliente(idCliente)); }
public bool ModificarCliente(Cliente prod) { daoCliente dao = new daoCliente(); return(dao.modificarCliente(prod)); }
public bool AgregarCliente(Cliente prod) { daoCliente dao = new daoCliente(); return(dao.agregar(prod)); }
public Cliente ObtenerUno(String idCliente) { daoCliente dao = new daoCliente(); return(dao.obtenerUno(idCliente)); }