public void ValidaCcargo() { if (txtccargo.Text.Trim().Length == 0) { txtdcargo.Text = string.Empty; } else { txtccargo.Text = VariablesPublicas.PADL(txtccargo.Text.Trim(), txtccargo.MaxLength, "0"); var BL = new tb_plla_cargosBL(); var BE = new tb_plla_cargos(); BE.cencosid = txtccosto.Text.Trim(); BE.cargoid = txtccargo.Text.Trim(); tmptabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { if (tmptabla.Rows.Count > 0) { txtccargo.Text = tmptabla.Rows[0]["cargoid"].ToString(); txtdcargo.Text = tmptabla.Rows[0]["cargoname"].ToString(); } else { txtccargo.Text = j_ccargo; } } else { txtccargo.Text = j_ccargo; } } }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { DataTable tmpcursor = new DataTable(); tb_plla_cargosBL BL = new tb_plla_cargosBL(); tb_plla_cargos BE = new tb_plla_cargos(); BE.cencosid = cmbccosto.SelectedValue.ToString(); BE.cargoid = txtcodigo.Text.Trim(); BE.norden = 0; BE.ver_blanco = 0; 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) { tb_plla_cargosBL BLMX = new tb_plla_cargosBL(); tb_plla_cargos BEMX = new tb_plla_cargos(); BEMX.cencosid = cmbccosto.SelectedValue.ToString(); txtcodigo.Text = BLMX.GetAll_MaxCodigo(VariablesPublicas.EmpresaID.ToString(), BEMX).Tables[0].Rows[0]["maximo_codigo"].ToString(); } tmpcursor.Rows.Add(VariablesPublicas.InsertIntoTable(tmpcursor)); tmpcursor.Rows[0]["cargoid"] = txtcodigo.Text; tmpcursor.Rows[0]["status"] = 1; } tmpcursor.Rows[0]["cargoname"] = txtdescripcion.Text; tmpcursor.Rows[0]["status"] = (chkactivo.Checked ? 1 : 0); tmpcursor.Rows[0]["cencosid"] = cmbccosto.SelectedValue; tmpcursor.Rows[0]["ocupaid"] = txtcodrtps.Text; tmpcursor.Rows[0]["tipogasto"] = (rbdirecto.Checked ? '1' : '2'); tmpcursor.AcceptChanges(); if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, tmpcursor)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } }
private void CargaDatos() { string xtipoplanilla = ""; if (cmbfiltroccosto.Enabled) { if ((cmbfiltroccosto.SelectedValue != null)) { xtipoplanilla = cmbfiltroccosto.SelectedValue.ToString(); } } int nposcolumnasortear = 0; SortOrder PrvSotOrder = default(SortOrder); bool zordenado = false; string xcodcliente = ".."; string xpalabra1 = ""; string xpalabra2 = ""; string xpalabra3 = ""; 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["cargoid"].Value.ToString(); } if ((Examinar.SortedColumn != null)) { nposcolumnasortear = Examinar.SortedColumn.Index; PrvSotOrder = Examinar.SortOrder; zordenado = true; } tb_plla_cargosBL BL = new tb_plla_cargosBL(); tb_plla_cargos BE = new tb_plla_cargos(); BE.cencosid = xtipoplanilla; BE.nomlike1 = xpalabra1; BE.nomlike2 = xpalabra2; BE.nomlike3 = xpalabra3; BE.norden = 0; BE.ver_blanco = 0; tablaclientes = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; Examinar.AutoGenerateColumns = false; Examinar.DataSource = tablaclientes; if (BL.Sql_Error.Length == 0) { //if (!(txtdescripcion.MaxLength == tablaclientes.Columns["cargoname"].MaxLength)) //{ // txtdescripcion.MaxLength = tablaclientes.Columns["cargoname"].MaxLength; // txtcodigo.MaxLength = tablaclientes.Columns["cargoid"].MaxLength; //} } else { Frm_Class.ShowError(BL.Sql_Error, this); } 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["cargoid"], System.ComponentModel.ListSortDirection.Ascending); } if (Examinar.CurrentRow == null) { if (Examinar.RowCount > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["cargoid"]; } } for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["cargoid"].Value.ToString() == xcodcliente) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["cargoid"]; break; } } U_RefrescaControles(); }
private void btneliminar_Click(object sender, EventArgs e) { if ((Examinar.CurrentRow != null)) { string xnomcampo = ""; tb_plla_cargosBL BL = new tb_plla_cargosBL(); tb_plla_cargos BE = new tb_plla_cargos(); BE.cencosid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["cencosid"].Value.ToString(); BE.cargoid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["cargoid"].Value.ToString(); //tmpcursor = BL.GetAll_CONSULTAIR(VariablesPublicas.EmpresaID, BE).Tables[0]; ////tmpcursor = ocapa.IR_PAG2100(GlobalVars.GetInstance.Company, Examinar.Rows(Examinar.CurrentRow.Index).Cells("ccos_21").Value, Examinar.Rows(Examinar.CurrentRow.Index).Cells("cargoid").Value); //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) { tb_plla_cargosBL BLEL = new tb_plla_cargosBL(); tb_plla_cargos BEEL = new tb_plla_cargos(); BEEL.cencosid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["cencosid"].Value.ToString(); BEEL.cargoid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["cargoid"].Value.ToString(); BEEL.norden = 1; BEEL.ver_blanco = 0; tmptabla = BLEL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BEEL).Tables[0]; if (BLEL.Sql_Error.Length == 0) { string message = "Desea eliminar datos del cargo " + tmptabla.Rows[0]["cargoid"].ToString().Trim() + "-" + tmptabla.Rows[0]["cargoname"].ToString().Trim() + " ...?"; string caption = "Mensaje del Sistema"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; // Muestra el cuadro de mensaje. result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { BLEL.Eliminar(VariablesPublicas.EmpresaID, tmptabla); if (BLEL.Sql_Error.Length == 0) { tb_co_seguridadlogBL BLL = new tb_co_seguridadlogBL(); tb_co_seguridadlog BEL = new tb_co_seguridadlog(); BEL.moduloid = Name; BEL.clave = VariablesPublicas.EmpresaID + Examinar.Rows[Examinar.CurrentRow.Index].Cells["cencosid"].Value.ToString() + Examinar.Rows[Examinar.CurrentRow.Index].Cells["cargoid"].Value.ToString(); BEL.cuser = VariablesPublicas.Usuar; BEL.fecha = DateTime.Now; BEL.pc = VariablesPublicas.userip; BEL.accion = "B"; BEL.detalle = "Cargo: " + txtdescripcion.Text.Trim(); BLL.Insert(VariablesPublicas.EmpresaID.ToString(), BEL); Examinar.Rows.Remove(Examinar.CurrentRow); Examinar.Refresh(); u_PintaDatos(); } else { Frm_Class.ShowError(BLEL.Sql_Error, this); } } } else { Frm_Class.ShowError(BLEL.Sql_Error, this); } } else { MessageBox.Show(xnomcampo, "IMPOSIBLE ELIMINAR REGISTRO"); } } U_RefrescaControles(); }