//Metodo que listar private void BindGrid() { //Se instancia objeto Obj_Persona_DAL = new Cls_Persona_DAL(); if (this.txtFiltraPersona.Value == string.Empty)//listar { //llamado metodo listar estados Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Listar); } else { Obj_Persona_DAL.sIdPersona = this.txtFiltraPersona.Value; //llamado metodo listar estados Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Filtrar); } if (Obj_Persona_DAL.sMsjError == string.Empty) { //Carga de Grid con DataSet instanciado en DAL this.PersonaGridView.DataSource = Obj_Persona_DAL.DS.Tables[0]; this.PersonaGridView.DataBind(); } else { this.errorMensaje.InnerHtml = "Se presento un error a la hora de listar las Personas."; this.BindGrid(); } }
//boton modificar protected void btnEditar_Click(object sender, EventArgs e) { //Recorre Grid buscando chk foreach (GridViewRow row in PersonaGridView.Rows) { //busca el la fila if (row.RowType == DataControlRowType.DataRow) { //si esta checkeado instancia las propiedades del objeto if ((row.Cells[0].FindControl("chkRow") as CheckBox).Checked) { //Se instancia objeto Obj_Persona_DAL = new Cls_Persona_DAL(); //Secion tipo Editar Session["tipo"] = BD.Actualizar; Obj_Persona_DAL.sIdPersona = row.Cells[0].Text; Obj_Persona_DAL.sNombre = WebUtility.HtmlDecode(row.Cells[1].Text); Obj_Persona_DAL.sDireccion = WebUtility.HtmlDecode(row.Cells[2].Text); // INICIO: Obtener Rol Cls_Rol_BLL Obj_Rol_BLL = new Cls_Rol_BLL(); Cls_Rol_DAL Obj_Rol_DAL = new Cls_Rol_DAL(); Obj_Rol_DAL.sDescripcion = row.Cells[3].Text; Obj_Rol_BLL.crudRol(ref Obj_Rol_DAL, BD.Filtrar); Obj_Persona_DAL.bIdRol = Convert.ToByte(Obj_Rol_DAL.DS.Tables[0].Rows[0][0].ToString()); // FIN: Obtener Rol //Sesion persona lleva el objeto Session["Persona"] = Obj_Persona_DAL; Response.Redirect(pantallaMantenimiento, false); } } } }
private void Login(char tipo) { Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Cls_Usuario_DAL Obj_Usuarios_DAL = new Cls_Usuario_DAL(); Cls_Usuario_BLL Obj_Usuarios_BLL = new Cls_Usuario_BLL(); Obj_Usuarios_DAL.SIdPersona = this.uname.Value; Obj_Usuarios_DAL.SContrasena = this.psw.Value; Obj_Usuarios_BLL.Encripta(ref Obj_Usuarios_DAL); Obj_Usuarios_BLL.Login(ref Obj_Usuarios_DAL); if (Obj_Usuarios_DAL.DS.Tables[0].Rows.Count > 0) { Obj_Persona_DAL.bIdRol = Convert.ToByte(Obj_Usuarios_DAL.DS.Tables[0].Rows[0][1]); Obj_Persona_DAL.sNombre = Obj_Usuarios_DAL.DS.Tables[0].Rows[0][0].ToString(); Session["Login"] = Obj_Persona_DAL; if (Obj_Persona_DAL.bIdRol == 1) { Response.Redirect(sistemaMantenimiento, false); } else { Response.Redirect(sistemaCliente, false); } } else { Response.Write("<script>window.alert('Usuario No se puede Registrar o ya se encuentra registrado');</script>"); } }
private void returnaNombre() { if (this.cedulaRG.Value != string.Empty) { Cls_Persona_BLL Obj_Persona_BLL = new Cls_Persona_BLL(); Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Persona_DAL.sIdPersona = this.cedulaRG.Value.Trim(); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Filtrar); if (Obj_Persona_DAL.sMsjError == string.Empty) { if (Obj_Persona_DAL.DS.Tables[0].Rows.Count > 0) { this.nombreRG.Value = Obj_Persona_DAL.DS.Tables[0].Rows[0][1].ToString(); } else { Response.Write("<script>window.alert('La cedula ingresada no corresponde a ningun cliente. Por favro ingrese un cliente valido');</script>"); this.nombreRG.Value = string.Empty; } } else { Response.Write("<script>window.alert('Error a consultar datos, comunicarse con la administracion');</script>"); this.nombreRG.Value = string.Empty; } } }
protected void btnEditar_Click(object sender, EventArgs e) { //Recorre Grid buscando chk foreach (GridViewRow row in MembresiasGridView.Rows) { //busca el la fila if (row.RowType == DataControlRowType.DataRow) { //si esta checkeado instancia las propiedades del objeto CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox); if (chkRow.Checked) { //Se instancia objeto Obj_Membresias_DAL = new Cls_Membresias_DAL(); //Secion tipo Editar Session["tipo"] = BD.Actualizar; Obj_Membresias_DAL.iIdMembresia = Convert.ToInt16(row.Cells[0].Text); Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Persona_DAL.sIdPersona = row.Cells[1].Text; Obj_Persona_DAL.sNombre = row.Cells[2].Text; //Sesion estado lleva el objeto Session["sMembresia"] = Obj_Membresias_DAL; Session["Persona"] = Obj_Persona_DAL; Response.Redirect(pantallaMantenimiento, false); //llama la pantalla } } } }
private string returnaNombre(string cedula) { Cls_Persona_BLL Obj_Persona_BLL = new Cls_Persona_BLL(); Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Persona_DAL.sIdPersona = cedula.Trim(); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Filtrar); if (Obj_Persona_DAL.sMsjError == string.Empty) { if (Obj_Persona_DAL.DS.Tables[0].Rows.Count > 0) { return(Obj_Persona_DAL.DS.Tables[0].Rows[0][1].ToString()); } else { Response.Write("<script>window.alert('PERSONA NO REGISTRADA INGRESE AL BOTON DE PERSONAS');</script>"); ////this.mensajeError.InnerHtml = "PERSONA NO REGISTRADA INGRESE AL BOTON DE PERSONAS"; return(string.Empty); } } else { Response.Write("<script>window.alert('Error al consultar persona, Contactar TI');</script>"); this.mensajeError.InnerHtml = "Error al consultar persona, Contactar TI"; return(string.Empty); } }
protected void Page_Load(object sender, EventArgs e) { System.Globalization.CultureInfo customCulture = new System.Globalization.CultureInfo("en-US", true); customCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = customCulture; if (!IsPostBack) { if (Session["Login"] == null) { this.guardar.Disabled = true; this.cedulaRG.Value = string.Empty; this.nombreRG.Value = string.Empty; } else { Cls_Persona_DAL persona = (Cls_Persona_DAL)Session["Login"]; this.cedulaRG.Value = persona.sNombre; CargarTipoMembresias(); this.DropDownMembresias.SelectedIndex = 0; this.fechaInicioRG.Value = DateTime.Today.ToString("yyyy-MM-dd"); validaDatos(); } } else { validaDatos(); } }
//boton eliminar protected void btnEliminar_Click(object sender, EventArgs e) { Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Telefonos_DAL = new Cls_Telefonos_DAL(); Obj_Correos_DAL = new Cls_Correos_DAL(); //Recorre Grid buscando chk foreach (GridViewRow row in PersonaGridView.Rows) { //busca el la fila if (row.RowType == DataControlRowType.DataRow) { //si esta checkeado instancia las propiedades del objeto CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox); if (chkRow.Checked) { Obj_Persona_DAL.sIdPersona = row.Cells[0].Text; Obj_Correos_DAL.sIdPersona = row.Cells[0].Text; Obj_Telefonos_DAL.sIdPersona = row.Cells[0].Text; Obj_Telefonos_BLL.crudTelefono(ref Obj_Telefonos_DAL, BD.Eliminar); Obj_Correos_BLL.crudCorreos(ref Obj_Correos_DAL, BD.Eliminar); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Eliminar); } } } if (Obj_Persona_DAL.sMsjError == string.Empty) { this.errorMensaje.InnerHtml = "Persona Eliminada con exito."; this.BindGrid(); } else { this.errorMensaje.InnerHtml = "Se presento un error a la hora de Eliminar la(s) Persona(s)."; } }
protected void btnGuardar_Click1(object sender, EventArgs e) { Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Persona_DAL.sIdPersona = txtCedula.Value.Trim(); Obj_Persona_DAL.sNombre = txtnombre.Value.Trim(); Obj_Persona_DAL.sDireccion = TextAreadireccion.Value.Trim(); Obj_Persona_DAL.bIdRol = Convert.ToByte(DropDownRol.Value); // Primero se inserta la persona, de lo contrario no se insertarán los telefonos ni los correos // Por que el IdPErsona, es la llave primaria de estos campos if ((BD)Session["tipo"] == BD.Actualizar) { Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Actualizar); } if ((BD)Session["tipo"] == BD.Insertar) { Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Insertar); } #region Telefono if (BD.Insertar.Equals((BD)Session["tipo"])) { foreach (GridViewRow row in GridViewTelefono.Rows) { //busca el la fila if (row.RowType == DataControlRowType.DataRow) { { Obj_Telefonos_DAL = new Cls_Telefonos_DAL(); Obj_Telefonos_DAL.sTelefono = row.Cells[0].Text; Obj_Telefonos_DAL.sIdPersona = txtCedula.Value.ToString().Trim(); Obj_Telefonos_BLL.crudTelefono(ref Obj_Telefonos_DAL, BD.Insertar);// insertar } } } } #endregion //-Aqui agrego el de correo foreach #region Correo if (BD.Insertar.Equals((BD)Session["tipo"])) { foreach (GridViewRow row in CorreoPersonaGridView.Rows) { //busca el la fila if (row.RowType == DataControlRowType.DataRow) { { Obj_Correo_DAL = new Cls_Correos_DAL(); Obj_Correo_DAL.sIdPersona = this.txtCedula.Value.ToString().Trim(); Obj_Correo_DAL.sCorreo = row.Cells[0].Text; Obj_Correo_BLL.crudCorreos(ref Obj_Correo_DAL, BD.Insertar);// insertar } } } } #endregion Response.Redirect(pantallaMantenimiento, true); }
protected void Page_Load(object sender, EventArgs e) { Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); if (Session["Login"] != null) { Cls_Persona_DAL persona = (Cls_Persona_DAL)Session["Login"]; this.idUsuario.InnerText = persona.sNombre; } }
private void CargarPersona() { Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Cls_Persona_BLL Obj_Persona_BLL = new Cls_Persona_BLL(); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Listar); DropDownPersona.DataSource = Obj_Persona_DAL.DS.Tables[0]; DropDownPersona.DataTextField = "Nombre"; DropDownPersona.DataValueField = "Identificacion"; DropDownPersona.DataBind(); }
private void LlenarDDL() //Llenado del Drop down list { Cls_Persona_BLL Obj_Persona_BLL = new Cls_Persona_BLL(); Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Listar); DropDownTUsuarios.DataSource = Obj_Persona_DAL.DS.Tables[0]; DropDownTUsuarios.DataValueField = "Identificacion"; DropDownTUsuarios.DataTextField = "Nombre"; DropDownTUsuarios.DataBind(); DropDownTUsuarios.Items.Insert(0, "Seleccione una persona"); }
protected void Registrarse(object sender, EventArgs e) { Cls_Persona_DAL Obj_Persona_DAL = new Cls_Persona_DAL(); Cls_Persona_BLL Obj_Persona_BLL = new Cls_Persona_BLL(); Obj_Persona_DAL.sIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Persona_DAL.sNombre = this.nombreRG.Value.ToString().Trim(); Obj_Persona_DAL.sDireccion = this.direccionRG.Value.ToString().Trim(); Obj_Persona_DAL.bIdRol = (byte)Rol.Cliente; Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Insertar); Cls_Telefonos_DAL Obj_Telefonos_DAL = new Cls_Telefonos_DAL(); Cls_Telefono_BLL Obj_Telefonos_BLL = new Cls_Telefono_BLL(); Obj_Telefonos_DAL.sTelefono = this.telefonoRG.Value.ToString().Trim(); Obj_Telefonos_DAL.sIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Telefonos_BLL.crudTelefono(ref Obj_Telefonos_DAL, BD.Insertar);// insertar Cls_Correos_DAL Obj_Correo_DAL = new Cls_Correos_DAL(); Cls_Correos_BLL Obj_Correo_BLL = new Cls_Correos_BLL(); Obj_Correo_DAL.sIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Correo_DAL.sCorreo = this.emailRG.Value.ToString().Trim(); Obj_Correo_BLL.crudCorreos(ref Obj_Correo_DAL, BD.Insertar);// insertar Cls_Clientes_DAL Obj_Cliente_DAL = new Cls_Clientes_DAL(); Cls_Clientes_BLL Obj_Cliente_BLL = new Cls_Clientes_BLL(); Obj_Cliente_DAL.sIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Cliente_DAL.bIdTipoCliente = (byte)Cliente.Socio; Obj_Cliente_BLL.crudCliente(ref Obj_Cliente_DAL, BD.Insertar); Cls_Usuario_DAL Obj_Usuario_DAL = new Cls_Usuario_DAL(); Cls_Usuario_BLL Obj_Usuario_BLL = new Cls_Usuario_BLL(); Obj_Usuario_DAL.SIdUsuario = this.cedulaRG.Value.ToString().Trim(); Obj_Usuario_DAL.SIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Usuario_DAL.SContrasena = this.passwordRG.Value.ToString().Trim(); Obj_Usuario_BLL.Encripta(ref Obj_Usuario_DAL); Obj_Usuario_BLL.crudUsuario(ref Obj_Usuario_DAL, BD.Insertar); Obj_Persona_DAL.sIdPersona = this.cedulaRG.Value.ToString().Trim(); Obj_Persona_BLL.crudPersona(ref Obj_Persona_DAL, BD.Filtrar); Session["Login"] = Obj_Persona_DAL; Server.Transfer("IndexCliente.aspx"); }
public void crudPersona(ref Cls_Persona_DAL Obj_Persona_DAL, BD Accion) { // Se instancia el Objeto de CatalogosMantenimientosClient (WCF) CatalogosMantenimientosClient Obj_Persona_Client = new CatalogosMantenimientosClient(); try { // Se abre la conexion al servicio Obj_Persona_Client.Open(); // Se cargan trae el DataTable y se carga al Obj_Persona_DAL string sMsjError = string.Empty; switch (Accion) { case BD.Actualizar: Obj_Persona_Client.actualizarPersona(Obj_Persona_DAL.sIdPersona, Obj_Persona_DAL.sNombre, Obj_Persona_DAL.sDireccion, Obj_Persona_DAL.bIdRol, ref sMsjError); break; case BD.Eliminar: Obj_Persona_Client.eliminarPersona(Obj_Persona_DAL.sIdPersona, ref sMsjError); break; case BD.Filtrar: Obj_Persona_DAL.DS.Tables.Add(Obj_Persona_Client.filtrarPersonaV(Obj_Persona_DAL.sIdPersona, Obj_Persona_DAL.sNombre, Obj_Persona_DAL.sDireccion, Obj_Persona_DAL.sRol, ref sMsjError)); break; case BD.Insertar: Obj_Persona_Client.insertarPersona(Obj_Persona_DAL.sIdPersona, Obj_Persona_DAL.sNombre, Obj_Persona_DAL.sDireccion, Obj_Persona_DAL.bIdRol, ref sMsjError); break; case BD.Listar: Obj_Persona_DAL.DS.Tables.Add(Obj_Persona_Client.listarPersona(ref sMsjError)); break; default: break; } Obj_Persona_DAL.sMsjError = sMsjError; } catch (Exception ex) { Obj_Persona_DAL.sMsjError = ex.Message.ToString(); } finally { if (Obj_Persona_Client.State == System.ServiceModel.CommunicationState.Opened) { Obj_Persona_Client.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CargarTipoMembresias(); CargarEstados(); txtNombre.Disabled = true; IDCliente.Disabled = true; if ((BD)Session["tipo"] == BD.Actualizar) { Cls_Membresias_DAL Obj_Membresias_DAL = (Cls_Membresias_DAL)Session["sMembresia"]; Cls_Persona_DAL Obj_Persona_DAL = (Cls_Persona_DAL)Session["Persona"]; IdMembresia = Obj_Membresias_DAL.iIdMembresia; Obj_Membresias_BLL.crudMembresias(ref Obj_Membresias_DAL, BD.Filtrar); this.mantenimiento.InnerHtml = "Modificacion de Membresias"; this.txtCedula.Disabled = true; this.txtCedula.Value = Obj_Persona_DAL.sIdPersona; this.txtNombre.Value = WebUtility.HtmlDecode(Obj_Persona_DAL.sNombre); this.DropDownTipoCliente.Value = Obj_Membresias_DAL.DS.Tables[0].Rows[0][2].ToString(); // idTipoMemebresia this.DropDownEstado.Value = Obj_Membresias_DAL.DS.Tables[0].Rows[0][3].ToString(); // //System.Globalization.CultureInfo customCulture = new System.Globalization.CultureInfo("en-US", true); //customCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; //System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; //System.Threading.Thread.CurrentThread.CurrentUICulture = customCulture; // this.FechaInicio.Value = Convert.ToDateTime(Obj_Membresias_DAL.DS.Tables[0].Rows[0][4]).ToString("yyyy-MM-dd"); validaDatos(); BindGridBeneficiarios(); } else { this.mantenimiento.InnerHtml = "Ingreso de Membresias"; this.txtCedula.Value = string.Empty; this.DropDownTipoCliente.SelectedIndex = 0; this.IDCliente.Value = string.Empty; this.FechaInicio.Value = DateTime.Today.ToString("yyyy-MM-dd"); fechavence(); } } else { this.mensajeError.InnerHtml = ""; validaDatos(); } }
private void validaPassword() { Cls_Usuario_DAL Obj_Usuarios_DAL = new Cls_Usuario_DAL(); Cls_Usuario_BLL Obj_Usuarios_BLL = new Cls_Usuario_BLL(); Cls_Persona_DAL persona = (Cls_Persona_DAL)Session["Login"]; if (passwordRG.Value != string.Empty) { Obj_Usuarios_DAL.SIdPersona = this.cedulaRG.Value; Obj_Usuarios_DAL.SContrasena = this.passwordRG.Value; Obj_Usuarios_BLL.Encripta(ref Obj_Usuarios_DAL); Obj_Usuarios_BLL.Login(ref Obj_Usuarios_DAL); if (Obj_Usuarios_DAL.DS.Tables[0].Rows[0][0].ToString() == persona.sNombre) { validacion = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CargarRoles(); // Carga combo con posibles valores if ((BD)Session["tipo"] == BD.Actualizar) { Obj_Persona_DAL = (Cls_Persona_DAL)Session["Persona"]; //this.mantenimiento.InnerHtml = "Modificacion de Persona"; // Carga de datos Obj_Persona_DAL txtCedula.Disabled = true; txtCedula.Value = Obj_Persona_DAL.sIdPersona; txtnombre.Value = Obj_Persona_DAL.sNombre; TextAreadireccion.Value = Obj_Persona_DAL.sDireccion; // Carga Rol DropDownRol.Value = Obj_Persona_DAL.bIdRol.ToString(); // carga grid teléfonos Obj_Telefonos_DAL = new Cls_Telefonos_DAL(); Obj_Telefonos_DAL.sIdPersona = Obj_Persona_DAL.sIdPersona; Obj_Telefonos_BLL.crudTelefono(ref Obj_Telefonos_DAL, BD.Filtrar); GridViewTelefono.DataSource = Obj_Telefonos_DAL.DS.Tables[0]; GridViewTelefono.DataBind(); // carga grid de correos Obj_Correo_DAL = new Cls_Correos_DAL(); Obj_Correo_DAL.sIdPersona = Obj_Persona_DAL.sIdPersona; Obj_Correo_BLL.crudCorreos(ref Obj_Correo_DAL, BD.Filtrar); CorreoPersonaGridView.DataSource = Obj_Correo_DAL.DS.Tables[0]; CorreoPersonaGridView.DataBind(); } else { //this.mantenimiento.InnerHtml = "Nuevos de Estados"; txtCedula.Value = string.Empty; txtnombre.Value = string.Empty; TextAreadireccion.Value = string.Empty; } } }