Пример #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals(ComandosGrid.Editar.Value))
            {
                int         RowIndex = Convert.ToInt32((e.CommandArgument).ToString());
                GridViewRow gvrow    = GridView1.Rows[RowIndex];
                hdfExtintorIDEdit.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);


                List <extintor> ListaExtintor = new List <extintor>();
                ListaExtintor = Mgr_Area.Get_Extintor(Convert.ToInt32(hdfExtintorIDEdit.Value));

                foreach (var item in ListaExtintor)
                {
                    int IdEmpresa  = Convert.ToInt32(item.area.sucursal.id_empresa);
                    int IdSucursal = Convert.ToInt32(item.area.sucursal.id_sucursal);

                    Mgr_Empresa.Lista_Empresa(ddlEmpresaEdit);
                    ddlEmpresaEdit.SelectedValue = string.Empty + IdEmpresa;

                    Mgr_Sucursal.Lista_Sucursal(ddlSucursalEdit, IdEmpresa);
                    ddlSucursalEdit.SelectedValue = string.Empty + IdSucursal;

                    Mgr_Area.List_Area_Sucursal(ddlAreasEdit, IdSucursal);
                    ddlAreasEdit.SelectedValue = string.Empty + item.id_area;

                    txtSerialEdit.Text = item.serial_extintor.ToString();

                    string   fecha1 = item.fecha_ultima_recarga.ToString();
                    DateTime date1  = Convert.ToDateTime(fecha1).Date;
                    txtFechaUltRecEdit.Text = date1.ToString("yyyy-MM-dd");

                    fecha1 = item.fecha_proxima_recarga.ToString();
                    date1  = Convert.ToDateTime(fecha1).Date;
                    txtFechaProxRecEdit.Text = date1.ToString("yyyy-MM-dd");

                    txtPesoEdit.Text          = item.peso;
                    txtPresionEdit.Text       = item.presion;
                    txtNombreEmpresaEdit.Text = item.nombre_empresa;

                    ddlTipoExtEdit.SelectedValue = item.tipo_extintor;
                }

                Modal.registrarModal("editModal", "EditModalScript", this);
            }
            if (e.CommandName.Equals(ComandosGrid.Eliminar.Value))
            {
                int         RowIndex = Convert.ToInt32((e.CommandArgument).ToString());
                GridViewRow gvrow    = GridView1.Rows[RowIndex];
                hdfExtintorIDDel.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                Modal.registrarModal("deleteModal", "DeleteModalScript", this);
            }
        }
Пример #2
0
        private void cargarInformacion()
        {
            List <extintor> extintor = Mgr_Area.Get_Extintor(Convert.ToInt32(ddlExtintor.SelectedValue));

            lblArea.Text        = ddlArea.SelectedItem.Text;
            lblPeso.Text        = extintor.ElementAt(0).peso;
            lblPresion.Text     = extintor.ElementAt(0).presion;
            lblAgenteExt.Text   = extintor.ElementAt(0).tipo_extintor;
            lblNroExtintor.Text = extintor.ElementAt(0).serial_extintor;
            DateTime fecha_ultima = extintor.ElementAt(0).fecha_ultima_recarga.Value;

            lblFechaUltimaRecarga.Text = fecha_ultima.Date.ToString("yyyy-MM-dd");
            DateTime fecha_proxima = extintor.ElementAt(0).fecha_proxima_recarga.Value;

            lblFechaProximaRecarga.Text = fecha_proxima.Date.ToString("yyyy-MM-dd");
        }