public void comenzar() { // Console.Write("Empezar") _baseDatos = new BasedeDatos(); _baseDatos.registrar(); _baseDatos.AutenticarLogin(0123, 01234); _baseDatos.ObtenerSaldoDisponible(0123); _baseDatos.ObtenerSaldoTotal(0123); Console.ReadKey(); }
public void llenarCampuss() { BasedeDatos obj = new BasedeDatos(); string query = "select Codigo_campus,Nombre from cat_campus order by Nombre"; DataTable dt = obj.getQuery(conexionBecariosestatico, query); if (dt.Rows.Count > 0) { CampusFiltro.DataValueField = "Codigo_campus"; CampusFiltro.DataTextField = "Nombre"; CampusFiltro.DataSource = dt; CampusFiltro.DataBind(); } }
public static string Empleadosformarcion(string nomina, string mensajes) { string json = ""; string query = ""; DataTable dt; int i = 0; BasedeDatos bd = new BasedeDatos(); json = "["; if (!string.IsNullOrEmpty(nomina)) { query = "exec sp_nombre_nomina_rol '" + nomina + "'"; dt = bd.getQuery(conexionBecariosestatico, query); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (i == dt.Rows.Count - 1) { json += "{\"NombreComleto\":\"" + dt.Rows[i]["NombreCompleto"].ToString() + "\",\"Rol\":\"" + dt.Rows[i]["Rol"].ToString() + "\",\"Mensaje\":\"" + mensajes + "\"}"; } else { //json += "[\"" + dt.Rows[i]["NombreCompleto"].ToString() + "\",\"" + dt.Rows[i]["Rol"].ToString() + "\"],"; json += "{\"NombreComleto\":\"" + dt.Rows[i]["NombreCompleto"].ToString() + "\",\"Rol\":\"" + dt.Rows[i]["Rol"].ToString() + "\",\"Mensaje\":\"" + mensajes + "\"},"; } i++; } } else { json += "{\"Mensaje\":\"No\"}"; } } else { json += "{\"Mensaje\":\"" + mensajes + "\"}"; } json += "]"; return(json); }
public string Detalle(string Campus, string Periodo = null) { string body = ""; ReporteTotalesDetalle obj = new ReporteTotalesDetalle(); BasedeDatos db = new BasedeDatos(); obj.query = "sp_Reportes_Totales_Filtro_Por_Campus '" + Campus + "'"; if (Periodo != "" && Periodo != "0" && Periodo != null) { obj.query += " ,'" + Periodo + "' "; } try { obj.dt = db.getQuery(obj.conexionBecarios, obj.query); if (obj.dt.Rows.Count > 0) { body += "<table class='table' id='dtTable'>"; body += " <thead><tr><th>Nomina</th><th>Nombre</th><th>Periodo</th><th>Solicitud</th><th>Fecha de Solicitud</th><th>Estatus</th><th>Tipo</th></tr></thead><tbody>"; foreach (DataRow Res in obj.dt.Rows) { body += "<tr>"; body += "<td>" + Res["Nomina"] + "</td>"; body += "<td>" + Res["Nombre"] + "</td>"; body += "<td>" + Res["Periodo"] + "</td>"; body += "<td>" + Res["id_MiSolicitud"] + "</td>"; body += "<td>" + Res["Fecha_solicitud"].ToString().Substring(0, 10) + "</td>"; body += "<td>" + Res["Solicitud_estatus"] + "</td>"; body += "<td>" + Res["Tipo"] + "</td>"; body += "</tr>"; } body += " </tbody><tfoot><tr><th>Nomina</th><th>Nombre</th><th>Solicitud</th><th>Periodo</th><th>Fecha de Solicitud</th><th>Estatus</th><th>Tipo</th></tr></tfoot></table>"; } else { return("<div class='alert alert-warning text-center'><b>Campus Vacío</b></div>"); } }catch (Exception ex) { return(ex.Message); } return(body); }
public static string insertarPermisos_especial(string id, string nomina, string inicio, string fin) { //Inserta un permiso por nomina dentro de la base de datos BasedeDatos bd = new BasedeDatos(); string retorno = ""; try { //string query = "exec sp_guarda_permisos_especiales '" + nomina + "'," + id + ",'" + inicio + "','" + fin + "' "; string query = "exec sp_guarda_permisos_especiales_nuevo_is '" + nomina + "'," + id + ",'" + inicio + "','" + fin + "' "; DataTable dt = bd.getQuery(conexionBecariosestatico, query);; if (dt.Rows.Count > 0) { retorno = dt.Rows[0]["Mensaje"].ToString(); } } catch (Exception es) { retorno = es.Message.ToString(); } return(retorno); }
static void Main(string[] args) { while (true) { Console.Clear(); string opcion = ""; BasedeDatos datos = new BasedeDatos(); while (true) { Console.Clear(); Console.WriteLine(" Sistema de notas escolares"); Console.WriteLine("----------------------------"); Console.WriteLine("1 - Lista de Alumnos"); Console.WriteLine("2 - Clases Disponibles"); Console.WriteLine("3 - Registro de Alumno"); Console.WriteLine("4 - Matricular Clase"); Console.WriteLine("5 - Retirar Clase"); Console.WriteLine("6 - Ingresar Notas"); Console.WriteLine("0 - Salir"); Console.WriteLine(""); Console.WriteLine(""); Console.Write("Ingrese una opcion: "); opcion = Console.ReadLine(); switch (opcion) { case "1": { Console.Clear(); Console.WriteLine(" Sistema de notas escolares"); Console.WriteLine("----------------------------"); Console.WriteLine(""); Console.WriteLine("1- Ingreso de informacion general por Alumno(a)"); Console.WriteLine(""); Console.WriteLine("2- Ingreso de Alumnos matriculados por clase"); Console.WriteLine(""); Console.WriteLine("3- Lista de calificaciones por Alumno"); Console.WriteLine(""); Console.Write("Ingrese una opcion: "); string op2 = Console.ReadLine(); switch (op2) { case "1": datos.ListarAlumnos(); break; case "2": datos.ListarMatriculas(); break; case "3": datos.ListarNotas(); break; default: break; } break; } case "2": datos.ListarClases(); break; case "3": { Console.Clear(); Console.WriteLine(""); Console.WriteLine("1- Ingresar Alumno(a)"); Console.WriteLine(""); Console.WriteLine("2- Eliminar registro de Alumno(a)"); Console.WriteLine(""); Console.Write("Ingrese una opcion: "); string op3 = Console.ReadLine(); switch (op3) { case "1": datos.IngresarAlumno(); break; case "2": datos.ModificarAlumno(); break; default: break; } } break; case "4": datos.MatriculaAlumno(); break; case "5": datos.RetirarAlumno(); break; case "6": datos.IngresarNotas(); break; default: break; } if (opcion == "0") { break; } } } }
public static string agregarElementos(string nomina) { //Este metodo construye el html de los checkbox que se implementan dentro del div para seleccionar solamente a los permisos //el cual no tiene. int i = 0; BasedeDatos bd = new BasedeDatos(); int columna = 0; string cadena = ""; string componentes = ""; string strColumnas = ""; string strRows = ""; //string querystatic = "exec sp_muestra_menus_de_nomina '" + nomina + "'"; string querystatic = "exec sp_muestra_menus_de_nomina_nuevo '" + nomina + "'"; DataTable dt = bd.getQuery(conexionBecariosestatico, querystatic); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (columna == 0) { strRows = "<div class='Row' >"; } else { strRows = ""; } if (dt.Rows[i]["rol"].ToString() != "N/A") { strColumnas = "<div class='col-md-3'>"; if (columna > 0) { componentes = strRows + strColumnas + componentes + "<input id='che" + dt.Rows[i]["id_menu"] + "' name='radios' checked class='checkbox' type='checkbox' value='" + dt.Rows[i]["id_menu"] + "' /> " + dt.Rows[i]["Nombre"] + "</div>"; } else { componentes = strRows + strColumnas + componentes + "<input id='che" + dt.Rows[i]["id_menu"] + "' name='radios' checked class='checkbox' type='checkbox' value='" + dt.Rows[i]["id_menu"] + "' /> " + dt.Rows[i]["Nombre"] + "</div>"; } } else { strColumnas = "<div class='col-md-3'style='height:50px' >"; if (columna > 0) { componentes = strRows + strColumnas + componentes + " <input id='che" + dt.Rows[i]["id_menu"] + "' name='radios' class='css-checkbox' type='checkbox' value='" + dt.Rows[i]["id_menu"] + "' /> <label for='che" + dt.Rows[i]["id_menu"] + "' name='che" + dt.Rows[i]["id_menu"] + "' class='css-label'>" + dt.Rows[i]["Nombre"] + "</label> </div> "; } else { componentes = strRows + strColumnas + componentes + " <input id='che" + dt.Rows[i]["id_menu"] + "' name='radios' class='css-checkbox' type='checkbox' value='" + dt.Rows[i]["id_menu"] + "' /> <label for='che" + dt.Rows[i]["id_menu"] + "' name='che" + dt.Rows[i]["id_menu"] + "' class='css-label'>" + dt.Rows[i]["Nombre"] + "</label> </div> "; } } if (columna < 3) { columna++; } else { componentes = componentes + "</div>"; columna = 0; } i++; cadena = cadena + componentes; componentes = ""; } } return(cadena); }
public static string ElementosAMostrar(string nomina) { int i = 0; string query; DataTable dt, dtw, dt1; BasedeDatos bd = new BasedeDatos(); string json = ""; string ambiente = System.Configuration.ConfigurationManager.AppSettings["Ambiente"]; string Mensaje = ""; query = "sp_saca_informacion_del_empleado '" + nomina + "'"; dt = bd.getQuery(conexionBecariosestatico, query); if (dt.Rows.Count > 0) { if (dt.Rows[0]["Mensaje"].ToString() == "Ok")//El empleado esta { Mensaje = "Ok"; json = Empleadosformarcion(nomina, Mensaje); } else //El empleado no esta en la base de datos lo agregamos desde el ws { if (ambiente == "pprd")//Ambiente de pruebas { dtw = informacionEmpleado_pruebas(nomina); if (dtw.Rows[0]["Nomina"].ToString() != "Nada") { //Guardamos el empleado en la base de datos int campus = int.Parse(dtw.Rows[0]["Campus"].ToString().Trim()); query = "sp_inserta_nomina_directa_nuevo '" + formatoEscritura(dtw.Rows[0]["Nomina"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Nombres"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Apaterno"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Amaterno"].ToString()) + "','" + dtw.Rows[0]["Correo"].ToString().Trim() + "','" + formatoEscritura(dtw.Rows[0]["Divicion"].ToString()) + "','" + dtw.Rows[0]["UFisica"].ToString() + "','" + formatoEscritura(dtw.Rows[0]["Puesto"].ToString()) + "','" + campus + "','" + dtw.Rows[0]["Extencion"].ToString() + "','" + dtw.Rows[0]["Estatus"].ToString().Trim() + "','" + formatoEscritura(dtw.Rows[0]["Departamento"].ToString()) + "'," + dtw.Rows[0]["Grupo"].ToString().Trim() + "," + dtw.Rows[0]["Area"].ToString().Trim() + ""; dt1 = bd.getQuery(conexionBecariosestatico, query); if (dt1.Rows.Count > 0) { switch (dt1.Rows[0]["Mensaje"].ToString()) { case "Ok": //insertamos el emplado en con el rol solicitante query = "sp_agregar_rol_nomina_solicitante " + nomina + ""; dt = bd.getQuery(conexionBecariosestatico, query); if (dt.Rows.Count > 0) { if (dt.Rows[0]["Mensaje"].ToString() == "Ok") { Mensaje = "Ok"; json = Empleadosformarcion(nomina, Mensaje); } } break; case "Existe": break; default: Mensaje = dt1.Rows[0]["Mensaje"].ToString(); json = Empleadosformarcion("", Mensaje); //Solamente mandamos el mensaje error break; } } } } if (ambiente == "prod")//Ambiente de produccion { string aquivama = "aqui tiene que ir istaladao el ws de produccion"; dtw = informaciónEmpleado_produccion(nomina); if (dtw.Rows[0]["Nomina"].ToString() != "Nada") { //Guardamos el empleado en la base de datos int campus = int.Parse(dtw.Rows[0]["Campus"].ToString().Trim()); query = "sp_inserta_nomina_directa_nuevo '" + formatoEscritura(dtw.Rows[0]["Nomina"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Nombres"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Apaterno"].ToString()) + "','" + formatoEscritura(dtw.Rows[0]["Amaterno"].ToString()) + "','" + dtw.Rows[0]["Correo"].ToString().Trim() + "','" + formatoEscritura(dtw.Rows[0]["Divicion"].ToString()) + "','" + dtw.Rows[0]["UFisica"].ToString() + "','" + formatoEscritura(dtw.Rows[0]["Puesto"].ToString()) + "','" + campus + "','" + dtw.Rows[0]["Extencion"].ToString() + "','" + dtw.Rows[0]["Estatus"].ToString().Trim() + "','" + formatoEscritura(dtw.Rows[0]["Departamento"].ToString()) + "'," + dtw.Rows[0]["Grupo"].ToString().Trim() + "," + dtw.Rows[0]["Area"].ToString().Trim() + ""; dt1 = bd.getQuery(conexionBecariosestatico, query); if (dt1.Rows.Count > 0) { switch (dt1.Rows[0]["Mensaje"].ToString()) { case "Ok": //insertamos el emplado en con el rol solicitante query = "sp_agregar_rol_nomina_solicitante " + nomina + ""; dt = bd.getQuery(conexionBecariosestatico, query); if (dt.Rows.Count > 0) { if (dt.Rows[0]["Mensaje"].ToString() == "Ok") { Mensaje = "Ok"; json = Empleadosformarcion(nomina, Mensaje); } } break; case "Existe": break; default: Mensaje = dt1.Rows[0]["Mensaje"].ToString(); json = Empleadosformarcion("", Mensaje); //Solamente mandamos el mensaje error break; } } } } } } return(json); }
public static string CampusDetalle(string Campus, string Periodo) { string body = ""; ReporteTotales obj = new ReporteTotales(); BasedeDatos db = new BasedeDatos(); obj.query = "sp_Reportes_Totales_Filtro_Por_Campus '" + Campus + "'"; if (Periodo != "" && Periodo != "0") { obj.query += " '" + Periodo + "' "; } try { obj.dt = db.getQuery(obj.conexionBecarios, obj.query); if (obj.dt.Rows.Count > 0) { body += "<center><b>Solicitantes<b></center><table class='table' id='dtTable'>"; body += " <thead><tr><th>Nómina</th><th>Nombre</th><th>Periodo</th><th>Solicitud</th><th>Fecha de Solicitud</th><th>Estatus</th><th>Tipo</th></tr></thead><tbody>"; foreach (DataRow Res in obj.dt.Rows) { body += "<tr>"; body += "<td>" + Res["Nomina"] + "</td>"; body += "<td>" + Res["Nombre"] + "</td>"; body += "<td>" + Res["Periodo"] + "</td>"; body += "<td>" + Res["id_MiSolicitud"] + "</td>"; body += "<td>" + Res["Fecha_solicitud"].ToString().Substring(0, 10) + "</td>"; body += "<td>" + Res["Solicitud_estatus"] + "</td>"; body += "<td>" + Res["Tipo"] + "</td>"; body += "</tr>"; } body += " </tbody><tfoot><tr><th>Nomina</th><th>Nombre</th><th>Periodo</th><th>Solicitud</th><th>Fecha de Solicitud</th><th>Estatus</th><th>Tipo</th></tr></tfoot></table>"; } else { body += "<div class='alert alert-warning text-center'><b>Sin solicitantes</b></div>"; } obj.query = "sp_Reportes_Totales_Filtro_Por_Campus_Becario '" + Campus + "'"; if (Periodo != "" && Periodo != "0") { obj.query += " '" + Periodo + "' "; } obj.dt = db.getQuery(obj.conexionBecarios, obj.query); if (obj.dt.Rows.Count > 0) { body += "<center><b>Becarios<b></center><table class='table' id='dtTable2'>"; body += " <thead><tr><th>Matrícula</th><th>Nombre</th><th>Calificación</th><th>Programa</th><th>Nivel</th></tr></thead><tbody>"; foreach (DataRow Res in obj.dt.Rows) { body += "<tr>"; body += "<td>" + Res["Matricula"] + "</td>"; body += "<td>" + Res["Nombre"] + "</td>"; body += "<td>" + Res["Becario_calificacion"] + "</td>"; body += "<td>" + Res["Nombre_programa_academico"] + "</td>"; body += "<td>" + Res["Nivel_academico"] + "</td>"; body += "</tr>"; } body += " </tbody><tfoot><tr><th>Matrícula</th><th>Nombre</th><th>Calificación</th><th>Programa</th><th>Nivel</th></tr></tfoot></table>"; } else { body += "<div class='alert alert-warning text-center'><b>Sin Becarios</b></div>"; } }catch (Exception ex) { return(ex.Message); } return(body); }
static void Main(string[] args) { Seguridad s = new Seguridad(); string usuario = ""; string contrasena = ""; Console.Clear(); Console.WriteLine(" ============================================================="); Console.WriteLine(" ========== Area de Acceso al Sistema de la Empresa =========="); Console.WriteLine(" ============================================================="); Console.Write(""); Console.Write(" Ingrese Usuario: "); Console.ForegroundColor = ConsoleColor.DarkYellow; usuario = Console.ReadLine(); Console.Write(""); Console.ForegroundColor = ConsoleColor.White; Console.Write(" Ingrese Contraseña: "); Console.ForegroundColor = ConsoleColor.DarkYellow; contrasena = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" ============================================================="); if (s.Autenticador(usuario, contrasena)) { BasedeDatos Bases = new BasedeDatos(); string opcion1 = " "; string opcion2 = " "; string opcion3 = " "; while (true) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Clear(); Console.WriteLine(" BIENVENIDO AL SISTEMA DE FACTURACION DE FERRETARIA LA CONFIANZA "); Console.WriteLine(" Le saluda Douglas Aguilera, Gerente de la Ferreteria "); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(" Presione cualquier tecla y siga las instrucciones... "); Console.BackgroundColor = ConsoleColor.Black; Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" ||=======================================================|| "); Console.WriteLine(" || || "); Console.WriteLine(" ||-----------------FERRETERIA LA CONFIANZA---------------|| "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" ||-----------Sistema de Ventas e Informacion-------------|| "); Console.WriteLine(" ||=======================================================|| "); Console.WriteLine(" || || "); Console.WriteLine(" || ¿Qué opcion desea ingresar? || "); Console.WriteLine(" || || "); Console.WriteLine(" || 1 - Facturación || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || 2 - Lista de Clientes || "); Console.WriteLine(" || 3 - Lista de Vendedores || "); Console.WriteLine(" || 4 - Control de Inventario || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || || "); Console.WriteLine(" || 0 - Salida del Sistema || "); Console.WriteLine(" || || "); Console.WriteLine(" ||=======================================================|| "); opcion1 = Console.ReadLine(); Console.Clear(); if (opcion1 == "1") { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine(" ==============================================================="); Console.WriteLine(" ===========Ingrese la opcion a la que desea acceder:==========="); Console.WriteLine(" ==============================================================="); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" 1- Crear una Factura (Venta)"); Console.WriteLine(" 2 - Revisar las facturas Existentes"); Console.ForegroundColor = ConsoleColor.DarkYellow; opcion2 = Console.ReadLine(); Console.Clear(); switch (opcion2) { case "1": Bases.CrearVenta(); break; case "2": Bases.CantidadVentas(); break; default: break; } } else if (opcion1 == "2") { Bases.DatosClientes(); } else if (opcion1 == "4") { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" ==============================================================="); Console.WriteLine(" ===========Ingrese la opcion a la que desea acceder:==========="); Console.WriteLine(" ==============================================================="); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" 1- Añadir Producto al Inventario"); Console.WriteLine(" 2 - Eliminar Producto del Inventario"); Console.WriteLine(" 3 - Revisar Lista de Inventario"); opcion3 = Console.ReadLine(); Console.Clear(); switch (opcion3) { case "1": Bases.ingresoDeInventario(); break; case "2": Bases.salidaDeInventario(); break; case "3": Bases.DatosProductos(); break; default: break; } } else if (opcion1 == "3") { Bases.DatosVendedores(); } else if (opcion1 == "0") { Environment.Exit(0); } } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" ¡Acceso Denegado! "); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.ReadLine(); } }