Beispiel #1
0
 private void estudianteBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         cboCantones.SelectedValue   = cboListaCantones.SelectedValue;
         cboProvincias.SelectedValue = cboListaProvincias.SelectedValue;
         cboDistritos.SelectedValue  = cboListaDistritos.SelectedValue;
         if (!ValidateFields())
         {
             return;
         }
         estudianteBindingSource.EndEdit();
         var selectedEstudiante = commB.SetEntity <Estudiante>(estudianteBindingSource.Current);
         if (selectedEstudiante != null)
         {
             commB.UpdateEntity <Estudiante>(selectedEstudiante);
         }
         estudianteBindingSource.ResetBindings(true);
         commB.SaveBitacora(this.Name + " Guardado estudiante: " + selectedEstudiante.IdEstudiante, false, Tools.UserCredentials.UserId);
         lblInfoMessage.Text = "Estudiante guardado satisfactoriamente";
     }
     catch (Exception ex)
     {
         CursosBusiness.BusinessHelpers.General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
Beispiel #2
0
        private void productoBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            productoBindingSource.EndEdit();

            var selectedProduct = commB.SetEntity <Producto>(productoBindingSource.Current);

            if (selectedProduct != null)
            {
                var selectedProveedor = commB.SetEntity <Proveedore>(cboProveedores.SelectedItem);
                var selectedCategory  = commB.SetEntity <Categoria>(cboCategorias.SelectedItem);
                var selectedUnidad    = commB.SetEntity <UnidadesMedida>(cboUnidadesMedidas.SelectedItem);

                selectedProduct.IdProveedor    = selectedProveedor.IdProveedor;
                selectedProduct.IdCategoria    = selectedCategory.IdCategoria;
                selectedProduct.IdUnidadMedida = selectedCategory.IdCategoria;
                //selectedProduct.PrecioVenta = selectedProduct.PrecioUnitario * (1 + selectedProduct.Utilidad / 100);
                commB.UpdateEntity <Producto>(selectedProduct);
            }
            productoBindingSource.ResetBindings(true);
        }
Beispiel #3
0
        private void proveedorBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            proveedorBindingSource.EndEdit();

            var selectedProveedor = commB.SetEntity <Proveedore>(proveedorBindingSource.Current);

            if (selectedProveedor != null)
            {
                commB.UpdateEntity <Proveedore>(selectedProveedor);
            }
            proveedorBindingSource.ResetBindings(true);
        }
Beispiel #4
0
        private void cajaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            cajaBindingSource.EndEdit();
            var selectedCaja = commB.SetEntity <ControlEntity.Caja>(cajaBindingSource.Current);

            try
            {
                if (selectedCaja != null)
                {
                    commB.UpdateEntity <ControlEntity.Caja>(selectedCaja);
                }
            }
            catch (Exception ex)
            {
                ControlBusiness.BusinessHelpers.General.DoError(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }

            cajaBindingSource.ResetBindings(true);
        }
 private void tipoIdBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateFields())
         {
             return;
         }
         tipoIdBindingSource.EndEdit();
         var selectedTipoId = commB.SetEntity <TipoId>(tipoIdBindingSource.Current);
         if (selectedTipoId != null)
         {
             commB.UpdateEntity <TipoId>(selectedTipoId);
         }
         tipoIdBindingSource.ResetBindings(true);
         commB.SaveBitacora(this.Name + " Guardado tipo Id: " + selectedTipoId.IdTipoId, false, Tools.UserCredentials.UserId);
         lblInfoMessage.Text = "Tipo Id guardado satisfactoriamente";
     }
     catch (Exception ex)
     {
         CursosBusiness.BusinessHelpers.General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
 private void usuarioBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateFields())
         {
             return;
         }
         usuarioBindingSource.EndEdit();
         var selectedUsuario = commB.SetEntity <Usuario>(usuarioBindingSource.Current);
         if (selectedUsuario != null)
         {
             commB.UpdateEntity <Usuario>(selectedUsuario);
         }
         commB.SaveBitacora("Usuario guardado: " + selectedUsuario.IdUsuario, false, Tools.UserCredentials.UserId);
         usuarioBindingSource.ResetBindings(true);
         lblInfoMessage.Text = "Usuario guardado satisfactoriamente";
     }
     catch (Exception ex)
     {
         General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
 private void aulaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateFields())
         {
             return;
         }
         aulaBindingSource.EndEdit();
         var selectedAula = commB.SetEntity <Aula>(aulaBindingSource.Current);
         if (selectedAula != null)
         {
             commB.UpdateEntity <Aula>(selectedAula);
         }
         aulaBindingSource.ResetBindings(true);
         commB.SaveBitacora(this.Name + " Guardada aula: " + selectedAula.IdAula, false, Tools.UserCredentials.UserId);
         lblInfoMessage.Text = "Aula guardada satisfactoriamente";
     }
     catch (Exception ex)
     {
         General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
Beispiel #8
0
        private void parametrosVentaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            parametrosVentaBindingSource.EndEdit();
            var selectedParam = commB.SetEntity <ParametrosVenta>(parametrosVentaBindingSource.Current);

            if (selectedParam != null)
            {
                commB.UpdateEntity <ParametrosVenta>(selectedParam);
            }
            parametrosVentaBindingSource.ResetBindings(true);
        }
        private void unidadesMedidaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            unidadesMedidaBindingSource.EndEdit();
            var selectedUni = commB.SetEntity <UnidadesMedidaForm>(unidadesMedidaBindingSource.Current);

            if (selectedUni != null)
            {
                commB.UpdateEntity <UnidadesMedidaForm>(selectedUni);
            }
            unidadesMedidaBindingSource.ResetBindings(true);
        }
        private void tarjetasBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            tarjetasBindingSource.EndEdit();
            var selectedTarjeta = commB.SetEntity <ControlEntity.Tarjeta>(tarjetasBindingSource.Current);

            if (selectedTarjeta != null)
            {
                commB.UpdateEntity <Tarjeta>(selectedTarjeta);
            }
            tarjetasBindingSource.ResetBindings(true);
        }
Beispiel #11
0
        private void clienteBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }
            clienteBindingSource.EndEdit();
            var selectedCliente = commB.SetEntity <Cliente>(clienteBindingSource.Current);

            if (selectedCliente != null)
            {
                commB.UpdateEntity <Cliente>(selectedCliente);
            }
            clienteBindingSource.ResetBindings(true);
        }
Beispiel #12
0
        private void frecuenciasPagoesBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            frecuenciasPagoesBindingSource.EndEdit();

            var selectedFrec = commB.SetEntity <ControlEntity.FrecuenciasPago>(frecuenciasPagoesBindingSource.Current);

            if (selectedFrec != null)
            {
                commB.UpdateEntity <ControlEntity.FrecuenciasPago>(selectedFrec);
            }
            frecuenciasPagoesBindingSource.ResetBindings(true);
        }
Beispiel #13
0
        private void usuarioBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            usuarioBindingSource.EndEdit();

            var selectedUser = commB.SetEntity <Usuario>(usuarioBindingSource.Current);

            if (selectedUser != null)
            {
                commB.UpdateEntity <Usuario>(selectedUser);
            }
            usuarioBindingSource.ResetBindings(true);
        }
        private void bancosBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            bancosBindingSource.EndEdit();

            var selectedBanco = commB.SetEntity <ControlEntity.Banco>(bancosBindingSource.Current);

            if (selectedBanco != null)
            {
                commB.UpdateEntity <ControlEntity.Banco>(selectedBanco);
            }
            bancosBindingSource.ResetBindings(true);
        }
Beispiel #15
0
        private void cboHorario_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboHorario.SelectedValue == null)
            {
                return;
            }
            cboProfesor.DataSource = null;
            cboProfesor.Enabled    = false;
            var horario   = commB.SetEntity <Horario>(cboHorario.SelectedItem);
            var profeList = commB.GetProfesorByIdCurso(Convert.ToInt32(txtIdCurso.Text.Trim()),
                                                       Convert.ToInt32(horario.IdHorario));

            cboProfesor.DataSource    = profeList;
            cboProfesor.DisplayMember = "Nombre";
            cboProfesor.ValueMember   = "IdProfesor";
            cboProfesor.Enabled       = true;
        }