/// <summary> /// 批量新增店铺分配表 /// </summary> /// <param name="NickIds">要分配的店铺列表</param> /// <param name="customerID">负责人ID</param> /// <param name="depId">部门Id</param> public void BatchMarkXMNickCustomerMappingsInsert(List <int> NickIds, int customerID, int depId) { foreach (var nickId in NickIds) { var query = from p in this._context.XMNickCustomerMappings where //NickIds.Contains(System.Convert.ToInt32(p.NickId)) NickIds.Contains(p.NickId.Value) && p.CustomerTypeID == (int)depId && p.CustomerID == (int)customerID select p; var objLst = query.ToList(); if (objLst.Count == 0) { var contractCustomerMapping = new XMNickCustomerMapping() { NickId = nickId, CustomerID = customerID, CustomerTypeID = depId, Created = DateTime.Now, CreatorID = HozestERPContext.Current.User.CustomerID, Updated = DateTime.Now, UpdatorID = HozestERPContext.Current.User.CustomerID }; _context.XMNickCustomerMappings.AddObject(contractCustomerMapping); } } _context.SaveChanges(); }
/// <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(); }
public void InsertCodeList(CodeList codeList) { if (codeList == null) { throw new ArgumentNullException("codeList"); } _context.CodeLists.AddObject(codeList); _context.SaveChanges(); }
public void InsertCodeType(CodeType codeType) { if (codeType == null) { throw new ArgumentNullException("codeType"); } _context.CodeTypes.AddObject(codeType); _context.SaveChanges(); }
/// <summary> /// Insert a new record /// </summary> /// <param name="XMQuestionDetail">pXMQuestionDetail</param> /// <returns>record</returns> public void Insert(XMQuestionDetail pXMQuestionDetail) { if (pXMQuestionDetail == null) { throw new ArgumentNullException("pXMQuestionDetail"); } _context.XMQuestionDetails.AddObject(pXMQuestionDetail); _context.SaveChanges(); }
/// <summary> /// Insert a new record /// </summary> /// <param name="XMQuestion">pXMQuestion</param> /// <returns>record</returns> public void Insert(XMQuestion pXMQuestion) { if (pXMQuestion == null) { throw new ArgumentNullException("pXMQuestion"); } _context.XMQuestions.AddObject(pXMQuestion); _context.SaveChanges(); }
/// <summary> /// 上传附件数据 /// </summary> /// <param name="uploadFile">UploadFile</param> /// <returns></returns> public UploadFile InsertUploadFile(UploadFile uploadFile) { if (uploadFile == null) { throw new ArgumentNullException("uploadFile"); } _context.UploadFiles.AddObject(uploadFile); _context.SaveChanges(); return(uploadFile); }
/// <summary> /// 更新店铺记录 /// </summary> /// <param name="xMNick"></param> public void UpdateXMNick(XMNick xMNick) { if (xMNick == null) { throw new ArgumentNullException("xMNick"); } if (!_context.IsAttached(xMNick)) { _context.XMNicks.Attach(xMNick); } _context.SaveChanges(); }
/// <summary> /// Deletes a Module item /// </summary> /// <param name="logId">Log item identifier</param> public void DeleteModule(int moduleId) { var module = getModuleByModuleID(moduleId); if (module == null) { return; } module.Deleted = true; if (!_context.IsAttached(module)) { _context.Modules.Attach(module); } _context.SaveChanges(); }
/// <summary> /// 修改单位信息 /// </summary> /// <param name="Enterprise"></param> public void UpdateEnterprise(Enterprise Enterprise) { if (Enterprise == null) { throw new ArgumentNullException("Enterprise"); } if (!_context.IsAttached(Enterprise)) { _context.Enterprises.Attach(Enterprise); } _context.SaveChanges(); if (this.EnterpriseCacheEnabled) { _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY); } }
/// <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(); }
/// <summary> /// 新增记录 /// </summary> /// <param name="record"></param> public void InsertTableUpdateLog(TableUpdateLog record) { if (record == null) { throw new ArgumentNullException("TableUpdateLog"); } _context.TableUpdateLogs.AddObject(record); _context.SaveChanges(); }
/// <summary> /// Batch delete XMLogisticsFeeDetail by ID /// </summary> /// <param name="IDs">XMLogisticsFeeDetail ID</param> public void BatchDeleteXMLogisticsFeeDetail(List <int> ids) { var query = from q in _context.XMLogisticsFeeDetails where ids.Contains(q.ID) select q; var xmlogisticsfeedetails = query.ToList(); foreach (var item in xmlogisticsfeedetails) { if (!_context.IsAttached(item)) { _context.XMLogisticsFeeDetails.Attach(item); } _context.XMLogisticsFeeDetails.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete CWProject by Id /// </summary> /// <param name="Ids">CWProject Id</param> public void BatchDeleteCWProject(List <int> ids) { var query = from q in _context.CWProjects where ids.Contains(q.Id) select q; var cwprojects = query.ToList(); foreach (var item in cwprojects) { if (!_context.IsAttached(item)) { _context.CWProjects.Attach(item); } _context.CWProjects.DeleteObject(item); } _context.SaveChanges(); }
/// <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(); }
/// <summary> /// Inserts an CustomerAction /// </summary> /// <param name="customerAction">CustomerAction</param> public void InsertCustomerAction(CustomerAction customerAction) { if (customerAction == null) { throw new ArgumentNullException("customerAction"); } _context.CustomerActions.AddObject(customerAction); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(CUSTOMERACTIONS_PATTERN_KEY); } }
public void UpdateAreaCode(AreaCode entity) { if (entity == null) { throw new ArgumentNullException("codeList"); } if (!_context.IsAttached(entity)) { _context.AreaCodes.Attach(entity); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMAdvertingField by Id /// </summary> /// <param name="Ids">XMAdvertingField Id</param> public void BatchDeleteXMAdvertingField(List<int> ids) { var query = from q in _context.XMAdvertingFields where ids.Contains(q.Id) select q; var xmadvertingfields = query.ToList(); foreach (var item in xmadvertingfields) { if (!_context.IsAttached(item)) _context.XMAdvertingFields.Attach(item); _context.XMAdvertingFields.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMSaleInfo by Id /// </summary> /// <param name="Ids">XMSaleInfo Id</param> public void BatchDeleteXMSaleInfo(List<int> ids) { var query = from q in _context.XMSaleInfoes where ids.Contains(q.Id) select q; var xmsaleinfos = query.ToList(); foreach (var item in xmsaleinfos) { if (!_context.IsAttached(item)) _context.XMSaleInfoes.Attach(item); _context.XMSaleInfoes.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMSaleDeliveryProductDetails by Id /// </summary> /// <param name="Ids">XMSaleDeliveryProductDetails Id</param> public void BatchDeleteXMSaleDeliveryProductDetails(List<int> ids) { var query = from q in _context.XMSaleDeliveryProductDetails where ids.Contains(q.Id) select q; var xmsaledeliveryproductdetailss = query.ToList(); foreach (var item in xmsaledeliveryproductdetailss) { if (!_context.IsAttached(item)) _context.XMSaleDeliveryProductDetails.Attach(item); _context.XMSaleDeliveryProductDetails.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// 设置列数 /// </summary> /// <param name="portalColumn"></param> public void UpdatePortalColumnsNumber(List <PortalColumnNumber> portalColumnNumbers) { if (portalColumnNumbers.Count == 0) { throw new ArgumentNullException("portalColumnNumbers"); } foreach (var item in portalColumnNumbers) { if (!_context.IsAttached(item)) { _context.PortalColumnNumbers.Attach(item); } } _context.SaveChanges(); }
/// <summary> /// 更新公告信息 /// </summary> /// <param name="Bulletin"></param> public void UpdateBulletin(Bulletin bulletin) { if (bulletin == null) { throw new ArgumentNullException("bulletin"); } if (!_context.IsAttached(bulletin)) { _context.Bulletins.Attach(bulletin); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMStorageProductBarCodeDetail by Id /// </summary> /// <param name="Ids">XMStorageProductBarCodeDetail Id</param> public void BatchDeleteXMStorageProductBarCodeDetail(List <int> ids) { var query = from q in _context.XMStorageProductBarCodeDetails where ids.Contains(q.Id) select q; var xmstorageproductbarcodedetails = query.ToList(); foreach (var item in xmstorageproductbarcodedetails) { if (!_context.IsAttached(item)) { _context.XMStorageProductBarCodeDetails.Attach(item); } _context.XMStorageProductBarCodeDetails.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete ACLModule by ACLModuleId /// </summary> /// <param name="ACLModuleIds">ACLModule ACLModuleId</param> public void BatchDeleteACLModule(List <int> aclmoduleids) { var query = from q in _context.ACLModules where aclmoduleids.Contains(q.ACLModuleId) select q; var aclmodules = query.ToList(); foreach (var item in aclmodules) { if (!_context.IsAttached(item)) { _context.ACLModules.Attach(item); } _context.ACLModules.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete Setting by SettingID /// </summary> /// <param name="SettingIDs">Setting SettingID</param> public void BatchDeleteSetting(List <int> settingids) { var query = from q in _context.Settings where settingids.Contains(q.SettingID) select q; var settings = query.ToList(); foreach (var item in settings) { if (!_context.IsAttached(item)) { _context.Settings.Attach(item); } _context.Settings.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMCustomerWangNo by ID /// </summary> /// <param name="IDs">XMCustomerWangNo ID</param> public void BatchDeleteXMCustomerWangNo(List <int> ids) { var query = from q in _context.XMCustomerWangNoes where ids.Contains(q.ID) select q; var xmcustomerwangnos = query.ToList(); foreach (var item in xmcustomerwangnos) { if (!_context.IsAttached(item)) { _context.XMCustomerWangNoes.Attach(item); } _context.XMCustomerWangNoes.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete Sys_AlertSettings by ID /// </summary> /// <param name="IDs">Sys_AlertSettings ID</param> public void BatchDeleteSys_AlertSettings(List <int> ids) { var query = from q in _context.Sys_AlertSettings where ids.Contains(q.ID) select q; var sys_alertsettingss = query.ToList(); foreach (var item in sys_alertsettingss) { if (!_context.IsAttached(item)) { _context.Sys_AlertSettings.Attach(item); } _context.Sys_AlertSettings.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMJDSaleRejected by Id /// </summary> /// <param name="Ids">XMJDSaleRejected Id</param> public void BatchDeleteXMJDSaleRejected(List <int> ids) { var query = from q in _context.XMJDSaleRejecteds where ids.Contains(q.Id) select q; var xmjdsalerejecteds = query.ToList(); foreach (var item in xmjdsalerejecteds) { if (!_context.IsAttached(item)) { _context.XMJDSaleRejecteds.Attach(item); } _context.XMJDSaleRejecteds.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMDeductionSetUp by Id /// </summary> /// <param name="Ids">XMDeductionSetUp Id</param> public void BatchDeleteXMDeductionSetUp(List <int> ids) { var query = from q in _context.XMDeductionSetUps where ids.Contains(q.Id) select q; var xmdeductionsetups = query.ToList(); foreach (var item in xmdeductionsetups) { if (!_context.IsAttached(item)) { _context.XMDeductionSetUps.Attach(item); } _context.XMDeductionSetUps.DeleteObject(item); } _context.SaveChanges(); }
/// <summary> /// Batch delete XMActivity by Id /// </summary> /// <param name="Ids">XMActivity Id</param> public void BatchDeleteXMActivity(List <int> ids) { var query = from q in _context.XMActivities where ids.Contains(q.Id) select q; var xmactivitys = query.ToList(); foreach (var item in xmactivitys) { if (!_context.IsAttached(item)) { _context.XMActivities.Attach(item); } _context.XMActivities.DeleteObject(item); } _context.SaveChanges(); }