private void btngrabar_Click(object sender, EventArgs e)
        {
            /*string cbo;
             * cbo = cbosubsidio.Text;
             * if (cbo.Contains("S.P."))
             *  Messages.M_warning("SUPENSION PERFECTA");
             * else if (cbo.Contains("S.I."))
             *  Messages.M_warning("SUSPENSION IMPERFECTA");*/

            if (String.IsNullOrWhiteSpace(txtdias.Text))
            {
                return;
            }

            mensaje = "";
            using (ndsub = new NDiasSubsidiados())
            {
                ndsub.Id_subsidios = Convert.ToInt32(cbosubsidio.SelectedValue);
                ndsub.Id_empleado  = PlanillaCache.p_idempleado;
                ndsub.Id_mes       = PlanillaCache.p_idmes;
                ndsub.Id_periodo   = UserCache.Idperiodo;
                ndsub.Dias         = Convert.ToInt32(txtdias.Text.Trim());
                mensaje            = ndsub.GuardarCambios();
            }

            txtdias.Text = string.Empty;
            txtdias.Focus();
            Fill_detSubsidio(PlanillaCache.Subsidiado);
            SumarDias();
            SentTypeDaySubsidio();
        }
 private void dgvsubsidio_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         if (dgvsubsidio.Rows[e.RowIndex].Cells["modificar"].Selected)
         {
             mensaje = "";
             using (ndsub = new NDiasSubsidiados())
             {
                 ndsub.state            = EntityState.Modificar;
                 ndsub.Dias             = Convert.ToInt32(dgvsubsidio.Rows[e.RowIndex].Cells["canti_dias"].Value);
                 ndsub.Id_det_subsidios = Convert.ToInt32(dgvsubsidio.Rows[e.RowIndex].Cells["id_dsubsidio"].Value);
                 mensaje = ndsub.GuardarCambios();
                 if (!mensaje.Equals(""))
                 {
                     Fill_detSubsidio(PlanillaCache.Subsidiado);
                     SumarDias();
                     SentTypeDaySubsidio();
                 }
                 Messages.M_info(mensaje);
                 ndsub.state = EntityState.Guardar;
             }
         }
         else if (dgvsubsidio.Rows[e.RowIndex].Cells["eliminar"].Selected)
         {
             mensaje = "";
             using (ndsub = new NDiasSubsidiados())
             {
                 string       cod_subsi = dgvsubsidio.CurrentRow.Cells["cod_subsidio"].Value.ToString();
                 DialogResult result    = Messages.M_question("¿Está seguro de eliminar el tipo " + cod_subsi + "?");
                 if (result == DialogResult.Yes)
                 {
                     ndsub.state            = EntityState.Remover;
                     ndsub.Id_det_subsidios = Convert.ToInt32(dgvsubsidio.Rows[e.RowIndex].Cells["id_dsubsidio"].Value);
                     mensaje = ndsub.GuardarCambios();
                     if (!mensaje.Equals(""))
                     {
                         Fill_detSubsidio(PlanillaCache.Subsidiado);
                         SumarDias();
                         SentTypeDaySubsidio();
                     }
                     Messages.M_info(mensaje);
                     ndsub.state = EntityState.Guardar;
                 }
             }
         }
     }
 }
Пример #3
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            result = "";
            using (nds)
            {
                nds.Id_subsidios = Convert.ToInt32(txtidsubsidio.Text.Trim());
                nds.Id_empleado  = UserCache.IdUser;
                nds.Id_mes       = Convert.ToInt32(txtmes.Text.Trim());
                nds.Id_periodo   = UserCache.Idperiodo;
                nds.Dias         = Convert.ToInt32(txtdias.Text.Trim());

                bool valida = new ValidacionDatos(nds).Validate();
                if (valida)
                {
                    result = nds.GuardarCambios();
                    Messages.M_info(result);
                }
            }
        }