public static object GetSelectSepelio(int jtStartIndex, int jtPageSize, string jtSorting,String nro_contrato,String tipo)
 {
     int indexPage;
     if (jtStartIndex != 0)
     {
         indexPage = jtStartIndex / jtPageSize;
     }
     else {
         indexPage = jtStartIndex;
     }
     eDatoAString das = SetEntitySelect(nro_contrato, tipo);//entidad de dato a
     bDatoAVC tb = new bDatoAVC();
     List<eDatoAString> list = tb.GetSelecionarSepelio(das, indexPage, jtPageSize, jtSorting.Substring(1).ToUpper(), out total);
     return new { Result = "OK", Records = list, TotalRecordCount = total };
 }
 //insertar pension 20%
 private void SetInsertarPension20()
 {
     try
     {
         String moneda = "";
         String cod_ramo = "";
         List<eDatoA> LstData = new List<eDatoA>();
         for (int i = 0; i < dtExcel.Rows.Count; i++)
         {
             Int32 codmoneda = SetValidationNumber(dtExcel.Rows[i][23].ToString());
             if (codmoneda == 1 || codmoneda == 2)
                 moneda = "SOL";
             else
                 moneda = "DOL";
             Int32 ramo = SetValidationNumber(dtExcel.Rows[i][5].ToString());
             switch (ramo)
             {
                 case 3:
                     cod_ramo = "093";
                     break;
                 case 2:
                     cod_ramo = "092";
                     break;
                 default:
                     cod_ramo = "091";
                     break;
             }
             var io = new eDatoA();
             io._Ide_Empresa = Convert.ToInt32(Session["idempresa"]); ;
             io._Nro_Contrato = dbl_contrato_d.SelectedItem.Value;
             io._Anio_Vigente = SetAnioMesVigente(0);
             io._Mes_Vigente = SetAnioMesVigente(2);
             io._Tipo_Dato = ddl_tipinfo_d.SelectedItem.Value;
             io._Cod_Ramo = cod_ramo;
             io._Cod_Producto = 4;
             io._Cod_Asegurado = codigoseguro;
             io._Cod_Moneda = moneda;
             io._Ap_Mtno_Pens = dtExcel.Rows[i][14].ToString();
             io._Ap_Mtno_Solic = "-";
             io._Ap_Ptno_Pens = dtExcel.Rows[i][13].ToString();
             io._Ap_Ptno_Solic = "-";
             io._Aport_Comp = 0.00m;//Decimal.Parse(dtExcel.Rows[i][29]);
             io._Aport_Oblig = 0.00m;//Decimal.Parse(dtExcel.Rows[i][30]);
             io._Cap_Req_Pens = 0.00m;
             io._Cap_Req_Sepe = 0.00m;
             io._Cic_Mon_Nsol = 0.00m;
             io._Cic_Mon_Orig = 0.00m;
             io._Cru_Familiar = 0.00m;
             io._Cuspp = dtExcel.Rows[i][3].ToString();
             io._Fe_Sin = dtExcel.Rows[i][6].ToString();
             io._Id_Afp = dtExcel.Rows[i][2].ToString();
             io._Id_Cod_Csv1 = SetValidationNumber(dtExcel.Rows[i][32].ToString());
             io._Id_Cod_Csv2 = SetValidationNumber(dtExcel.Rows[i][35].ToString());
             io._Id_Cod_Csv3 = SetValidationNumber(dtExcel.Rows[i][38].ToString());
             io._Id_Cod_Csv4 = SetValidationNumber(dtExcel.Rows[i][41].ToString());
             io._Id_Cod_Transf = 0;//Int32.Parse(dtExcel.Rows[i][44]);
             io._Id_Tip_Soli = ramo;
             io._Mto_Pago_Csv1 = SetValidationDecimal(dtExcel.Rows[i][34].ToString());
             io._Mto_Pago_Csv2 = SetValidationDecimal(dtExcel.Rows[i][37].ToString());
             io._Mto_Pago_Csv3 = SetValidationDecimal(dtExcel.Rows[i][40].ToString());
             io._Mto_Pago_Csv4 = SetValidationDecimal(dtExcel.Rows[i][43].ToString());
             io._Ti_Mov = dtExcel.Rows[i][1].ToString();
             io._Fe_Dev = "-";
             io._Fe_Falle = "-";
             io._Fe_Ini_Inv = "-";
             io._Fe_Pag_Aa = "-";
             io._Id_Tip_Doc = 0;
             io._Ind_Pens_Pre = " ";
             io._Mto_Aa_Mon_Nsol = 0.00m;
             io._Mto_Aa_Mon_Orig = 0.00m;
             io._Mto_Exc_Mon_Nsol = 0.00m;
             io._Mto_Exc_Mon_Orig = 0.00m;
             io._Mto_Pens_Pre_Mon_Nsol = 0.00m;
             io._Mto_Pens_Pre_Mon_Orig = 0.00m;
             io._Nro_Benef = "-";
             io._Nro_Iden_Solic = "-";
             io._Num_Csv = "-";
             io._Pri_Nomb_Solic = "-";
             io._Ram_Prom_Nsol = 0.00m;
             io._Segu_Nomb_Solic = "-";
             io._Tasa_Int = 0.00m;
             io._Ti_Camb_Compra = 0.00m;
             io._Ti_Camb_Vta = 0.00m;
             io._Ti_Reg = dtExcel.Rows[i][0].ToString();
             io._Tip_Mon = SetValidationNumber(dtExcel.Rows[i][23].ToString());
             io._Tip_Pen_Equiv = "-";
             io._Tot_Cap_Req_Mon_Nsol = 0.00m;
             io._Tot_Cap_Req_Mon_Orig = 0.00m;
             io._Desct_Pens = SetValidationDecimal(dtExcel.Rows[i][28].ToString());
             io._Desct_Pens_Csv1 = SetValidationDecimal(dtExcel.Rows[i][33].ToString());
             io._Desct_Pens_Csv2 = SetValidationDecimal(dtExcel.Rows[i][36].ToString());
             io._Desct_Pens_Csv3 = SetValidationDecimal(dtExcel.Rows[i][39].ToString());
             io._Desct_Pens_Csv4 = SetValidationDecimal(dtExcel.Rows[i][42].ToString());
             io._Fe_Dev_Act = dtExcel.Rows[i][8].ToString();
             io._Fe_Dev_Ini = dtExcel.Rows[i][7].ToString();
             io._Fe_Fin_Subsi = "-";
             io._Fe_Naci_Pens = dtExcel.Rows[i][17].ToString();
             io._Fe_Seci = "-";
             io._Fec_Pago = dtExcel.Rows[i][30].ToString();
             io._Frac_Mes_Dev = dtExcel.Rows[i][11].ToString();
             io._Id_Cod_Ben = dtExcel.Rows[i][20].ToString();
             io._Id_Parent = Int32.Parse(dtExcel.Rows[i][12].ToString());
             io._Id_Tip_Docu_Pens = dtExcel.Rows[i][18].ToString();
             io._Mes_Dev = dtExcel.Rows[i][9].ToString();
             io._Mon_Equi = dtExcel.Rows[i][24].ToString();
             io._Mto_Aport_Comp_Csv1 = 0.00m;
             io._Mto_Aport_Comp_Csv2 = 0.00m;
             io._Mto_Aport_Comp_Csv3 = 0.00m;
             io._Mto_Aport_Comp_Csv4 = 0.00m;
             io._Mto_Aport_Oblig_Csv1 = 0.00m;
             io._Mto_Aport_Oblig_Csv2 = 0.00m;
             io._Mto_Aport_Oblig_Csv3 = 0.00m;
             io._Mto_Aport_Oblig_Csv4 = 0.00m;
             io._Mto_Pago = SetValidationDecimal(dtExcel.Rows[i][29].ToString());
             io._Nro_Docu_Pens = dtExcel.Rows[i][19].ToString();
             io._Nro_Eess = dtExcel.Rows[i][31].ToString();
             io._Nro_Mes_Dev = dtExcel.Rows[i][10].ToString();
             io._Nro_Sin = 0;
             io._Nro_Soli = dtExcel.Rows[i][4].ToString();
             io._Pens_Base = SetValidationDecimal(dtExcel.Rows[i][26].ToString());
             io._Pens_Pagar_80 = SetValidationDecimal(dtExcel.Rows[i][27].ToString());
             io._Pri_Nomb_Pens = dtExcel.Rows[i][15].ToString();
             io._Proc_Bene = dtExcel.Rows[i][21].ToString();
             io._Prom_Act_6_Meses_Apocomp = 0.00m;
             io._Rempro_Act = SetValidationDecimal(dtExcel.Rows[i][25].ToString());
             io._Segu_Nomb_Pens = dtExcel.Rows[i][16].ToString();
             io._Tip_Pen = dtExcel.Rows[i][22].ToString();
             io._Estado = "A";
             io._Usu_Reg = Session["username"].ToString();
             LstData.Add(io);
         }
         bDatoAVC da = new bDatoAVC();
         Int32 resp = da.SetInsertarDatoA(LstData);
         if (resp == -1)
         {
             MessageBox("Ya Existe Registros, <br> Debes borrar los Registros existentes <br> para Realizar una nueva carga.");
             SetClearDtExcel("2");
         }
         else if (resp != 0)
         {
             MessageBox(resp + " Registro (s) Grabado (s) Correctamente <br>" + RowError + " Registro (s) Observado (s)");
             SetClearDtExcel("2");
         }
         else
         {
             MessageBox("Ocurrio un Error en el Servidor!");
         }
     }
     catch (Exception e) {
         MessageBox("ERROR =>" + e.Message);
     }
 }
        //eliminar dato_A
        private void SetEliminaDatoA(Int32 indexTab)
        {
            try
            {
                eDatoA da = new eDatoA();
                if (indexTab == 1)
                {
                    da._Nro_Contrato = ddl_contrato_r.SelectedItem.Value;
                    da._Tipo_Dato = "01";
                    da._Anio_Vigente = anio_vigente;
                    da._Mes_Vigente = mes_vigente;
                }
                else if (indexTab == 2)
                {
                    da._Nro_Contrato = ddl_contrato_p.SelectedItem.Value;
                    da._Tipo_Dato = ddl_tippago_p.SelectedItem.Value;
                    da._Anio_Vigente = anio_vigente;
                    da._Mes_Vigente = mes_vigente;
                }

                bDatoAVC bd = new bDatoAVC();
                Int32 resp = bd.SetEliminarDatoA(da);
                if (resp != 0)
                {
                    MessageBox(resp + " Registro (s) Eliminado (s) Correctamente");
                    SetClearSecreen();
                }
                else
                {
                    MessageBox("Ocurrio un Error en el Servidor!");
                }
            }
            catch (Exception e) {
                MessageBox("ERROR =>"+e.Message);
            }
        }
        private void SetInsertarRsp()
        {
            try
            {
                String cod_ramo = "";
                String cod_moneda = "";
                String id_afp = "";
                List<eDatoA> LstData = new List<eDatoA>();
                for (int i = 0; i < dtExcel.Rows.Count; i++)
                {
                    //codigo ramo
                    String tip_cob = dtExcel.Rows[i][2].ToString();
                    if (tip_cob.Substring(0, 1).ToUpper().Equals("I"))
                        cod_ramo = "091";
                    else if (tip_cob.Substring(0, 1).ToUpper().Equals("S"))
                        cod_ramo = "092";
                    else
                        cod_ramo = "093";
                    //cod moneda
                    String moneda = dtExcel.Rows[i][3].ToString();
                    if (moneda.Trim().Equals("2") || moneda.Trim().Equals("4"))
                        cod_moneda = "DOL";
                    else
                        cod_moneda = "SOL";
                    //id_Afp
                    String afp = dtExcel.Rows[i][7].ToString();
                    if (afp.ToUpper().Equals("PRIMA"))
                        id_afp = afp.Substring(1, 2).ToUpper() + "00";
                    else
                       id_afp = afp.Substring(0, 2).ToUpper() + "00";

                    var io = new eDatoA();

                    io._Ide_Empresa = Convert.ToInt32(Session["idempresa"]);

                    io._Nro_Contrato = dbl_contrato_d.SelectedItem.Value;
                    io._Anio_Vigente = SetAnioMesVigente(0);
                    io._Mes_Vigente = SetAnioMesVigente(2);
                    io._Tipo_Dato = ddl_tipinfo_d.SelectedItem.Value;
                    io._Cod_Ramo = cod_ramo;
                    io._Cod_Producto = 1;
                    io._Cod_Asegurado = codigoseguro;
                    io._Cod_Moneda = cod_moneda;
                    io._Ap_Mtno_Pens = " ";
                    io._Ap_Mtno_Solic = "";
                    io._Ap_Ptno_Pens = " ";
                    io._Ap_Ptno_Solic = "";
                    io._Aport_Comp = 0.00m;
                    io._Aport_Oblig = 0.00m;
                    io._Cap_Req_Pens = 0.00m;
                    io._Cap_Req_Sepe = 0.00m;
                    io._Cic_Mon_Nsol = 0.00m;
                    io._Cic_Mon_Orig = 0.00m;
                    io._Cru_Familiar = 0.00m;
                    io._Cuspp = dtExcel.Rows[i][0].ToString();
                    io._Fe_Sin = dtExcel.Rows[i][5].ToString();
                    io._Id_Afp = id_afp;
                    io._Id_Cod_Csv1 = -0;
                    io._Id_Cod_Csv2 = -0;
                    io._Id_Cod_Csv3 = -0;
                    io._Id_Cod_Csv4 = -0;
                    io._Id_Cod_Transf = 0;//Int32.Parse(dtExcel.Rows[i][27]);
                    io._Id_Tip_Soli = -0;
                    io._Mto_Pago_Csv1 = 0.00m;
                    io._Mto_Pago_Csv2 = 0.00m;
                    io._Mto_Pago_Csv3 = 0.00m;
                    io._Mto_Pago_Csv4 = 0.00m;
                    io._Ti_Mov = dtExcel.Rows[i][1].ToString();
                    io._Fe_Dev = dtExcel.Rows[i][4].ToString();
                    io._Fe_Falle = "";
                    io._Fe_Ini_Inv = "";
                    io._Fe_Pag_Aa = "";
                    io._Id_Tip_Doc = -0;
                    io._Ind_Pens_Pre = " ";
                    io._Mto_Aa_Mon_Nsol = 0.00m;
                    io._Mto_Aa_Mon_Orig = 0.00m;
                    io._Mto_Exc_Mon_Nsol = 0.00m;
                    io._Mto_Exc_Mon_Orig = 0.00m;
                    io._Mto_Pens_Pre_Mon_Nsol = 0.00m;
                    io._Mto_Pens_Pre_Mon_Orig = 0.00m;
                    io._Nro_Benef = "";
                    io._Nro_Iden_Solic = "";
                    io._Num_Csv = "";
                    io._Pri_Nomb_Solic = "";
                    io._Ram_Prom_Nsol = 0.00m;
                    io._Segu_Nomb_Solic = "";
                    io._Tasa_Int = 0.00m;
                    io._Ti_Camb_Compra = 0.00m;
                    io._Ti_Camb_Vta = 0.00m;
                    io._Ti_Reg = tip_cob;
                    io._Tip_Mon = SetValidationNumber(moneda);
                    io._Tip_Pen_Equiv = "";
                    io._Tot_Cap_Req_Mon_Nsol = 0.00m;
                    io._Tot_Cap_Req_Mon_Orig = 0.00m;
                    io._Desct_Pens = 0.00m;
                    io._Desct_Pens_Csv1 = 0.00m;
                    io._Desct_Pens_Csv2 = 0.00m;
                    io._Desct_Pens_Csv3 = 0.00m;
                    io._Desct_Pens_Csv4 = 0.00m;
                    io._Fe_Dev_Act = "";
                    io._Fe_Dev_Ini = "";
                    io._Fe_Fin_Subsi = "";
                    io._Fe_Naci_Pens = "";
                    io._Fe_Seci = dtExcel.Rows[i][8].ToString();
                    io._Fec_Pago = "";
                    io._Frac_Mes_Dev = "";
                    io._Id_Cod_Ben = "";
                    io._Id_Parent = 0;
                    io._Id_Tip_Docu_Pens = "";
                    io._Mes_Dev = "";
                    io._Mon_Equi = "";
                    io._Mto_Aport_Comp_Csv1 = 0.00m;
                    io._Mto_Aport_Comp_Csv2 = 0.00m;
                    io._Mto_Aport_Comp_Csv3 = 0.00m;
                    io._Mto_Aport_Comp_Csv4 = 0.00m;
                    io._Mto_Aport_Oblig_Csv1 = 0.00m;
                    io._Mto_Aport_Oblig_Csv2 = 0.00m;
                    io._Mto_Aport_Oblig_Csv3 = 0.00m;
                    io._Mto_Aport_Oblig_Csv4 = 0.00m;
                    io._Mto_Pago = SetValidationDecimal(dtExcel.Rows[i][6].ToString());
                    io._Nro_Docu_Pens = "";
                    io._Nro_Eess = "";
                    io._Nro_Mes_Dev = "";
                    io._Nro_Sin = -0;
                    io._Nro_Soli = "";
                    io._Pens_Base = 0.00m;
                    io._Pens_Pagar_80 = 0.00m;
                    io._Pri_Nomb_Pens = "";
                    io._Proc_Bene = "";
                    io._Prom_Act_6_Meses_Apocomp = 0.00m;
                    io._Rempro_Act = 0.00m;
                    io._Segu_Nomb_Pens = "";
                    io._Tip_Pen = "";
                    io._Estado = "A";
                    io._Usu_Reg = Session["username"].ToString();
                    LstData.Add(io);
                }

                bDatoAVC da = new bDatoAVC();
                Int32 resp = da.SetInsertarDatoA(LstData);
                if (resp == -1)
                {
                    MessageBox("Ya Existe Registros, <br> Debes borrar los Registros existentes <br> para Realizar una nueva carga.");
                    SetClearDtExcel("2");
                }
                else if (resp != 0)
                {
                    MessageBox(resp + " Registro (s) Grabado (s) Correctamente <br>" + RowError + " Registro (s) Observado (s) <br><br> "+ MessageError);
                    SetClearDtExcel("2");
                }
                else
                {
                    MessageBox("Ocurrio un Error en el Servidor!");
                }
            }
            catch (Exception e) {
                MessageBox("ERROR =>" + e.Message);
            }
        }