private void btnCopiar_Click(object sender, EventArgs e) { if (spnperiodo.Value == spnperiodod.Value) { MessageBox.Show("Periodos deben ser distintos", "Mensaje del Sistema"); return; } var BL = new tb_plla_feriadosBL(); var BE = new tb_plla_feriados(); BE.perianioini = spnperiodo.Value.ToString(); BE.perianiofin = spnperiodod.Value.ToString(); BE.deleteoall = (chkdel.Checked ? 1 : 0); BL.Copiar(VariablesPublicas.EmpresaID, BE); if (BL.Sql_Error.Length > 0) { Frm_Class.ShowError(BL.Sql_Error, this); } else { if ((_LpDelegado != null)) { _LpDelegado(true); } Close(); } }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { tb_plla_feriadosBL BL = new tb_plla_feriadosBL(); tb_plla_feriados BE = new tb_plla_feriados(); BE.perianio = spnperiodo.Value.ToString(); BE.perimes = cmbmes.SelectedValue.ToString(); BE.peridia = txtdias.Text.Trim(); tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; //tmpcursor = ocapa.CaeSoft_GetAllFeriados(cmbperiodo.SelectedValue, cmbmes.SelectedValue, txtdias.Text, "", "", ""); if (tmpcursor.Rows.Count == 0) { tmpcursor.Rows.Add(VariablesPublicas.InsertIntoTable(tmpcursor)); } tmpcursor.Rows[0]["perianio"] = spnperiodo.Value; tmpcursor.Rows[0]["perimes"] = cmbmes.SelectedValue; tmpcursor.Rows[0]["peridia"] = txtdias.Text.Trim(); tmpcursor.Rows[0]["descrip"] = txtdescripcion.Text.Trim(); tmpcursor.AcceptChanges(); if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, tmpcursor)) { seguridadlog(); //SeguridadLogic.InsertUpdateVariables(Name, cmbperiodo.SelectedValue + cmbmes.SelectedValue + txtdias.Text, "Descripción:" + txtdescripcion.Text, GlobalVars.GetInstance.UserID, "M", UtilitariosInterface.InformacionPC()); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } }
private void CargaDatos() { int nposcolumnasortear = 0; SortOrder PrvSotOrder = default(SortOrder); bool zordenado = false; string xcodcliente = ".."; string xpalabra1 = ""; string xpalabra2 = ""; string xpalabra3 = ""; string xperiodo = ""; if (spnperiodo.Enabled) { //if ((spnperiodo.Value != null)) //{ if ((!object.ReferenceEquals(spnperiodo.Value, DBNull.Value))) { xperiodo = spnperiodo.Value.ToString(); } //} } 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["d_fecha"].Value.ToString(); } if ((Examinar.SortedColumn != null)) { nposcolumnasortear = Examinar.SortedColumn.Index; PrvSotOrder = Examinar.SortOrder; zordenado = true; } tb_plla_feriadosBL BL = new tb_plla_feriadosBL(); tb_plla_feriados BE = new tb_plla_feriados(); BE.perianio = xperiodo; BE.nomlike1 = xpalabra1; BE.nomlike2 = xpalabra2; BE.nomlike3 = xpalabra3; tablaclientes = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; //tablaclientes = ocapa.CaeSoft_GetAllFeriados(xperiodo, "", "", xpalabra1, xpalabra2, xpalabra3); if (BL.Sql_Error.Length > 0) { Frm_Class.ShowError(BL.Sql_Error, this); return; } Examinar.AutoGenerateColumns = false; Examinar.DataSource = tablaclientes; //if (!(txtdescripcion.MaxLength == tablaclientes.Columns["descrip"].MaxLength)) //{ // txtdescripcion.MaxLength = tablaclientes.Columns["descrip"].MaxLength; //} 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["d_fecha"], System.ComponentModel.ListSortDirection.Ascending); } if (Examinar.CurrentRow == null) { if (Examinar.RowCount > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["d_fecha"]; } } //if (Examinar.RowCount > 0) //{ // lbltotalregistros.Text = Examinar.RowCount.ToString + " Registro(s)"; //} //else //{ // lbltotalregistros.Text = ""; //} for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["d_fecha"].Value.ToString() == xcodcliente) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["descrip"]; break; } } }
private void btneliminar_Click(object sender, EventArgs e) { if ((Examinar.CurrentRow != null)) { xnomcampo = ""; if (xnomcampo.Length == 0) { tb_plla_feriadosBL BL = new tb_plla_feriadosBL(); tb_plla_feriados BE = new tb_plla_feriados(); BE.perianio = Examinar.Rows[Examinar.CurrentRow.Index].Cells["perianio"].Value.ToString(); BE.perimes = Examinar.Rows[Examinar.CurrentRow.Index].Cells["perimes"].Value.ToString(); BE.peridia = Examinar.Rows[Examinar.CurrentRow.Index].Cells["peridia"].Value.ToString(); tmptabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; //tmptabla = ocapa.CaeSoft_GetAllFeriados(Examinar.Rows(Examinar.CurrentRow.Index).Cells("perianio").Value, Examinar.Rows(Examinar.CurrentRow.Index).Cells("MES").Value, Examinar.Rows(Examinar.CurrentRow.Index).Cells("peridia").Value, "", "", ""); if (BL.Sql_Error.Length == 0) { string message = "Desea eliminar datos " + tmptabla.Rows[0]["perianio"].ToString().Trim() + "/" + tmptabla.Rows[0]["mesdia"].ToString().Trim() + "-" + tmptabla.Rows[0]["descrip"].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) { //if (Interaction.MsgBox("Desea eliminar datos " + tmptabla.Rows[0]["perianio"].ToString().Trim() + "/" + tmptabla.Rows[0]["MESDIA"].ToString().Trim() + "-" + tmptabla.Rows[0]["descrip"].ToString().Trim(), 4 + 32 + 256, "") == 6) //{ BL.Eliminar(VariablesPublicas.EmpresaID, tmptabla); if (BL.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["perianio"].Value.ToString() + Examinar.Rows[Examinar.CurrentRow.Index].Cells["perimes"].Value.ToString() + Examinar.Rows[Examinar.CurrentRow.Index].Cells["peridia"].Value.ToString(); BEL.cuser = VariablesPublicas.Usuar; BEL.fecha = DateTime.Now; BEL.pc = VariablesPublicas.userip; BEL.accion = "B"; BEL.detalle = "Descripción: " + txtdescripcion.Text; BLL.Insert(VariablesPublicas.EmpresaID.ToString(), BEL); //SeguridadLogic.InsertUpdateVariables(Name, cmbperiodo.SelectedValue + cmbmes.SelectedValue + txtdias.Text, "Descripción:" + txtdescripcion.Text, GlobalVars.GetInstance.UserID, "b", UtilitariosInterface.InformacionPC()); 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(); }