private void Llenar_cboSistPensiones() { cmbafp.ValueMember = "regipenid"; cmbafp.DisplayMember = "regipenname"; var BL = new tb_plla_pdt_tabla11BL(); var BE = new tb_plla_pdt_tabla11(); cmbafp.DataSource = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; }
private void CargaDatos() { var nposcolumnasortear = 0; var PrvSotOrder = default(SortOrder); var zordenado = false; var xcodcliente = ".."; var xpalabra1 = string.Empty; var xpalabra2 = string.Empty; var xpalabra3 = string.Empty; if (txtfiltronombre.Text.Trim().Length > 0) { xpalabra1 = VariablesPublicas.Palabras(txtfiltronombre.Text, 1); xpalabra2 = VariablesPublicas.Palabras(txtfiltronombre.Text, 2); xpalabra3 = VariablesPublicas.Palabras(txtfiltronombre.Text, 3); } if ((Examinar.CurrentRow != null)) { xcodcliente = Examinar.Rows[Examinar.CurrentRow.Index].Cells["regipenid"].Value.ToString(); } if ((Examinar.SortedColumn != null)) { nposcolumnasortear = Examinar.SortedColumn.Index; PrvSotOrder = Examinar.SortOrder; zordenado = true; } var BL = new tb_plla_pdt_tabla11BL(); var BE = new tb_plla_pdt_tabla11(); BE.nomlike1 = xpalabra1; BE.nomlike2 = xpalabra2; BE.nomlike3 = xpalabra3; BE.norden = 1; BE.incluir_blanco = 0; tablaclientes = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; Examinar.AutoGenerateColumns = false; Examinar.DataSource = tablaclientes; VariablesPublicas.PintaEncabezados(Examinar); if (zordenado) { if (PrvSotOrder == SortOrder.Ascending) { Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Ascending); } else { Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Descending); } } else { Examinar.Sort(Examinar.Columns["regipenid"], System.ComponentModel.ListSortDirection.Ascending); } if (Examinar.CurrentRow == null) { if (Examinar.RowCount > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["regipenid"]; } } for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["regipenid"].Value.ToString() == xcodcliente.ToString()) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["regipenid"]; break; } } }
private void btneliminar_Click(object sender, EventArgs e) { if ((Examinar.CurrentRow != null)) { var xnomcampo = string.Empty; var BLIR = new tb_plla_pdt_tabla11BL(); var BEIR = new tb_plla_pdt_tabla11(); BEIR.regipenid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["regipenid"].Value.ToString(); tmpcursor = BLIR.GetAll_IR(VariablesPublicas.EmpresaID, BEIR).Tables[0]; if (BLIR.Sql_Error.Length > 0) { xnomcampo = BLIR.Sql_Error; Frm_Class.ShowError(BLIR.Sql_Error, this); } else { if (tmpcursor.Rows.Count == 0) { } else { for (lc_cont = 0; lc_cont <= tmpcursor.Rows.Count - 1; lc_cont++) { xnomcampo = xnomcampo + tmpcursor.Rows[lc_cont]["relacion"] + "\r"; if (lc_cont + 1 == 10) { break; } } } } if (xnomcampo.Length == 0) { var BL = new tb_plla_pdt_tabla11BL(); var BE = new tb_plla_pdt_tabla11(); BE.regipenid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["regipenid"].Value.ToString(); BE.norden = 1; BE.incluir_blanco = 0; tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { var message = "Desea eliminar datos " + tmptabla.Rows[0]["regipenid"].ToString().Trim() + "-" + tmptabla.Rows[0]["regipenname"].ToString().Trim() + " ...?"; var caption = "Mensaje del Sistema"; var buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { BL.Delete(VariablesPublicas.EmpresaID, BE); if (BL.Sql_Error.Length == 0) { var BLL = new tb_co_seguridadlogBL(); var BEL = new tb_co_seguridadlog(); BEL.moduloid = Name; BEL.clave = VariablesPublicas.EmpresaID + Examinar.Rows[Examinar.CurrentRow.Index].Cells["regipenid"].Value.ToString(); BEL.cuser = VariablesPublicas.Usuar; BEL.fecha = DateTime.Now; BEL.pc = VariablesPublicas.userip; BEL.accion = "B"; BEL.detalle = "Descripción: " + txtdescripcion.Text.Trim(); BLL.Insert(VariablesPublicas.EmpresaID.ToString(), BEL); Examinar.Rows.Remove(Examinar.CurrentRow); Examinar.Refresh(); u_PintaDatos(); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } } else { Frm_Class.ShowError(BL.Sql_Error, this); } } else { MessageBox.Show(xnomcampo, "IMPOSIBLE ELIMINAR REGISTRO"); } } U_RefrescaControles(); }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var BL = new tb_plla_pdt_tabla11BL(); var BE = new tb_plla_pdt_tabla11(); BE.regipenid = txtcodigo.Text.Trim(); BE.regipenname = txtdescripcion.Text.Trim(); BE.regipenabrv = txtabreviatura.Text.Trim(); BE.afpnet = (Equivalencias.Left(txtcodigo.Text.Trim(), 1) == "2" ? txtsiglaafpnet.Text.Trim() : string.Empty); BE.status = (Equivalencias.Left(txtcodigo.Text.Trim(), 1) == "2" ? "A" : "0"); if (u_n_opsel == 1) { if (BL.Insert(VariablesPublicas.EmpresaID.ToString(), BE)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } else { if (BL.Update(VariablesPublicas.EmpresaID.ToString(), BE)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } } }
private BindingSource NewMethodoAfp() { var BL = new tb_plla_pdt_tabla11BL(); var BE = new tb_plla_pdt_tabla11(); BE.status = "A"; var table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; var rows = table.Rows; object[] cell; var dic = new Dictionary<string, string>(); var binding = new BindingSource(); foreach (DataRow item in rows) { cell = item.ItemArray; dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[1].ToString()); cell = null; } binding.DataSource = dic; return binding; }