Пример #1
0
        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);
        }
Пример #2
0
 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>());
 }
Пример #3
0
        //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;
            }
        }
Пример #4
0
        // 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);
        }
Пример #5
0
 public static void Get_Conection()
 {
     if (FrontUser.connection == null)
     {
         FrontUser.connection = new BMS_DATA_DENTEntities();
     }
 }
Пример #6
0
        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));
        }
Пример #7
0
        //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
Пример #8
0
        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);
        }
Пример #9
0
        //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);
        }
Пример #10
0
        //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);
        }
Пример #11
0
        //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());
        }
Пример #12
0
        //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);
        }
Пример #13
0
        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);
            }
        }
Пример #14
0
        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());
        }
Пример #15
0
        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>());
        }
Пример #16
0
        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);
        }
        private bool saveFileInformation(HttpPostedFileBase file, string path, string membershipId, string ticket)
        {
            bool     success  = false;
            string   fileName = file.FileName.Replace(" ", "");
            var      ext      = Path.GetExtension(fileName);
            var      name     = Path.GetFileNameWithoutExtension(fileName);
            DateTime now      = DateTime.Now;

            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();
            SGA_EVIDENCIA_TICKET  evidence   = new SGA_EVIDENCIA_TICKET()
            {
                NAME          = name,
                EXTENSION     = ext,
                PATH          = path,
                MEMBERSHIP_ID = membershipId,
                ID_TICKET     = ticket,
                DATE          = now,
                ACTIVE        = true,
                UPDATED       = null,
                DESCRIPTION   = null
            };

            try
            {
                connection.SGA_EVIDENCIA_TICKET.Add(evidence);
                connection.SaveChanges();
                success = true;
            }
            catch (Exception) {
                success = false;
            }
            return(success);
        }
Пример #18
0
        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);
        }
Пример #19
0
        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);
        }
Пример #20
0
        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());
        }
Пример #21
0
        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>());
        }
Пример #22
0
        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);
            }
        }
Пример #23
0
        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);
        }
Пример #24
0
        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);
        }
Пример #25
0
        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));
        }
Пример #26
0
        public List <string> Get_Product_Category()
        {
            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();
            var model = (from category in connection.SGA_CATEGORY_PRODUCT
                         select category.NOMBRE_CATEGORIA).ToList();

            return(model);
        }
Пример #27
0
        //execute the store procedure that create and change an old membership to new one
        private void Change_Membership_Sp(string OLD_AFILIADO = "", string N_AFILIADO = "", string CONTACTO  = "", string COMERCIO   = "", string TELEFONO = "", string PROVINCIA = "",
                                          string CANTON       = "", string DISTRITO   = "", string DIRECCION = "", string REFERENCIA = "")
        {
            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();

            connection.SGA_CAMBIAR_AFILIADO(OLD_AFILIADO, N_AFILIADO, CONTACTO, COMERCIO, TELEFONO, PROVINCIA, CANTON, DISTRITO, DIRECCION, REFERENCIA);
            connection.SaveChanges();
        }
Пример #28
0
        private List <WEB_Distrito> Get_Distritos()
        {
            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();
            var model = (from distrito in connection.WEB_Distrito
                         orderby distrito.nombreDistrito
                         select distrito).ToList();

            return(model);
        }
Пример #29
0
        private List <WEB_Canton> Get_Cantones()
        {
            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();
            var model = (from canton in connection.WEB_Canton
                         orderby canton.nombreCanton
                         select canton).ToList();

            return(model);
        }
Пример #30
0
        //cantones, distritos y provincias del pais
        private List <WEB_Provincia> Get_Provincias()
        {
            BMS_DATA_DENTEntities connection = BDConnection.Get_Connection();
            var model = (from provincia in connection.WEB_Provincia
                         orderby provincia.nombreProvincia
                         select provincia).ToList();

            return(model);
        }