Exemplo n.º 1
0
 private void BtnActualizarPuntos_Click(object sender, EventArgs e)
 {
     try
     {
         ErrProvider.Clear();
         Cursor = Cursors.WaitCursor;
         if (Cboempresa1.SelectedIndex != -1 & ProductoID != "" & TxtNuevosPuntos.Text != "." & TxtNuevosPuntos.Text != "." & TxtNuevosPuntos.Text != "")
         {
             if (Convert.ToInt32(TxtNuevosPuntos.Text) > 0)
             {
                 //obtener nuevo precio
                 E_ListaPrecio ObjE_ListaPrecio = new E_ListaPrecio();
                 ObjE_ListaPrecio.EmpresaID  = Cboempresa1.SelectedValue.ToString();
                 ObjE_ListaPrecio.SedeID     = AppSettings.SedeID;
                 ObjE_ListaPrecio.ProductoID = ProductoID;
                 ObjE_ListaPrecio.Puntos     = Convert.ToInt32(TxtNuevosPuntos.Text);
                 ObjE_ListaPrecio.UsuarioID  = AppSettings.UserID;
                 ObjCL_Producto.UpdatePuntos(ObjE_ListaPrecio);
                 MessageBox.Show("Se actualizo correctamente los puntos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 LimpiarPrecio();
             }
             else
             {
                 ErrProvider.SetError(TxtNuevosPuntos, "puntos debe ser diferente de cero.");
             }
         }
         else
         {
             if (Cboempresa1.SelectedIndex == -1)
             {
                 ErrProvider.SetError(Cboempresa1, "Seleccione una empresa.");
             }
             if (TxtNuevosPuntos.Text == "." | TxtNuevosPuntos.Text == "")
             {
                 ErrProvider.SetError(TxtNuevosPuntos, "Ingrese un punto válido");
             }
             else if (TxtNuevosPuntos.Text.Length > 0 && Convert.ToInt32(TxtNuevosPuntos.Text) == 0)
             {
                 ErrProvider.SetError(TxtNuevosPuntos, "puntos debe ser diferente de cero.");
             }
         }
         Cursor = Cursors.Default;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Cursor = Cursors.Default;
     }
 }