private void btnSeleccionar_Click(object sender, EventArgs e) { var xmsgerror = string.Empty; var BL = new tb_plla_numeracionpllaBL(); var BE = new tb_plla_numeracionplla(); BE.perianio = VariablesPublicas.perianio; BE.asiento = Examinar.Rows[Examinar.CurrentRow.Index].Cells["asiento"].Value.ToString(); if (cboTipo.Text.ToUpper() == "NORMAL") { if (!BL.Plla_SELECCIONADA(VariablesPublicas.EmpresaID, BE)) { xmsgerror = BL.Sql_Error; } } else { if (!BL.Plla_HESELECCIONADA(VariablesPublicas.EmpresaID, BE)) { xmsgerror = BL.Sql_Error; } } if (xmsgerror.Trim().Length == 0) { btnCancelar_Click(sender, e); } else { Frm_Class.ShowError(xmsgerror, this); } }
private void CargaDatos() { var xtipoplanilla = string.Empty; if (cmbfiltrotipoplanilla.Enabled) { if ((cmbfiltrotipoplanilla.SelectedValue != null)) { xtipoplanilla = cmbfiltrotipoplanilla.SelectedValue.ToString(); } } 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["asiento"].Value.ToString(); } if ((Examinar.SortedColumn != null)) { nposcolumnasortear = Examinar.SortedColumn.Index; PrvSotOrder = Examinar.SortOrder; zordenado = true; } var BL = new tb_plla_numeracionpllaBL(); var BE = new tb_plla_numeracionplla(); BE.perianio = VariablesPublicas.perianio; BE.tipoplla = xtipoplanilla; BE.nomlike1 = xpalabra1; BE.nomlike2 = xpalabra2; BE.nomlike3 = xpalabra3; BE.norden = 1; 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["asiento"], System.ComponentModel.ListSortDirection.Ascending); } if (Examinar.CurrentRow == null) { if (Examinar.RowCount > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["asiento"]; } } for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["asiento"].Value.ToString() == xcodcliente) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["asiento"]; break; } } U_RefrescaControles(); }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var tmpcursor = new DataTable(); var BL = new tb_plla_numeracionpllaBL(); var BE = new tb_plla_numeracionplla(); BE.perianio = VariablesPublicas.perianio; BE.asiento = txtcodigo.Text.Trim(); BE.norden = 1; tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; if (u_n_opsel == 1) { tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmpcursor.Rows.Count > 0) { MessageBox.Show("Número de planilla ya existente", "Mensaje del Sistema"); } tmpcursor.Rows.Add(VariablesPublicas.INSERTINTOTABLE(tmpcursor)); tmpcursor.Rows[0]["perianio"] = VariablesPublicas.perianio; tmpcursor.Rows[0]["asiento"] = txtcodigo.Text.Trim(); } tmpcursor.Rows[0]["perimes"] = cmbmes.SelectedValue; tmpcursor.Rows[0]["tipoplla"] = cmbtipoplanilla.SelectedValue; if ((cmbmodalidad.SelectedValue != null)) { tmpcursor.Rows[0]["planit"] = Convert.ToInt16(cmbmodalidad.SelectedValue); } tmpcursor.Rows[0]["glosa"] = txtdescripcion.Text.Trim(); if (frangolabini.Checked) { tmpcursor.Rows[0]["fechaini"] = frangolabini.Value; } else { tmpcursor.Rows[0]["fechaini"] = DBNull.Value; } if (frangolabfin.Checked) { tmpcursor.Rows[0]["fechafin"] = frangolabfin.Value; } else { tmpcursor.Rows[0]["fechafin"] = DBNull.Value; } tmpcursor.Rows[0]["nsemana"] = VariablesPublicas.StringtoDecimal(txtsemana.Text); tmpcursor.Rows[0]["status"] = '0'; if (frangotrabini.Checked) { tmpcursor.Rows[0]["fechpini"] = frangotrabini.Value; } else { tmpcursor.Rows[0]["fechpini"] = DBNull.Value; } if (frangotrabfin.Checked) { tmpcursor.Rows[0]["fechpfin"] = frangotrabfin.Value; } else { tmpcursor.Rows[0]["fechpfin"] = DBNull.Value; } if ((cmbtipoquincena.SelectedValue != null)) { tmpcursor.Rows[0]["tipoquincena"] = cmbtipoquincena.SelectedValue; } tmpcursor.AcceptChanges(); if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, tmpcursor)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } }
private void btneliminar_Click(object sender, EventArgs e) { if ((Examinar.CurrentRow != null)) { var xnomcampo = string.Empty; var BL = new tb_plla_numeracionpllaBL(); var BE = new tb_plla_numeracionplla(); BE.perianio = Examinar.Rows[Examinar.CurrentRow.Index].Cells["perianio"].Value.ToString(); BE.asiento = Examinar.Rows[Examinar.CurrentRow.Index].Cells["asiento"].Value.ToString(); tmpcursor = BL.GetAll_CONSULTAIR(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length > 0) { xnomcampo = BL.Sql_Error; Frm_Class.ShowError(BL.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) { BE.norden = 1; tmptabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { var message = "Desea eliminar datos de la Numeración " + tmptabla.Rows[0]["asiento"].ToString().Trim() + "-" + tmptabla.Rows[0]["glosa"].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.Eliminar(VariablesPublicas.EmpresaID, tmptabla); 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["perianio"].Value.ToString() + Examinar.Rows[Examinar.CurrentRow.Index].Cells["asiento"].Value.ToString(); BEL.cuser = VariablesPublicas.Usuar; BEL.fecha = DateTime.Now; BEL.pc = VariablesPublicas.userip; BEL.accion = "B"; BEL.detalle = "NUMERO DE PLANILA: " + txtcodigo.Text.Trim() + " | " + 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 U_LoadPlanillas(int nInit) { if (nInit == 1) { cboTipo.Text = "Normal"; } Examinar.AutoGenerateColumns = false; var BL = new tb_plla_numeracionpllaBL(); var BE = new tb_plla_numeracionplla(); BE.perianio = VariablesPublicas.perianio; BE.norden = 1; Examinar.DataSource = BL.CONSULTA_SELECCION(VariablesPublicas.EmpresaID, BE).Tables[0]; VariablesPublicas.PintaEncabezados(Examinar); var ncol = 0; for (ncol = 0; ncol <= Examinar.ColumnCount - 1; ncol++) { Examinar.Columns[ncol].SortMode = DataGridViewColumnSortMode.Automatic; } if (cboTipo.Text.ToUpper() == "NORMAL") { Examinar.Columns["Column8"].DataPropertyName = "plla_sel"; } else { Examinar.Columns["Column8"].DataPropertyName = "he_sel"; } Examinar.Columns[6].Visible = false; Examinar.Columns[7].Visible = false; Examinar.Columns[8].Visible = true; }