public ActionResult CreateLetter(string board_id, string discussion_id, string creator, string words, string delta_flags) { if (!Util.IsAjaxRequest(Request)) { Util.ThrowBadRequestException("Not ajax post."); } object ret_obj = Warehouse.RateLimiter.Validate(CarryType.CreateLetter); if (ret_obj != null) { return(Json(ret_obj)); } checkLetterInput(creator, words, false); delta_flags = delta_flags.Replace("\r\n", "\n"); checkEditFlags(delta_flags, false); Subtype subtype = Subtype.r; if (DiscussionLoadStore.IsCurrentUserDiscussionCreator(board_id, discussion_id)) { subtype = Subtype.s; } string letter_id = DiscussionLoadStore.CreateLetter(board_id, discussion_id, creator, words, subtype, delta_flags, Request.Files); return(Json(new { letter_id = letter_id })); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { return(((Bytes != null ? Bytes.GetHashCode() : 0) * 397) ^ Subtype.GetHashCode()); } }
public static void HarvestObjectTypes([NotNull] ObjectDataset objectDataset, [NotNull] IObjectClass objectClass) { Assert.ArgumentNotNull(objectClass, nameof(objectClass)); IList <Subtype> subtypes = DatasetUtils.GetSubtypes(objectClass); if (subtypes.Count > 0) { for (var subtypeIndex = 0; subtypeIndex < subtypes.Count; subtypeIndex++) { Subtype subtype = subtypes[subtypeIndex]; AddOrUpdateObjectType(objectDataset, subtype, subtypeIndex, subtypes); } } else { var subtype = new Subtype(0, "<default>"); AddOrUpdateObjectType(objectDataset, subtype, 0, subtypes); subtypes.Add(subtype); } DeleteObjectTypesNotInList(objectDataset, subtypes); }
public void CheckSemantics(IDslModel existingConcepts) { if (!(Subtype is IOrmDataStructure)) { throw new DslSyntaxException(this, "Is (polymorphic) may only be used on a database-mapped data structure, such as Entity or SqlQueryable. " + this.Subtype.GetUserDescription() + " is not IOrmDataStructure."); } if (ImplementationName == null) { throw new DslSyntaxException(this, "ImplementationName must not be null. It is allowed to be an empty string."); } if (!string.IsNullOrEmpty(ImplementationName)) { DslUtility.ValidateIdentifier(ImplementationName, this, "Invalid ImplementationName value."); } if (existingConcepts.FindByReference <PolymorphicMaterializedInfo>(pm => pm.Polymorphic, Supertype).Any()) { // Verifying if the ChangesOnChangedItemsInfo can be created (see IsSubtypeOfMacro) var dependsOn = DslUtility.GetBaseChangesOnDependency(Subtype, existingConcepts); if (dependsOn.Count() == 0) { throw new DslSyntaxException(this, Subtype.GetUserDescription() + " should be an *extension* of an entity. Otherwise it cannot be used in a materialized polymorphic entity because the system cannot detect when to update the persisted data."); } } }
public static Subtype GetSubtype(DynamicTableEntity entity) { string subtype = entity["subtype"].StringValue; Subtype st = (Subtype)Enum.Parse(typeof(Subtype), subtype); return(st); }
public void AddItem(Subtype key, string value) { if (intenalDictionary.Keys.Contains(key) == false) { intenalDictionary.Add(key, value); } }
public WowArmor(IWowInventoryItem wowBasicItem) : base(wowBasicItem) { Id = wowBasicItem.Id; BagId = wowBasicItem.BagId; BagSlot = wowBasicItem.BagSlot; Type = wowBasicItem.Type; Subtype = wowBasicItem.Subtype; Name = wowBasicItem.Name; ItemLink = wowBasicItem.ItemLink; EquipSlot = wowBasicItem.EquipSlot; ItemQuality = wowBasicItem.ItemQuality; ItemLevel = wowBasicItem.ItemLevel; RequiredLevel = wowBasicItem.RequiredLevel; Price = wowBasicItem.Price; Count = wowBasicItem.Count; MaxStack = wowBasicItem.MaxStack; Durability = wowBasicItem.Durability; MaxDurability = wowBasicItem.MaxDurability; EquipLocation = wowBasicItem.EquipLocation; if (Subtype.EndsWith("s")) { Subtype = Subtype.Remove(Subtype.Length - 1); } ArmorType = Enum.TryParse(Subtype, out WowArmorType armorType) ? armorType : WowArmorType.Misc; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ClassificationComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Domain != null) { dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopy(); } if (Classification != null) { dest.Classification = (Hl7.Fhir.Model.CodeableConcept)Classification.DeepCopy(); } if (Subtype != null) { dest.Subtype = new List <Hl7.Fhir.Model.CodeableConcept>(Subtype.DeepCopy()); } if (Source != null) { dest.Source = new List <Hl7.Fhir.Model.ResourceReference>(Source.DeepCopy()); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Media; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (TypeElement != null) { dest.TypeElement = (Code <Hl7.Fhir.Model.Media.DigitalMediaType>)TypeElement.DeepCopy(); } if (Subtype != null) { dest.Subtype = (Hl7.Fhir.Model.CodeableConcept)Subtype.DeepCopy(); } if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Operator != null) { dest.Operator = (Hl7.Fhir.Model.ResourceReference)Operator.DeepCopy(); } if (View != null) { dest.View = (Hl7.Fhir.Model.CodeableConcept)View.DeepCopy(); } if (DeviceNameElement != null) { dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)DeviceNameElement.DeepCopy(); } if (HeightElement != null) { dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopy(); } if (WidthElement != null) { dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopy(); } if (FramesElement != null) { dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopy(); } if (DurationElement != null) { dest.DurationElement = (Hl7.Fhir.Model.UnsignedInt)DurationElement.DeepCopy(); } if (Content != null) { dest.Content = (Hl7.Fhir.Model.Attachment)Content.DeepCopy(); } return(dest); }
/// <summary> /// Converts an object into its XML representation. /// </summary> /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized.</param> void IXmlSerializable.WriteXml(XmlWriter writer) { writer.WriteAttributeString("subtype", Subtype.ToString()); if (Bytes != null) { writer.WriteBase64(Bytes, 0, Bytes.Length); } }
public override int GetHashCode() { var result = Type.GetHashCode(); result = (31 * result) + Subtype.GetHashCode(); result = (31 * result) + Parameters.GetHashCode(); return(result); }
protected override void visitSubtypeDeclaration(Subtype declaration) { writer.Append(KeywordEnum.SUBTYPE.ToString()).Append(' '); writer.AppendIdentifier(declaration).Append(' '); writer.Append(KeywordEnum.IS.ToString()).Append(' '); output.writeSubtypeIndication(declaration.SubtypeIndication); writer.Append(';').NewLine(); }
/// <summary> /// This method should return a list of distinct initial <see cref="Status"/> values available for a given <see cref="Subtype"/>. /// /// An initial <see cref="Status"/> is defined as a <see cref="Status"/> that exists as the ToStatus property of a /// <see cref="Transition" /> which also has a null FromStatus value. /// /// </summary> /// <param name="subtype">The <see cref="Subtype"/> value to filter by.</param> /// <returns> An <see cref="IEnumerable{Status}"/> that represents all distinct Initial Status values available </returns> public IEnumerable <Status> GetInitialStatuses(Subtype subtype) { var allTransitions = TransitionRepo.GetAll(); // Initial Transitions are defined as those with a null FromStatus value from config var initialTransitions = allTransitions.Where(t => t.FromStatus == null && t.Subtype == subtype); // Select all the ToStatus values from the initialTransitioned queried return(initialTransitions.Select(t => t.ToStatus)); }
public IActionResult Create([Bind("SubtypeId,SubtypeName,TypeId")] Subtype subtype) { if (ModelState.IsValid) { _subtypeRepository.Create(subtype); return(RedirectToAction(nameof(Index))); } ViewData["TypeId"] = new SelectList(_typeRepository.GetAll(), "TypeId", "TypeName", subtype.TypeId); return(View(subtype)); }
public WowArmor(IWowInventoryItem wowBasicItem) : base(wowBasicItem) { if (Subtype.ToLowerInvariant().EndsWith("s")) { Subtype = Subtype.Remove(Subtype.Length - 1); } ArmorType = Enum.TryParse(Subtype, true, out WowArmorType armorType) ? armorType : WowArmorType.Misc; }
public static void CheckControlRight(string board_id, string discussion_id, string letter_id, ref string delta_flags, DynamicTableEntity entity) { Subtype subtype = LetterConverter.GetSubtype(entity); if (subtype == Subtype.d) { Util.ThrowUnauthorizedException("不能修改的類型。"); } bool auto_unreport = false; if (SandFlags.Check(delta_flags, SandFlags.MT_PERMANENT_DELETE, 1)) { GroupStore.CheckPermanentDeleteRight(board_id, discussion_id, letter_id, entity); auto_unreport = true; } int delete_num = SandFlags.GetNumber(delta_flags, SandFlags.MT_DELETED); if (delete_num == 1 || delete_num == -1) { //bool is_undelete = SandFlags.Check(delta_flags, SandFlags.DELETED_FLAG_CHAR, -1); int user_level = GroupStore.CheckDeleteRight(board_id, discussion_id, letter_id, entity, delete_num == -1); //delta_flags = SandFlags.DELETED_FLAG_CHAR + (delete_num * user_level).ToString(); //delta_flags = SandFlags.MultiplyNumber(delta_flags, SandFlags.DELETED_FLAG_CHAR, user_level); delta_flags = SandFlags.Operate(delta_flags, new FlagOperation { type = FlagOperation.Type.Multiply, MetaTitle = SandFlags.MT_DELETED, N = user_level }); string current_flags = entity.GetFlags(); SandFlags.CheckLevel(current_flags, SandFlags.MT_DELETED, delta_flags); auto_unreport = true; } if (SandFlags.Check(delta_flags, SandFlags.MT_REPORT, 0)) { GroupStore.CheckUnreportRight(board_id); } else if (SandFlags.Check(delta_flags, SandFlags.MT_REPORT, 1)) { } else { if (auto_unreport) { delta_flags = SandFlags.Add(delta_flags, SandFlags.MT_REPORT, 0); } } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("DataItem=["); sb.Append("Typ=0x" + Type.ToString("x")); sb.Append(" Subtyp=0x" + Subtype.ToString("x")); sb.Append(" Offset=0x" + Offset.ToString("x")); sb.Append("]"); return(sb.ToString()); }
private static void AddOrUpdateObjectType([NotNull] ObjectDataset objectDataset, [NotNull] Subtype subtype, int subtypeIndex, [NotNull] IEnumerable <Subtype> allSubtypes) { Assert.ArgumentNotNull(subtype, nameof(subtype)); Assert.ArgumentNotNull(allSubtypes, nameof(allSubtypes)); ObjectType objectType = GetObjectType(objectDataset, subtype, allSubtypes); if (objectType == null) { objectType = new ObjectType(objectDataset, subtype.Code, subtype.Name); _msg.InfoFormat("Adding object type {0}", objectType.Name); objectDataset.AddObjectType(subtype.Code, subtype.Name); } else { // object type already registered if (objectType.Deleted) { _msg.WarnFormat( "Object type {0} ({1}) was registered as deleted, but exists now. " + "Resurrecting it...", objectType.Name, objectType.SubtypeCode); objectType.RegisterExisting(); } // update properties if (!Equals(objectType.Name, subtype.Name)) { _msg.InfoFormat("Updating name of object type {0} to {1}", objectType.Name, subtype.Name); objectType.UpdateName(subtype.Name); } if (!Equals(objectType.SubtypeCode, subtype.Code)) { _msg.InfoFormat("Updating subtype code of object type {0} from {1} to {2}", objectType.Name, objectType.SubtypeCode, subtype.Code); objectType.UpdateSubtypeCode(subtype.Code); } } // configure the object type objectType.SortOrder = subtypeIndex; }
/// <summary> /// This method should return a list of distinct initial <see cref="Status"/> values available for a given <see cref="Subtype"/>. /// /// An initial <see cref="Status"/> is defined as a <see cref="Status"/> that exists as the ToStatus property of a /// <see cref="Transition" /> which also has a null FromStatus value. /// /// </summary> /// <param name="subtype">The <see cref="Subtype"/> value to filter by.</param> /// <returns> An <see cref="IEnumerable{Status}"/> that represents all distinct Initial Status values available </returns> public IEnumerable <Status> GetInitialStatuses(Subtype subtype) { var allTransitions = TransitionRepo.GetAll(); // Initial Transitions are defined as those with a null FromStatus value from config var initialTransitions = allTransitions .Where(tr => tr.Subtype.Id == subtype.Id) // Here is the correction. Due to it's missing to filter for the subtype passed .Where(t => t.FromStatus == null); // Select all the ToStatus values from the initialTransitioned queried return(initialTransitions.Select(t => t.ToStatus)); }
/// <summary> /// Determines whether the specified <see cref="System.Object" />, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { var mediaType = obj as MediaType; if (mediaType == null) { return(false); } return(Type.Equals(mediaType.Type, StringComparison.CurrentCultureIgnoreCase) && Subtype.Equals(mediaType.Subtype, StringComparison.CurrentCultureIgnoreCase) && (Suffix == null && mediaType.Suffix == null || (Suffix != null && mediaType.Suffix != null && Suffix.Equals(mediaType.Suffix, StringComparison.CurrentCultureIgnoreCase)))); }
public override int GetHashCode() { unchecked { int result = base.GetHashCode(); result = (result * 397) ^ (TopLevelMediaType != null ? TopLevelMediaType.GetHashCode() : 0); result = (result * 397) ^ (Subtype != null ? Subtype.GetHashCode() : 0); foreach (string parameterName in Parameters.Keys) { result = (result * 397) ^ (parameterName + Parameters[parameterName]).GetHashCode(); } return(result); } }
public void Type() { //Arrange var type = new Subtype(); var region = new Region { Subtype = type }; //Act var result = region.Subtype; //Assert Assert.AreSame(type, result); }
public IActionResult Edit(int id, [Bind("SubtypeId,SubtypeName,TypeId")] Subtype subtype) { if (id != subtype.SubtypeId) { return(NotFound()); } if (ModelState.IsValid) { _subtypeRepository.Update(subtype); return(RedirectToAction(nameof(Index))); } ViewData["TypeId"] = new SelectList(_typeRepository.GetAll(), "TypeId", "TypeName", subtype.TypeId); return(View(subtype)); }
public void AssertValid() { Timestamp.TimestampAssertValid(); Id.SpanIdAssertValid(); TransactionId.TransactionIdAssertValid(); TraceId.TraceIdAssertValid(); ParentId.ParentIdAssertValid(); Subtype?.AssertValid(); Action?.AssertValid(); Context?.AssertValid(); Duration.DurationAssertValid(); Name?.NameAssertValid(); StackTrace?.AssertValid(); Type?.AssertValid(); }
public static void CheckEditRight(string board_id, string discussion_id, DynamicTableEntity entity) { Subtype subtype = LetterConverter.GetSubtype(entity); if (subtype == Subtype.d) { Util.ThrowUnauthorizedException("不能編輯的類型。"); } if (!CreatorConverter.IsCurrentUserCreator(entity) && !DiscussionLoadStore.IsCurrentUserDiscussionCreator(board_id, discussion_id) && !IsBoardOwner(board_id)) { Util.ThrowUnauthorizedException("沒有編輯權限。只有副板主以上、串主、或原作者可以編輯。"); } }
public bool Includes(MimeType other) { if (other == null) { return(false); } if (IsWildcardType) { // */* includes anything return(true); } else if (Type.Equals(other.Type)) { if (Subtype.Equals(other.Subtype)) { return(true); } if (IsWildcardSubtype) { // Wildcard with suffix, e.g. application/*+xml var thisPlusIdx = Subtype.LastIndexOf('+'); if (thisPlusIdx == -1) { return(true); } else { // application/*+xml includes application/soap+xml var otherPlusIdx = other.Subtype.LastIndexOf('+'); if (otherPlusIdx != -1) { var thisSubtypeNoSuffix = Subtype.Substring(0, thisPlusIdx); var thisSubtypeSuffix = Subtype.Substring(thisPlusIdx + 1); var otherSubtypeSuffix = other.Subtype.Substring(otherPlusIdx + 1); if (thisSubtypeSuffix.Equals(otherSubtypeSuffix) && WILDCARD_TYPE.Equals(thisSubtypeNoSuffix)) { return(true); } } } } } return(false); }
public IActionResult CreateItem(Item p) { ViewBag.User = HasAccess(); if (ViewBag.User == null) { return(RedirectToAction("Index", "Home", new { area = "Account" })); } if (ModelState.IsValid) { bool StillValid = true; string nameError; StillValid = ValidateUniqueItemName(p.Name, out nameError) ? StillValid : false; ViewBag.NameError = nameError; string imageError; StillValid = ValidateImageLocation(p.Image, out imageError) ? StillValid : false; ViewBag.ImageError = imageError; string mainItemTypeError; StillValid = ValidateMainItemType(HttpContext.Request.Form["MainItemType"], out mainItemTypeError) ? StillValid : false; ViewBag.MainItemTypeError = mainItemTypeError; List <int> SubItemTypeIds = new List <int>(); string subItemTypeError; StillValid = ValidateSubItemTypes(HttpContext.Request.Form["SubItemType"].ToList(), SubItemTypeIds, out subItemTypeError) ? StillValid : false; ViewBag.SubItemTypeError = subItemTypeError; if (StillValid) { p.IsTradeable = p.IsTradeable ?? false; p.MainItemTypeId = Int32.Parse(HttpContext.Request.Form["MainItemType"]); context.Add(p); foreach (int subId in SubItemTypeIds) { Subtype s = new Subtype(); s.SubItemTypeId = subId; s.ItemId = p.ItemId; context.Add(s); } context.SaveChanges(); TempData["AdminMessage"] = $"{p.Name} successfully added to the database!"; return(RedirectToAction("ItemList")); } } ViewBag.MainItemTypes = context.MainItemTypes.ToList(); ViewBag.SubItemTypes = context.SubItemTypes.ToList(); return(View("NewItem")); }
public override bool Equals(object other) { if (this == other) { return(true); } if (!(other is MimeType)) { return(false); } var otherType = (MimeType)other; return(Type.Equals(otherType.Type, StringComparison.InvariantCultureIgnoreCase) && Subtype.Equals(otherType.Subtype, StringComparison.InvariantCultureIgnoreCase) && ParametersAreEqual(otherType)); }
public static void CreateLetterEntity(DynamicTableEntity entity, string creator, string words, Subtype subtype, string delta_flags, string board_id, string discussion_id) { CreatorConverter.FillEntity(entity, CreatorConverter.Status.Creator, creator); entity["subtype"] = new EntityProperty(subtype.ToString()); #if OLD string flags = SandFlags.Merge("", delta_flags); if (flags.Length > 0) { entity["flags"] = new EntityProperty(flags); } #else entity.OperateFlags(new FlagMergeOperation(delta_flags)); #endif fillWords(entity, words, board_id, discussion_id); // must be after flags modification so that encrypt flag is correct. }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("POI=[Typ=0x"); sb.Append(Type.ToString("x2")); if (Subtype > 0x0) { sb.Append(Subtype.ToString("x2")); } sb.AppendFormat(" {0}x{1}", Width, Height); sb.Append(" ColormodeDay=" + ColormodeDay.ToString()); sb.Append(" ColormodeNight=" + ColormodeNight.ToString()); if (FontType != Fontdata.Default) { sb.Append(" Fonttyp=[" + FontType.ToString() + "]"); } if (FontColType != FontColours.No) { sb.Append(" CustomColours=["); switch (FontColType) { case FontColours.Day: sb.Append("Day=" + colFontColour[0].ToString()); break; case FontColours.Night: sb.Append("Night=" + colFontColour[1].ToString()); break; case FontColours.DayAndNight: sb.Append("Day=" + colFontColour[0].ToString()); sb.Append(" Night=" + colFontColour[0].ToString()); break; } sb.Append("]"); } if (WithString) { sb.Append(" " + Text.ToString()); } sb.Append(" ]"); return(sb.ToString()); }
public void AddToSubtypes(Subtype subtype) { base.AddObject("Subtypes", subtype); }
public ProjectFile(string filename, BuildAction buildAction) { this.filename = filename; subtype = Subtype.Code; buildaction = buildAction; }
public GUIPreference(Patient proband, bool readOnly = false) { this.ReadOnly = readOnly; this.PrefSubtype = Subtype.Normal; annotations = new PedigreeAnnotationList(proband.unitnum); owningPatient = proband; }
/// <summary> /// For use with user default meta data contruction /// </summary> /// <param name="u"></param> /// <param name="readOnly">should this object be locked against db persistance?</param> public GUIPreference(User u, bool readOnly = false) { this.ReadOnly = readOnly; this.PrefSubtype = Subtype.User; annotations = new PedigreeAnnotationList("-1"); owningPatient = null; parentName = u.userLogin; formName = "Default"; }
/// <summary> /// For use with system default meta data construction /// </summary> public GUIPreference(bool readOnly = false) { this.ReadOnly = readOnly; this.PrefSubtype = Subtype.System; owningPatient = null; parentName = "System"; formName = "Default"; annotations = new PedigreeAnnotationList("-1"); //annotations.BackgroundListLoad(); }
public static Subtype CreateSubtype(int pk_Subtype, string description, int iD_Type) { Subtype subtype = new Subtype(); subtype.Pk_Subtype = pk_Subtype; subtype.Description = description; subtype.ID_Type = iD_Type; return subtype; }
public PathTestType() { TheSub = new Subtype(); }
public ProjectFile(string filename) { this.filename = filename; subtype = Subtype.Code; buildaction = BuildAction.Compile; }