public void InsertHabitaciones() { string sql = "insert into ReservacionesHabitaciones" + "(IdHotel, Codigo, Nombre, Certificado, Valido, DelNetCenter, DeAgencias, Adultos,Menores, Capacidad, Code) values" + "(@idHotel, @Codigo, @Nombre, 0, 1, 0, 0, @Adultos, @Menores, @Capacidad, @Codigo)"; using (SqlConnection conn = new SqlConnection(cx.cadenaConexion)) { conn.Open(); using (SqlCommand comando = new SqlCommand(sql, conn)) { comando.Parameters.Add("@idHotel", SqlDbType.Int).Value = IdHotel; comando.Parameters.Add("@Codigo", SqlDbType.VarChar).Value = Codigo; comando.Parameters.Add("@Nombre", SqlDbType.VarChar).Value = Nombre; comando.Parameters.Add("@Adultos", SqlDbType.Int).Value = Adultos; comando.Parameters.Add("@Menores", SqlDbType.Int).Value = Menores; comando.Parameters.Add("@Capacidad", SqlDbType.Int).Value = Capacidad; comando.CommandType = CommandType.Text; comando.ExecuteNonQuery(); } conn.Close(); } bita.RegistrarBitacora(100000, "ReservacionesHabitaciones", "Registro Nuevo", "I", "", "IdHabitacion: " + MaxConsec() + ", Capacidad: " + Capacidad); }
protected void Button1_Click(object sender, EventArgs e) { try { Decimal capi = Convert.ToDecimal(TextCapital.Text); em.Agencia(TextNombre.Text, TextDireccion.Text, TextTelefono.Text, true, TextDepartamento.Text, TextMunicipio.Text, capi, idempresa); //llenar de nuevo el gridview GridView1.DataSource = em.ListadoAgencias(idempresa); GridView1.Columns[0].Visible = false; GridView1.DataBind(); //bitacora Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "crear agencia: " + TextNombre.Text, Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button1_Click(object sender, EventArgs e) { try { //crear usuarios string valor2 = Request.QueryString["Valor"]; int idperson = Convert.ToInt32(valor2); string conocer = co.SaberIDEmpleadoP(idperson).Rows[0][0].ToString(); int empleado = Convert.ToInt32(conocer); //crear el usuario per.Usuario(TextUsuario.Text, TextContra.Text, true, empleado); //crear permisos co.UsuarioPermiso(Convert.ToInt32(co.ConocerUsuarioE(empleado).Rows[0][0].ToString())); //ocultar cosas InformaPermisos.Visible = false; CrearUsuaio.Visible = false; Permisos.Visible = true; ResetearContra.Visible = true; //refresco la lista de permisos ListarPermisoso(); //bitacora Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Creo Usuario" + TextUsuario.Text, Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ew) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button4_Click(object sender, EventArgs e) { Response.Redirect("ImprimirListadoClientes.aspx"); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Imprimir", "Imprimir listado completo ", Convert.ToInt32(Session["idempleado"])); }
protected void Button1_Click1(object sender, EventArgs e) { ReportePaginaInicio repo = new ReportePaginaInicio(); IngresoUsuarios log = new IngresoUsuarios(); log.i(TextBox1.Text, TextBox2.Text, Label1.Text); string cool = log.i(TextBox1.Text, TextBox2.Text, Label1.Text); string c1 = TextBox1.Text; log.s(TextBox1.Text, TextBox2.Text, Label2.Text); string agencia = log.s(TextBox1.Text, TextBox2.Text, Label2.Text); if (cool == "1") { Session["cool"] = c1; Session["idagencia"] = agencia; Session["idempleado"] = repo.SaberIdEmpleado(TextBox1.Text, TextBox2.Text).Rows[0][0].ToString(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Inicio de sesion", "Empleado inicio sesion", Convert.ToInt32(Session["idempleado"])); Response.Redirect("Inicio.aspx"); } else { ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); string tipopre = presta.InfoTabUNO(idprestamo).Rows[0][0].ToString(); string desembolso = presta.InfoTabUNO(idprestamo).Rows[0][1].ToString(); if (tipopre == "False" && desembolso == "False") { ////eliminarPrestamos presta.EliminarGarantia(idprestamo); presta.EliminarPrestamo(idprestamo); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Cancelacion", "Cancelo prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); Response.Redirect("PrestamosPorPrecalificar.aspx"); } if (tipopre == "True" && desembolso == "False") { ////eliminarPrestamos presta.EliminarGarantia(idprestamo); presta.EliminarPrestamo(idprestamo); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Cancelacion", "Cancelo prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); Response.Redirect("Desembolsos.aspx"); } }
protected void Button2_Click(object sender, EventArgs e) { //se realizan los pagos y abono try { string valor3 = Request.QueryString["Valor3"]; int idprestamo = Convert.ToInt32(valor3); int codigo = Convert.ToInt32(Session["idempleado"]); int inicio = Convert.ToInt32(abo.IDPAGOSINICIOABONO(idprestamo).Rows[0][0].ToString()); string fecha1 = DateTime.Now.ToString("dd/MM/yyyy"); DateTime fecha = Convert.ToDateTime(fecha1); //aqui se registra el abono abo.RegistrarAbono(Convert.ToDecimal(Label3.Text), TextOB.Text, idprestamo); //aqui se modifican los pagos for (int k = inicio; k < inicio + Convert.ToInt32(Label4.Text); k++) { presta.RealizarPago(k, true, fecha, codigo, true); } Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Abono", "Abono de: " + TextMonto.Text + " a prestamo: " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); TextOB.Visible = false; Button2.Visible = false; // Label1.Text = ""; Label2.Text = ""; string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception pp) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button1_Click(object sender, EventArgs e) { try { Decimal capo = Convert.ToDecimal(TextCapital.Text); Decimal Capi = Convert.ToDecimal(Label1.Text) + capo; int agen = Convert.ToInt32(Label3.Text); modi.AgregarCapital(agen, Capi); GridView1.DataSource = em.ListadoAgencias(idempresa); GridView1.Columns[0].Visible = false; GridView1.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Agregar capital Agencia : " + Label3.Text + " Cantidad de " + Convert.ToString(Capi), Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
public void UpdPago(Pagos p, string tipo) { bita.RegistrarBitacora(p.FolioContrato, "Pagos", tipo, "U", "Consec=" + p.Consec, "registro movido a la tabla CSharpPagosCC"); using (SqlConnection con = new SqlConnection(cx.cadenaConexion)) { con.Open(); string sql = "insert into CSharpPagosCC select*from Pagos where FolioContrato = @Folio and Consec = @Consec"; using (SqlCommand comando = new SqlCommand(sql, con)) { comando.Parameters.Add("@Folio", SqlDbType.Int).Value = p.FolioContrato; comando.Parameters.Add("@Consec", SqlDbType.Int).Value = p.Consec; comando.CommandType = CommandType.Text; comando.ExecuteNonQuery(); } string sql2 = "delete Pagos where FolioContrato = @Folio and Consec = @Consec"; using (SqlCommand comando = new SqlCommand(sql2, con)) { comando.Parameters.Add("@Folio", SqlDbType.Int).Value = p.FolioContrato; comando.Parameters.Add("@Consec", SqlDbType.Int).Value = p.Consec; comando.CommandType = CommandType.Text; comando.ExecuteNonQuery(); } con.Close(); } }
protected void Button3_Click(object sender, EventArgs e) { try { int agencia = Convert.ToInt32(Session["idagencia"]); int idperson = Convert.ToInt32(Label8.Text); ver.QuitardeLista(idperson); GridView1.DataSource = ver.ListaNegra(agencia); GridView1.Columns[4].Visible = false; GridView1.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Quitar de lista negra " + Convert.ToString(idperson), Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button2_Click(object sender, EventArgs e) { //resetear contrasena try { string valor2 = Request.QueryString["Valor"]; int idperson = Convert.ToInt32(valor2); string conocer = co.SaberIDEmpleadoP(idperson).Rows[0][0].ToString(); int empleado = Convert.ToInt32(conocer); mo.ModUsuario(empleado, TextBox1.Text); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Resetear Contrasena", "ID EMpleado " + conocer, Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button1_Click(object sender, EventArgs e) { try { string mora = DropDownList1.SelectedValue.ToString(); int mora1 = Convert.ToInt32(mora); if (RadioButton1.Checked == true) { ingre.Plan(TextNombre.Text, TextDescripcion.Text, Convert.ToInt32(TextPeriodo.Text), true, false, false, Convert.ToInt32(TextInteres.Text), mora1); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Plan " + TextNombre.Text, Convert.ToInt32(Session["idempleado"])); } else { ingre.Plan(TextNombre.Text, TextDescripcion.Text, Convert.ToInt32(TextPeriodo.Text), false, true, false, Convert.ToInt32(TextInteres.Text), mora1); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Plan " + TextNombre.Text, Convert.ToInt32(Session["idempleado"])); } GridView1.DataSource = presta.ListarPlanes(); GridView1.Columns[0].Visible = false; GridView1.DataBind(); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void svCliente_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { try { string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); // int idpago = Convert.ToInt32(GridView1.DataKeys[e.NewSelectedIndex].Value); bool pagito = true; int codigo = Convert.ToInt32(Session["idempleado"]); string fecha1 = DateTime.Now.ToString("G"); DateTime fecha = Convert.ToDateTime(fecha1); //verificar si es el ultimopago if (p.LIstadoPagosFUll(idprestamo).Rows.Count == 1) { p.FinalizarPrestamo(idprestamo); } presta.RealizarPago(idpago, pagito, fecha, codigo, true); //actualizo el grid GridView1.DataSource = p.PagosConMora(idprestamo); GridView1.DataBind(); //bitacora Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Pagar", "pago de cuota prestamo No. " + Convert.ToString(idprestamo) + ", idpago" + Convert.ToString(idpago), Convert.ToInt32(Session["idempleado"])); /* actualizar reportes*/ int prestamo = Convert.ToInt32(r.SaberIDPrestamo(idpago).Rows[0][0].ToString()); if (r.InfoReporte(prestamo).Rows.Count != 0) { int PagosAtrasados = Convert.ToInt32(r.InfoReporte(prestamo).Rows[0][0].ToString()); Decimal MontoAtrasado = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][1].ToString()); Decimal Morita = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][2].ToString()); Decimal MontoAtrasadoMasMora = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][3].ToString()); Decimal SaldoTotal = Convert.ToDecimal(r.SaldoTotal(prestamo).Rows[0][0].ToString()); Decimal SaldoTotalMasMora = SaldoTotal + Morita; r.ModificarAgregarReporte(PagosAtrasados, MontoAtrasado, Morita, MontoAtrasadoMasMora, SaldoTotalMasMora, prestamo); } /*fin de actualizarrepoertes*/ string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button5_Click(object sender, EventArgs e) { String Valor = Label8.Text; Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Imprimir", "info de cliente " + Valor, Convert.ToInt32(Session["idempleado"])); Response.Redirect("ImprimirInfoCliente.aspx?valor=" + Valor); }
protected void Button2_Click(object sender, EventArgs e) { Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Imprimir", "Cartera vencida", Convert.ToInt32(Session["idempleado"])); int empleado = Convert.ToInt32(DropDownList1.SelectedValue.ToString()); String Valor = Convert.ToString(empleado); Response.Redirect("ImprimirCarteravencida.aspx?valor=" + Valor); }
protected void Button7_Click(object sender, EventArgs e) { string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Generar Cheque, de prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); String Valor = Convert.ToString(idprestamo); Response.Redirect("ImprimirCheque.aspx?valor=" + Valor); }
protected void svpagos_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { try { int agencia2 = Convert.ToInt32(Session["idagencia"]); int idpago = Convert.ToInt32(GridView2.DataKeys[e.NewSelectedIndex].Value); bool pagito = true; int codigo = Convert.ToInt32(Session["idempleado"]); string fecha1 = DateTime.Now.ToString("G"); DateTime fecha = Convert.ToDateTime(fecha1); //si el pago es el ultimo int idprestamo = Convert.ToInt32(p.IDPRESTAMO(idpago).Rows[0][0].ToString()); if (p.LIstadoPagosFUll(idprestamo).Rows.Count == 1) { p.FinalizarPrestamo(idprestamo); } //realizar el pago presta.RealizarPago(idpago, pagito, fecha, codigo, true); GridView2.DataSource = repo.PaganHoy(agencia2); GridView2.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Pago", "Pago de cuota de pago id" + Convert.ToString(idpago), Convert.ToInt32(Session["idempleado"])); /* actualizar reportes*/ int prestamo = Convert.ToInt32(r.SaberIDPrestamo(idpago).Rows[0][0].ToString()); if (r.InfoReporte(prestamo).Rows.Count != 0) { int PagosAtrasados = Convert.ToInt32(r.InfoReporte(prestamo).Rows[0][0].ToString()); Decimal MontoAtrasado = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][1].ToString()); Decimal Morita = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][2].ToString()); Decimal MontoAtrasadoMasMora = Convert.ToDecimal(r.InfoReporte(prestamo).Rows[0][3].ToString()); Decimal SaldoTotal = Convert.ToDecimal(r.SaldoTotal(prestamo).Rows[0][0].ToString()); Decimal SaldoTotalMasMora = SaldoTotal + Morita; r.ModificarAgregarReporte(PagosAtrasados, MontoAtrasado, Morita, MontoAtrasadoMasMora, SaldoTotalMasMora, prestamo); } /*fin de actualizarrepoertes*/ string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Page_Load(object sender, EventArgs e) { try { Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Cerrar sesion", "Empleado cerro sesion", Convert.ToInt32(Session["idempleado"])); Session.Remove("cool"); Response.Redirect("index.aspx"); string usuario = Session["cool"].ToString(); } catch (Exception ex) { Response.Redirect("index.aspx"); } }
protected void Button6_Click(object sender, EventArgs e) { string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Eiliminar ", "Elimino prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); presta.EliminarGarantia(idprestamo); presta.EliminarPagosPRestamo(idprestamo); presta.EliminarPrestamo(idprestamo); Response.Redirect("Inicio.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { try { DateTime dia = Convert.ToDateTime(TextBox1.Text); em.OmitirDias(dia, true, TextDescripcion.Text); GridView1.DataSource = em.VerFeriados(); GridView1.Columns[0].Visible = false; GridView1.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro ", "Nueva Feriado " + TextDescripcion.Text, Convert.ToInt32(Session["idempleado"])); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction2();</script>"); } }
protected void svCliente_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { try { int id = Convert.ToInt32(GridView1.DataKeys[e.NewSelectedIndex].Value); em.EliminarDiasFeriado(id); GridView1.DataSource = em.VerFeriados(); GridView1.Columns[0].Visible = false; GridView1.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Eliminacion", "Elimino feriado ", Convert.ToInt32(Session["idempleado"])); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); } catch (Exception s) { ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction2();</script>"); } }
public void ModificaHotel(Hoteles h, string campo, string anterior, string nuevo) { string sql = nuevo == "" ? "UPDATE Hoteles set " + campo + "=null where idHotel = @idHotel" : "UPDATE Hoteles set " + campo + "= '" + nuevo + "' where idHotel = @idHotel"; using (SqlConnection con = new SqlConnection(cx.cadenaConexion)) { con.Open(); using (SqlCommand comando = new SqlCommand(sql, con)) { comando.Parameters.Add("@idHotel", SqlDbType.Int).Value = h.idHotel; comando.CommandType = CommandType.Text; comando.ExecuteNonQuery(); } con.Close(); } bita.RegistrarBitacora(100000, "Hoteles", campo + " (idHotel: " + h.idHotel + ")", "U", anterior, nuevo); }
protected void Button3_Click(object sender, EventArgs e) { try { modi.ModMora(Convert.ToInt32(Label3.Text), TextNombre.Text, TextDescripcion.Text, Convert.ToDecimal(TextInteres.Text), true); GridView1.DataSource = i.ListarMora(); GridView1.Columns[0].Visible = false; GridView1.DataBind(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Actualizar", "Mora " + TextNombre.Text, Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
public void ModContrato(Contratos cto, string campo, string anterior, string nuevo) { string sql = nuevo == "" ? "UPDATE Contratos set " + campo + "=null where FolioContrato = @Folio" : "UPDATE Contratos set " + campo + "= '" + nuevo + "' where FolioContrato = @Folio"; using (SqlConnection con = new SqlConnection(cx.cadenaConexion)) { con.Open(); using (SqlCommand comando = new SqlCommand(sql, con)) { comando.Parameters.Add("@Folio", SqlDbType.Int).Value = cto.FolioContrato; comando.CommandType = CommandType.Text; comando.ExecuteNonQuery(); } con.Close(); } bita.RegistrarBitacora(cto.FolioContrato, "Contratos", campo, "U", anterior, nuevo); }
///anular pago protected void svCliente_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { try { string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); int idpago = Convert.ToInt32(GridView4.DataKeys[e.NewSelectedIndex].Value); presta.AnularPago(idpago); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); GridView4.DataSource = presta.TabPagosEfectuados(idprestamo); GridView4.Columns[0].Visible = false; GridView4.DataBind(); Label3.Text = "Q. " + presta.TOTAlPagosTab4(idprestamo).Rows[0][0].ToString(); Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Anular", "Anular pago de prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); } catch (Exception ex) { } }
protected void Button3_Click(object sender, EventArgs e) { string valor2 = Request.QueryString["Valor"]; int idperson = Convert.ToInt32(valor2); string conocer = co.SaberIDEmpleadoP(idperson).Rows[0][0].ToString(); int empleado = Convert.ToInt32(conocer); //aqui lo de permisos como es de esperar que el usuario ya fue creado int codigo = Convert.ToInt32(co.ListarPermisos(empleado).Rows[0][0].ToString()); //guardadPermisos try { if (CheckBox1.Checked == true) { p.Permiso1(codigo, true); } else { p.Permiso1(codigo, false); } if (CheckBox2.Checked == true) { p.Permiso2(codigo, true); } else { p.Permiso2(codigo, false); } if (CheckBox3.Checked == true) { p.Permiso3(codigo, true); } else { p.Permiso3(codigo, false); } if (CheckBox4.Checked == true) { p.Permiso4(codigo, true); } else { p.Permiso4(codigo, false); } if (CheckBox5.Checked == true) { p.Permiso5(codigo, true); } else { p.Permiso5(codigo, false); } if (CheckBox6.Checked == true) { p.Permiso6(codigo, true); } else { p.Permiso6(codigo, false); } if (CheckBox7.Checked == true) { p.Permiso7(codigo, true); } else { p.Permiso7(codigo, false); } if (CheckBox8.Checked == true) { p.Permiso8(codigo, true); } else { p.Permiso8(codigo, false); } if (CheckBox9.Checked == true) { p.Permiso9(codigo, true); } else { p.Permiso9(codigo, false); } if (CheckBox10.Checked == true) { p.Permiso10(codigo, true); } else { p.Permiso10(codigo, false); } if (CheckBox11.Checked == true) { p.Permiso11(codigo, true); } else { p.Permiso11(codigo, false); } if (CheckBox12.Checked == true) { p.Permiso12(codigo, true); } else { p.Permiso12(codigo, false); } if (CheckBox13.Checked == true) { p.Permiso13(codigo, true); } else { p.Permiso13(codigo, false); } if (CheckBox14.Checked == true) { p.Permiso14(codigo, true); } else { p.Permiso14(codigo, false); } if (CheckBox15.Checked == true) { p.Permiso15(codigo, true); } else { p.Permiso15(codigo, false); } if (CheckBox16.Checked == true) { p.Permiso16(codigo, true); } else { p.Permiso16(codigo, false); } if (CheckBox17.Checked == true) { p.Permiso17(codigo, true); } else { p.Permiso17(codigo, false); } if (CheckBox18.Checked == true) { p.Permiso18(codigo, true); } else { p.Permiso18(codigo, false); } if (CheckBox19.Checked == true) { p.Permiso19(codigo, true); } else { p.Permiso19(codigo, false); } if (CheckBox20.Checked == true) { p.Permiso20(codigo, true); } else { p.Permiso20(codigo, false); } if (CheckBox21.Checked == true) { p.Permiso21(codigo, true); } else { p.Permiso21(codigo, false); } if (CheckBox22.Checked == true) { p.Permiso22(codigo, true); } else { p.Permiso22(codigo, false); } if (CheckBox23.Checked == true) { p.Permiso23(codigo, true); } else { p.Permiso23(codigo, false); } //fin de ifs //refrescamos ListarPermisoso(); //bitacora Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Configuro Permisos a Id Empledo" + conocer, Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }
protected void Button2_Click(object sender, EventArgs e) { string asesor1 = DropDownList1.SelectedValue.ToString(); int asesor = Convert.ToInt32(asesor1); Decimal monto = Convert.ToDecimal(TextMonto.Text); string plan1 = DropDownList2.SelectedValue.ToString(); int plan = Convert.ToInt32(plan1); //garantias string des1 = TextRef1.Text; string modelo1 = TextRef2.Text; string serie1 = TextRef3.Text; Decimal valor1 = Convert.ToDecimal(TextRef4.Text); string des2 = TextRef5.Text; string modelo2 = TextRef6.Text; string serie2 = TextRef7.Text; string des3 = TextRef9.Text; string modelo3 = TextRef10.Text; string serie3 = TextRef11.Text; //para llenar nuevo prestamo bool estado = false; bool tipoPrestamo = false; bool autorizacion = false; //calculo de interes string recuperarInt = presta.SaberCantidadInteres(plan).Rows[0][0].ToString(); int cantidadInteres = Convert.ToInt32(recuperarInt); Decimal MontoInteres = monto * Convert.ToDecimal(cantidadInteres) / 100; /*string s = MontoInteres.ToString().Replace(",", "."); * Decimal hola=Convert.ToDecimal(s);*/ ///autorizacion se usa para saber si un prestamo ya esta pagado totalmente int persona = Convert.ToInt32(Label8.Text); string persona2 = presta.SaberIDcliente(persona).Rows[0][0].ToString(); int cliente = Convert.ToInt32(persona2); string fecha1 = DateTime.Now.ToString("dd/MM/yyyy"); DateTime fecha = Convert.ToDateTime(fecha1); try { //prestamo nuevo if (RadioButton1.Checked == true) { ingreso.Prestamo(monto, "ninguna", tipoPrestamo, MontoInteres, autorizacion, estado, cliente, asesor, plan, fecha, true, false); //para no permitir que pueda prestar presta.NoPUedePrestar(cliente); //Garantias int IDultimo = Convert.ToInt32(presta.UltimoPrestamo().Rows[0][0].ToString()); if (TextRef5.Text.Trim() == "" && TextRef6.Text.Trim() == "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "" && TextRef10.Text.Trim() == "" && TextRef11.Text.Trim() == "" && TextRef12.Text.Trim() == "") { ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); } else if (TextRef9.Text.Trim() == "" && TextRef10.Text.Trim() == "" && TextRef11.Text.Trim() == "" && TextRef12.Text.Trim() == "") { Decimal valor2 = Convert.ToDecimal(TextRef8.Text); ingreso.Garantia(des2, modelo2, serie2, valor2, IDultimo); ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); } else { Decimal valor3 = Convert.ToDecimal(TextRef12.Text); Decimal valor2 = Convert.ToDecimal(TextRef8.Text); ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); ingreso.Garantia(des2, modelo2, serie2, valor2, IDultimo); ingreso.Garantia(des3, modelo3, serie3, valor3, IDultimo); }//fin garantias Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Nuevo Prestamo " + Convert.ToString(IDultimo), Convert.ToInt32(Session["idempleado"])); }//prestamos activo else { ingreso.Prestamo(monto, "ninguna", true, MontoInteres, false, true, cliente, asesor, plan, fecha, false, true); //para no permitir que pueda prestar presta.NoPUedePrestar(cliente); int IDultimoPrestamo = Convert.ToInt32(presta.UltimoPrestamo().Rows[0][0].ToString()); //generacion de pagos //pago cuando son dias if (presta.InfoPlan(plan).Rows[0][2].ToString() == "True") { //pago cuando son dias DateTime fechaInicial1 = fecha; DateTime fechaInicial = fechaInicial1.AddDays(1); List <DateTime> fechasList = new List <DateTime>(); DateTime fechaTemp = fechaInicial; int feriados = Convert.ToInt32(presta.CantidadDiasFeriados(fecha).Rows[0][0].ToString()); int DD2 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int CantidadDatosFeriado = feriados; int k = 0; int dias = DD2; for (int i = 0; i <= dias; i++) { fechaTemp = fechaInicial.AddDays(i); fechasList.Add(fechaTemp); Label1.Text = Convert.ToString(fechasList.Last()); //ciclo para recorrer lista y comprobar si es domingo for (int j = 0; j < fechasList.Count; j++) { ///si es domingo if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); //fechasferiad for (int c = 0; c < fechasList.Count; c++) { for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[c] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(c); } } } //finfechasferiado } //fin si es domingo } } //comprobar que k sea mayor a 0 para aumentar dias int comprobar = Convert.ToInt32(Label2.Text); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); if (comprobar > 0) { fechaInicial = fechaprueba; for (int t = 1; t <= comprobar; t++) { fechaTemp = fechaInicial.AddDays(t); fechasList.Add(fechaTemp); } } //comprobar dias agregados si son domingos o feriados for (int j = 0; j < fechasList.Count; j++) { ///si es domingo if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); fechaInicial = Convert.ToDateTime(Label1.Text); fechaTemp = fechaInicial.AddDays(1); fechasList.Add(fechaTemp); } for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[j] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); fechaInicial = Convert.ToDateTime(Label1.Text); fechaTemp = fechaInicial.AddDays(1); fechasList.Add(fechaTemp); } } } //finpagos cuando son dias //int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); Decimal cuota = (monto + MontoInteres) / Convert.ToDecimal(presta.InfoPlan(plan).Rows[0][1].ToString()); Decimal mora = Convert.ToDecimal(0); Decimal saldo = (monto + MontoInteres); for (int f = 1; f <= dias3; f++) { saldo = saldo - cuota; ingreso.Pagos(cuota, mora, fechasList[f], false, cuota, saldo, IDultimoPrestamo, false); } //agregar campos para el reporte DateTime fe = Convert.ToDateTime(r.SaberFechaVencimiento(IDultimoPrestamo).Rows[0][0].ToString()); r.AgregarReporte(0, 0, 0, 0, 0, IDultimoPrestamo, fe); } //si se paga en semanas else if (presta.InfoPlan(plan).Rows[0][3].ToString() == "True") { DateTime fechaInicial1 = fecha; DateTime fechaInicial = fechaInicial1.AddDays(1); List <DateTime> fechasList = new List <DateTime>(); DateTime fechaTemp = fechaInicial; int feriados = Convert.ToInt32(presta.CantidadDiasFeriados(fechaInicial1).Rows[0][0].ToString()); int CantidadDatosFeriado = feriados; int k = 0; int DD2 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int dias = DD2 * 6; int i = 0; for (i = 0; i <= dias; i++) { i = i + 6; fechaTemp = fechaInicial.AddDays(i); fechasList.Add(fechaTemp); for (int j = 0; j < fechasList.Count; j++) { for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[j] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); fechaTemp = fechaprueba.AddDays(1); fechasList.Add(fechaTemp); } } if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); fechaTemp = fechaprueba.AddDays(1); fechasList.Add(fechaTemp); } } } fechasList.Sort(); int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()) - 1; Decimal cuota = (monto + MontoInteres) / Convert.ToDecimal(presta.InfoPlan(plan).Rows[0][1].ToString()); Decimal mora = Convert.ToDecimal(0); Decimal saldo = (monto + MontoInteres); for (int f = 0; f <= dias3; f++) { saldo = saldo - cuota; ingreso.Pagos(cuota, mora, fechasList[f], false, cuota, saldo, IDultimoPrestamo, false); } DateTime fe = Convert.ToDateTime(r.SaberFechaVencimiento(IDultimoPrestamo).Rows[0][0].ToString()); r.AgregarReporte(0, 0, 0, 0, 0, IDultimoPrestamo, fe); }//fin de else if //fin de generacion de pagos //Garantias int IDultimo = Convert.ToInt32(presta.UltimoPrestamo().Rows[0][0].ToString()); if (TextRef5.Text.Trim() == "" && TextRef6.Text.Trim() == "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "" && TextRef10.Text.Trim() == "" && TextRef11.Text.Trim() == "" && TextRef12.Text.Trim() == "") { ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); } else if (TextRef9.Text.Trim() == "" && TextRef10.Text.Trim() == "" && TextRef11.Text.Trim() == "" && TextRef12.Text.Trim() == "") { Decimal valor2 = Convert.ToDecimal(TextRef8.Text); ingreso.Garantia(des2, modelo2, serie2, valor2, IDultimo); ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); } else { Decimal valor3 = Convert.ToDecimal(TextRef12.Text); Decimal valor2 = Convert.ToDecimal(TextRef8.Text); ingreso.Garantia(des1, modelo1, serie1, valor1, IDultimo); ingreso.Garantia(des2, modelo2, serie2, valor2, IDultimo); ingreso.Garantia(des3, modelo3, serie3, valor3, IDultimo); }//fin garantias //Datos de Contrato; string NombreCliente = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][0].ToString(); string edad = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][1].ToString()).ToLower(); string EstadoCivil = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][2].ToString(); string Profesion = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][3].ToString(); string DireccionCli = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][4].ToString(); string Parte1DPI = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][5].ToString().Substring(0, 4)).ToLower(); string Parte2DPI = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][5].ToString().Substring(4, 5)).ToLower(); string Parte3DPI = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][5].ToString().Substring(9, 1)).ToLower(); string Parte4DPI = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][5].ToString().Substring(10, 3)).ToLower(); string DPI = Parte1DPI + ", " + Parte2DPI + ", " + Parte3DPI + ", " + Parte4DPI + " (" + presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][5].ToString() + ")"; string MontoPresta = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][6].ToString()) + " QUETZALES" + " ( Q." + presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][6].ToString() + ")"; string PeriodoContra = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][7].ToString()).ToLower(); Decimal Prueba = Convert.ToDecimal(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][8].ToString()); string CuotaContra = ca.enletras(Convert.ToString(Math.Round(Prueba, 0))) + " QUETZALES" + " (Q." + Convert.ToString(Math.Round(Prueba, 0)) + ")"; string MoraContra = ca.enletras(presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][9].ToString()) + " QUETZALES" + " (Q." + presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][9].ToString() + ")"; string SemanasDias = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][10].ToString(); string DirAgencia = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][11].ToString(); string Nacionalidad = presta.INFOPARACONTRATO(IDultimoPrestamo).Rows[0][12].ToString(); string Parte1FI = ca.enletras(presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][0].ToString().Substring(0, 2)).ToLower(); string Parte2FI = presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][0].ToString().Substring(3, 2); string Parte3FI = ca.enletras(presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][0].ToString().Substring(6, 4)).ToLower(); string mes = "mes"; if (Parte2FI == "01") { mes = "enero"; } else if (Parte2FI == "02") { mes = "febrero"; } else if (Parte2FI == "03") { mes = "marzo"; } else if (Parte2FI == "04") { mes = "abril"; } else if (Parte2FI == "05") { mes = "mayo"; } else if (Parte2FI == "06") { mes = "junio"; } else if (Parte2FI == "07") { mes = "julio"; } else if (Parte2FI == "08") { mes = "agosto"; } else if (Parte2FI == "09") { mes = "septiembre"; } else if (Parte2FI == "10") { mes = "octubre"; } else if (Parte2FI == "11") { mes = "noviembre"; } else if (Parte2FI == "12") { mes = "diciembre"; } string FechaInicialContra = Parte1FI + " de " + mes + " de " + Parte3FI; //fecha final string Parte1FF = ca.enletras(presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][1].ToString().Substring(0, 2)).ToLower(); string Parte2FF = presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][1].ToString().Substring(3, 2); string Parte3FF = ca.enletras(presta.FechaInicialYFinal(IDultimoPrestamo).Rows[0][1].ToString().Substring(6, 4)).ToLower(); string mes2 = "mes"; if (Parte2FF == "01") { mes2 = "enero"; } else if (Parte2FF == "02") { mes2 = "febrero"; } else if (Parte2FF == "03") { mes2 = "marzo"; } else if (Parte2FF == "04") { mes2 = "abril"; } else if (Parte2FF == "05") { mes2 = "mayo"; } else if (Parte2FF == "06") { mes2 = "junio"; } else if (Parte2FF == "07") { mes2 = "julio"; } else if (Parte2FF == "08") { mes2 = "agosto"; } else if (Parte2FF == "09") { mes2 = "septiembre"; } else if (Parte2FF == "10") { mes2 = "octubre"; } else if (Parte2FF == "11") { mes2 = "noviembre"; } else if (Parte2FF == "12") { mes2 = "diciembre"; } string FechaFinallContra = Parte1FF + " de " + mes2 + " de " + Parte3FF; string GarantiasCon = ""; if (presta.GarantiasContrato(IDultimoPrestamo).Rows.Count == 1) { GarantiasCon = presta.GarantiasContrato(IDultimoPrestamo).Rows[0][0].ToString(); } else if (presta.GarantiasContrato(IDultimoPrestamo).Rows.Count == 2) { GarantiasCon = presta.GarantiasContrato(IDultimoPrestamo).Rows[0][0].ToString() + "; " + presta.GarantiasContrato(IDultimoPrestamo).Rows[1][0].ToString(); } else if (presta.GarantiasContrato(IDultimoPrestamo).Rows.Count == 3) { GarantiasCon = presta.GarantiasContrato(IDultimoPrestamo).Rows[0][0].ToString() + "; " + presta.GarantiasContrato(IDultimoPrestamo).Rows[1][0].ToString() + "; " + presta.GarantiasContrato(IDultimoPrestamo).Rows[2][0].ToString(); } presta.CrearContrato(NombreCliente, edad, EstadoCivil, Profesion, DireccionCli, DPI, MontoPresta, PeriodoContra, CuotaContra, FechaInicialContra, FechaFinallContra, MoraContra, SemanasDias, GarantiasCon, DirAgencia, true, Nacionalidad, IDultimoPrestamo); //final de crear contrato Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Nuevo Prestamo " + Convert.ToString(IDultimoPrestamo), Convert.ToInt32(Session["idempleado"])); } string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel4, UpdatePanel4.GetType(), "notificacion1", notificacion1, true); }catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel4, UpdatePanel4.GetType(), "notificacion2", notificacion2, true); } }
protected void Button1_Click(object sender, EventArgs e) { string valor2 = Request.QueryString["Valor"]; int idperson = Convert.ToInt32(valor2); //variables persona string fecha_llegada = TextNacimiento.Text; DateTime f_registro = Convert.ToDateTime(fecha_llegada); string dpi = TextDPI.Text; string pnombre = TextPrimerNombre.Text; string snombre = TextSegundoNombre.Text; string papell = TextPrimerApellido.Text; string sappell = TextSegundoApellido.Text; string telper = TextTelefonoPersonal.Text; string dirper = TextDomicilio.Text; string ciudad = TextDepartamento.Text; string muni = TextMunicipio.Text; string correo = TextCorreo.Text; string extendido = TextExtendido.Text; string profesion = TextProfesion.Text; string estadocivil = TextEstadoCivil.Text; string telcasa = TextTelefonoResidencial.Text; //variables cliente string fecha_contratacion = TextTrabajo.Text; DateTime f_contra = Convert.ToDateTime(fecha_contratacion); Decimal sueldo = Convert.ToDecimal(TextSalario.Text); int porcentaje = Convert.ToInt32(TextPorcentaje.Text); Decimal comision = Convert.ToDecimal(TextCantidadPorComision.Text); //variables de referencia string ref1 = TextRef1.Text; string ref2 = TextRef2.Text; string ref3 = TextRef3.Text; string ref4 = TextRef4.Text; string ref5 = TextRef5.Text; string ref6 = TextRef6.Text; string ref7 = TextRef7.Text; string ref8 = TextRef8.Text; string ref9 = TextRef9.Text; string ref10 = LaRef1.Text; string ref11 = LaRef2.Text; string ref12 = LaRef3.Text; int agencia = Convert.ToInt32(Session["idagencia"]); string agencia1 = DropDownList1.SelectedValue.ToString(); int agenciad = Convert.ToInt32(agencia1); string puesto1 = DropDownList2.SelectedValue.ToString(); int puesto = Convert.ToInt32(puesto1); int Puestofull = Convert.ToInt32(LabePuesato.Text); try { if (CheckBox1.Checked == true) { string foto = ""; //carga de imagenes Boolean fileOK = false; String path = Server.MapPath("~/ImagenesCargadas/Empleados/"); if (FileUpload1.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); String[] allowedExtensions = { ".png", ".jpeg", ".jpg" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName); Label1.Text = "File uploaded!"; foto = FileUpload1.FileName.ToString(); } catch (Exception ex) { Label1.Text = "File could not be uploaded."; } } else { Label1.Text = "Cannot accept files of this type."; } if (RadioButton1.Checked == true) { //si es hombre if (RadioButton3.Checked == true) { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, true, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, true, foto, telcasa, agencia); } } else { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, false, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, false, foto, telcasa, agencia); } } } else { //si es mujer if (RadioButton3.Checked == true) { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, true, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, true, foto, telcasa, agencia); } } else { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, false, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, false, foto, telcasa, agencia); } } } //Empleado; if (CheckBox3.Checked == true) { mo.ModEmpleado(idperson, f_contra, true, sueldo, porcentaje, comision, puesto); } else { mo.ModEmpleado(idperson, f_contra, true, sueldo, porcentaje, comision, Puestofull); } //referencia int nrorows = ver2.ReferenciasCli(idperson).Rows.Count; if (TextRef1.Text.Trim() != "" && TextRef1.Text.Trim() != "" && TextRef3.Text.Trim() != "" && TextRef4.Text.Trim() == "" && TextRef5.Text.Trim() == "" && TextRef6.Text.Trim() == "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { if (nrorows == 1) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); } } else if (TextRef4.Text.Trim() != "" && TextRef5.Text.Trim() != "" && TextRef6.Text.Trim() != "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { if (nrorows == 1) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); per.Referencia(ref4, ref5, ref6, true, idperson); } else if (nrorows == 2) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); } } else if (TextRef1.Text.Trim() != "" && TextRef2.Text.Trim() != "" && TextRef3.Text.Trim() != "" && TextRef4.Text.Trim() != "" && TextRef5.Text.Trim() != "" && TextRef6.Text.Trim() != "" && TextRef7.Text.Trim() != "" && TextRef8.Text.Trim() != "" && TextRef9.Text.Trim() != "") { if (nrorows == 2) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); per.Referencia(ref7, ref8, ref9, true, idperson); } else if (nrorows == 3) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); mo.ModReferencia(Convert.ToInt32(ref12), ref7, ref8, ref9, true); } ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); } } else { //si el chek no esta seleccionado string foto = ver.InfoActualizarEmpleado(idperson).Rows[0][17].ToString(); if (RadioButton1.Checked == true) { //si es hombre if (RadioButton3.Checked == true) { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, true, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, true, foto, telcasa, agencia); } } else { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, false, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, false, foto, telcasa, agencia); } } } else { //si es mujer if (RadioButton3.Checked == true) { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, true, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, true, foto, telcasa, agencia); } } else { if (CheckBox2.Checked == true) { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, false, foto, telcasa, agenciad); } else { mo.ModPersona(idperson, dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, false, foto, telcasa, agencia); } } } //empleado; if (CheckBox3.Checked == true) { mo.ModEmpleado(idperson, f_contra, true, sueldo, porcentaje, comision, puesto); } else { mo.ModEmpleado(idperson, f_contra, true, sueldo, porcentaje, comision, Puestofull); } //referencia int nrorows = ver2.ReferenciasCli(idperson).Rows.Count; if (TextRef1.Text.Trim() != "" && TextRef1.Text.Trim() != "" && TextRef3.Text.Trim() != "" && TextRef4.Text.Trim() == "" && TextRef5.Text.Trim() == "" && TextRef6.Text.Trim() == "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { if (nrorows == 1) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); } } else if (TextRef4.Text.Trim() != "" && TextRef5.Text.Trim() != "" && TextRef6.Text.Trim() != "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { if (nrorows == 1) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); per.Referencia(ref4, ref5, ref6, true, idperson); } else if (nrorows == 2) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); } } else if (TextRef1.Text.Trim() != "" && TextRef2.Text.Trim() != "" && TextRef3.Text.Trim() != "" && TextRef4.Text.Trim() != "" && TextRef5.Text.Trim() != "" && TextRef6.Text.Trim() != "" && TextRef7.Text.Trim() != "" && TextRef8.Text.Trim() != "" && TextRef9.Text.Trim() != "") { if (nrorows == 2) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); per.Referencia(ref7, ref8, ref9, true, idperson); } else if (nrorows == 3) { mo.ModReferencia(Convert.ToInt32(ref10), ref1, ref2, ref3, true); mo.ModReferencia(Convert.ToInt32(ref11), ref4, ref5, ref6, true); mo.ModReferencia(Convert.ToInt32(ref12), ref7, ref8, ref9, true); } } Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Actualizar ", "Empleado con idpersona " + Convert.ToString(idperson), Convert.ToInt32(Session["idempleado"])); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction2();</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { //variables persona string fecha_llegada = TextNacimiento.Text; DateTime f_registro = Convert.ToDateTime(fecha_llegada); string dpi = TextDPI.Text; string pnombre = TextPrimerNombre.Text; string snombre = TextSegundoNombre.Text; string papell = TextPrimerApellido.Text; string sappell = TextSegundoApellido.Text; string telper = TextTelefonoPersonal.Text; string dirper = TextDomicilio.Text; string ciudad = TextDepartamento.Text; string muni = TextMunicipio.Text; string correo = TextCorreo.Text; string extendido = TextExtendido.Text; string profesion = TextProfesion.Text; string estadocivil = TextEstadoCivil.Text; string foto = ""; string telcasa = TextTelefonoResidencial.Text; //variables empleado string fecha_contratacion = TextTrabajo.Text; DateTime f_contra = Convert.ToDateTime(fecha_contratacion); Decimal sueldo = Convert.ToDecimal(TextSalario.Text); int porcentaje = Convert.ToInt32(TextPorcentaje.Text); Decimal comision = Convert.ToDecimal(TextCantidadPorComision.Text); //int puesto= Convert.ToString() //variables de referencia string ref1 = TextRef1.Text; string ref2 = TextRef2.Text; string ref3 = TextRef3.Text; string ref4 = TextRef4.Text; string ref5 = TextRef5.Text; string ref6 = TextRef6.Text; string ref7 = TextRef7.Text; string ref8 = TextRef8.Text; string ref9 = TextRef9.Text; string agencia1 = DropDownList1.SelectedValue.ToString(); int agencia = Convert.ToInt32(agencia1); string puesto1 = DropDownList2.SelectedValue.ToString(); int puesto = Convert.ToInt32(puesto1); try { //carga de imagenes Boolean fileOK = false; String path = Server.MapPath("~/ImagenesCargadas/Empleados/"); if (FileUpload1.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); String[] allowedExtensions = { ".png", ".jpeg", ".jpg" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName); Label1.Text = "File uploaded!"; foto = FileUpload1.FileName.ToString(); } catch (Exception ex) { Label1.Text = "File could not be uploaded."; } } else { Label1.Text = "Cannot accept files of this type."; } if (RadioButton1.Checked == true) { if (RadioButton3.Checked == true) { per.Persona(dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, true, foto, telcasa, agencia); } else { per.Persona(dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, true, false, foto, telcasa, agencia); } } else { if (RadioButton3.Checked == true) { per.Persona(dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, true, foto, telcasa, agencia); } else { per.Persona(dpi, pnombre, snombre, papell, sappell, f_registro, telper, dirper, ciudad, muni, correo, true, extendido, profesion, estadocivil, false, false, foto, telcasa, agencia); } } int id = Convert.ToInt32(per.ultimoID().Rows[0][0].ToString()); //empleado; per.Empleado(f_contra, true, sueldo, porcentaje, comision, puesto, id); //referencia if (TextRef4.Text.Trim() == "" && TextRef5.Text.Trim() == "" && TextRef6.Text.Trim() == "" && TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { per.Referencia(ref1, ref2, ref3, true, id); } else if (TextRef7.Text.Trim() == "" && TextRef8.Text.Trim() == "" && TextRef9.Text.Trim() == "") { per.Referencia(ref1, ref2, ref3, true, id); per.Referencia(ref4, ref5, ref6, true, id); } else { per.Referencia(ref1, ref2, ref3, true, id); per.Referencia(ref4, ref5, ref6, true, id); per.Referencia(ref7, ref8, ref9, true, id); } Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Nuevo Empleado con id persona" + Convert.ToString(id), Convert.ToInt32(Session["idempleado"])); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction();</script>"); limpiar(); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:myFunction2();</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { ///Si es prestamos nuevo string valor2 = Request.QueryString["Valor"]; int idprestamo = Convert.ToInt32(valor2); string tipopre = presta.InfoTabUNO(idprestamo).Rows[0][0].ToString(); string desembolso = presta.InfoTabUNO(idprestamo).Rows[0][1].ToString(); if (tipopre == "False" && desembolso == "False") { presta.Precalificar(true, idprestamo); Button1.Enabled = false; Button1.Visible = false; string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); } //fin prestamos nuevo //desembolsar if (tipopre == "True" && desembolso == "False") { presta.Desembolsar(true, idprestamo); ///crear pagos despues de desembolsar Decimal monto = Convert.ToDecimal(presta.InfoTabUNO(idprestamo).Rows[0][7].ToString()); Decimal MontoInteres = Convert.ToDecimal(presta.InfoTabUNO(idprestamo).Rows[0][6].ToString()) - Convert.ToDecimal(presta.InfoTabUNO(idprestamo).Rows[0][7].ToString()); int plan = Convert.ToInt32(presta.SaberIdPrestamoPlan(idprestamo).Rows[0][0].ToString()); string fecha1 = DateTime.Now.ToString("dd/MM/yyyy"); // DateTime fecha = DateTime.ParseExact(fecha1, "dd/MM/yyyy", null); DateTime fecha = Convert.ToDateTime(fecha1); //pago cuando son dias if (presta.InfoPlan(plan).Rows[0][2].ToString() == "True") { //pago cuando son dias DateTime fechaInicial1 = fecha; DateTime fechaInicial = fechaInicial1.AddDays(1); List <DateTime> fechasList = new List <DateTime>(); DateTime fechaTemp = fechaInicial; int feriados = Convert.ToInt32(presta.CantidadDiasFeriados(fecha).Rows[0][0].ToString()); int DD2 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int CantidadDatosFeriado = feriados; int k = 0; int dias = DD2; for (int i = 0; i <= dias; i++) { fechaTemp = fechaInicial.AddDays(i); fechasList.Add(fechaTemp); Label1.Text = Convert.ToString(fechasList.Last()); //ciclo para recorrer lista y comprobar si es domingo for (int j = 0; j < fechasList.Count; j++) { ///si es domingo if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); //fechasferiad for (int c = 0; c < fechasList.Count; c++) { for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[c] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(c); } } } //finfechasferiado } //fin si es domingo } } //comprobar que k sea mayor a 0 para aumentar dias int comprobar = Convert.ToInt32(Label2.Text); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); if (comprobar > 0) { fechaInicial = fechaprueba; for (int t = 1; t <= comprobar; t++) { fechaTemp = fechaInicial.AddDays(t); fechasList.Add(fechaTemp); } } //comprobar dias agregados si son domingos o feriados for (int j = 0; j < fechasList.Count; j++) { ///si es domingo if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); fechaInicial = Convert.ToDateTime(Label1.Text); fechaTemp = fechaInicial.AddDays(1); fechasList.Add(fechaTemp); } for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[j] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); fechaInicial = Convert.ToDateTime(Label1.Text); fechaTemp = fechaInicial.AddDays(1); fechasList.Add(fechaTemp); } } } //finpagos cuando son dias //int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()) - 1; Decimal cuota = (monto + MontoInteres) / Convert.ToDecimal(presta.InfoPlan(plan).Rows[0][1].ToString()); Decimal mora = Convert.ToDecimal(0); Decimal saldo = (monto + MontoInteres); for (int f = 0; f <= dias3; f++) { saldo = saldo - cuota; ingreso.Pagos(cuota, mora, fechasList[f], false, cuota, saldo, idprestamo, false); } DateTime fe = Convert.ToDateTime(r.SaberFechaVencimiento(idprestamo).Rows[0][0].ToString()); r.AgregarReporte(0, 0, 0, 0, 0, idprestamo, fe); }///fin pago dias //si se paga en semanas else if (presta.InfoPlan(plan).Rows[0][3].ToString() == "True") { DateTime fechaInicial1 = fecha; DateTime fechaInicial = fechaInicial1.AddDays(1); List <DateTime> fechasList = new List <DateTime>(); DateTime fechaTemp = fechaInicial; int feriados = Convert.ToInt32(presta.CantidadDiasFeriados(fechaInicial1).Rows[0][0].ToString()); int CantidadDatosFeriado = feriados; int k = 0; int DD2 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()); int dias = DD2 * 6; int i = 0; for (i = 0; i <= dias; i++) { i = i + 6; fechaTemp = fechaInicial.AddDays(i); fechasList.Add(fechaTemp); for (int j = 0; j < fechasList.Count; j++) { for (int m = 0; m < CantidadDatosFeriado; m++) { if (fechasList[j] == Convert.ToDateTime(presta.FechasFeriado(fechaInicial1).Rows[m][0].ToString())) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); fechaTemp = fechaprueba.AddDays(1); fechasList.Add(fechaTemp); } } if (fechasList[j].DayOfWeek == DayOfWeek.Sunday) { Label1.Text = Convert.ToString(fechasList.Last()); k++; Label2.Text = Convert.ToString(k); fechasList.RemoveAt(j); DateTime fechaprueba = Convert.ToDateTime(Label1.Text); fechaTemp = fechaprueba.AddDays(1); fechasList.Add(fechaTemp); } } } fechasList.Sort(); int dias3 = Convert.ToInt32(presta.InfoPlan(plan).Rows[0][1].ToString()) - 1; Decimal cuota = (monto + MontoInteres) / Convert.ToDecimal(presta.InfoPlan(plan).Rows[0][1].ToString()); Decimal mora = Convert.ToDecimal(0); Decimal saldo = (monto + MontoInteres); for (int f = 0; f <= dias3; f++) { saldo = saldo - cuota; ingreso.Pagos(cuota, mora, fechasList[f], false, cuota, saldo, idprestamo, false); } //agregar campos para el reporte DateTime fe = Convert.ToDateTime(r.SaberFechaVencimiento(idprestamo).Rows[0][0].ToString()); r.AgregarReporte(0, 0, 0, 0, 0, idprestamo, fe); }//fin de else if //fin pago por mes //fin de creacion de pagos //Hacer no visible el boton de cancelar Button2.Visible = false; Button1.Visible = false; GridView3.DataSource = presta.TablaPagosTab(idprestamo); GridView3.DataBind(); DivHistoPagos.Visible = true; Button5.Visible = true; Button6.Visible = true; Button7.Visible = true; //Datos de Contrato; string NombreCliente = presta.INFOPARACONTRATO(idprestamo).Rows[0][0].ToString(); string edad = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][1].ToString()).ToLower(); string EstadoCivil = presta.INFOPARACONTRATO(idprestamo).Rows[0][2].ToString(); string Profesion = presta.INFOPARACONTRATO(idprestamo).Rows[0][3].ToString(); string DireccionCli = presta.INFOPARACONTRATO(idprestamo).Rows[0][4].ToString(); string Parte1DPI = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][5].ToString().Substring(0, 4)).ToLower(); string Parte2DPI = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][5].ToString().Substring(4, 5)).ToLower(); string Parte3DPI = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][5].ToString().Substring(9, 1)).ToLower(); string Parte4DPI = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][5].ToString().Substring(10, 3)).ToLower(); string DPI = Parte1DPI + ", " + Parte2DPI + ", " + Parte3DPI + ", " + Parte4DPI + " (" + presta.INFOPARACONTRATO(idprestamo).Rows[0][5].ToString() + ")"; string MontoPresta = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][6].ToString()) + " QUETZALES" + " ( Q." + presta.INFOPARACONTRATO(idprestamo).Rows[0][6].ToString() + ")"; string PeriodoContra = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][7].ToString()).ToLower(); Decimal Prueba = Convert.ToDecimal(presta.INFOPARACONTRATO(idprestamo).Rows[0][8].ToString()); string CuotaContra = ca.enletras(Convert.ToString(Math.Round(Prueba, 0))) + " QUETZALES" + " (Q." + Convert.ToString(Math.Round(Prueba, 0)) + ")"; string MoraContra = ca.enletras(presta.INFOPARACONTRATO(idprestamo).Rows[0][9].ToString()) + " QUETZALES" + " (Q." + presta.INFOPARACONTRATO(idprestamo).Rows[0][9].ToString() + ")"; string SemanasDias = presta.INFOPARACONTRATO(idprestamo).Rows[0][10].ToString(); string DirAgencia = presta.INFOPARACONTRATO(idprestamo).Rows[0][11].ToString(); string Nacionalidad = presta.INFOPARACONTRATO(idprestamo).Rows[0][12].ToString(); string Parte1FI = ca.enletras(presta.FechaInicialYFinal(idprestamo).Rows[0][0].ToString().Substring(0, 2)).ToLower(); string Parte2FI = presta.FechaInicialYFinal(idprestamo).Rows[0][0].ToString().Substring(3, 2); string Parte3FI = ca.enletras(presta.FechaInicialYFinal(idprestamo).Rows[0][0].ToString().Substring(6, 4)).ToLower(); string mes = "mes"; if (Parte2FI == "01") { mes = "enero"; } else if (Parte2FI == "02") { mes = "febrero"; } else if (Parte2FI == "03") { mes = "marzo"; } else if (Parte2FI == "04") { mes = "abril"; } else if (Parte2FI == "05") { mes = "mayo"; } else if (Parte2FI == "06") { mes = "junio"; } else if (Parte2FI == "07") { mes = "julio"; } else if (Parte2FI == "08") { mes = "agosto"; } else if (Parte2FI == "09") { mes = "septiembre"; } else if (Parte2FI == "10") { mes = "octubre"; } else if (Parte2FI == "11") { mes = "noviembre"; } else if (Parte2FI == "12") { mes = "diciembre"; } string FechaInicialContra = Parte1FI + " de " + mes + " de " + Parte3FI; //fecha final string Parte1FF = ca.enletras(presta.FechaInicialYFinal(idprestamo).Rows[0][1].ToString().Substring(0, 2)).ToLower(); string Parte2FF = presta.FechaInicialYFinal(idprestamo).Rows[0][1].ToString().Substring(3, 2); string Parte3FF = ca.enletras(presta.FechaInicialYFinal(idprestamo).Rows[0][1].ToString().Substring(6, 4)).ToLower(); string mes2 = "mes"; if (Parte2FF == "01") { mes2 = "enero"; } else if (Parte2FF == "02") { mes2 = "febrero"; } else if (Parte2FF == "03") { mes2 = "marzo"; } else if (Parte2FF == "04") { mes2 = "abril"; } else if (Parte2FF == "05") { mes2 = "mayo"; } else if (Parte2FF == "06") { mes2 = "junio"; } else if (Parte2FF == "07") { mes2 = "julio"; } else if (Parte2FF == "08") { mes2 = "agosto"; } else if (Parte2FF == "09") { mes2 = "septiembre"; } else if (Parte2FF == "10") { mes2 = "octubre"; } else if (Parte2FF == "11") { mes2 = "noviembre"; } else if (Parte2FF == "12") { mes2 = "diciembre"; } string FechaFinallContra = Parte1FF + " de " + mes2 + " de " + Parte3FF; string GarantiasCon = ""; if (presta.GarantiasContrato(idprestamo).Rows.Count == 1) { GarantiasCon = presta.GarantiasContrato(idprestamo).Rows[0][0].ToString(); } else if (presta.GarantiasContrato(idprestamo).Rows.Count == 2) { GarantiasCon = presta.GarantiasContrato(idprestamo).Rows[0][0].ToString() + "; " + presta.GarantiasContrato(idprestamo).Rows[1][0].ToString(); } else if (presta.GarantiasContrato(idprestamo).Rows.Count == 3) { GarantiasCon = presta.GarantiasContrato(idprestamo).Rows[0][0].ToString() + "; " + presta.GarantiasContrato(idprestamo).Rows[1][0].ToString() + "; " + presta.GarantiasContrato(idprestamo).Rows[2][0].ToString(); } presta.CrearContrato(NombreCliente, edad, EstadoCivil, Profesion, DireccionCli, DPI, MontoPresta, PeriodoContra, CuotaContra, FechaInicialContra, FechaFinallContra, MoraContra, SemanasDias, GarantiasCon, DirAgencia, true, Nacionalidad, idprestamo); //final de crear contrato Bitacora bita = new Bitacora(); bita.RegistrarBitacora("Registro", "Precalificar prestamo No. " + Convert.ToString(idprestamo), Convert.ToInt32(Session["idempleado"])); string notificacion1; notificacion1 = "myFunction();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion1", notificacion1, true); }//fin desembolar } catch (Exception ex) { string notificacion2; notificacion2 = "myFunction2();"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "notificacion2", notificacion2, true); } }