Esempio n. 1
0
        public void loadSync(object element)
        {
            if (element != null)
            {
                CATEGORIA poco = (CATEGORIA)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.CATEGORIAs
                                 where poco.UNID_CATEGORIA == cust.UNID_CATEGORIA
                                 select cust).ToList();

                    //Actualización
                    if (query.Count > 0)
                    {
                        var aux = query.First();

                        if (aux.LAST_MODIFIED_DATE < poco.LAST_MODIFIED_DATE)
                        {
                            udpateElementSync((object)poco);
                        }
                    }
                    //Inserción
                    else
                    {
                        insertElementSync((object)poco);
                    }

                    var modifiedCategoria = entity.CATEGORIAs.First(p => p.UNID_CATEGORIA == poco.UNID_CATEGORIA);
                    modifiedCategoria.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
        private void agregarBtn_Click(object sender, EventArgs e)
        {
            try
            {
                PRODUCTO  productoEditado = new PRODUCTO();
                CATEGORIA categoria       = new CATEGORIA();

                String nuevaDescripcion = nombreTxt.Text;
                int    nuevoPrecio      = (int)precioSpnr.Value;
                categoria = (CATEGORIA)comboCB.SelectedItem;

                productoEditado.ID_PRODUCTO     = producto.ID_PRODUCTO;
                productoEditado.ID_CATEGORIA    = categoria.ID_CATEGORIA;
                productoEditado.NOMBRE_PRODUCTO = nuevaDescripcion;
                productoEditado.PRECIO_PRODUCTO = nuevoPrecio;

                productoDAL.actualizarProducto(productoEditado);

                this.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        public static void SetStringConfig(String sParametro, CATEGORIA CAT, String sParamValue)
        {
            SqlConnection conn = new SqlConnection(myConfig.ConnectionInfo);

            try
            {
                conn.Open();
                SqlCommand comm = new SqlCommand();
                comm.Connection  = conn;
                comm.CommandText = "update ConfigParams set paramValue = @paramValue where CategoryID = @CategoryID AND paramName = @paramName";
                comm.Parameters.Add("@CategoryID", SqlDbType.Int).Value     = (int)CAT;
                comm.Parameters.Add("@paramName", SqlDbType.VarChar).Value  = sParametro;
                comm.Parameters.Add("@paramValue", SqlDbType.VarChar).Value = sParamValue;

                comm.ExecuteNonQuery();
            }
            catch (System.Exception ex)
            {
                Logger.Instance.LogException(Logger.typeUserActions.SELECT, "could not save param: " + sParamValue + " value:" + sParamValue, "SetStringConfig", ref ex);
            }
            finally
            {
                conn.Close();
            }
        }
 public CatalogCategoriaModel(IDataMapper dataMapper, long unidProv)
 {
     this._dataMapper        = new CategoriaDataMapper();
     this._itemCategoria     = new FixupCollection <DeleteCategoria>();
     this._selectedCategoria = new CATEGORIA();
     this.loadItems(unidProv);
 }
Esempio n. 5
0
    public async Task <ActionResult <List <CATEGORIA> > > Put(int id, [FromBody] CATEGORIA model, [FromServices] DataContext context)
    {
        if (id != model.ID)
        {
            return(NotFound(new { message = "Categoria não encontrada" }));
        }

        if (!ModelState.IsValid)
        {
            return(BadRequest(ModelState));
        }

        try{
            context.Entry <CATEGORIA>(model).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(Ok(model));
        }catch (DbUpdateConcurrencyException)
        {
            return(BadRequest(new { message = "Este registro já foi atualizado" }));
        }catch
        {
            return(BadRequest(new { message = "Não foi possivel atualizar a Categoria" }));
        }
    }
        public IHttpActionResult PostCATEGORIA(CATEGORIA cATEGORIA)
        {
            /* if (!ModelState.IsValid)
             * {
             *   return BadRequest(ModelState);
             * }
             */
            db.CATEGORIA.Add(cATEGORIA);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CATEGORIAExists(cATEGORIA.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = cATEGORIA.Id }, cATEGORIA));
        }
        public string ActualizarCategoria(string nombre, int id)
        {
            try
            {
                CATEGORIA     categoria     = new CATEGORIA();
                CategoriasDAL categoriasDAL = new CategoriasDAL();

                if (nombre.Trim().Length > 1)
                {
                    if (id > 0)
                    {
                        categoria.ID = id;
                        categoria.FECHA_ULTIMO_UPDATE = DateTime.Now;
                        categoria.NOMBRE = nombre;
                        return(categoriasDAL.ActualizarCategoria(categoria));
                    }
                    else
                    {
                        return("Seleccione un registro de la tabla");
                    }
                }
                else
                {
                    return("El nombre debe tener al menos 2 caracteres");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult CategoriaUpdt(CATEGORIA CATEGORIA, HttpPostedFileBase file)
        {
            BLL_Login.VerificarSesionActiva();// valida que la sesion este activa

            ViewBag.Estado = new SelectList(FuncionesEnum.ListaEnum <EnumEstados>(), "Value", "Text", (int)CATEGORIA.Estado);

            if (CATEGORIA != null)
            {
                if (ModelState.IsValid)
                {
                    BLL_Categoria BLL_Categoria = new BLL_Categoria();
                    if (BLL_Categoria.ModificarCategoria(CATEGORIA, file))
                    {
                        return(RedirectToAction("Index", new { Mensaje = "Categoria Modificada con Exito", Creado = "true" }));
                    }
                    else
                    {
                        return(View(CATEGORIA));
                    }
                }
                else
                {
                    return(View(CATEGORIA));
                }
            }
            else
            {
                return(View(CATEGORIA));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Obtiene todos los elementos en la tabla transporte
        /// </summary>
        /// <returns></returns>
        public object getElements_EntradasSalidas(object element)
        {
            object o = null;

            if (element != null)
            {
                CATEGORIA Eprov = (CATEGORIA)element;

                using (var Entity = new TAE2Entities())
                {
                    var res = (from p in Entity.ARTICULOes
                               .Include("MODELO")
                               .Include("MARCA")
                               .Include("EQUIPO")
                               .Include("CATEGORIA")
                               where p.UNID_CATEGORIA == Eprov.UNID_CATEGORIA
                               select p).ToList();

                    //foreach (ARTICULO trans in ((List<ARTICULO>)res))
                    //{
                    //    trans.MODELO = trans.MODELO;
                    //    trans.MARCA = trans.MARCA;
                    //    trans.EQUIPO = trans.EQUIPO;
                    //    trans.CATEGORIA = trans.CATEGORIA;
                    //}

                    o = (object)res;
                }
            }
            return(o);
        }
Esempio n. 10
0
        public frmMantEventocs(GestorEventos eventManager)
        {
            InitializeComponent();
            _eventManager    = eventManager;
            comboBox1.Text   = CATEGORIA.TECNOLOGIA.ToString();
            _currentCategory = _currentCategory.Parse(comboBox1.Text);
            _viewEvents      = _eventManager.Eventos[_currentCategory].Values.ToList();
            _preguntas       = new List <Pregunta>();

            FileStream   fileStream = new FileStream("Preguntas.txt", FileMode.Open, FileAccess.Read);
            StreamReader reader     = new StreamReader(fileStream);

            string buffer;

            char[]   delims = { ',' };
            string[] tokens = new string[3];
            try
            {
                while ((buffer = reader.ReadLine()) != null)
                {
                    tokens = buffer.Split(delims);
                    _preguntas.Add(new Pregunta(tokens[0], Int32.Parse(tokens[1]), Int32.Parse(tokens[2])));
                }
            }
            catch (Exception ex)
            {
            }

            reader.Close();
            fileStream.Close();
            Update();
        }
        public ActionResult CategoriaAdd(CATEGORIA CATEGORIA, HttpPostedFileBase file)
        {
            BLL_Login.VerificarSesionActiva();// valida que la sesion este activa

            ViewBag.estado = new SelectList(FuncionesEnum.ListaEnum <EnumEstados>(), "Value", "Text", (int)CATEGORIA.Estado);

            if (ModelState.IsValid)
            {
                if (file != null && file.ContentLength > 0)
                {
                    BLL_Categoria BLL_Categoria = new BLL_Categoria();
                    if (BLL_Categoria.GuargarCategoria(CATEGORIA, file))
                    {// pregunta si la funcion de creacion se ejecuto con exito
                        return(RedirectToAction("Index", new { Mensaje = "Categoria Creada con Exito", Creado = "true" }));
                    }
                    else
                    {// no creado
                        return(View(CATEGORIA));
                    }
                }
                else
                {// no creado
                    return(View(CATEGORIA));
                }
            }
            else
            {
                return(View(CATEGORIA));
            }
        }
Esempio n. 12
0
        public void AtualizarCategoria()
        {
            idCategoria = int.Parse(TxtCodigo.Text);

            categoria = categorias.Find(c => c.IDT_CATEGORIA == idCategoria).First <CATEGORIA>();

            categoria.NOME = txtCategoria.Text;

            if (txtCategoria == null || txtCategoria.Text.Length < 3)
            {
                Util.showMessage(Page, "O Campo Categoria não pode estar vazio ou conter menos de 3 caracteres, favor digite o nome corretamente");
            }
            else
            {
                categorias.Update(categoria);
                categorias.SaveChanges();

                ListarCategorias();

                categoria    = null;
                categoriaBLL = null;

                LimparCampos();
            }
        }
Esempio n. 13
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (TxtCodigo.Text != string.Empty)
            {
                AtualizarCategoria();
            }
            else
            {
                if (txtCategoria == null || txtCategoria.Text.Length < 3)
                {
                    Util.showMessage(Page, "O Campo Categoria não pode estar vazio ou conter menos de 3 caracteres, favor digite o nome corretamente");
                }
                else
                {
                    categoria.NOME = txtCategoria.Text;
                    categoriaBLL.Add(categoria);
                    categoriaBLL.SaveChanges();

                    ListarCategorias();

                    Util.showMessage(Page, "Categoria salva com sucesso!");

                    categoria    = null;
                    categoriaBLL = null;
                    LimparCampos();
                }
            }
        }
        public FixupCollection <EQUIPO> GetArticuloEquipoByCategoria(CATEGORIA categoria)
        {
            FixupCollection <EQUIPO> equipos = new FixupCollection <EQUIPO>();

            if (categoria != null)
            {
                using (var entity = new TAE2Entities())
                {
                    try
                    {
                        (from art in entity.ARTICULOes
                         join catt in entity.CATEGORIAs
                         on art.UNID_CATEGORIA equals catt.UNID_CATEGORIA
                         join equ in entity.EQUIPOes
                         on art.UNID_EQUIPO equals equ.UNID_EQUIPO
                         where catt.UNID_CATEGORIA == categoria.UNID_CATEGORIA
                         select equ
                        ).Distinct().ToList <EQUIPO>().ForEach(o => equipos.Add(new EQUIPO()
                        {
                            UNID_EQUIPO = o.UNID_EQUIPO, EQUIPO_NAME = o.EQUIPO_NAME
                        }));
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            return(equipos);
        }
        private void editarBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string nombre      = this.nombreTxt.Text;
                string descripcion = this.descripcionTxt.Text;

                if (nombre.Length > 0 || descripcion.Length > 0)
                {
                    CATEGORIA categoria = new CATEGORIA();
                    categoria.ID_CATEGORIA     = idCategoria;
                    categoria.DESCRIPCION      = descripcion;
                    categoria.NOMBRE_CATEGORIA = nombre;
                    if (categoriaDAL.updateCategoria(categoria))
                    {
                        MessageBox.Show("Categoria modificada");
                        this.Close();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="categoria"></param>
        /// <param name="equipo"></param>
        /// <returns>Regresa un string JSON y si no hay datos </returns>
        public FixupCollection <ARTICULO> getElement(CATEGORIA categoria, EQUIPO equipo)
        {
            FixupCollection <ARTICULO> articulos = new FixupCollection <ARTICULO>();


            if (categoria != null && equipo != null)
            {
                using (var entity = new TAE2Entities())
                {
                    try
                    {
                        (from cust in entity.ARTICULOes
                         where cust.UNID_CATEGORIA == categoria.UNID_CATEGORIA &&
                         cust.UNID_EQUIPO == equipo.UNID_EQUIPO
                         select cust).ToList <ARTICULO>().ForEach(o => articulos.Add(o));
                    }
                    catch (Exception ex)
                    {
                        ;
                    }
                }
            }//endif

            return(articulos);
        }
        public IHttpActionResult PutCATEGORIA(int id, CATEGORIA cATEGORIA)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cATEGORIA.Id)
            {
                return(BadRequest());
            }

            db.Entry(cATEGORIA).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CATEGORIAExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 18
0
        public ItemModel(ITEM item)
        {
            this._articulo    = item.ARTICULO;
            this._nombre      = item.ARTICULO.ARTICULO1;
            this._unidItem    = item.UNID_ITEM;
            this._sku         = item.SKU;
            this.SKU          = item.SKU;
            this.NUMERO_SERIE = item.NUMERO_SERIE;
            this._numeroSerie = item.NUMERO_SERIE;
            //this._itemStatuss.updateItemStatus = item.UNID_ITEM_STATUS;
            if (item.ITEM_STATUS != null)
            {
                this._itemStatus  = item.ITEM_STATUS;
                this._itemStatuss = new ItemStatusModel(null)
                {
                    ItemStatusName = item.ITEM_STATUS.ITEM_STATUS_NAME, UnidItemStatus = long.Parse(item.UNID_ITEM_STATUS.ToString())
                };
            }
            this.UNID_ITEM_STATUS = item.UNID_ITEM_STATUS;
            this.COSTO_UNITARIO   = item.COSTO_UNITARIO;
            this._pedimentoExpo   = item.PEDIMENTO_EXPO;
            this._pedimentoImpo   = item.PEDIMENTO_IMPO;
            //this._facturaDetalle = item.FACTURA_DETALLE;
            this.IS_ACTIVE  = item.IS_ACTIVE;
            this.IsChecked  = false;
            this._equipo    = item.ARTICULO.EQUIPO;
            this._categoria = item.ARTICULO.CATEGORIA;
            this._marca     = item.ARTICULO.MARCA;
            this._modelo    = item.ARTICULO.MODELO;

            this.Detalles = new ObservableCollection <DeleteFacturaDetalleModel>();

            this._dataMapper = new ItemDataMapper();
        }
Esempio n. 19
0
 public void setCategoria(String categoria)
 {
     if (categoria.Equals("LER"))
     {
         cat = CATEGORIA.LER;
     }
     else if (categoria.Equals("ESCREVER"))
     {
         cat = CATEGORIA.ESCREVER;
     }
     else if (categoria.Equals("CONTAR"))
     {
         cat = CATEGORIA.CONTAR;
     }
     else if (categoria.Equals("DINAMICO"))
     {
         cat = CATEGORIA.DINAMICO;
     }
     else if (categoria.Equals("HISTORIAS"))
     {
         cat = CATEGORIA.HISTORIAS;
     }
     else if (categoria.Equals("CRUZADINHA"))
     {
         cat = CATEGORIA.CRUZADINHA;
     }
     audioController.changeMusic(audioController.musicFase1, "Menu2", true, slider);
 }
Esempio n. 20
0
        private ObservableCollection <ARTICULO> GetArticulosByCategoria(CATEGORIA categoria)
        {
            ObservableCollection <ARTICULO> articuloModels = new ObservableCollection <ARTICULO>();

            try
            {
                ArticuloDataMapper artDataMapper = new ArticuloDataMapper();
                List <ARTICULO>    articulos     = (List <ARTICULO>)artDataMapper.getElementsByCategoria(new CATEGORIA()
                {
                    UNID_CATEGORIA = categoria.UNID_CATEGORIA
                });

                articulos.ForEach(o => articuloModels.Add(new ARTICULO()
                {
                    UNID_ARTICULO = o.UNID_ARTICULO
                    ,
                    ARTICULO1 = o.ARTICULO1
                }));
            }
            catch (Exception)
            {
                ;
            }

            return(articuloModels);
        }
Esempio n. 21
0
    public void GoToAndCreateMinigame()
    {
        switch (minijuego)
        {
        case MINIJUEGO.MEMORAMA:
        {
            nivelDificultadGlobal = nivelDificultad;
            categoriaGlobal       = categoria;
            levelIDGlobal         = levelID;
            SceneManager.LoadScene("Memorama_Minigame");
        }
        break;

        case MINIJUEGO.AHORCADO:
        {
            nivelDificultadGlobal = nivelDificultad;
            categoriaGlobal       = categoria;
            levelIDGlobal         = levelID;
            SceneManager.LoadScene("Ahorcado_Minigame");
        }
        break;

        default:
            Debug.Log("Game not found");
            break;
        }
    }
Esempio n. 22
0
        private List <PROVEEDOR> GetProveedorbyCategoria(CATEGORIA categoria)
        {
            List <PROVEEDOR> articuloModels = new List <PROVEEDOR>();

            try
            {
                ProveedorDataMapper artDataMapper = new ProveedorDataMapper();
                List <PROVEEDOR>    articulos     = artDataMapper.getElementsByCategoria(new CATEGORIA()
                {
                    UNID_CATEGORIA = categoria.UNID_CATEGORIA
                });

                articulos.ForEach(o => articuloModels.Add(new PROVEEDOR()
                {
                    UNID_PROVEEDOR = o.UNID_PROVEEDOR
                    ,
                    PROVEEDOR_NAME = o.PROVEEDOR_NAME
                }));
            }
            catch (Exception)
            {
                ;
            }

            return(articuloModels);
        }
Esempio n. 23
0
        public void SetCategoria(CATEGORIA categoria)
        {
            var db = new bancodadosEntities();

            if (categoria.ID_CATEGORIA == 0)
            {
                db.AddToCATEGORIA(categoria);
            }
            else
            {
                var q = db.CATEGORIA.FirstOrDefault(p => p.ID_CATEGORIA == categoria.ID_CATEGORIA);

                q.ID_CATEGORIA                       = categoria.ID_CATEGORIA;
                q.DESCRICAO_CATEGORIA                = categoria.DESCRICAO_CATEGORIA;
                q.ESPORTE_ID_ESPORTE                 = categoria.ESPORTE_ID_ESPORTE;
                q.GRADUACAO_ID_GRADUACAO             = categoria.GRADUACAO_ID_GRADUACAO;
                q.GRADUACAO_FINAL                    = categoria.GRADUACAO_FINAL;
                q.PESO_INICIAL_CATEGORIA             = categoria.PESO_INICIAL_CATEGORIA;
                q.PESO_FINAL_CATEGORIA               = categoria.PESO_FINAL_CATEGORIA;
                q.SEXO_CATEGORIA                     = categoria.SEXO_CATEGORIA;
                q.TIPO_CATEGORIA                     = categoria.TIPO_CATEGORIA;
                q.IDADE_INICIAL                      = categoria.IDADE_INICIAL;
                q.IDADE_FINAL                        = categoria.IDADE_FINAL;
                q.STATUS_CATEGORIA                   = categoria.STATUS_CATEGORIA;
                q.ALTURA_INICIAL_CATEGORIA           = categoria.ALTURA_INICIAL_CATEGORIA;
                q.ALTURA_FINAL_CATEGORIA             = categoria.ALTURA_FINAL_CATEGORIA;
                q.NUMERO_CATEGORIA                   = categoria.NUMERO_CATEGORIA;
                q.TIPO_COMPETICAO_ID_TIPO_COMPETICAO = categoria.TIPO_COMPETICAO_ID_TIPO_COMPETICAO;
            }
            db.SaveChanges();
        }
        public List <PROVEEDOR> getElementsByCategoria(CATEGORIA categoria)
        {
            List <PROVEEDOR> res = new List <PROVEEDOR>();

            try
            {
                using (var entity = new TAE2Entities())
                {
                    var o = (from provL in entity.PROVEEDOR_CATEGORIA
                             join prov in entity.PROVEEDORs on provL.UNID_PROVEEDOR equals prov.UNID_PROVEEDOR
                             join cat in entity.CATEGORIAs on provL.UNID_CATEGORIA equals cat.UNID_CATEGORIA
                             where provL.UNID_CATEGORIA == categoria.UNID_CATEGORIA
                             select prov).ToList <PROVEEDOR>();


                    foreach (PROVEEDOR c in o)
                    {
                        res.Add(c);
                    }
                }
            }
            catch (Exception)
            {
                ;
            }
            return(res);
        }//
 public DeleteCategoria(CATEGORIA categoria)
 {
     this.UNID_CATEGORIA = categoria.UNID_CATEGORIA;
     this.CATEGORIA_NAME = categoria.CATEGORIA_NAME;
     this.IS_ACTIVE      = categoria.IS_ACTIVE;
     this.IsChecked      = false;
 }
Esempio n. 26
0
        public Evento(CATEGORIA cat, string name, int entries, double price)
        {
            Stands       = new List <StandInformation>();
            Participants = new List <EquipoxEvento>();
            _fileName    = name + ".txt";
            EventName    = name;
            NEntries     = entries;
            PriceEntry   = price;
            if (File.Exists(_fileName))
            {
                FileStream   fileStream = new FileStream(_fileName, FileMode.Open, FileAccess.Read);
                StreamReader reader     = new StreamReader(fileStream);

                string   buffer;
                char[]   delims = { ' ', ';', '.' };
                string[] tokens;

                for (int i = 0; i < NEntries; i++)
                {
                    buffer = reader.ReadLine();
                    if (buffer != null)
                    {
                        tokens = buffer.Split(delims);
                        Stands.Add(new StandInformation(tokens[0], tokens[1], tokens[2]));
                    }
                }
                reader.Close();
                fileStream.Close();
            }
            else
            {
                FileStream fileStream = new FileStream(_fileName, FileMode.OpenOrCreate, FileAccess.Read);
                fileStream.Close();
            }
        }
Esempio n. 27
0
        public static bool GetBoolConfig(String sParamName, CATEGORIA CAT, bool bDefault)
        {
            bool   bRes  = false;
            String sTemp = myConfig.GetStringConfig(sParamName, CAT, "");

            if (sTemp.Length > 0)
            {
                switch (sTemp)
                {
                case "TRUE":
                    bRes = true;
                    break;

                case "FALSE":
                    bRes = false;
                    break;

                default:
                    bRes = bDefault;
                    break;
                }
            }
            else
            {
                bRes = bDefault;
            }
            return(bRes);
        }
        public async Task <IActionResult> Edit(int id, [Bind("id_categoria,id_pai,nome")] CATEGORIA cATEGORIA)
        {
            if (id != cATEGORIA.id_categoria)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cATEGORIA);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CATEGORIAExists(cATEGORIA.id_categoria))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cATEGORIA));
        }
Esempio n. 29
0
        public static String GetStringConfig(String sParametro, CATEGORIA CAT, String sDefault)
        {
            String        sResult = sDefault;
            SqlConnection conn    = new SqlConnection(myConfig.ConnectionInfo);

            try
            {
                conn.Open();
                SqlCommand comm = new SqlCommand();
                comm.Connection  = conn;
                comm.CommandText = "select paramValue from ConfigParams where CategoryID = @CategoryID AND paramName = @paramName";
                comm.Parameters.Add("@CategoryID", SqlDbType.Int).Value    = (int)CAT;
                comm.Parameters.Add("@paramName", SqlDbType.VarChar).Value = sParametro;

                SqlDataReader r = comm.ExecuteReader();
                if (r.HasRows && r.Read() && r[0] != null && r[0].ToString().Length > 0)
                {
                    sResult = r[0].ToString();
                }
            }
            catch (System.Exception ex)
            {
                Logger.Instance.LogException(Logger.typeUserActions.SELECT, "No se pudo consultar parametro", "GetStringConfig", ref ex);
                sResult = sDefault;
            }
            finally
            {
                conn.Close();
            }
            return(sResult);
        }
Esempio n. 30
0
        //PRUEBA
        public void UpdateCategoria(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    CATEGORIA ETipo = (CATEGORIA)element;

                    var query = (from cust in entity.CATEGORIAs
                                 where cust.UNID_CATEGORIA == ETipo.UNID_CATEGORIA
                                 select cust).ToList();
                    if (query.Count > 0)
                    {
                        try
                        {
                            var tipo = query.First();

                            tipo.CATEGORIA_NAME = ETipo.CATEGORIA_NAME;
                            //Sync
                            tipo.IS_MODIFIED        = true;
                            tipo.LAST_MODIFIED_DATE = UNID.getNewUNID();
                            var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                            modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                            entity.SaveChanges();
                            //
                            entity.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                }
            }
        }