public PersonaFisica(TipoID tipoID, string numeroId, string nombre, TipoMonedaCompañia TipoMoneda, string direccion, string[] telefono, string web, string correo, string observaciones, String apellidoPaterno, String apellidoMaterno, string codigo = "", Boolean activo = true) : base(tipoID, numeroId, nombre, TipoMoneda, direccion, telefono, web, correo, observaciones, codigo, activo) { this.apellidoPaterno = apellidoPaterno; this.apellidoMaterno = apellidoMaterno; }
public PersonaJuridica(TipoID tipoID, string numeroId, string nombre, TipoMonedaCompañia TipoMoneda, string direccion, string[] telefono, string web, string correo, string observaciones, string representanteLegal, string IDRepresentante, string codigo = "", bool activo = true) : base(tipoID, numeroId, nombre, TipoMoneda, direccion, telefono, web, correo, observaciones, codigo, activo) { this.MyRepresentanteLegal = representanteLegal; this.MyIDRepresentanteLegal = IDRepresentante; }
/// <summary> /// Retorna true si todo esta bien /// </summary> /// <param name="id"></param> /// <param name="tipoID"></param> /// <param name="mensaje"></param> /// <returns></returns> public static Boolean VerificarID(String id, TipoID tipoID, out String mensaje) { var retorno = true; /** * case TipoID.CEDULA_JURIDICA: return "3-000-000000"; * case TipoID.CEDULA_NACIONAL: return "0-0000-0000"; * case TipoID.DIMEX: return "000000000000"; * case TipoID.NITE: return "0000000000"; */ switch (tipoID) { case TipoID.CEDULA_JURIDICA: if (id.Length != 12) { mensaje = "Formato de cédula incorrecto"; return(false); } break; case TipoID.CEDULA_NACIONAL: if (id.Length != 11) { mensaje = "Formato de cédula incorrecto"; return(false); } break; case TipoID.DIMEX: if (id.Length != 12) { mensaje = "Formato de cédula incorrecto"; return(false); } break; case TipoID.NITE: if (id.Length != 10) { mensaje = "Formato de cédula incorrecto"; return(false); } break; default: break; } mensaje = "Formato de cédula correctos"; return(retorno); }
protected Compañia(TipoID tipoID, string numeroId, string nombre, TipoMonedaCompañia TipoMoneda, string direccion, string[] telefono, string web, string correo, string observaciones, string codigo = "", Boolean activo = true) { this.Codigo = codigo; this.TipoId = tipoID; this.NumeroCedula = numeroId; this.Nombre = nombre; this.TipoMoneda = TipoMoneda; this.Direccion = direccion; this.Telefono = telefono; this.Web = web; this.Correo = correo; this.Observaciones = observaciones; this.Activo = activo; }
/// <summary> /// Devuelve una string que puede ser utilizado como mascara /// para los campos de identificacion /// </summary> /// <param name="tipoID"></param> /// <returns></returns> public static String MascaraIdentificacion(TipoID tipoID) { switch (tipoID) { case TipoID.CEDULA_JURIDICA: return("3-000-000000"); case TipoID.CEDULA_NACIONAL: return("0-0000-0000"); case TipoID.DIMEX: return("000000000000"); case TipoID.NITE: return("0000000000"); default: return("null"); } }
public Compañia GetCompañia(String id, TipoID tipoID) { if (tipoID == TipoID.CEDULA_NACIONAL) { //tratar de hacerlo mas eficiente var comdando = "SELECT * FROM maestro_compania m, personas p WHERE M.codigo = P.IDCompania AND p.cedula = @p1 "; using (MySqlCommand cmd = new MySqlCommand(comdando, manejador.GetConnection())) { cmd.Parameters.AddWithValue("@p1", id); MySqlDataAdapter da = new MySqlDataAdapter(); da.SelectCommand = cmd; DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow item in dt.Rows) { Object[] vn = item.ItemArray; var c = new PersonaFisica(); c.Codigo = Convert.ToString(vn[0]); c.TipoId = (TipoID)Convert.ToInt32(vn[1]); c.Direccion = Convert.ToString(vn[2]); c.Web = Convert.ToString(vn[3]); c.Correo = Convert.ToString(vn[4]); c.Observaciones = Convert.ToString(vn[6]); c.NumeroCedula = Convert.ToString(vn[10]); c.Nombre = Convert.ToString(vn[11]); c.MyApellidoPaterno = Convert.ToString(vn[12]); c.MyApellidoMaterno = Convert.ToString(vn[13]); return(c); } } } else { //DataTable dt = Listado("sp_buscar_fisicasID", new ClsParametros("@id", id), CommandType.Text); //foreach (DataRow item in dt.Rows) //{ // return SetinComp.CrearPersonaFisica(item.ItemArray); //} } return(null); }
public DataTable GetDataTable(TipoID tipoID, Boolean todos = false) { var sql = ""; if (todos) { sql = " SET lc_time_names = 'es_MX'; SELECT " + "T0.company_id AS 'Código'," + "T0.type_id AS 'Tipo ID'," + "T0.number_id AS 'Número Identicación'," + "T0.name AS 'Nombre'," + "T0.op1 AS 'Apellido Paterno'," + "T0.op2 AS 'Apellido Materno'," + "T0.address AS 'Dirección'," + "T0.website AS 'Sitio Web'," + "T0.mail AS 'Correro Electronico'," + "T0.phone_number1 AS 'Telefono'," + "T0.phone_number2 AS 'Telefono'," + "T0.notes AS 'Observaciones'," + "(SELECT CONCAT(u.name, ' ', u.lastname_p, ' ', u.lastname_m) FROM users AS u WHERE u.user_id = T0.user_id LIMIT 1) AS 'Usuario'," + "IF(T0.active <> 1, 'No', 'Si') AS 'Acivo' " + "FROM companies AS T0 WHERE T0.type_id <> 1"; return(manejador.Listado(sql, CommandType.Text)); } if (tipoID == TipoID.CEDULA_JURIDICA) { sql = "SET lc_time_names = 'es_MX'; SELECT " + "company_id AS 'Código'," + "type_id AS 'Tipo ID'," + "number_id AS 'Número Identicación'," + "name AS 'Nombre'," + "op1 AS 'Representante Legal'," + "op2 AS 'ID Representante'," + "address AS 'Dirección'," + "website AS 'Sitio Web'," + "mail AS 'Correro Electronico'," + "phone_number1 AS 'Telefono'," + "phone_number2 AS 'Telefono'," + "notes AS 'Observaciones'," + "(SELECT CONCAT(name, ' ', lastname_p, ' ', lastname_m) FROM users AS u WHERE u.user_id = user_id LIMIT 1) AS 'Usuario'," + "IF(active <> 1, 'No', 'Si') AS 'Acivo' " + "FROM companies WHERE type_id = 1"; return(manejador.Listado(sql, CommandType.Text)); } else { sql = "SET lc_time_names = 'es_MX'; SELECT " + "company_id AS 'Código'," + "type_id AS 'Tipo ID'," + "number_id AS 'Número Identicación'," + "name AS 'Nombre'," + "op1 AS 'Apellido Paterno'," + "op2 AS 'Apellido Materno'," + "address AS 'Dirección'," + "website AS 'Sitio Web'," + "mail AS 'Correro Electronico'," + "phone_number1 AS 'Telefono'," + "phone_number2 AS 'Telefono'," + "notes AS 'Observaciones'," + "(SELECT CONCAT(name, ' ', lastname_p, ' ', lastname_m) FROM users AS u WHERE u.user_id = user_id LIMIT 1) AS 'Usuario'," + "IF(active <> 1, 'No', 'Si') AS 'Acivo' " + "FROM companies WHERE type_id = @type_id"; return(manejador.Listado(sql, new Parametro("@type_id", Convert.ToInt16(tipoID)), CommandType.Text)); } }
/// <summary> /// Obtiene los datos del formulario los valida y registra /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GuardarNuevaCómpaña(object sender, EventArgs e) { var copiarde = (Compañia)lstCopiarMaestroCuentas.SelectedItem; if (copiarde == null) { copiarde = ((Compañia)lstCopiarMaestroCuentas.Items[0]); } if (MessageBox.Show("Se guardara la compañia, ¿Desea continuar?", "Aries", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { TipoID tipo = (TipoID)lstTipoId.SelectedIndex + 1; if (lstTipoId.SelectedIndex == 0) { var Persona = new PersonaJuridica( numeroId: txtBoxID.Text, tipoID: tipo, nombre: txtBoxNombre.Text, TipoMoneda: (TipoMonedaCompañia)lstMovimientosRegistro.SelectedIndex + 1, representanteLegal: txtBoxOp1.Text, IDRepresentante: txtBoxOp2.Text, direccion: txtBoxDireccion.Text, web: txtBoxWeb.Text, correo: txtBoxMail.Text, observaciones: txtBoxObservaciones.Text, telefono: new string[] { this.txtBoxTelefono1.Text, this.txtBoxTelefono2.Text } ); if (compañiaCL.Insert(Persona, GlobalConfig.Usuario, copiarde, out String mensaje)) { MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Information); lst.Add(Persona); this.LimpiarFormulario(); //CargarDatos(); } else { MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { var Persona = new PersonaFisica( numeroId: txtBoxID.Text, tipoID: tipo, nombre: txtBoxNombre.Text, TipoMoneda: (TipoMonedaCompañia)lstMovimientosRegistro.SelectedIndex + 1, apellidoPaterno: txtBoxOp1.Text, apellidoMaterno: txtBoxOp2.Text, direccion: txtBoxDireccion.Text, web: txtBoxWeb.Text, correo: txtBoxMail.Text, observaciones: txtBoxObservaciones.Text, telefono: new string[] { this.txtBoxTelefono1.Text, this.txtBoxTelefono2.Text } ); if (compañiaCL.Insert(Persona, GlobalConfig.Usuario, copiarde, out String mensaje)) { MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Information); lst.Add(Persona); LimpiarFormulario(); //CargarDatos(); } else { MessageBox.Show(mensaje, TextoGeneral.NombreApp, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { MessageBox.Show(ex.Message, TextoGeneral.MensajeBannerError, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } }