public async Task <BlackListModel> TryGetAsync(string blockchainType, string blockedAddress) { var partitionKey = BlackListEntity.GetPartitionKey(blockchainType); var rowKey = BlackListEntity.GetRowKey(blockedAddress); var entity = await _storage.GetDataAsync(partitionKey, rowKey); return(entity?.ToDomain()); }
public static BlackListEntity GetBlackListEntityById(long cid) { BlackListEntity result = new BlackListEntity(); BlackListRepository mr = new BlackListRepository(); BlackListInfo info = mr.GetBlackListByKey(cid); if (info != null) { result = TranslateBlackListEntity(info); } return(result); }
public static List <BlackListEntity> GetBlackListInfoPager(PagerInfo pager) { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetAllBlackListInfoPager(pager); foreach (BlackListInfo mInfo in miList) { BlackListEntity carEntity = TranslateBlackListEntity(mInfo); all.Add(carEntity); } return(all); }
private ValidationItemResult ValidationFailed(BlackListEntity foundEntity, object problemItem) { var ret = new ValidationItemResult(this); ret.ValidationResultState = ResultState.OkWithWarning; ret.ResultMessage = string.Format("Subjekt s IČ DPH {0} sa nachádza na zozname platiteľov DPH s dôvodom na zrušenie registrácie!", foundEntity.IcDph); ret.ResultTooltip = string.Format("IČ DPH: {1}{0}Názov: {2}{0}Rok porušenia: {3}{0}Dátum zverejnenia: {4}{0}", Environment.NewLine, foundEntity.IcDph, foundEntity.Nazov, foundEntity.RokPorusenia, foundEntity.DatumZverejnenia); ret.ProblemObject = problemItem; ret.Details = new DetailedResultInfo(); ret.Details.LineNumber = 0; return ret; }
public Task <object> Delete(object id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var entity = new BlackListEntity { Content = id.ToString() }; return(this.Delete(entity)); }
public async Task DeleteAsync(string blockchainType, string blockedAddress) { var partitionKey = BlackListEntity.GetPartitionKey(blockchainType); var rowKey = BlackListEntity.GetRowKey(blockedAddress); var existingEntity = await _storage.GetDataAsync(partitionKey, rowKey); if (existingEntity == null) { throw new ArgumentValidationException($"Entity with address {blockedAddress} does not exist", "blockedAddress"); } await _storage.DeleteIfExistAsync(partitionKey, rowKey); }
public static List <BlackListEntity> GetBlackListInfoByRule(int BlackListID, PagerInfo pager) { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetBlackListInfoByRule(BlackListID, pager); if (!miList.IsEmpty()) { foreach (BlackListInfo mInfo in miList) { BlackListEntity storeEntity = TranslateBlackListEntity(mInfo); all.Add(storeEntity); } } return(all); }
public async Task <BlackListModel> GetOrAddAsync(string blockchainType, string blockedAddress, Func <BlackListModel> newAggregateFactory) { var partitionKey = BlackListEntity.GetPartitionKey(blockchainType); var rowKey = BlackListEntity.GetRowKey(blockedAddress); var startedEntity = await _storage.GetOrInsertAsync( partitionKey, rowKey, () => { var newAggregate = newAggregateFactory(); return(BlackListEntity.FromDomain(newAggregate)); }); return(startedEntity.ToDomain()); }
public void ModifyBlack(int blackid, string type, int unionid, string unionname, int status, int subStatus, string cardCode, string Remark)//Type,UnionID,UnionName,Remark,OperatorID,Status { BlackListEntity entity = new BlackListEntity(); entity.BlackID = blackid; entity.BlackType = type; entity.UnionID = unionid; entity.UnionName = unionname; entity.SubStatus = subStatus; entity.Status = status; entity.CardCode = cardCode; entity.Remark = Remark; if (entity != null) { entity.OperatorID = CurrentUser.UserID.ToString().ToInt(0); } BlackListService.ModifyBlackList(entity); }
private static void LoadEntitiesFromXml(string path, List<BlackListEntity> entities) { var doc = new XmlDocument(); doc.Load(path); var dsDph = doc["ZoznamPlatitelovDPHsDovodomNaZrusenieRegistracie"]["DS_DPHZ"]; foreach (XmlElement el in dsDph) { var ble = new BlackListEntity(); ble.IcDph = el["IC_DPH"].InnerText; ble.Nazov = el["NAZOV"].InnerText.Replace('"', ' '); ble.Obec = el["OBEC"].InnerText.Replace('"', ' '); ble.Psc = el["PSC"].InnerText.Replace('"', ' '); ble.Adresa = el["ADRESA"].InnerText.Replace('"', ' '); ble.RokPorusenia = Convert.ToInt32(el["ROK_PORUSENIA"].InnerText); ble.DatumZverejnenia = el["DAT_ZVEREJNENIA"].InnerText; entities.Add(ble); } }
public async Task <(IEnumerable <BlackListModel>, string continuationToken)> TryGetAllAsync(string blockchainType, int take, string continuationToken = null) { if (!string.IsNullOrEmpty(continuationToken)) { try { JsonConvert.DeserializeObject <TableContinuationToken>(Utils.HexToString(continuationToken)); } catch { throw new ArgumentValidationException($"{continuationToken} continuationToken is not valid", $"{nameof(continuationToken)}"); } } var partitionKey = BlackListEntity.GetPartitionKey(blockchainType); var(entities, newToken) = await _storage.GetDataWithContinuationTokenAsync(partitionKey, take, continuationToken); return(entities?.Select(x => x.ToDomain()), newToken); }
public static List <BlackListEntity> GetBlackListAll() { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetAllBlackList();//Cache.Get<List<BlackListInfo>>("BlackListALL"); //if (miList.IsEmpty()) //{ // miList = mr.GetAllBlackList(); // Cache.Add("BlackListALL", miList); //} if (!miList.IsEmpty()) { foreach (BlackListInfo mInfo in miList) { BlackListEntity BlackListEntity = TranslateBlackListEntity(mInfo); all.Add(BlackListEntity); } } return(all); }
public static bool ModifyBlackList(BlackListEntity entity) { long result = 0; if (entity != null) { BlackListRepository mr = new BlackListRepository(); BlackListInfo info = TranslateBlackListInfo(entity); if (entity.BlackID > 0) { info.ChangeDate = DateTime.Now; mr.ModifyBlackList(info); } else { info.ChangeDate = DateTime.Now; info.CreateDate = DateTime.Now; result = mr.CreateNew(info); } } return(result > 0); }
private static BlackListEntity TranslateBlackListEntity(BlackListInfo info) { BlackListEntity entity = new BlackListEntity(); if (info != null) { entity.BlackID = info.BlackID; entity.BlackType = info.BlackType; entity.BlackTypeDesc = StringHelper.GetBlackTypeDesc(info.BlackType); entity.UnionID = info.UnionID; entity.UnionName = info.UnionName; entity.Status = info.Status; entity.SubStatus = info.SubStatus; entity.CardCode = info.CardCode; entity.Remark = info.Remark; entity.OperatorID = info.OperatorID; entity.CreateDate = info.CreateDate; entity.ChangeDate = info.ChangeDate; } return(entity); }
private static BlackListInfo TranslateBlackListInfo(BlackListEntity entity) { BlackListInfo info = new BlackListInfo(); if (info != null) { info.BlackID = entity.BlackID; info.BlackType = entity.BlackType; info.UnionID = entity.UnionID; info.UnionName = entity.UnionName; info.Status = entity.Status; info.SubStatus = entity.SubStatus; info.CardCode = entity.CardCode; info.Remark = entity.Remark; info.OperatorID = entity.OperatorID; info.CreateDate = entity.CreateDate; info.ChangeDate = entity.ChangeDate; } return(info); }
public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); BlackListEntity para = new BlackListEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); //类型 if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { var condition = queryParam["condition"].ToString().ToLower(); switch (condition) { case "objectname": para.ObjectName = queryParam["keyword"].ToString(); break; } } if (!queryParam["schoolid"].IsEmpty()) { para.SchoolId = queryParam["schoolid"].ToString(); } } var pageList = BlackListBLL.Instance.GetPageList(para, ref pagination); var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public async Task SaveAsync(BlackListModel aggregate) { var entity = BlackListEntity.FromDomain(aggregate); await _storage.InsertOrReplaceAsync(entity); }