public IActionResult DeleteFile(int id) { InfoItem infoItem = _context.INFO_ITEMS.Find(id); if (infoItem == null) { return(NotFound()); } if (infoItem.ATTACHED_FILE != null) { var fileToDelete = Path.Combine( Directory.GetCurrentDirectory(), "wwwroot", infoItem.ATTACHED_FILE); if (System.IO.File.Exists(fileToDelete)) { System.IO.File.Delete(fileToDelete); } infoItem.ATTACHED_FILE = null; _context.INFO_ITEMS.Update(infoItem); _context.SaveChanges(); } return(Ok()); }
/// <summary> /// /// </summary> /// <param name="value"></param> private void Append(InfoItem value) { if (!_parameters.ContainsKey(value.Key)) { object obj = value.Value; if (value.Element.DataSchema.TypeName.StartsWith("date")) { DateTime t; if (!DateTime.TryParse(value.Value, out t)) { this.IsValid = false; this.Description += value.Key + "非法的日期格式" + value.Value + ";"; } if (t < SystemTime.MinDate) { t = SystemTime.MinDate; } else if (t > SystemTime.MaxDate) { t = SystemTime.MaxDate; } obj = t; } if (obj == null) { obj = DBNull.Value; } var p = _createParameter(); p.ParameterName = value.Key; p.Value = obj; _parameters.Add(value.Key, p); _text.Append("@").Append(value.Key); } }
// Update is called once per frame void Update() { frames = frames + 1; for (int i = 0; i < poseScriptJoint.jointPoints.Length; i++) { if (i != 11 || i != 13) { Debug.Log("eye null"); } else { InfoItem infoitem = new InfoItem(); infoitem.Info.transformX = poseScriptJoint.jointPoints[i].Transform.position.x.ToString(); infoitem.Info.transformY = poseScriptJoint.jointPoints[i].Transform.position.x.ToString(); infoitem.Info.transformZ = poseScriptJoint.jointPoints[i].Transform.position.x.ToString(); infoitem.Info.rotationX = poseScriptJoint.jointPoints[i].Transform.rotation.x.ToString(); infoitem.Info.rotationY = poseScriptJoint.jointPoints[i].Transform.rotation.x.ToString(); infoitem.Info.rotationZ = poseScriptJoint.jointPoints[i].Transform.rotation.x.ToString(); infoitem.Info.Jointname = poseScriptJoint.jointPoints[i].Transform.name; infoitems.Add(infoitem); } } directory.Add(frames.ToString(), infoitems); OnClickSave(); infoitems.Clear(); }
public void Conference_Add() { // Arrange string section = "DPRO"; var info = new InfoItem { Name = "DevPRO", City = "Tomsk", Location = "ul. Naberejnaya reki Ushaiky, 12 (IAM TSU)" }; using (var context = GetContextWithData()) using (var controller = new ConferenceController(context)) { // Act var result = controller.Create(section, info); // Assert var createdResult = result.Should().BeOfType <CreatedAtRouteResult>().Subject; var item = createdResult.Value.Should().BeAssignableTo <ConferenceItem>().Subject; item.Section.Should().Be("DPRO"); item.Info.Name.Should().Be("DevPRO"); item.Info.City.Should().Be("Tomsk"); item.Info.Location.Should().Be("ul. Naberejnaya reki Ushaiky, 12 (IAM TSU)"); } }
private List <InfoItem> ToInfoItems(DataSet ds) { List <InfoItem> list = new List <InfoItem>(); DataRowCollection rows = ds.Tables[0].Rows; DataColumnCollection cols = ds.Tables[0].Columns; string[] s = new string[cols.Count]; for (int n = 0; n < cols.Count; n++) { s[n] = cols[n].ColumnName; } for (int i = 0; i < rows.Count; i++) { DataRow r = rows[0]; InfoItem it = new InfoItem(); it.Infoid = Convert.ToInt32(rows[i]["InfoID"]); it.Infoclass = Convert.ToInt32(rows[i]["Class"]); it.Infogroup = Convert.ToInt32(rows[i]["Group"]); it.Title = DBUtil.CheckDataRow(rows[i], "Title", s, "").ToString(); it.Subhead = DBUtil.CheckDataRow(rows[i], "Subhead", s, "").ToString(); it.Summary = DBUtil.CheckDataRow(rows[i], "Summary", s, "").ToString(); it.Content = DBUtil.CheckDataRow(rows[i], "Content", s, "").ToString(); it.Author = DBUtil.CheckDataRow(rows[i], "Author", s, "").ToString(); it.Happendate = Convert.ToInt64(DBUtil.CheckDataRow(rows[i], "HappenDate", s, -1)); it.Credate = Convert.ToInt64(DBUtil.CheckDataRow(rows[i], "CreDate", s, -1)); it.Infostatus = Convert.ToInt32(DBUtil.CheckDataRow(rows[i], "InfoStatus", s, -1)); it.Memo = DBUtil.CheckDataRow(rows[i], "Memo", s, "").ToString(); it.Hitcount = Convert.ToInt32(DBUtil.CheckDataRow(rows[i], "HitCount", s, 0)); it.Ext1 = DBUtil.CheckDataRow(rows[i], "Ext1", s, "").ToString(); it.Ext2 = DBUtil.CheckDataRow(rows[i], "Ext2", s, "").ToString(); it.Ext3 = DBUtil.CheckDataRow(rows[i], "Ext3", s, "").ToString(); list.Add(it); } return(list); }
internal void AddChild(InfoItem item) { if (!childs.Contains(item)) { childs.Add(item); } }
/// <summary>Sets Information Item.</summary> /// <param name="panel">Information Item Panel.</param> public void ShowInfoItem(IInfoItemPanel panel) { _infoItemPanel = panel; InfoItem item = panel.GetInfoItem(); txbTitle.Text = item.SrcTitle; txbUrl.Text = item.Link; txbChannel.Text = item.Channel; dkpView.Children.Clear(); InfoItemViewer intoViewer = new InfoItemViewer(item); intoViewer.Width = dkpView.ActualWidth; intoViewer.Height = dkpView.ActualHeight; dkpView.Children.Add(intoViewer); if (item.Description == null || item.Description.Length <= 0) { lblEmpty.Visibility = Visibility.Visible; } else { lblEmpty.Visibility = Visibility.Hidden; } }
public Item(World world, InfoItem infoItem) : base(world) { this.infoItem = infoItem; rect = new RectangleShape(new Vector2f(infoItem.SpriteSheet.SubWidth, infoItem.SpriteSheet.SubHeight)); rect.Texture = infoItem.SpriteSheet.Texture; rect.TextureRect = infoItem.SpriteSheet.GetTextureRect(infoItem.SpriteI, infoItem.SpriteJ); }
//详细信息表 public ActionResult InfoItem() { InfoItemViewModel infoitemview = new InfoItemViewModel(); DataSet info = _ServicesSoapClient.GetInfoItem(); foreach (DataRow row in info.Tables[0].Rows) { InfoItem infoiteminfo = new InfoItem(); infoiteminfo.CategoryCode = row[0].ToString(); infoiteminfo.Code = row[1].ToString(); infoiteminfo.Name = row[2].ToString(); infoiteminfo.ParentCode = row[3].ToString(); infoiteminfo.SortNo = Convert.ToInt32(row[4]); infoiteminfo.ControlCode = row[8].ToString(); if (infoiteminfo.ControlCode != "") { infoiteminfo.ControlType = _ServicesSoapClient.GetMstTypeName("ControlType", Convert.ToInt32(infoiteminfo.ControlCode)); } else { infoiteminfo.ControlType = ""; } infoiteminfo.OptionCategory = row[9].ToString(); infoitemview.InfoItemList.Add(infoiteminfo); } return(View(infoitemview)); }
private void PlaceCubeNear(Vector3 clickPoint) { InfoItem info = pasteObj.GetComponent <InfoItem>(); float xCrat = 0, zCrat = 0; if (info.item.width % 2 == 0) { xCrat = 0.5f; } if (info.item.height % 2 == 0) { zCrat = 0.5f; } clickPoint -= new Vector3(xCrat, 0, zCrat); //Vector3 finalPosition = grid.GetNearestPointOnGrid(clickPoint); //finalPosition = new Vector3(finalPosition.x, 1.0f, finalPosition.z); Debug.Log("finalPosition " + clickPoint + "| " + clickPoint); canCreate = CheckGridFree(info, clickPoint); if (canCreate) { //Debug.Log("Create not access!" + finalPosition); pasteObj.transform.position = new Vector3(clickPoint.x + xCrat, 0, clickPoint.z + zCrat); pasteObj.GetComponent <FollowMousePosition>().enabled = false; info.ColorSwap(Color.clear); MyGrid.DotsBlock(clickPoint, info.item.width, info.item.height, 1); pasteObj = null; } else { info.ColorSwap(Color.red); Debug.Log("Create not access!"); } }
private void InitArticle(string artid) { showMode = "art"; int id = Convert.ToInt32(artid); ibll.PlusHitCountByKey(id); InfoItem art = ibll.GetArticleByKey(id); if (art != null) { ModelClass cl = cbll.GetClassBySN(art.Infoclass); if (cl != null) { pagePosition += ">>" + cl.GroupTitle + ">><a href='ArticleList.aspx?gr=" + cl.Group + "&cl=" + cl.Sn + "'>" + cl.Title + "</a>>>详细信息"; } lbArticleTitle.Text = art.Title; if (art.Happendate > 10000000) { lbTime.Text = articleConverter.ValueToDateStringConverter(art.Happendate); } else { lbTime.Text = DateTime.FromFileTime(art.Credate).ToString("yyyy-MM-dd HH:mm"); } lbHit.Text = art.Hitcount.ToString(); lbAuthor.Text = art.Author; iframeUrl = "Article.aspx?id=" + id; } }
/// <summary>Gets Information Item related to this panel.</summary> /// <returns>Information Item related to this panel.</returns> public InfoItem GetInfoItem() { InfoItem dummy = new InfoItem(); dummy.Title = txbMenuItem.Text; return(dummy); }
public static void saveToJson(InfoItem infoitem) { PlayerInfo playerinfo = readArchive(); bool isAdd = true; //存档不为空 if (playerinfo != null) { for (int i = 0; i < playerinfo.inforList.ToArray().Length; i++) { //存在改存档,修改存档即可 if (playerinfo.inforList[i].id == infoitem.id) { playerinfo.inforList[i] = infoitem; isAdd = false; } } //如果不存在此项存档,添加存档 if (isAdd) { playerinfo.inforList.Add(infoitem); } trans_save(playerinfo); } else { Debug.LogError("Archive failed"); } }
public async Task <Token> UpdateTokenAsync() { using (Metrics.CreateHistogram("stack_air_update_token_async_duration_seconds", "").NewTimer()) { await SemaphoreSlim.WaitAsync(); try { var infoItem = new InfoItem(_apiSecret.ClientId, _apiSecret.ClientSecret, _apiSecret.Scope, _apiSecret.AuthorityUrl); var url = _apiSecret.GraphQLUrl; var token = await _service.GetTokenAsync(infoItem); if (token == null) { _logger.LogError(2432, "Error occurred while fetch token."); return(null); } return(token); } finally { SemaphoreSlim.Release(); } } }
void Start() { info = GetComponent <InfoItem>(); Vector3 centerCamera = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, Camera.main.nearClipPlane)); transform.position = new Vector3(centerCamera.x + 7.5f, 0.0f, centerCamera.z + 7.5f); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = "GetExtendedInfoItem/{id}")] HttpRequest req, string id) { _logger.LogInformation("C# HTTP trigger function GetExtendedInfoItem processed a request."); string tenant = req.Headers[Constants.HEADER_TENANT]; if (String.IsNullOrWhiteSpace(tenant)) { tenant = null; } ServerSettings serverSettings = await _serverSettingsRepository.GetServerSettings(tenant); string keyWord = req.Headers[Constants.HEADER_KEYWORD]; if (String.IsNullOrEmpty(keyWord) || !(serverSettings.IsUser(keyWord))) { _logger.LogWarning("GetExtendedInfoItem called with wrong keyword."); return(new BadRequestErrorMessageResult("Keyword is missing or wrong.")); } // Get CalendarItem by id InfoItem rawInfoItem = await _cosmosRepository.GetItem(id); if (null == rawInfoItem) { return(new BadRequestErrorMessageResult("No InfoItem with given id found.")); } ExtendedInfoItem extendedItem = new ExtendedInfoItem(rawInfoItem); // Read all comments extendedItem.CommentsList = await _commentRepository.GetItems(c => c.CalendarItemId.Equals(extendedItem.Id)); return(new OkObjectResult(extendedItem)); }
/// <summary> /// 构建update语句 /// </summary> /// <returns></returns> private void BuildUpdateSql() { IList <InfoItem> valueItems = new List <InfoItem>(); // 添加触发器关注字段 valueItems.Add(InfoItem.Create(_ontology.ModifiedOnElement, DateTime.Now.ToString())); valueItems.Add(InfoItem.Create(_ontology.ModifiedNodeIdElement, _clientId)); valueItems.Add(InfoItem.Create(_ontology.ModifiedCommandIdElement, _commandId)); foreach (var item in _infoValue) { valueItems.Add(item); } _text.Append("update [").Append(_ontology.Ontology.EntityTableName).Append("] set "); int l2 = _text.Length; foreach (var infoItem in valueItems) { if (infoItem.Element != _ontology.IdElement) { if (_text.Length > l2) { _text.Append(","); } _text.Append(infoItem.Element.Element.FieldCode).Append("="); this.Append(infoItem); } } _text.Append(" where Id="); this.Append(InfoItem.Create(_ontology.IdElement, _localEntityId)); }
public async Task Conference_Post() { // Arrange string section = "DPRO"; var info = new InfoItem { Name = "DevPRO", City = "Tomsk", Location = "ul. Naberejnaya reki Ushaiky, 12 (IAM TSU)" }; var content = JsonConvert.SerializeObject(info); var stringContent = new StringContent(content, Encoding.UTF8, "application/json"); // Act var response = await _client.PostAsync("/conference/" + section + "/info", stringContent); // Assert response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); var conference = JsonConvert.DeserializeObject <ConferenceItem>(responseString); conference.Section.Should().Be("DPRO"); conference.Info.Name.Should().Be("DevPRO"); conference.Info.City.Should().Be("Tomsk"); conference.Info.Location.Should().Be("ul. Naberejnaya reki Ushaiky, 12 (IAM TSU)"); }
private void infoItemView(DataSet ds) { flowLayoutPanel1.Controls.Clear(); InfoItem[] infolist = new InfoItem[count]; int i = 0; foreach (DataRow item in ds.Tables[0].Rows) { infolist[i] = new InfoItem(); infolist[i].lb_COM_NAME = item["COM_NAME"].ToString(); infolist[i].lb_FIELD = item["FIELD"].ToString(); double point; double.TryParse(item["STAR_PT"].ToString(), out point); infolist[i].lb_POINT = point; int sales; int.TryParse(item["SALES"].ToString(), out sales); infolist[i].lb_SALES = sales; infolist[i].lb_COM_TEL = item["COM_TEL"].ToString(); int ap_count; int.TryParse(item["AP_COUNT"].ToString(), out ap_count); infolist[i].lb_AP_COUNT = ap_count; infolist[i].lb_COM_ADDR = item["COM_ADDR"].ToString(); if (flowLayoutPanel1.Controls.Count < 0) { flowLayoutPanel1.Controls.Clear(); } flowLayoutPanel1.Controls.Add(infolist[i]); i++; } }
static Window CreatePackageWindow(InfoItem infoItem) { var window = new TooltipInformationWindow(); window.ShowArrow = true; window.RepositionWindow(); var cts = new CancellationTokenSource(); window.Closed += delegate { cts.Cancel(); }; var packages = infoItem.Packages; TooltipInformation ti; bool done = CreatePackageTooltipInfo((string)infoItem.ResolveResult.Reference, packages, out ti); if (!done) { packages.ContinueWith(t => { if (!done) { done = CreatePackageTooltipInfo((string)infoItem.ResolveResult.Reference, packages, out ti); if (ti != null) { window.Clear(); window.AddOverload(ti); } } }, cts.Token, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); } window.AddOverload(ti); return(window); }
static Info() { Expert = new InfoItem(182, 160, 74, 31); Goblins = new InfoItem(80, 74, 52, 20); Tournament = new InfoItem(98, 72, 54, 20); OldGods = new InfoItem(100, 72, 54, 21); Gadgetzan = new InfoItem(98, 72, 54, 20); Ungoro = new InfoItem(98, 72, 54, 23); FrozenThrone = new InfoItem(98, 72, 54, 23); Kobolds = new InfoItem(98, 72, 54, 23); Witchwood = new InfoItem(98, 72, 54, 23); Naxx = new InfoItem(36, 8, 4, 6); Mountain = new InfoItem(30, 22, 0, 5); League = new InfoItem(50, 26, 4, 5); Karazhan = new InfoItem(54, 24, 2, 5); Hall = new InfoItem(6, 2, 2, 5); Dictionary = new Dictionary <CardSet, InfoItem> { { CardSet.HOF, Hall }, { CardSet.EXPERT1, Expert }, { CardSet.GVG, Goblins }, { CardSet.TGT, Tournament }, { CardSet.OG, OldGods }, { CardSet.GANGS, Gadgetzan }, { CardSet.UNGORO, Ungoro }, { CardSet.ICECROWN, FrozenThrone }, { CardSet.LOOTAPALOOZA, Kobolds }, { CardSet.GILNEAS, Witchwood }, { CardSet.NAXX, Naxx }, { CardSet.BRM, Mountain }, { CardSet.LOE, League }, { CardSet.KARA, Karazhan } }; }
private async Task <IEnumerable <InfoDocument> > GetDocumentCategoryOtv(int userId) { using (var connection = new MySqlConnection(_dataBaseMain.ConntectionString)) { var docs = new List <InfoDocument>(); var queryRoot = await connection.QueryAsync <InfoRoot>(SqlQueryHelper.Query, new { userId }); foreach (var item in queryRoot.GroupBy(g => g.Razdel)) { var doc = new InfoDocument(); doc.Title = item.Key; doc.Items = new List <InfoCategoty>(); foreach (var root in item.GroupBy(g => g.Text.ToLower().Contains("уголов") ? "Уголовня ответственность" : "Иная ответственность")) { var itemCategory = new InfoCategoty(); itemCategory.Title = root.Key; itemCategory.Items = new List <InfoItem>(); foreach (var infoRoot in root.GroupBy(g => g.Text)) { var itemLine = new InfoItem(); itemLine.Title = infoRoot.Key; itemLine.ProfName = infoRoot.Select(s => s.ProfName).ToList(); itemCategory.Items.Add(itemLine); } doc.Items.Add(itemCategory); } docs.Add(doc); } return(docs); } }
private async Task <IEnumerable <InfoDocument> > GetDocumentCategoryDol(int userId) { using (var connection = new MySqlConnection(_dataBaseMain.ConntectionString)) { var docs = new List <InfoDocument>(); var queryRoot = await connection.QueryAsync <InfoRoot>(SqlQueryHelper.QueryGlagol, new { userId }); foreach (var item in queryRoot.GroupBy(g => g.Razdel)) { var doc = new InfoDocument(); doc.Title = item.Key; doc.Items = new List <InfoCategoty>(); foreach (var root in item.GroupBy(g => g.Category)) { var itemCategory = new InfoCategoty(); itemCategory.Title = root.Key; itemCategory.Items = new List <InfoItem>(); foreach (var infoRoot in root.GroupBy(g => g.Text)) { var itemLine = new InfoItem(); itemLine.Title = FirstLetterToUpper(infoRoot.Key.Trim(',', ' ')); itemLine.ProfName = infoRoot.Select(s => s.ProfName).ToList(); itemCategory.Items.Add(itemLine); } doc.Items.Add(itemCategory); } docs.Add(doc); } return(docs); } }
protected InfoItem CreateItem(DocumentItem rootDocItem, string number) { InfoItem infoItem = new InfoItem(); if (_wordDbContext.DocumentItem.FirstOrDefault(f => f.Number == number && f.Parent == rootDocItem) == null) { infoItem.Title = "Тут должно быть что-то, но в инструкции ничего нет"; infoItem.ProfName = new List <string>(); if (_wordDbContext.DocumentLoader.FirstOrDefault(f => f.Id == rootDocItem.DocumentLoaderId) == null) { infoItem.ProfName.Add("Не определилось должность"); } else { infoItem.ProfName.Add(_wordDbContext.DocumentLoader.FirstOrDefault(f => f.Id == rootDocItem.DocumentLoaderId).ProfName); } } else { infoItem.Title = _wordDbContext.DocumentItem.FirstOrDefault(f => f.Number == number && f.Parent == rootDocItem).TextContent; infoItem.ProfName = new List <string>(); if (_wordDbContext.DocumentLoader.FirstOrDefault(f => f.Id == rootDocItem.DocumentLoaderId) == null) { infoItem.ProfName.Add("Не определилось должность"); } else { infoItem.ProfName.Add(_wordDbContext.DocumentLoader.FirstOrDefault(f => f.Id == rootDocItem.DocumentLoaderId).ProfName); } } return(infoItem); }
private static InfoItem[] GetTuple(MessageContext context) { if (context.Command.Verb == Verb.Create) { var items = new List <InfoItem>(); var commandFactory = context.Host.NodeHost.MessageProducer; foreach (var node in context.Host.NodeHost.Nodes) { if (commandFactory.IsProduce(context, node)) { bool isCare = false; foreach (var item in context.InfoTuplePair.ValueTuple) { if (node.IsCareforElement(item.Element)) { isCare = true; items.Add(item); } } if (isCare) { foreach (var element in node.GetInfoIdElements()) { items.Add(InfoItem.Create(element, string.Empty)); } } } } return(items.ToArray()); } return(context.TowInfoTuple.SingleInfoTuple); }
/// <summary> /// 通过主键获取信息对象 /// </summary> /// <param name="id">主键</param> /// <returns></returns> public InfoItem GetInfoItemByKey(int id) { InfoItem i = null; SqlParameter[] array = { new SqlParameter("@id", id) }; DataSet ds = DBUtil.ExecuteQuery(SQL_getInfoItemByKey, array); if (ds.Tables[0].Rows.Count > 0) { i = new InfoItem(); i.Infoid = Convert.ToInt32(ds.Tables[0].Rows[0]["InfoID"]); i.Infoclass = Convert.ToInt32(ds.Tables[0].Rows[0]["Class"]); i.Infogroup = Convert.ToInt32(ds.Tables[0].Rows[0]["Group"]); i.Title = ds.Tables[0].Rows[0]["Title"].ToString(); i.Subhead = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Subhead"], "").ToString(); i.Summary = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Summary"], "").ToString(); i.Content = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Content"], "").ToString(); i.Ext1 = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Ext1"], "").ToString(); i.Ext2 = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Ext2"], "").ToString(); i.Ext3 = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Ext3"], "").ToString(); i.Author = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Author"], "").ToString(); i.Happendate = Convert.ToInt64(DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["HappenDate"], -1)); i.Credate = Convert.ToInt64(ds.Tables[0].Rows[0]["CreDate"]); i.Infostatus = Convert.ToInt32(ds.Tables[0].Rows[0]["InfoStatus"]); i.Memo = DBUtil.DBNullReplace(ds.Tables[0].Rows[0]["Memo"], "").ToString(); i.Hitcount = Convert.ToInt32(ds.Tables[0].Rows[0]["HitCount"]); } return(i); }
public async Task <bool> TryRequestTokenAsync() { try { if (_token != null && _expires > DateTimeOffset.Now) { return(true); } var infoItem = new InfoItem( _secret.ClientId, _secret.ClientSecret, _secret.Scope, _secret.AuthorityUrl); _token = await _identity.GetTokenAsync(infoItem); if (_token == null) { _logger.LogWarning(2432, $"Error occurred while request token Client: '{infoItem.ClientId}', Scope '{infoItem.Scope}'."); return(false); } _expires = DateTimeOffset.Now.AddSeconds(_token.ExpiresIn - 60); return(true); } catch (Exception ex) { _logger.LogError(2432, ex, $"Error occurred while request token."); return(false); } }
public async Task <Token> GetTokenAsync( InfoItem infoItem) { var disco = await _client.GetDiscoveryDocumentAsync(infoItem.Url); if (disco.IsError) { _logger.LogError(7231, $"Failed to connect to '{infoItem.Url}'. No DiscoveryDocument could be loaded"); return(null); } var tokenResponse = await _client.RequestClientCredentialsTokenAsync( new ClientCredentialsTokenRequest { Scope = infoItem.Scope, Address = disco.TokenEndpoint, ClientId = infoItem.ClientId, ClientSecret = infoItem.Secret }); infoItem.Delete(); if (tokenResponse.IsError) { _logger.LogError(7231, $"Failed to download token from '{infoItem.Url}'. Error Description:'{tokenResponse.ErrorDescription}' Error Reason: '{tokenResponse.HttpErrorReason}' Http Status: '{tokenResponse.HttpStatusCode}'"); return(null); } var token = Token.FromJson(tokenResponse.Raw); return(token ?? null); }
public static void save(Role role) { InfoItem infoitem = new InfoItem(role); infoitem.otherstates = temp; saveToJson(infoitem); }
private void AfterBuying() { MobaMessageManagerTools.SendClientMsg(ClientV2C.propviewCollectionAfterBuying, null, false); SacrificialCtrl.GetInstance().collectionState = CollectionState.Nothing; InfoItem component = this.item_Info.GetComponent <InfoItem>(); component.Init(false); }
/// <summary> /// /// </summary> /// <param name = "actionType"></param> /// <param name="ontology"></param> /// <param name="isDumb"></param> /// <param name="client"></param> /// <param name="commandId"></param> /// <param name="localEntityId"></param> /// <param name="infoValue"></param> internal DbCmd(DbActionType actionType, OntologyDescriptor ontology, bool isDumb, NodeDescriptor client, string commandId, string localEntityId, InfoItem[] infoValue) { this.ActionType = actionType; this.Ontology = ontology; this.IsDumb = isDumb; this.Client = client; this.CommandId = commandId; this.LocalEntityId = localEntityId; this.InfoValue = infoValue; }
public void UpdateResultInfo(InfoItem item) { CombinedCode item1 = item as CombinedCode; AssertsUnit item2 = item as AssertsUnit; ProjectCode item3 = item as ProjectCode; if (item1 != null) this.UpdateResultInfo(item1.Xmdm, item1.Zcdy, item1.Zhdm); else if (item2 != null) this.UpdateResultInfo(item2.Xmdm, item2.Zcdy, null); else if (item3 != null) this.UpdateResultInfo(item3.Xmdm, null, null); }
public ManagedObject(OntologyDescriptor ontology, InfoItem[] entity, InfoItem[] inputValues) { if (ontology == null) { throw new ArgumentNullException("ontology"); } if (entity == null) { throw new ArgumentNullException("entity"); } this.Ontology = ontology; this.Entity = entity; this.InputValues = inputValues; }
static void SaveItemAttribute(int p_index, InfoItem p_attribute, string p_value) { string __key = InfoName.ITEM.ToString() + p_index.ToString() + p_attribute.ToString(); PlayerPrefs.SetString(__key, p_value); }
public MessageTuple(MessageContext context, InfoItem[] tuple) { this.Context = context; this.Tuple = tuple; }
/// <summary> /// /// </summary> public Sql(OntologyDescriptor ontology, string clientId, string commandId, DbActionType actionType, string localEntityId, InfoItem[] infoValue, Func<DbParameter> createParameter) { this._ontology = ontology; this._localEntityId = localEntityId; this._infoValue = infoValue; this._clientId = clientId; this._commandId = commandId; this._createParameter = createParameter; if (ontology == null || string.IsNullOrEmpty(localEntityId)) { this.IsValid = false; this.Description = "命令信息标识或信息值为空或本体为空或本地标识为空"; throw new ArgumentNullException("command"); } // 无需把switch流程选择逻辑重构掉,因为actionType枚举不存在变化 switch (actionType) { case DbActionType.Insert: if (infoValue == null || infoValue.Length == 0) { this.Description = "命令信息值为空"; break; } BuildInsertSql(); break; case DbActionType.Update: if (infoValue == null || infoValue.Length == 0) { this.Description = "命令信息值为空"; break; } BuildUpdateSql(); break; case DbActionType.Delete: BuildDeleteSql(); break; default: this.IsValid = false; this.Description = "意外的不能执行的动作码" + actionType.ToString(); break; } }
private bool ValidInfoItem(InfoItem infoItem, out ProcessResult result) { #region 空值验证 if (infoItem.Element.Element != null && infoItem.Element.Element.IsInput && infoItem.Element.DataSchema != null && !infoItem.Element.DataSchema.IsNullable) { if (string.IsNullOrEmpty(infoItem.Value)) { result = new ProcessResult(false, Status.InvalidInfoValue, "不能为空的值:" + infoItem.Value); return false; } } #endregion #region 值长度验证 if (infoItem.Element.Element.MaxLength.HasValue && infoItem.Element.Element.MaxLength > 0) { if (infoItem.Value != null && infoItem.Value.Length > infoItem.Element.Element.MaxLength.Value) { result = new ProcessResult(false, Status.OutOfLength, "超过长度限制的值:" + infoItem.Value); return false; } } #endregion #region 字典验证 if (infoItem.Element.Element.InfoDicId.HasValue) { InfoDicState infoDic; if (!infoItem.Element.Host.NodeHost.InfoDics.TryGetInfoDic(infoItem.Element.Element.InfoDicId.Value, out infoDic)) { result = new ProcessResult(false, Status.InternalServerError, infoItem.Element.Element.Name + "本体元素信息字典配置错误,非法的信息字典标识:" + infoItem.Element.Element.InfoDicId.Value); return false; } InfoDicItemState infoDicItem; if (!infoItem.Element.Host.NodeHost.InfoDics.TryGetInfoDicItem(infoDic, infoItem.Value, out infoDicItem) || infoDicItem.IsEnabled != 1) { result = new ProcessResult(false, Status.InvalidDicItemValue, "非法的" + infoItem.Element.Element.Name + "字典值:" + infoItem.Value); return false; } } #endregion #region 正则验证 if (!string.IsNullOrEmpty(infoItem.Value) && !string.IsNullOrEmpty(infoItem.Element.Element.Regex)) { if (!Regex.IsMatch(infoItem.Value, infoItem.Element.Element.Regex)) { result = new ProcessResult(false, Status.InvalidInfoValue, "非法格式的" + infoItem.Element.Element.Name + "值:" + infoItem.Value); return false; } } #endregion // 如果是目录 if (infoItem.Element.Ontology.Ontology.IsCataloguedEntity && infoItem.Key.Equals("ZZJGM", StringComparison.OrdinalIgnoreCase)) { CatalogState org; if (!this.ValidCatalogCode(infoItem.Element.Ontology, infoItem.Value, out org, out result)) { return false; } } // 应用信息验证器 foreach (var infoRule in infoItem.Element.Element.GetInfoRules()) { var r = infoRule.InfoRule.Valid(infoItem.Value); if (r.IsSuccess) continue; result = new ProcessResult(false, r.StateCode, r.Description); if (r.Exception != null) { infoItem.Element.Host.LoggingService.Error(r.Exception); } return false; } result = ProcessResult.Ok; return true; }
public void UpdateInfo(InfoItem item) { this.item = item; infoText.text = item.GetInfo(); }
static string LoadItemAttributeString(int p_index, InfoItem p_attribute) { string __key = InfoName.ITEM.ToString() + p_index.ToString() + p_attribute.ToString(); return PlayerPrefs.GetString(__key); }
public void FormattedResult_Includes_BlockedColumns() { // Arrange. var item = new InfoItem { Field1 = "Value 1", Field2 = "Value 2", Field3 = "Value 3", BlockedFields = { "Field2" } }; var searchResult = new SearchCommandResult { Items = new InfoList<IInfoClass> { item }, ResultColumns = { CreateColumnMetadata("Field1"), CreateColumnMetadata("Field2"), CreateColumnMetadata("Field3") } }; var formatter = new InternalSearchResultFormatter(_colorTranslator); // Act. var result = formatter.FormatResult(searchResult); // Assert. Assert.IsNotNull(result); Assert.IsNotNull(result.Items); Assert.AreEqual(1, result.Items.Count); Assert.IsTrue(result.Items[0].BlockedColumns.SequenceEqual(new[] { 1 })); }
public void FormatResult_CanFormat_BackcolorColumns() { // Arrange. var item1 = new InfoItem { Field1_BC = 0 }; var item2 = new InfoItem { Field1_BC = 0xFF123456 }; var searchResult = new SearchCommandResult { Items = new InfoList<IInfoClass> { item1, item2 }, ResultColumns = { CreateColumnMetadata("Field1_BC", ColumnTypes.FieldBackcolor) } }; var formatter = CreateFormatter(); // Act. var result = formatter.FormatResult(searchResult); // Assert. Assert.IsNotNull(result); Assert.IsNotNull(result.Items); Assert.AreEqual(2, result.Items.Count); Assert.IsTrue(result.Items[0].Values.SequenceEqual(new object[] { null })); Assert.IsTrue(result.Items[1].Values.SequenceEqual(new object[] { "#123456" })); }
public void FormatResult_CanFormat_ApprovalColumns() { // Arrange. var item1 = new InfoItem(); var item2 = new InfoItem { Approval = ApprovalStates.ReadyForApproval.ToString() }; var searchResult = new SearchCommandResult { Items = new InfoList<IInfoClass> { item1, item2 }, ResultColumns = { CreateColumnMetadata("Approval", ColumnTypes.Approval) } }; var formatter = CreateFormatter(); // Act. var result = formatter.FormatResult(searchResult); // Assert. Assert.IsNotNull(result); Assert.IsNotNull(result.Items); Assert.AreEqual(2, result.Items.Count); Assert.IsTrue(result.Items[0].Values.SequenceEqual(new object[] { ApprovalStates.NotReadyForApproval.GetDisplayName() })); Assert.IsTrue(result.Items[1].Values.SequenceEqual(new object[] { ApprovalStates.ReadyForApproval.GetDisplayName() })); }