public static bool UpdatePassword(int id, string password)
        {
            try
            {
                var db = new Data.Access.Context();

                var value = db.TBL_USER.SingleOrDefault(a => a.CDG_ID == id);

                if (value == null)
                {
                    return(false);
                }

                value.CAR_PASSWORD = password;

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_USER");
                return(false);
            }
        }
        public static bool Update(Domain.TBL_USER user)
        {
            try
            {
                var db = new Data.Access.Context();

                var value = db.TBL_USER.SingleOrDefault(a => a.CDG_ID == user.CDG_ID);

                if (value == null)
                {
                    return(false);
                }

                value.CAR_EMAIL   = user.CAR_EMAIL;
                value.CAR_NAME    = user.CAR_NAME;
                value.COD_PROFILE = user.COD_PROFILE;

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_USER");
                return(false);
            }
        }
        public static bool UpdateLastEntry(int id)
        {
            try
            {
                var db = new Data.Access.Context();

                var value = db.TBL_USER.SingleOrDefault(a => a.CDG_ID == id);

                if (value == null)
                {
                    return(false);
                }

                value.DAT_LAST_ENTRY = DateTime.Now;

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_USER");
                return(false);
            }
        }
        public static int Save(Domain.TBL_LOG log)
        {
            try
            {
                var db = new Data.Access.Context();
                log.DAT_TIMESTAMP = DateTime.Now;
                db.TBL_LOG.Add(log);

                db.SaveChanges();

                var id = db.TBL_LOG.OrderByDescending(d => d.CDG_ID).First().CDG_ID;

                return id;
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_LOG");
                return 0;
            }
        }
Example #5
0
        public static bool UpdateLast(int id)
        {
            try
            {
                var db   = new Data.Access.Context();
                var data = db.TBL_DATA_ARTICLES.SingleOrDefault(d => d.CDG_ID == id);

                if (data != null)
                {
                    data.LAST = (byte)Domain.Enums.LAST_REGISTER.DISABLED;
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_DATA_ARTICLES");
                return(false);
            }
        }
Example #6
0
        public static int Save(Domain.TBL_DATA_ARTICLES detail)
        {
            try
            {
                var db = new Data.Access.Context();
                detail.LAST      = (byte)Domain.Enums.LAST_REGISTER.ENABLED;
                detail.TIMESTAMP = DateTime.Now;
                db.TBL_DATA_ARTICLES.Add(detail);

                db.SaveChanges();

                var id = db.TBL_DATA_ARTICLES.OrderByDescending(d => d.CDG_ID).First().CDG_ID;

                return(id);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_DATA_ARTICLES");
                return(0);
            }
        }
Example #7
0
        public static bool DeleteAll()
        {
            try
            {
                var db   = new Data.Access.Context();
                var data = db.TBL_DATA_ARTICLES.ToList();

                //db.TBL_DATA_ARTICLES.
                foreach (var d in data)
                {
                    db.TBL_DATA_ARTICLES.Remove(d);
                }

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_DATA_ARTICLES");
                return(false);
            }
        }
        public static int Save(Domain.TBL_USER user)
        {
            try
            {
                var db = new Data.Access.Context();

                user.DAT_TIMESTAMP = DateTime.Now;
                //este estado variar en un futuro si varia la forma de activacion
                user.COD_STATUS = (byte)Domain.Status.TBL_USER.ENABLED;

                db.TBL_USER.Add(user);

                db.SaveChanges();

                var id = db.TBL_USER.OrderByDescending(d => d.CDG_ID).First().CDG_ID;

                return(id);
            }
            catch (Exception ex)
            {
                TBL_ERROR.Create(ex, Utilities.Basic.GetCurrentMethod(), "Inventory.Data.Management.TBL_USER");
                return(0);
            }
        }