Ejemplo n.º 1
0
        public HT_NSD_PVI Sua(HT_NSD_PVI obj)
        {
            HT_NSD_PVI kq       = null;
            Entities   entities = ContextFactory.GetInstance();
            EntityKey  key      = null;
            object     original = null;

            try
            {
                key = entities.CreateEntityKey(ENTITY_SET_NAME, obj);
                if (entities.TryGetObjectByKey(key, out original))
                {
                    entities.ApplyCurrentValues(key.EntitySetName, obj);
                }
                entities.SaveChanges();
                kq = obj;
            }
            catch (System.Exception ex)
            {
                kq = null;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }
Ejemplo n.º 2
0
        public bool Xoa(HT_NSD_PVI obj)
        {
            bool     kq       = true;
            Entities entities = ContextFactory.GetInstance();

            try
            {
                entities.HT_NSD_PVI.DeleteObject(obj);
                entities.SaveChanges();
            }
            catch (System.Exception ex)
            {
                kq = false;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }
Ejemplo n.º 3
0
        public HT_NSD_PVI Them(HT_NSD_PVI obj)
        {
            HT_NSD_PVI kq       = null;
            Entities   entities = ContextFactory.GetInstance();

            try
            {
                entities.HT_NSD_PVI.AddObject(obj);
                entities.SaveChanges();
                kq = obj;
            }
            catch (System.Exception ex)
            {
                kq = null;
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                entities = null;
            }
            return(kq);
        }