Exemplo n.º 1
0
    public Object execute(Object O)
    {
        VOReg = (DiotVO)O;

        //if (VOReg.Operacion == DiotVO.ACTUALIZAR)
        //{
        //    return actualizaUsuario();
        //}
        //else
        if (VOReg.Operacion == DiotVO.INSERTAR)
        {
            return(insertaPeriodo());
        }
        //else if (VOReg.Operacion == DiotVO.BUSCAR)
        //{
        //    return buscarUsuario();
        //}

        return(VOReg);
    }
Exemplo n.º 2
0
    protected void btnAplicaPeriodo_Click(object sender, EventArgs e)
    {
        int inrRevision = revisaFechaAcreditacionPolizas();

        if (inrRevision == 1)
        {
            DiotVO VO = new DiotVO();
            DiotBL BL = new DiotBL();
            VO.Operacion = DiotVO.INSERTAR;

            int anoAcreditacion = Int32.Parse(txtAnoAcreditacion.Text.Trim());
            int mesAcreditacion = Int32.Parse(lstMesAcreditacion.SelectedValue.ToString());

            VO.AnoAcreditamiento = anoAcreditacion;
            VO.MesAcreditamiento = mesAcreditacion;
            VO.UsuarioId         = Int32.Parse(Session["usuarioID"].ToString());

            //ArrayList arrListaPolizas = getListaPolizas();
            //ArrayList listaPolizas = new ArrayList();

            String strSucursal = "";

            if (gvPolizas.Rows.Count > 0)
            {
                foreach (GridViewRow row in gvPolizas.Rows)
                {
                    strSucursal = gvPolizas.DataKeys[row.RowIndex][0].ToString().Trim();
                    CheckBox ckbPoliza = ((CheckBox)row.FindControl("ckbPoliza"));
                    bool     result    = ckbPoliza.Checked;
                    if (result)
                    {
                        //String strFecha = row.Cells[3].Text;
                        String strFecha  = gvPolizas.DataKeys[row.RowIndex][1].ToString().Trim();
                        String anoPoliza = strFecha.Substring(6, 4);
                        String mesPoliza = strFecha.Substring(3, 2);

                        if (anoAcreditacion >= Int32.Parse(anoPoliza))
                        {
                            //if (mesAcreditacion >= Int32.Parse(mesPoliza))
                            //{
                            //VO.PolizaId = Int32.Parse(row.Cells[1].Text);
                            VO.PolizaId = Int32.Parse(gvPolizas.DataKeys[row.RowIndex][2].ToString().Trim());
                            //VO.Cuenta = row.Cells[2].Text.Trim();
                            VO.Cuenta   = gvPolizas.DataKeys[row.RowIndex][3].ToString().Trim();
                            VO.Sucursal = strSucursal.Trim();
                            //VO.ClaveProveedor = row.Cells[4].Text.Trim();
                            VO.ClaveProveedor = gvPolizas.DataKeys[row.RowIndex][4].ToString().Trim();
                            //VO.TipoPoliza = row.Cells[9].Text.Trim();
                            VO.TipoPoliza = gvPolizas.DataKeys[row.RowIndex][6].ToString().Trim();
                            //VO.SerieDocumento = row.Cells[10].Text.Split('-')[0].Trim();
                            //VO.FolioDocumento = row.Cells[10].Text.Split('-')[1].Trim();
                            //VO.SerieDocumento = gvPolizas.DataKeys[row.RowIndex][5].ToString().Trim().Split('-')[0].Trim();
                            //VO.FolioDocumento = gvPolizas.DataKeys[row.RowIndex][5].ToString().Trim().Split('-')[1].Trim();
                            VO.SerieDocumento = gvPolizas.DataKeys[row.RowIndex][5].ToString().Substring(4).ToString().Trim().Split('-')[0].Trim();
                            VO.FolioDocumento = gvPolizas.DataKeys[row.RowIndex][5].ToString().Substring(4).ToString().Trim().Split('-')[1].Trim();


                            VO = (DiotVO)BL.execute(VO);
                            //if (VO.Resultado == 0)

                            //listaPolizas.Add(index);
                            //}
                            //else
                            //{
                            //    ckbPoliza.Text = "Fecha menos al periodo de acreditamiento";
                            //}
                        }
                        //else
                        //{
                        //    ckbPoliza.Text = "Fecha menos al periodo de acreditamiento";
                        //}
                    }
                    // ckbPoliza.Dispose();
                }
            }
            lblMensajeEx.Text = "Cambio Exitoso";
        }

        if (inrRevision == 2)
        {
            lblMensaje.Text = "Fecha menor o igual al periodo de acreditamiento";
        }

        if (inrRevision == 0)
        {
            lblMensaje.Text = "Seleccione alguna póliza";
        }
    }