Ejemplo n.º 1
0
 /// <summary>
 /// 物理删除
 /// </summary>
 /// <param name="KeyId">需要删除对象的ID</param>
 /// <returns>返回受影响的行数</returns>
 public virtual int LogicDelete(string KeyId)
 {
     int counts = 0;//影响行数标记
     ServiceDirectDBEntities objDB;
     vUTPCommand vUTPCommandObj;
     try
     {
         objDB = new ServiceDirectDBEntities();
         vUTPCommandObj = objDB.vUTPCommand.FirstOrDefault(c => c.RelateID == KeyId);
         if (vUTPCommandObj != null)
         {
             if (vUTPCommandObj.RelateID != null && vUTPCommandObj.RelateID != string.Empty)
             {
                 objDB.DeleteObject(vUTPCommandObj);
                 counts = objDB.SaveChanges();
             }
         }
     }
     catch (EntityException)
     {
         throw;
     }
     return counts;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 物理删除
        /// </summary>
        /// <param name="KeyId">需要删除对象的ID</param>
        /// <returns>返回受影响的行数</returns>
        public virtual int LogicDelete(string KeyId)
        {
            int counts = 0;//影响行数标记
            System.Guid KeyIdGuid = new Guid(KeyId);//转换成Guid类型
            tblBackup BackupObjDelete;//需要跟新的对象

            try
            {
                ServiceDirectDBEntitiesDelete = new ServiceDirectDBEntities();
                BackupObjDelete = ServiceDirectDBEntitiesDelete.tblBackup.First(t => t.BackupID == KeyIdGuid);
                ServiceDirectDBEntitiesDelete.DeleteObject(BackupObjDelete);
                counts = ServiceDirectDBEntitiesDelete.SaveChanges();
            }
            catch (EntityException)
            {
                throw;
            }
            return counts;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 物理删除
        /// </summary>
        /// <param name="KeyId">需要删除对象的ID</param>
        /// <returns>返回受影响的行数</returns>
        public virtual string LogicDelete(string KeyId)
        {
            int counts = 0;//影响行数标记
            string strMessage = "InsertError";

            System.Guid KeyIdGuid = new Guid(KeyId);//转换成Guid类型
            tblScheduler SchedulerObjDelete;//需要跟新的对象

            try
            {
                ServiceDirectDBEntitiesDelete = new ServiceDirectDBEntities();
                SchedulerObjDelete = ServiceDirectDBEntitiesDelete.tblScheduler.First(t => t.ScheduleID == KeyIdGuid);
                ServiceDirectDBEntitiesDelete.DeleteObject(SchedulerObjDelete);
                counts = ServiceDirectDBEntitiesDelete.SaveChanges();
            }
            catch (EntityException)
            {
                throw;
            }
            if (counts > 0)
            {
                strMessage = "update success";
                return strMessage;
            }
            return strMessage;
        }