Пример #1
0
        /// <summary>
        /// Deletes a picture
        /// </summary>
        /// <param name="pictureId">Picture identifier</param>
        public void DeletePicture(int pictureId)
        {
            var picture = GetPictureById(pictureId);

            if (picture == null)
            {
                return;
            }

            //delete thumbs
            string filter = string.Format("{0}*.*", pictureId.ToString("0000000"));

            string[] currentFiles = System.IO.Directory.GetFiles(this.LocalThumbImagePath, filter);
            foreach (string currentFileName in currentFiles)
            {
                File.Delete(Path.Combine(this.LocalThumbImagePath, currentFileName));
            }

            //delete from file system
            if (!this.StoreInDB)
            {
                DeletePictureOnFileSystem(picture);
            }

            //delete from database

            if (!_context.IsAttached(picture))
            {
                _context.Pictures.Attach(picture);
            }
            _context.DeleteObject(picture);
            _context.SaveChanges();
        }
Пример #2
0
        /// <summary>
        /// Deletes a log item
        /// </summary>
        /// <param name="logId">Log item identifier</param>
        public void DeleteLog(int logId)
        {
            var log = GetLogById(logId);

            if (log == null)
            {
                return;
            }


            if (!_context.IsAttached(log))
            {
                _context.Logs.Attach(log);
            }
            _context.DeleteObject(log);
            _context.SaveChanges();
        }
Пример #3
0
        /// <summary>
        /// Deletes a setting
        /// </summary>
        /// <param name="settingId">Setting identifer</param>
        public void DeleteSetting(int settingId)
        {
            var setting = GetSettingById(settingId);

            if (setting == null)
            {
                return;
            }


            if (!_context.IsAttached(setting))
            {
                _context.Settings.Attach(setting);
            }
            _context.DeleteObject(setting);
            _context.SaveChanges();
        }
Пример #4
0
        /// <summary>
        /// Deletes an activity log type item
        /// </summary>
        /// <param name="activityLogTypeId">Activity log type identifier</param>
        public void DeleteActivityType(int activityLogTypeId)
        {
            var activityLogType = GetActivityTypeById(activityLogTypeId);

            if (activityLogType == null)
            {
                return;
            }


            if (!_context.IsAttached(activityLogType))
            {
                _context.ActivityLogTypes.Attach(activityLogType);
            }
            _context.DeleteObject(activityLogType);
            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(ACTIVITYTYPE_PATTERN_KEY);
            }
        }
Пример #5
0
        /// <summary>
        /// Deletes a customer action
        /// </summary>
        /// <param name="customerActionId">Customer action identifier</param>
        public void DeleteCustomerAction(int customerActionId)
        {
            var customerAction = GetCustomerActionById(customerActionId);

            if (customerAction == null)
            {
                return;
            }


            if (!_context.IsAttached(customerAction))
            {
                _context.CustomerActions.Attach(customerAction);
            }
            _context.DeleteObject(customerAction);
            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(CUSTOMERACTIONS_PATTERN_KEY);
            }
        }
Пример #6
0
        /// <summary>
        /// Deletes an IP address by its identifier
        /// </summary>
        /// <param name="ipAddressId">IP address unique identifier</param>
        public void DeleteBannedIpAddress(int ipAddressId)
        {
            var ipAddress = GetBannedIpAddressById(ipAddressId);

            if (ipAddress == null)
            {
                return;
            }


            if (!_context.IsAttached(ipAddress))
            {
                _context.BannedIpAddresses.Attach(ipAddress);
            }
            _context.DeleteObject(ipAddress);
            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(BLACKLIST_IP_PATTERN_KEY);
            }
        }
Пример #7
0
        public void DeleteCodeList(int codeID)
        {
            var codeList = GetCodeListInfoByCodeID(codeID);

            if (codeList == null)
            {
                return;
            }
            if (!_context.IsAttached(codeList))
            {
                _context.CodeLists.Attach(codeList);
            }
            _context.DeleteObject(codeList);
            _context.SaveChanges();
        }
Пример #8
0
        public void DeleteCodeType(int codeTypeID)
        {
            var codeType = GetCodeTypeByCodeTypeID(codeTypeID);

            if (codeType == null)
            {
                return;
            }
            if (!_context.IsAttached(codeType))
            {
                _context.CodeTypes.Attach(codeType);
            }
            _context.DeleteObject(codeType);
            _context.SaveChanges();
        }
Пример #9
0
        /// <summary>
        /// 删除Sys_CustomerStar表信息
        /// </summary>
        /// <param name="customerStarID">customerStarID</param>
        public void DeleteCustomerStar(int customerStarID)
        {
            var customerStar = GetCustomerStarByID(customerStarID);

            if (customerStar == null)
            {
                return;
            }

            if (!_context.IsAttached(customerStar))
            {
                _context.Sys_CustomerStar.Attach(customerStar);
            }
            _context.DeleteObject(customerStar);
            _context.SaveChanges();
        }
Пример #10
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="id"></param>
        public void Delete(int id)
        {
            var mRecord = GetById(id);

            if (mRecord == null)
            {
                return;
            }

            if (!_context.IsAttached(mRecord))
            {
                _context.XMQuestionDetails.Attach(mRecord);
            }

            _context.DeleteObject(mRecord);
            _context.SaveChanges();
        }
Пример #11
0
        /// <summary>
        /// Deletes a Notice item
        /// </summary>
        /// <param name="logId">Log item identifier</param>
        public void DeleteNotice(List <int> noticeIds)
        {
            foreach (var id in noticeIds)
            {
                var notice = GetNoticeByID(new Guid(id.ToString()));
                if (notice == null)
                {
                    break;
                }

                if (!_context.IsAttached(notice))
                {
                    _context.Notices.Attach(notice);
                }

                _context.DeleteObject(notice);
            }
            _context.SaveChanges();
        }
Пример #12
0
        /// <summary>
        /// 删除桌面模块信息
        /// </summary>
        /// <param name="portalcolumnid"></param>
        public void DeletePortalColumn(int portalcolumnid)
        {
            var portalcolumn = this.GetPortalColumnByID(portalcolumnid);

            if (portalcolumn == null)
            {
                return;
            }


            if (!_context.IsAttached(portalcolumn))
            {
                _context.PortalColumns.Attach(portalcolumn);
            }

            _context.DeleteObject(portalcolumn);

            _context.SaveChanges();
        }
Пример #13
0
        /// <summary>
        /// 删除附件数据
        /// </summary>
        /// <param name="uploadfileid">UploadFile ID</param>
        public void DeleteUploadFile(int uploadfileid)
        {
            if (uploadfileid == 0)
            {
                return;
            }
            var uploadfile = GetUploadFileByUploadFileID(uploadfileid);

            if (uploadfile == null)
            {
                return;
            }
            if (File.Exists(HttpContext.Current.Server.MapPath("~") + "Upload\\" + uploadfile.Url))
            {
                File.Delete(HttpContext.Current.Server.MapPath("~") + "Upload\\" + uploadfile.Url);
            }
            if (!_context.IsAttached(uploadfile))
            {
                _context.UploadFiles.Attach(uploadfile);
            }

            _context.DeleteObject(uploadfile);
            _context.SaveChanges();
        }