/// <summary> /// Provede vložení hodnoty, a vyvolání eventu <see cref="ValueChanging"/>. /// Pokud ale na začátku je <see cref="_ValueIsChanging"/> == true, pak nedělá nic; to je ochranou proti zacyklení. /// </summary> /// <param name="sender"></param> /// <param name="value"></param> /// <param name="eventSource"></param> protected void _SetValue(object sender, T value, EventSourceType eventSource) { if (this._ValueIsChanging) { return; } try { this._ValueIsChanging = true; T oldValue = this._Value; T newValue = this.AlignValueToLimit(value); if (!this.IsEqual(oldValue, newValue)) { this._Value = newValue; GPropertyChangeArgs <T> args = new GPropertyChangeArgs <T>(oldValue, newValue, eventSource); this.CallValueChanging(sender, args); this._Value = args.CorrectValue; } } finally { this._ValueIsChanging = false; } }
/// <summary> /// Default constructor /// </summary> /// <param name="type">Event type</param> /// <param name="eventAtTimestamp">The DateTime when the Event occurred</param> /// <param name="sourceType">Specifies the origin of this event. For example, Notification, User etc.</param> /// <param name="sourceID">The identifier for the origin source of the event. For example, if the event occurred at the Notification level, the identifier would be the NotificationID.</param> public Event(EventType type, DateTime eventAtTimestamp, EventSourceType sourceType, long sourceID) { Type = type; EventAtTimestamp = eventAtTimestamp; SourceType = sourceType; SourceID = sourceID; }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { Dictionary <string, string> descDic = null; if (sourceType == EventSourceType.Group) { descDic = Config.GroupCommandDesc; } else if (sourceType == EventSourceType.Private) { descDic = Config.PrivateCommandDesc; } else { return; } StringBuilder desc = new StringBuilder().AppendLine(string.Join("\n", descDic.Select(p => $"{p.Key}\t\t{p.Value}"))); if (DataManager.Instance.AdminQQ > 0) { desc.Append($"bug反馈请联系QQ:{DataManager.Instance.AdminQQ}"); } MessageManager.Send(sourceType, desc.ToString(), qq: qq?.QQ, toGroupNo: member?.GroupNumber); }
/// <inheritdoc/> public async Task <bool> ReadAnyRemainingHourEventsAsync(int hourId, EventSourceType eventTypeToExclude, params EventStatus[] statuses) { using (var conn = connectionFactory.GetEddsPerformanceConnection()) { return(await conn.QueryFirstOrDefaultAsync <int>(Resources.Event_ReadCountByHourStatusTypes, new { hourId, eventTypeToExclude, statusIds = statuses.Select(s => (int)s).ToList() }) > 0); } }
public async Task DeleteAllByTypeAsync(EventSourceType eventType) { using (var conn = connectionFactory.GetEddsPerformanceConnection()) { await conn.ExecuteAsync(Resources.Event_DeleteAllByType, new { eventType }); } }
/// <summary> /// Uloží danou hodnotu do this._ValueTotal. /// Provede požadované akce (ValueAlign, ScrollDataValidate, InnerBoundsReset, OnValueChanged). /// </summary> /// <param name="valueTotal"></param> /// <param name="actions"></param> /// <param name="eventSource"></param> protected void SetValueTotal(DecimalRange valueTotal, ProcessAction actions, EventSourceType eventSource) { if (valueTotal == null) { return; } DecimalRange oldValueTotal = this._ValueTotal; DecimalRange newValueTotal = valueTotal; if (oldValueTotal != null && newValueTotal == oldValueTotal) { return; // No change = no reactions. } this._ValueTotal = newValueTotal; if (IsAction(actions, ProcessAction.RecalcValue)) { this.SetValue(this._Value, LeaveOnlyActions(actions, ProcessAction.RecalcValue, ProcessAction.PrepareInnerItems, ProcessAction.CallChangedEvents), eventSource); } if (IsAction(actions, ProcessAction.PrepareInnerItems)) { this.ChildItemsReset(); } if (IsAction(actions, ProcessAction.CallChangedEvents)) { this.CallValueTotalChanged(oldValueTotal, newValueTotal, eventSource); } if (IsAction(actions, ProcessAction.CallDraw)) { this.CallDrawRequest(eventSource); } }
public static void Send(EventSourceType sourceType, string message, long?qq = null, long?toGroupNo = null) { switch (sourceType) { case EventSourceType.Group: if (!toGroupNo.HasValue || toGroupNo <= 0) { return; } SendToGroup(toGroupNo.Value, message); break; case EventSourceType.Private: if (!qq.HasValue || qq <= 0) { return; } SendPrivate(qq.Value, message); break; case EventSourceType.Friend: if (!qq.HasValue || qq <= 0) { return; } SendPrivate(qq.Value, message); break; } }
/// <summary> /// Konstruktor /// </summary> /// <param name="oldvalue"></param> /// <param name="newValue"></param> /// <param name="eventSource"></param> public GPropertyChangeArgs(T oldvalue, T newValue, EventSourceType eventSource) { this.OldValue = oldvalue; this.NewValue = newValue; this.EventSource = eventSource; this.CorrectValue = newValue; this.Cancel = false; }
public async Task <Event> ReadLastBySourceIdAndTypeAsync(EventSourceType type, int?sourceId) { using (var conn = connectionFactory.GetEddsPerformanceConnection()) { return((sourceId.HasValue) ? await conn.QueryFirstOrDefaultAsync <Event>(Resources.Event_ReadLastByEventTypeWithSourceId, new { eventType = type, sourceId }) : await conn.QueryFirstOrDefaultAsync <Event>(Resources.Event_ReadLastByEventType, new { eventType = type })); } }
/// <summary> /// Use for testing only, indexes not optimized /// </summary> /// <param name="hourId"></param> /// <param name="sourceType"></param> /// <param name="eventStatus"></param> /// <returns></returns> public async Task <bool> ExistsAsync(int hourId, EventSourceType sourceType, EventStatus eventStatus) { using (var conn = connectionFactory.GetEddsPerformanceConnection()) { return(await conn.QueryFirstOrDefaultAsync <bool>( Resources.Event_ExistsForHourTypeStatus, new { hourId, sourceTypeId = sourceType, statusId = (int)eventStatus })); } }
/// <summary> /// Vyvolá metodu OnValueChanged() a event ValueChanged /// </summary> protected void CallValueChanged(Decimal oldValue, Decimal newValue, EventSourceType eventSource) { GPropertyChangeArgs <Decimal> args = new GPropertyChangeArgs <Decimal>(oldValue, newValue, eventSource); this.OnValueChanged(args); if (!this.IsSuppressedEvent && this.ValueChanged != null) { this.ValueChanged(this, args); } }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { if (sourceType != EventSourceType.Private) { return; } Common.CqApi.SendPraise(qq.QQ); MessageManager.Send(sourceType, "赞了赞了!", qq?.QQ); }
private async Task WaitUntilEventFoundAsync(int hourId, EventSourceType eventSourceType, CancellationToken cancellationToken) { var eventFound = false; while (!eventFound && !cancellationToken.IsCancellationRequested) { await Task.Delay(500, cancellationToken); eventFound = await this.eventRepository.ExistsAsync(hourId, eventSourceType, EventStatus.Completed); } }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { if (sourceType != EventSourceType.Private && sourceType != EventSourceType.Friend) { return; } if (qq == null || qq.QQ != DataManager.Instance.AdminQQ) { return; } var firstCommand = command.FirstOrDefault(); if (firstCommand == null) { return; } switch (firstCommand.ToLower()) { case "say": { command.RemoveAt(0); if (command.Count < 2) { return; } var groupNumber = 0L; if (!long.TryParse(command.First(), out groupNumber)) { return; } command.RemoveAt(0); var message = string.Join(" ", command); MessageManager.Send(EventSourceType.Group, message, qq?.QQ, groupNumber); return; } case "rename": command.RemoveAt(0); if (command.Count < 1) { return; } var name = command[0]; DataManager.Instance.BotName = name; MessageManager.Send(EventSourceType.Friend, "改名成功", qq?.QQ); return; case "save": DataManager.Save(); MessageManager.Send(EventSourceType.Friend, "保存成功", qq?.QQ); return; } }
public static void Execute(string command, EventSourceType sourceType, long?qqNo = null, long?groupNo = null) { UserInfo qq = null; Group group = null; if (qqNo.HasValue) { qq = UserManager.Get(qqNo.Value); } GroupMember member = null; if (qqNo.HasValue && groupNo.HasValue) { member = GroupMemberManager.Get(qqNo.Value, groupNo.Value); } if (!command.StartsWith(".") && !command.StartsWith("/")) { if (sourceType == EventSourceType.Group) { ExecuteWithoutCommand(command, sourceType, qq, member); } return; } var commandStr = command.Remove(0, 1); var commandList = TakeCommandParts(commandStr); var commandName = commandList.FirstOrDefault(); if (commandName == null) { return; } var manager = GetManagerByCommand(commandName); if (manager == null) { if (sourceType == EventSourceType.Group) { ExecuteWithoutCommand(command, sourceType, qq, member); } return; } commandList.RemoveAt(0); var args = commandList; Task.Run(async() => { await manager.ExecuteAsync(args, sourceType, qq, group, member); }); }
private static void ExecuteWithoutCommand(string message, EventSourceType sourceType, UserInfo qq, GroupMember member) { var managerList = new List <Tuple <BaseManager, List <string> > >(); var randomRes = Random.Next(1, 101); if (member != null && DataManager.Instance.GroupRepeatConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupRepeatConfig[member.GroupNumber]; if (randomRes <= config.Percent) { managerList.Add(new Tuple <BaseManager, List <string> >(new RepeatManager(), new List <string> { "repeat", message })); } } if (member != null && DataManager.Instance.GroupShaDiaoTuConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupShaDiaoTuConfig[member.GroupNumber]; if (randomRes <= config.Percent) { managerList.Add(new Tuple <BaseManager, List <string> >(new ShaDiaoTuManager(), new List <string> { "shadiaotu" })); } } if (member != null && DataManager.Instance.GroupBakiConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupBakiConfig[member.GroupNumber]; if (randomRes <= config.Percent) { managerList.Add(new Tuple <BaseManager, List <string> >(new BakiManager(), new List <string> { "baki" })); } } if (managerList.Any()) { var choose = Random.Next(0, managerList.Count); var choosen = managerList[choose]; Task.Run(async() => { await choosen.Item1.ExecuteAsync(choosen.Item2, sourceType, qq, null, member); }); } }
/// <summary> /// Ensure this.Bounds is valid for VirtualBounds and VirtualConvertor. /// If current Bounds is different from (VirtualBounds × VirtualConvertor), then store correct value to base.Bounds from this.VirtualBounds via this.VirtualConvertor. /// </summary> protected void CheckBounds(ProcessAction actions, EventSourceType sourceType) { if (this.IsVirtualValid) { return; } Rectangle?bounds = this._VirtualConvertor.ConvertToPixelFromLogical(this._VirtualBounds); if (bounds.HasValue) { this._LastIdentity = this._VirtualConvertor.Identity; this.SetBounds(bounds.Value, actions, sourceType); } }
public void GetEventTask(EventSourceType eventType, Type expectedType) { // Arrange using (var kernel = new StandardKernel()) { kernel.Bind <EventTask>().ToMethod(c => new EventTask(null, null, this.logger.Object, null)); kernel.Bind <CheckEventTask>().ToMethod(c => new CheckEventTask(null, null, this.logger.Object, null)); // Act var result = this.eventTaskFactory.GetEventTask(kernel, eventType); // Assert Assert.That(result.GetType(), Is.EqualTo(expectedType)); } }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { var name = ""; if (sourceType == EventSourceType.Group) { if (member == null) { return; } name = string.IsNullOrWhiteSpace(member.GroupName) ? qq.Name : member.GroupName; } else if (sourceType == EventSourceType.Private) { if (qq == null) { return; } name = qq.Name; } var str = $"{name}的疯狂发作 - 总结症状:\n"; var insaneIndex = DiceManager.RollDice(_longInsaneList.Count - 1); str += $"1d{_longInsaneList.Count - 1}={insaneIndex}\n"; var duration = DiceManager.RollDice(10); if (insaneIndex == 9) { var fearIndex = DiceManager.RollDice(_fearList.Count - 1); str += string.Format($"症状=>{_longInsaneList[insaneIndex]}", "1d10=" + duration, $"1d{_fearList.Count - 1}={fearIndex}", _fearList[fearIndex]); } else if (insaneIndex == 10) { var panicIndex = DiceManager.RollDice(_panicList.Count - 1); str += string.Format($"症状=>{_longInsaneList[insaneIndex]}", "1d10=" + duration, $"1d{_panicList.Count - 1}={panicIndex}", _panicList[panicIndex]); } else { str += string.Format($"症状=>{_longInsaneList[insaneIndex]}", "1d10=" + duration); } MessageManager.Send(sourceType, str, qq?.QQ, member?.GroupNumber); }
private static void ExecuteWithoutCommand(string message, EventSourceType sourceType, UserInfo qq, GroupMember member) { BaseManager manager = null; var commands = new List <string>(); if (manager == null && member != null && DataManager.Instance.GroupRepeatConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupRepeatConfig[member.GroupNumber]; var rdm = Random.Next(1, 101); if (rdm <= config.Percent) { manager = new RepeatManager(); commands.Add("repeat"); commands.Add(message); } } if (manager == null && member != null && DataManager.Instance.GroupShaDiaoTuConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupShaDiaoTuConfig[member.GroupNumber]; var rdm = Random.Next(1, 101); if (rdm <= config.Percent) { manager = new ShaDiaoTuManager(); commands.Add("shadiaotu"); commands.Add(message); } } if (manager == null && member != null && DataManager.Instance.GroupBakiConfig.ContainsKey(member.GroupNumber)) { var config = DataManager.Instance.GroupBakiConfig[member.GroupNumber]; var rdm = Random.Next(1, 101); if (rdm <= config.Percent) { manager = new BakiManager(); commands.Add("baki"); commands.Add(message); } } if (manager != null) { Task.Run(async() => { await manager.ExecuteAsync(commands, sourceType, qq, null, member); }); } }
public static IList <EventSourceType> GetNextEvents(EventSourceType eventType) => new[] { new Hierarchy(EventSourceType.CheckForHourPrerequisites), // event task returns it's own next events in event result EventSourceType.CreateAuditProcessingBatches .WithNext(EventSourceType.ProcessAuditBatches), EventSourceType.CreateNextHour .WithNext(EventSourceType.StartHour .WithNext(EventSourceType.CreateCategoriesForHour .WithNext(EventSourceType.CreateCategoryScoresForCategory .WithNext(EventSourceType.CreateMetricDatasForCategoryScores .WithNext(EventSourceType.CheckSamplingPeriodForMetricData // event task returns it's own next events in event result .WithNext(EventSourceType.StartPrerequisitesForMetricData // event task returns it's own next events in event result .WithNext(EventSourceType.CheckMetricDataIsReadyForDataCollection // event task returns it's own next events in event result .WithNext(EventSourceType.CollectMetricData // event task returns it's own next events in event result .WithNext(EventSourceType.ScoreMetricData))))))))), EventSourceType.FindNextCategoriesToScore .WithNext(EventSourceType.ScoreCategoryScore .WithNext(EventSourceType.CompleteCategory .WithNext(EventSourceType.CheckIfHourReadyToScore .WithNext(EventSourceType.ScoreHour .WithNext( EventSourceType.SendScoreAlerts .WithNext(EventSourceType.CompleteHour), EventSourceType.HourCleanup .WithNext(EventSourceType.HourServerCleanup .WithNext(EventSourceType.CompleteHour))))))), EventSourceType.StartPrerequisites .WithNext( EventSourceType.StartQosDatabaseDeployment .WithNext(EventSourceType.DeployServerDatabases .WithNext(EventSourceType.CheckAllPrerequisitesComplete)), EventSourceType.StartMigrateEvents .WithNext(EventSourceType.CancelEvents .WithNext(EventSourceType.IdentifyIncompleteHours .WithNext(EventSourceType.CancelHour .WithNext(EventSourceType.CheckAllPrerequisitesComplete))))), EventSourceType.CheckAllPrerequisitesComplete .WithNext(EventSourceType.CompletePrerequisites) } .FindNextTypes(eventType);
public static int ToInt(this EventSourceType source) { //* type:1.好友消息 2.群消息 3.群临时消息 4.讨论组消息 5.讨论组临时消息 6.QQ临时消息 switch (source) { case EventSourceType.Discuss: return(4); case EventSourceType.Friend: return(1); case EventSourceType.Group: return(2); case EventSourceType.Private: return(6); } return(0); }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { if (member == null) { return; } var newNickName = command.FirstOrDefault(); string message = null; if (string.IsNullOrWhiteSpace(newNickName)) { DelNickName(member, ref message); } else { SetNickName(member, newNickName, ref message); } MessageManager.Send(sourceType, message, member.QQ, member.GroupNumber); }
/// <summary> /// Uloží danou hodnotu do this._Value. /// Provede požadované akce (ValueAlign, ScrollDataValidate, InnerBoundsReset, OnValueChanged). /// </summary> /// <param name="value"></param> /// <param name="actions"></param> /// <param name="eventSource"></param> protected void SetValue(Decimal value, ProcessAction actions, EventSourceType eventSource) { Decimal oldValue = this._Value; // Pokud nyní je zdrojem akce událost ValueChange (tj. změna hodnoty je definitivní), a pokud známe ValueDragOriginal, // pak jako oldValue bereme tuto ValueDragOriginal: if (eventSource.HasAnyFlag(EventSourceType.ValueChange) && this.ValueDragOriginal.HasValue) { oldValue = this.ValueDragOriginal.Value; } Decimal newValue = value; if (IsAction(actions, ProcessAction.RecalcValue)) { newValue = this.ValueAlign(newValue); } if (newValue == oldValue) { return; // No change = no reactions. } this._Value = newValue; if (IsAction(actions, ProcessAction.PrepareInnerItems)) { this.ChildItemsReset(); } if (IsAction(actions, ProcessAction.CallChangingEvents)) { this.CallValueChanging(oldValue, newValue, eventSource); } if (IsAction(actions, ProcessAction.CallChangedEvents)) { this.CallValueChanged(oldValue, newValue, eventSource); } if (IsAction(actions, ProcessAction.CallDraw)) { this.CallDrawRequest(eventSource); } }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { var fromQQ = 0L; var toGroup = 0L; var message = ""; if (sourceType == EventSourceType.Private) { fromQQ = qq.QQ; if (command.Count < 2) { MessageManager.Send(EventSourceType.Private, "你不说话我怎么知道你想让我帮你说什么0 0", fromQQ); return; } if (!long.TryParse(command[0], out toGroup)) { MessageManager.Send(EventSourceType.Private, "小夜看不明白你想把这段话发到哪", fromQQ); return; } var mem = GroupMemberManager.Get(fromQQ, toGroup); message = mem.GroupName + string.Join(" ", command.Skip(1)); MessageManager.Send(EventSourceType.Group, message, fromQQ, toGroup); } else if (sourceType == EventSourceType.Group) { fromQQ = member.QQ; toGroup = member.GroupNumber; if (!command.Any()) { MessageManager.Send(EventSourceType.Group, "你不说话我怎么知道你想让我帮你说什么0 0", fromQQ, toGroup); return; } message = member.GroupName + string.Join(" ", command); MessageManager.Send(EventSourceType.Group, message, fromQQ, toGroup); } }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { if (command.Count < 1) { MessageManager.Send(sourceType, "不提问怎么帮你选0 0?", qq?.QQ, member?.GroupNumber); return; } if (command.Count < 2) { MessageManager.Send(sourceType, "快把你打算的选择告诉我!", qq?.QQ, member?.GroupNumber); return; } var quest = command.First(); command.RemoveAt(0); var ansStr = string.Join(" ", command); var ans = ansStr.Split('|').ToList(); var res = Ask(ans); var message = $"关于[{quest}]:\n" + string.Join("\n", res.Select(p => $"{p.Quest}:{p.Percent}%")) + "\n" + $"小夜觉得{string.Join("、", GetMax(res).Select(p => p.Quest))}比较好"; MessageManager.Send(sourceType, message, qq?.QQ, member?.GroupNumber); }
public EventSourceTreeArgs(EventSourceType type = EventSourceType.Open, DbTool.DbForms.SourceTree.TreeNodeType treeNodeType = SourceTree.TreeNodeType.TABLE, object obj = null) { _eventSourceType = type; _sourceObject = obj; _treeNodeType = treeNodeType; }
public WebhookEventSource(EventSourceType type, string sourceId, string userId) { Type = type; Id = sourceId; UserId = userId; }
public EventSourceTreeArgs(EventSourceType type = EventSourceType.Open, DbTool.DbForms.SourceTree.TreeNodeType treeNodeType= SourceTree.TreeNodeType.TABLE,object obj = null) { _eventSourceType = type; _sourceObject = obj; _treeNodeType = treeNodeType; }
public override async Task ExecuteAsync(List <string> command, EventSourceType sourceType, UserInfo qq, Group group, GroupMember member) { var fromQQ = 0L; var toGroup = 0L; var message = ""; if (sourceType != EventSourceType.Group) { return; } fromQQ = member.QQ; toGroup = member.GroupNumber; var permit = member.PermitType; if (!command.Any()) { return; } if (command[0].Equals("on", StringComparison.CurrentCultureIgnoreCase)) { if (permit == Native.Csharp.Sdk.Cqp.Enum.PermitType.None) { MessageManager.Send(EventSourceType.Group, "只有群主或管理员才有权限开启复读功能", fromQQ, toGroup); return; } RepeatConfig config; if (command.Count == 1) { config = new RepeatConfig(); } else { if (int.TryParse(command[1], out var percent)) { config = new RepeatConfig { Percent = percent }; } else { config = new RepeatConfig(); } } DataManager.Instance.GroupRepeatConfig.AddOrUpdate(toGroup, config, (p, q) => config); MessageManager.Send(EventSourceType.Group, "复读已开启", fromQQ, toGroup); } else if (command[0].Equals("off", StringComparison.CurrentCultureIgnoreCase)) { if (permit == Native.Csharp.Sdk.Cqp.Enum.PermitType.None) { MessageManager.Send(EventSourceType.Group, "只有群主或管理员才有权限关闭复读功能", fromQQ, toGroup); return; } DataManager.Instance.GroupRepeatConfig.TryRemove(toGroup, out _); MessageManager.Send(EventSourceType.Group, "复读已关闭", fromQQ, toGroup); } else if (command[0].Equals("repeat", StringComparison.CurrentCultureIgnoreCase) && command.Count > 1) { MessageManager.Send(EventSourceType.Group, command[1], fromQQ, toGroup); } }
/// <summary> /// Is called after Bounds change, from SetBound() method, without any conditions (even if action is None). /// </summary> /// <param name="oldBounds">Původní umístění, před změnou</param> /// <param name="newBounds">Nové umístění, po změnou. Používejme raději tuto hodnotu než this.Bounds</param> /// <param name="actions">Akce k provedení</param> /// <param name="eventSource">Zdroj této události</param> protected override void SetBoundsAfterChange(Rectangle oldBounds, Rectangle newBounds, ref ProcessAction actions, EventSourceType eventSource) { this._SetMaximalBounds(); }
public ActionResult EditEventSourceType(EventSourceType type) { if (ModelState.IsValid) { db.Entry(type).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("EventSourceType"); } return View(type); }
public ActionResult CreateEventSourceType(EventSourceType type) { if (ModelState.IsValid) { db.EventSourceTypes.Add(type); db.SaveChanges(); return RedirectToAction("EventSourceType"); } return View(type); }