public C_documento_crud(Vo_documento documento = null) { frm = new Capa_Vista.frm_document_crud(); c_message = C_message.getInstancia(); message_box = c_message.formulario(); vo_documento.Operacion = "insert"; InitializeEvents(); if (documento != null) { vo_documento.Clave = documento.Clave; vo_documento.Operacion = documento.Operacion; vo_documento.Credencial = documento.Credencial; vo_documento.Comprobante_domicilio = documento.Comprobante_domicilio; vo_documento.Certificado = documento.Certificado; img[0] = documento.Credencial; img[1] = documento.Comprobante_domicilio; img[2] = documento.Certificado; frm.txtRFC.Text = documento.Rfc_trabajdor; frm.txtName.Text = documento.Nombre_trabajador; frm.cmbEstado.Text = documento.Estado.ToString(); frm.txtObservaciones.Text = documento.Observaciones; if (documento.Fecha_evaluacion != "Pendiente") { frm.dtpRegistrationDate.Value = Convert.ToDateTime(documento.Fecha_evaluacion); } } }
public bool UPDATE(Vo_documento documento) { try { MySqlCommand cmd = new MySqlCommand("sp_updateDocument", cnSql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", documento.Clave); cmd.Parameters.AddWithValue("@estado", documento.Estado); cmd.Parameters.AddWithValue("@observacion", documento.Observaciones); cmd.Parameters.AddWithValue("@fecha", documento.Fecha_evaluacion); if (cnSql.State == ConnectionState.Open) { cnSql.Close(); } cnSql.Open(); if (cmd.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch (Exception ex) { MessageBox.Show("Ocurrio un error", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); cnSql.Close(); return(false); } finally { cnSql.Close(); } }
public DataTable SEARCH(Vo_documento documento) { MySqlCommand cmd = new MySqlCommand("sp_searchDocument", cnSql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@termino", documento.Expresion); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public bool UPDATE(Vo_documento documento) { if (m_documento == null) { m_documento = new M_documento(); return(m_documento.UPDATE(documento)); } else { return(m_documento.UPDATE(documento)); } }
public DataTable SEARCH(Vo_documento documento) { if (m_documento == null) { m_documento = new M_documento(); return(m_documento.SEARCH(documento)); } else { return(m_documento.SEARCH(documento)); } }
public bool CREATE(Vo_documento documento) { try { MySqlCommand cmd = new MySqlCommand("sp_createDocument", cnSql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@credencial", documento.Credencial); cmd.Parameters.AddWithValue("@certificado", documento.Certificado); cmd.Parameters.AddWithValue("@comprobante_domicilio", documento.Comprobante_domicilio); cmd.Parameters.AddWithValue("@estado", documento.Estado); cmd.Parameters.AddWithValue("@observacion", documento.Observaciones); cmd.Parameters.AddWithValue("@rfc", documento.Rfc_trabajdor); cmd.Parameters.AddWithValue("@nombre trabajador", documento.Nombre_trabajador); cmd.Parameters.AddWithValue("@fecha_evaluacion", documento.Fecha_evaluacion); if (cnSql.State == ConnectionState.Open) { cnSql.Close(); } cnSql.Open(); if (cmd.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch (Exception ex) { MessageBox.Show("Ocurrio un error", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); cnSql.Close(); return(false); } finally { cnSql.Close(); } }