Esempio n. 1
0
        private void obtenerDanos()
        {
            try
            {
                cSGGIDANOPORIMPLEMENTONegocios Danos = new cSGGIDANOPORIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
                DT_Danos = new DataTable();
                DT_Danos = Danos.SeleccionarTodos();
                String aDataSet = "[";
                int cantidadColumnas = DT_Danos.Columns.Count;
                for (int IndiceDanos = 0; IndiceDanos < DT_Danos.Rows.Count; IndiceDanos++)
                {

                    aDataSet += "['" + DT_Danos.Rows[IndiceDanos][0] + "','" + DT_Danos.Rows[IndiceDanos][1].ToString() + "','" + DT_Danos.Rows[IndiceDanos][2].ToString() + "','" + DT_Danos.Rows[IndiceDanos][3] + "','" + DT_Danos.Rows[IndiceDanos][4].ToString().Split(' ')[0] + "']";
                    if (IndiceDanos + 1 != DT_Danos.Rows.Count)
                    {
                        aDataSet += ",";
                    }
                }
                aDataSet += "]";

                if (!Page.ClientScript.IsStartupScriptRegistered("TablaDanos"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "TablaDanos", "<script type=\"text/javascript\"> CrearTablaDanos(" + aDataSet + ");</script>");
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alertaDaños", "<script type=\"text/javascript\"> alert(" + "'" + ex.Message + "'" + ");</script>");
            }
        }
Esempio n. 2
0
 private Boolean modificarDano()
 {
     try
     {
         cSGGIDANOPORIMPLEMENTONegocios DanoAModificar = new cSGGIDANOPORIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
         cSGGIIMPLEMENTONegocios Implemento = new cSGGIIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
         DanoAModificar.ID_DANO = Int32.Parse(_DatosSeleccionadosDanos.Split(',')[0]);
         Implemento.DSC_IMPLEMENTO = TextBoxDescricpionImplemento.Text;
         int cantidadIngresada = Int32.Parse(TextBoxCantidad0.Text);
         DataTable DT_Imp = Implemento.Buscar();
         int cantidadImplementos = Int32.Parse(DT_Imp.Rows[0][DT_Imp.Columns.Count - 2].ToString());
         if (cantidadIngresada > cantidadImplementos)
         {
             throw new Exception("El Número dañados debe ser menor o igual a : " + cantidadImplementos.ToString() + ", Ya que esta es la cantidad de implementos registrados en el inventario");
         }
         DanoAModificar.FK_IDIMPLEMENTO = Int32.Parse(DT_Imp.Rows[0][0].ToString());
         DanoAModificar.CAN_IMPLEMENTOS = cantidadIngresada;
         DanoAModificar.DSC_DANO = TextBoxDescripcionDano.Text;
         DanoAModificar.FEC_REPORTE = DateTime.Today;
         return DanoAModificar.Actualizar();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
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;
     }
 }
Esempio n. 4
0
 private Boolean eliminarDano()
 {
     try
     {
         cSGGIDANOPORIMPLEMENTONegocios DanoAEliminar = new cSGGIDANOPORIMPLEMENTONegocios(Global.gCOD_APLICACION, "CA", 2, "cosejo");
         DanoAEliminar.ID_DANO = Int32.Parse(_DatosSeleccionadosDanos.Split(',')[0]);
         return DanoAEliminar.Eliminar();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
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();
                    }
                }
            }
        }