Exemplo n.º 1
0
 private Boolean ReportarDano()
 {
     try
     {
         cSGGIDANOPORIMPLEMENTONegocios DanoNuevo = new cSGGIDANOPORIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
         DanoNuevo.FK_IDIMPLEMENTO = Int32.Parse(_DatosSeleccionados.Split(',')[0].ToString());
         DanoNuevo.DSC_DANO = TextBoxDescripcion.Text;
         DanoNuevo.CAN_IMPLEMENTOS = Int32.Parse(TextBoxCantidad.Text.ToString());
         DanoNuevo.FEC_REPORTE = new SqlDateTime(DateTime.Now);
         return DanoNuevo.Insertar();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        private void AgregarImplementosDevueltos(cSGPRDEVOLUCIONNegocios pDevolucion)
        {
            Panel implementos = (Panel)_prestamoElegido.FindControl("implementos_" + pDevolucion.FK_IDPRESTAMO);
            Char[] delimiter = { '_' };

            foreach (Control implemento in implementos.Controls)
            {
                string idPanel = implemento.ID;
                string sIdImplemento = idPanel.Split(delimiter)[1];
                int idImplemento = int.Parse(sIdImplemento);

                DropDownList drpCantDevolver = (DropDownList)implemento.FindControl("drpCantDevolver_" + idImplemento);

                if (drpCantDevolver.SelectedIndex > 0)
                {
                    cSGPRIMPLEMENTOSPORDEVOLUCIONNegocios implementoDevuelto = new cSGPRIMPLEMENTOSPORDEVOLUCIONNegocios(Global.gCOD_APLICACION, "CA", 0, "0");
                    implementoDevuelto.FK_IMPLEMENTO = idImplemento;
                    implementoDevuelto.FK_DEVOLUCION = pDevolucion.ID_DEVOLUCION;
                    implementoDevuelto.CANT_DEVUELTOS = drpCantDevolver.SelectedIndex;
                    implementoDevuelto.Insertar();

                    cSGGIIMPLEMENTONegocios implementoInventario = new cSGGIIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
                    implementoInventario.ID_IMPLEMENTO = idImplemento;
                    DataTable tablaBusqueda = implementoInventario.Buscar();
                    implementoInventario.CAN_DISPONIBLE = int.Parse(tablaBusqueda.Rows[0]["CAN_DISPONIBLE"].ToString()) + drpCantDevolver.SelectedIndex;
                    implementoInventario.Actualizar();

                    DropDownList drpCantDanada = (DropDownList)implemento.FindControl("drpCantDanada_" + idImplemento);

                    if (drpCantDanada.SelectedIndex > 0)
                    {
                        cSGGIDANOPORIMPLEMENTONegocios dano = new cSGGIDANOPORIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 0, "0");
                        dano.FK_IDIMPLEMENTO = idImplemento;
                        dano.FEC_REPORTE = DateTime.Now;
                        dano.CAN_IMPLEMENTOS = drpCantDanada.SelectedIndex;
                        TextBox txtObservaciones = (TextBox)implemento.FindControl("txtObservaciones_" + idImplemento);
                        dano.DSC_DANO = txtObservaciones.Text;
                        dano.Insertar();

                        cSGPRDANOPORDEVOLUCIONNegocios danoDevolucion = new cSGPRDANOPORDEVOLUCIONNegocios(Global.gCOD_APLICACION, "CA", 0, "0");
                        danoDevolucion.FK_IDDEVOLUCION = pDevolucion.ID_DEVOLUCION;
                        danoDevolucion.FK_IDDANO = dano.ID_DANO;
                        danoDevolucion.Insertar();
                    }
                }
            }
        }