private void Save_Ticket_Advance(string id_tiquete = "", string type = "", string comentario = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); UserController uc = new UserController(); string userName = uc.Get_User_By_Id(SessionHelper.GetUser()).login_name; DateTime now = DateTime.Now; string hour = DateTime.Now.ToString("HH:mm"); try { INV_GARV iv = new INV_GARV() { CIA = "003", NUM_DOC_GARANTIA = id_tiquete, FECHA = now, HORA = hour, DETALLE1 = type, DETALLE2 = "Realizado desde el sistema S.G.A", DETALLE3 = userName, CONFIDENCIAL = comentario }; connection.INV_GARV.Add(iv); connection.SaveChanges(); } catch (Exception e) { Generate_Exception("Error " + e); } }
public DataTable Actividades(int Op, int Id_Actividad, String Nombre, String Descripcion, int Id_Modulo) { SqlParameter _Op = new SqlParameter("@Op", SqlDbType.Int); _Op.Value = Op; SqlParameter _Id_Actividad = new SqlParameter("@Id_Actividad", SqlDbType.Int); _Id_Actividad.Value = Id_Actividad; SqlParameter _Nombre = new SqlParameter("@Nombre", SqlDbType.VarChar); _Nombre.Value = Nombre; SqlParameter _Descripcion = new SqlParameter("@Descripcion", SqlDbType.VarChar); _Descripcion.Value = Descripcion; SqlParameter _Id_Modulo = new SqlParameter("@Id_Modulo", SqlDbType.Int); _Id_Modulo.Value = Id_Modulo; SqlParameter[] Parametros = { _Op, _Id_Actividad, _Nombre, _Descripcion, _Id_Modulo }; DataTable respuesta = null; using (SqlConnection conn = new SqlConnection(SqlConecction)) { respuesta = new BDConnection(SqlConecction).runStoredPrcDt(Parametros, conn, "JR_crud_actividades", 300000); } return(respuesta); }
public List <Inventory_Movement> Get_Movements_By_Id_Ticket(string Id_Ticket = "0") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); Inicialice_Controllers(); List <Inventory_Movement> list_movements = null; //en caso de que sea un campo diferente cambiar le adi8 var model = (from movi in connection.INV_MOV1 where movi.CIA == "003" && movi.ADI7 == Id_Ticket && movi.NULO != "S" select movi).ToList(); if (model.Count > 0) { list_movements = new List <Inventory_Movement>(); foreach (var movement in model) { Inventory_Movement Inv_mov = new Inventory_Movement { id = (int)movement.CONSECUTIVO, num_move = movement.NUM_DOC, type = movement.COD_TIPO }; Inv_mov.products_list = pcontroller.Get_Products_By_Mov(Inv_mov.num_move); list_movements.Add(Inv_mov); } } return(list_movements); }
public ActionResult Login(FormCollection collection = null) { BDConnection.Get_Connection(); if (collection != null) { string userName = collection["nombre"]; string password = collection["password"]; string mjs = "mensaje"; if (userName != null && password != null) { mjs = Validate_User(userName, password); if (mjs == "Succesful") { Start_Session(userName, password); return(RedirectToAction("Index", "Dashboard")); } else { ViewBag.Error = "Credenciales incorrectas"; ViewBag.Exception = mjs; } } } return(View()); }
public string[] Validate(BE_Propiedades.BE_Users user) { var bdc = new BDConnection(); string query = "SELECT * From Users WHERE UserName = '******'"; return(bdc.Select(query)); }
public List <Product> Products_Log_Ticket(string id_ticket = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); if (id_ticket != "") { var data = (from state in connection.SGA_ESTADO_PRODUCTOS join prod in connection.INV_PROD on new { x = "003", y = state.COD_PROD } equals new { x = prod.CIA, y = prod.COD_PROD } join seri in connection.INV_MOVS on state.SERIE_CONSECUTIVO equals seri.CONSECUTIVO where state.ID_BOLETA == id_ticket select new Product { id = state.ID, cod_prod = state.COD_PROD, serial_number = seri.SERIE, description = prod.NOMBRE_1, state = state.ESTADO, action = state.ACCION != null ? state.ACCION: "N/A", category = prod.NOTAS, serial_2 = seri.NOTAS }); if (data != null || data.Count() > 0) { return(data.ToList()); } } return(new List <Product>()); }
private Serial Get_Serial_By_Id(string serial_p = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from serial in connection.INV_MOVS join mov in connection.INV_MOV1 on new { x = serial.CIA, y = serial.NUM_DOC, z = serial.COD_TIPO } equals new { x = mov.CIA, y = mov.NUM_DOC, z = mov.COD_TIPO } join product in connection.INV_PROD on new { x = serial.CIA, y = serial.COD_PROD } equals new { x = product.CIA, y = product.COD_PROD } where serial.CIA == "003" && serial.SERIE.Trim() == serial_p orderby serial.CONSECUTIVO descending select new Serial { id = serial.CONSECUTIVO.ToString(), serial = serial.SERIE, state = serial.COD_TIPO == "01" ? "Compra" : serial.COD_TIPO == "02" ? "Salida para instalación" : serial.COD_TIPO == "03" ? "Entrada por retiro" : serial.COD_TIPO == "04" ? "Salida para repuesto" : serial.COD_TIPO == "05" ? "Entrada equipo de repuesto" : serial.COD_TIPO == "06" ? "Salida a desecho" : "No dispobible", date = mov.FECHA_DIG, other = mov.USUARIO, product_name = product.NOMBRE_1, physical_state = serial.COD_TIPO.Contains("01") ? "Nueva" : "Usada" }).Take(1); return(model.FirstOrDefault()); }
public TicketLog Get_Log_Ticket_By_Id(string id_ticket = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); if (id_ticket != "") { var model = (from log in connection.SGA_BITACORA_TICKET where log.ID_TICKET == id_ticket select new TicketLog { id = log.ID_TICKET, date = log.FECHA_DIG.Value, type_string = log.TIPO_MOVIMIENTO == "I" ? "INSTALACION" : log.TIPO_MOVIMIENTO == "V" ? "VISITA" : log.TIPO_MOVIMIENTO == "R" ? "RETIRO" : "N/A", damage = log.AVERIA_REPORTADA.Replace("\r\n", string.Empty), diagnostic = log.DIAGNOSTICO.Replace("\r\n", string.Empty), solution = log.SOLUCION.Replace("\r\n", string.Empty), others = log.OTROS, extra_1 = log.EXTRA_1, extra_2 = log.EXTRA_2, extra_3 = log.EXTRA_3, equipment_exposition = log.EXPOSICION_EQUIPO, equipment_exposition_2 = log.EXPOSICION_EQUIPO_2, mainmaintenance = log.MANTENIMIENTO, tests = log.PRUEBAS, connetion = log.TIPO_CONEXION, instalation_detaill = log.DETALLE_INSTALACION, visit_equipment_exposition = log.EXPOSICION_EQUIPO_VISITA }).FirstOrDefault(); return(model); } return(null); }
public JsonResult Update_Client(string id_client = null) { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); string mjs = ""; if (id_client != null) { var model = (from client in connection.SGA_AFILIADOS where client.N_AFILIADO == id_client select client); foreach (SGA_AFILIADOS client in model) { client.ACTUALIZADO = true; } try { connection.SaveChanges(); mjs = "Successful"; } catch (Exception e) { mjs = "Error " + e; } } return(Json(mjs)); }
//cambia el estatus del tiquetem puede cambiar a R = revisado o E = cerrado private string Change_Status_Ticket(string id_ticket = "", string status = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); string mjs = ""; if (id_ticket != "") { var model = (from ticket in connection.INV_GARA where ticket.NUM_DOC_GARANTIA == id_ticket && ticket.CIA == "003" select ticket); foreach (INV_GARA tickets in model) { tickets.STATUS = status; } try { connection.SaveChanges(); mjs = "Succesfull"; } catch (Exception e) { mjs = "Error " + e; Generate_Exception(mjs); } } return(mjs); }
//ultimos 10 revisados o cerrados private List <Ticket> Get_Last_10() { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); DateTime dateError = new DateTime(); var model = (from ticket in connection.INV_GARA where ticket.CIA == "003" && (ticket.STATUS == "E" || ticket.STATUS == "R") orderby ticket.NUM_DOC_GARANTIA descending select new Ticket { id = ticket.NUM_DOC_GARANTIA, date = ticket.FECHA_INGRESO, user = ticket.USUARIO, status = ticket.STATUS, technical = ticket.TECNICO, ticket_cred = ticket.PROBLEMA_2, membership_number = ticket.N_AFILIADO, contact = ticket.NOTA_1, local_name = ticket.CONTACTO, phone = ticket.TELEFONO, problem = ticket.PROBLEMA_1, province = ticket.N_COD_PROV, canton = ticket.N_COD_CANT, district = ticket.N_COD_DIST, address = ticket.N_DIRECCION, visit_date = ticket.N_FECHA_P != null ? ticket.N_FECHA_P.Value : dateError, type = ticket.TIPO_EVENTO == "I" ? "INSTALACION" : ticket.TIPO_EVENTO == "V" ? "VISITA" : ticket.TIPO_EVENTO == "R" ? "RETIRO" : "N/A" }).Take(10); return(model.ToList()); } //revisar excepciones
//se obtienens los tiquetes por numero de afiliado public List <Ticket> Get_Tickets_By_Client(string N_AFILIADO2 = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from ticket in connection.F_TICKETS_AFILIADO(N_AFILIADO2) orderby ticket.FECHA select new Ticket { id = ticket.ID, date = ticket.FECHA.Value, user = ticket.USUARIO, status = ticket.ESTATUS, technical = ticket.TECNICO, membership_number = ticket.N_AFILIADO, contact = ticket.CONTACTO, local_name = ticket.LOCAL_N, phone = ticket.TELEFONO, problem = ticket.PROBLEMA, province = ticket.PROVINCIA, canton = ticket.CANTON, district = ticket.DISTRITO, address = ticket.DIRECCION, visit_date = ticket.FECHA.Value, type = ticket.TIPO }).ToList(); if (model.Count > 0) { return(model); } return(null); }
//se obtienen los tiquetes por codigo de tecnico public List <Ticket> Get_Tickets_By_Technical(string code = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); DateTime dateError = new DateTime(); var model = (from ticket in connection.INV_GARA join tecnico in connection.INV_TECN on new { x = "003", y = ticket.TECNICO } equals new { x = tecnico.CIA, y = tecnico.COD_TECN } into ntenico from tecnico in ntenico.DefaultIfEmpty() where ticket.CIA == "003" && ticket.TECNICO == code && ticket.FECHA_INGRESO >= fecha select new Ticket { date = ticket.FECHA_INGRESO, ticket_cred = ticket.PROBLEMA_2, user = ticket.USUARIO, status = ticket.STATUS, technical = tecnico.DES_TECN == null ? "No Asignado" : tecnico.DES_TECN, membership_number = ticket.N_AFILIADO, contact = ticket.NOTA_1, local_name = ticket.CONTACTO, phone = new String(ticket.TELEFONO.Take(18).ToArray()), problem = ticket.PROBLEMA_1, province = ticket.N_COD_PROV, canton = ticket.N_COD_CANT, district = ticket.N_COD_DIST, address = ticket.N_DIRECCION, visit_date = ticket.N_FECHA_P != null ? ticket.N_FECHA_P.Value : dateError, type = ticket.TIPO_EVENTO == "I" ? "INSTALACION" : ticket.TIPO_EVENTO == "V" ? "VISITA" : ticket.TIPO_EVENTO == "R" ? "RETIRO" : "N/A" }); return(model.ToList()); }
//se obtiene el desgloce del tiquete a partir del id private Ticket Get_Details_Ticket(string id_ticket = "0") { DateTime dateError = new DateTime(); BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from ticket in connection.INV_GARA join tecnico in connection.INV_TECN on new { x = "003", y = ticket.TECNICO } equals new { x = tecnico.CIA, y = tecnico.COD_TECN } into ntenico from tecnico in ntenico.DefaultIfEmpty() where ticket.CIA == "003" && ticket.NUM_DOC_GARANTIA == id_ticket.Trim() select new Ticket { id = ticket.NUM_DOC_GARANTIA, ticket_cred = ticket.PROBLEMA_2, type = (ticket.TIPO_EVENTO == "I" ? "INSTALACION" : ticket.TIPO_EVENTO == "V" ? "VISITA" : ticket.TIPO_EVENTO == "R" ? "RETIRO" : "N/A"), date = ticket.FECHA_INGRESO, user = ticket.USUARIO, status = (ticket.STATUS == "E" ? "CERRADO": ticket.STATUS == "P" ? "PENDIENTE": ticket.STATUS == "R" ? "ATENDIDO" : "N/A"), technical = tecnico.DES_TECN == null ? "No Asignado" : tecnico.DES_TECN, membership_number = ticket.N_AFILIADO, problem = ticket.PROBLEMA_1, address = ticket.N_DIRECCION, visit_date = ticket.N_FECHA_P != null ? ticket.N_FECHA_P.Value : dateError, hour_programmed = ticket.N_HORA_P }).FirstOrDefault(); return(model); }
private string Insert_State_Products(string id_boleta, List <Product> product_list) { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); string result = "Success"; DateTime now = DateTime.Now; foreach (var product in product_list) { SGA_ESTADO_PRODUCTOS estado = new SGA_ESTADO_PRODUCTOS() { COD_PROD = product.cod_prod, SERIE_CONSECUTIVO = product.id, ESTADO = product.state, ID_BOLETA = id_boleta, FECHA = now, ACCION = product.action }; connection.SGA_ESTADO_PRODUCTOS.Add(estado); } try { connection.SaveChanges(); result = "Success"; } catch (Exception e) { result = "Error " + e; Generate_Exception(result); } return(result); }
//this regions is use to create the calls to the database //Get the last 10 register clients public List <Client> Get_List_Clients() { int amount = 10; BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); try{ var model = (from client in connection.SGA_AFILIADOS join province in connection.WEB_Provincia on client.N_COD_PROV equals province.idProvincia join canton in connection.WEB_Canton on(client.N_COD_PROV + client.N_COD_CANT).Trim() equals canton.idCanton join distrito in connection.WEB_Distrito on(client.N_COD_PROV + client.N_COD_CANT + client.N_COD_DIST).Trim() equals distrito.idDistrito orderby client.ID descending select new Client { id = client.ID, membership_number = client.N_AFILIADO, local_name = client.NOMBRE_NEGOCIO, contact = client.NOMBRE, phone = client.TELEFONO, province = province.nombreProvincia, canton = canton.nombreCanton, district = distrito.nombreDistrito, address = client.DIRECCION_1, updated = client.ACTUALIZADO.Value, status = client.ACTIVO.Value, status_varchar = client.ESTATUS }).Take(amount); return(model.ToList()); } catch (Exception e) { Generate_Exception("Error " + e); throw e; } }
private bool Change_Serial_Query(List <Changed_Serial> list = null) { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); bool success = true; UserController uc = new UserController(); string userName = uc.Get_User_By_Id(SessionHelper.GetUser()).login_name; if (list != null) { foreach (var serial in list) { Write_Serial_Log(3, serial.old_serial, serial.new_serial, "", userName); int consecutive = serial.consecutive; var query = (from seri in connection.INV_MOVS where seri.CONSECUTIVO == consecutive select seri); foreach (INV_MOVS movi in query) { movi.NOTAS = serial.old_serial.Trim(); movi.SERIE = serial.new_serial.Trim(); } try { connection.SaveChanges(); } catch (Exception e) { success = false; string result = "Error " + e; Generate_Exception(result); } } } return(success); }
// get the cliets by parameters private List <Client> Get_Client_By_Parametres(string BUSQUEDA = "", string PARAMETRO = "", string ESTATUS = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from client in connection.F_BUSQUEDA_AFILIADO(BUSQUEDA, PARAMETRO, ESTATUS) select new Client { id = client.ID.Value, membership_number = client.N_AFILIADO, local_name = client.NOMBRE_NEGOCIO, contact = client.NOMBRE, phone = client.TELEFONO, address = client.DIRECCION_1, province = client.N_COD_PROV == null ? "": client.N_COD_PROV, canton = client.N_COD_CANT == null ? "": client.N_COD_CANT, district = client.N_COD_DIST == null ? "": client.N_COD_DIST, updated = client.ACTUALIZADO.Value, status = client.ACTIVO.Value, status_varchar = client.ACTIVO_V }).DefaultIfEmpty(); if (model != null) { return(model.ToList()); } return(null); }
private void Write_Serial_Log(int type = 0, string serial1 = "", string serial2 = "", string num_ticket = "", string responsable = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); if (serial1 != "") { string detail = Utilities.Msj_Log_Serial(type, serial1, serial2); DateTime now = DateTime.Now; SGA_BITACORA_SERIE log = new SGA_BITACORA_SERIE() { SERIAL = serial1, DETALLE = detail, FECHA = now, NUM_TICKET = num_ticket, RESPONSABLE = responsable }; connection.SGA_BITACORA_SERIE.Add(log); } try { connection.SaveChanges(); } catch (Exception e) { Generate_Exception("Error " + e); } }
public Client Get_Client_By_Membership_Number(string ID_Number = "0") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); DateTime now = DateTime.Now; var model = (from client in connection.SGA_AFILIADOS join province in connection.WEB_Provincia on client.N_COD_PROV equals province.idProvincia into provusr from province in provusr.DefaultIfEmpty() join canton in connection.WEB_Canton on(client.N_COD_PROV + client.N_COD_CANT).Trim() equals canton.idCanton into cantusr from canton in cantusr.DefaultIfEmpty() join distrito in connection.WEB_Distrito on(client.N_COD_PROV + client.N_COD_CANT + client.N_COD_DIST).Trim() equals distrito.idDistrito into distusr from distrito in distusr.DefaultIfEmpty() where client.N_AFILIADO == ID_Number select new Client { id = client.ID, membership_number = client.N_AFILIADO, local_name = client.NOMBRE_NEGOCIO, contact = client.NOMBRE, phone = client.TELEFONO, address = client.DIRECCION_1, province = province.nombreProvincia != null ? province.nombreProvincia: "N/A", canton = canton.nombreCanton != null ? canton.nombreCanton: "N/A", district = distrito.nombreDistrito != null ? distrito.nombreDistrito: "N/A", updated = client.ACTUALIZADO.Value, status = client.ACTIVO.Value, last_membership = client.ANTIGUO_N_AFILIADO == null ? "N/A" : client.ANTIGUO_N_AFILIADO, changed = client.FECHA_CREACION == null ? now : client.FECHA_CREACION.Value, new_menbership = client.EXTRA_1 == null ? "N/A" : client.EXTRA_1, status_varchar = client.ESTATUS }).FirstOrDefault(); return(model); }
public List <Product_Movement> Get_Product_Movements(DateTime?F_INICIO = null, DateTime?F_FIN = null, string CATEGORIA = "", string MOVEMENTS = "") { string CIA = "003"; BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from movement in connection.F_MOVIMIENTOS_POR_PRODUCTOS(CIA, F_INICIO, F_FIN, CATEGORIA, MOVEMENTS) select movement).ToList(); List <Product_Movement> list = new List <Product_Movement>(); foreach (var movement in model) { Product product = new Product { cod_prod = movement.COD_PROD, category = movement.CATEGORIA, description = movement.PRODUCTO, serial_number = movement.SERIE }; Product_Movement pv = new Product_Movement { date_movement = movement.FECHA_MOVI.Value, local_name = movement.NEGOCIO, membership_number = movement.AFILIADO, num_doc = movement.NUM_DOC, type_movement = movement.TIPO, product = product }; list.Add(pv); } return(list); }
public List <Changed_Client> Get_List_Change_Client(DateTime?f_inifio = null, DateTime?f_fin = null) { if (f_inifio != null && f_fin != null) { try { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from cambio in connection.SGA_CAMBIO_AFILIADO join old_client in connection.SGA_AFILIADOS on cambio.ANTIGUO_AFILIADO equals old_client.N_AFILIADO into old_change from old_client in old_change.DefaultIfEmpty() join new_client in connection.SGA_AFILIADOS on cambio.NUEVO_AFILIADO equals new_client.N_AFILIADO into new_change from new_client in new_change.DefaultIfEmpty() where cambio.FECHA >= f_inifio && cambio.FECHA <= f_fin select new Changed_Client { old_membership = old_client.N_AFILIADO, old_local_name = old_client.NOMBRE_NEGOCIO, new_membership = new_client.N_AFILIADO, new_local_name = new_client.NOMBRE_NEGOCIO, address = new_client.DIRECCION_1, reference = new_client.EXTRA_2, date = cambio.FECHA }).ToList(); return(model); } catch (Exception e) { string mjs = "Error " + e; Generate_Exception(mjs); } } return(new List <Changed_Client>()); }
public bool Delete(BE_Propiedades.BE_Users user) { var bdc = new BDConnection(); string query = "EXEC [DeleteUser] @User = N'" + user.UserName + "'"; return(bdc.Insert(query)); }
public List <Client> Get_Membership_Without_Mainteinance(string MESES = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); try { var model = (from client in connection.F_SGA_AFILIADOS_SIN_MANTENIMIENTO(MESES) select new Client { membership_number = client.N_AFILIADO, name = client.NOMBRE, address = client.DIRECCION, local_name = client.NEGOCIO, phone = client.TELEFONO, province = client.PROVINCIA, canton = client.CANTON, district = client.DISTRITO }).ToList(); return(model); } catch (Exception e) { Generate_Exception("Error " + e); } return(new List <Client>()); }
public bool Insert(BE_Propiedades.BE_Users user) { var bdc = new BDConnection(); string query = "EXEC [InsertUser] @UserN = N'" + user.UserName + "', @Pass = N'" + user.PassWord + "'"; return(bdc.Insert(query)); }
public JsonResult Change_Client_Status_Client(string id_client = null, string estatus = "") { bool status = (estatus == "A" || estatus == "R" || estatus == "L" || estatus == "X") ? true : false; /* A = ACTIVO * I = INACTIVO * L=LEGAL * R=RETIRO * I = INACTIVO*/ BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); string mjs = ""; if (id_client != null) { var model = (from client in connection.SGA_AFILIADOS where client.N_AFILIADO == id_client select client); foreach (SGA_AFILIADOS client in model) { client.ACTIVO = status; client.FECHA_INACTIVACION = DateTime.Now; client.ESTATUS = estatus; } try { connection.SaveChanges(); mjs = "Successful"; } catch (Exception e) { mjs = "Error " + e; Generate_Exception(mjs); } } return(Json(mjs)); }
public DataTable Modulos(int id, int tipo, String nombre, String descripcion, int tipomodulo) { SqlParameter ID = new SqlParameter("@idmodulo", SqlDbType.VarChar); ID.Value = id; SqlParameter TIPO = new SqlParameter("@tipo", SqlDbType.VarChar); TIPO.Value = tipo; SqlParameter NOMBRE = new SqlParameter("@nombre", SqlDbType.VarChar); NOMBRE.Value = nombre; SqlParameter DESCRIPCION = new SqlParameter("@descripcion", SqlDbType.VarChar); DESCRIPCION.Value = nombre; SqlParameter IDTIPOMODULO = new SqlParameter("@idtipomodulo", SqlDbType.VarChar); IDTIPOMODULO.Value = tipomodulo; SqlParameter[] Parametros = { ID, TIPO, NOMBRE, DESCRIPCION, IDTIPOMODULO }; DataTable respuesta = null; using (SqlConnection conn = new SqlConnection(SqlConecction)) { respuesta = new BDConnection(SqlConecction).runStoredPrcDt(Parametros, conn, "FC_CRUD_Modulos", 5000); } return(respuesta); }
public static void hacerQuery(string query, ref DataGridView dataGrid) { BDConnection conn = new BDConnection(); DataTable dt = conn.cargarTablaSQL(query); try { if (dataGrid.DataSource != null) { dataGrid.Columns.Remove("seleccionar"); } } catch { //El unico caso donde va a tirar error es si no lo encuentra, entonces //es lo mismo que no haga nada } dataGrid.DataSource = dt; if (dt.Rows.Count == 0) { MessageBox.Show("No se han encontrado resultados en la consulta", "Falló la busqueda", MessageBoxButtons.OK); dataGrid.DataSource = null; } else { dataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; dataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; } dataGrid.AllowUserToAddRows = false; }
private List <Product_Inventory> Get_Inventory_By_Search(string MES = "", string ANO = "", string PARAMETRO = "", string P_CONSULTA = "") { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from product in connection.F_INVENTARIO_CREDOMATIC_TEST(MES, ANO, PARAMETRO, P_CONSULTA) select new Product_Inventory { cod_prod = product.COD_PROD, description = product.DESCRIPCION, balance_start = product.SALDO_INI.Value, balance_end = product.SALDO_FIN.Value, bought = product.COMPRADOS.Value, transfer_entry = product.ENTRADA_TRASPASO != null ? product.ENTRADA_TRASPASO.Value : 0, transfer_egress = product.SALIDA_TRASPASO != null ? product.SALIDA_TRASPASO.Value : 0, installed = product.INSTALADOS.Value, visit_entry = product.ENTRADA_VISITAS != null ? product.ENTRADA_VISITAS.Value : 0, visit_egress = product.SALIDA_VISITAS != null ? product.SALIDA_VISITAS.Value : 0, retired = product.RETIRADOS.Value, retired_in_transit = product.RETIRO_TRANSITO != null ? product.RETIRO_TRANSITO.Value : 0, reconditioned_good = product.REACONDICIONAMIENTO_BUENO != null? product.REACONDICIONAMIENTO_BUENO.Value : 0, reconditioned_missing = product.REACONDICIONAMIENTO_FALTANTE != null ? product.REACONDICIONAMIENTO_FALTANTE.Value : 0, reconditioned_discarted = product.DESECHADO != null ? product.DESECHADO.Value : 0, }).ToList(); return(model); }
public List <Ticket> Get_Closed_Recently(string cod_tec = "", bool filtrar = false, DateTime?date_start = null, DateTime?date_end = null) { BMS_DATA_DENTEntities connection = BDConnection.Get_Connection(); var model = (from ticket in connection.INV_GARA join log in connection.SGA_BITACORA_TICKET on new { x = ticket.CIA, y = ticket.NUM_DOC_GARANTIA.Trim() } equals new { x = "003", y = log.ID_TICKET.Trim() } where ticket.CIA == "003" && (ticket.STATUS == "R" || ticket.STATUS == "E") && (log.FECHA_DIG >= date_start && log.FECHA_DIG <= date_end) && ((filtrar == true && ticket.TECNICO == cod_tec) || filtrar == false) orderby log.FECHA_DIG descending select new Ticket { id = ticket.NUM_DOC_GARANTIA, date = ticket.FECHA_INGRESO, status = ticket.STATUS, membership_number = ticket.N_AFILIADO, contact = ticket.NOTA_1, local_name = ticket.CONTACTO, visit_date = log.FECHA_DIG.Value, type = ticket.TIPO_EVENTO == "I" ? "INSTALACION" : ticket.TIPO_EVENTO == "V" ? "VISITA" : ticket.TIPO_EVENTO == "R" ? "RETIRO" : "N/A" }); return(model.ToList()); }