private void SimpleTypeConstraintTest(SdbSchemaDatas actual) { // <Bibliography:SourceType /> is a simple type // <xsd:element name="SourceType" type="ST_SourceType"> SourceType sourceType = new SourceType(); var schemaTypeData = actual.GetSchemaTypeData(sourceType.ElementTypeId); Assert.Equal(sourceType.ElementTypeId, schemaTypeData.OpenXmlTypeId); Assert.False(schemaTypeData.HasAttributeConstraints); Assert.NotNull(schemaTypeData.SimpleTypeConstraint); Assert.False(schemaTypeData.IsCompositeType); Assert.True(schemaTypeData.IsSimpleContent); Assert.Null(schemaTypeData.ParticleConstraint); // ST_SourceType is ST_String255 based enum Assert.IsType(typeof(EnumValueRestriction), schemaTypeData.SimpleTypeConstraint); Assert.Equal(XsdType.Enum, schemaTypeData.SimpleTypeConstraint.XsdType); Assert.Equal(RestrictionField.None, schemaTypeData.SimpleTypeConstraint.RestrictionField); Assert.True(schemaTypeData.SimpleTypeConstraint.IsEnum); Assert.False(schemaTypeData.SimpleTypeConstraint.IsList); Assert.Null(schemaTypeData.SimpleTypeConstraint.Pattern); // <Bibliography:ConferenceName /> is a simple type //<xsd:element name="ConferenceName" type="ST_String255"> ConferenceName conferenceName = new ConferenceName(); schemaTypeData = actual.GetSchemaTypeData(conferenceName.ElementTypeId); Assert.Equal(conferenceName.ElementTypeId, schemaTypeData.OpenXmlTypeId); Assert.False(schemaTypeData.HasAttributeConstraints); Assert.NotNull(schemaTypeData.SimpleTypeConstraint); Assert.False(schemaTypeData.IsCompositeType); Assert.True(schemaTypeData.IsSimpleContent); Assert.Null(schemaTypeData.ParticleConstraint); //<xsd:simpleType name="ST_String255"> // <xsd:restriction base="xsd:string"> // <xsd:minLength value="0" /> // <xsd:maxLength value="255" /> // </xsd:restriction> //</xsd:simpleType> Assert.IsType(typeof(StringRestriction), schemaTypeData.SimpleTypeConstraint); Assert.Equal(XsdType.String, schemaTypeData.SimpleTypeConstraint.XsdType); Assert.False(schemaTypeData.SimpleTypeConstraint.IsEnum); Assert.False(schemaTypeData.SimpleTypeConstraint.IsList); Assert.Null(schemaTypeData.SimpleTypeConstraint.Pattern); var stringConstraint = schemaTypeData.SimpleTypeConstraint as StringRestriction; Assert.Equal(RestrictionField.MinLength | RestrictionField.MaxLength, stringConstraint.RestrictionField); Assert.Equal(0, stringConstraint.MinLength); Assert.Equal(255, stringConstraint.MaxLength); }
public override bool Equals(object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { Conference conf = (Conference)obj; return((ConferenceName.Equals(conf.ConferenceName)) && (ConferenceDate.Equals(conf.ConferenceDate))); } }
public IActionResult Upsert(ConferenceName ConferenceName) { if (ModelState.IsValid) { if (ConferenceName.Id == 0) { _unitOfWork.ConferenceName.Add(ConferenceName); } else { _unitOfWork.ConferenceName.Update(ConferenceName); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } return(View(ConferenceName)); }
public IActionResult Upsert(int?id) { ConferenceName ConferenceName = new ConferenceName(); if (id == null) { //this is for create return(View(ConferenceName)); } //this is for edit ConferenceName = _unitOfWork.ConferenceName.Get(id.GetValueOrDefault()); if (ConferenceName == null) { return(NotFound()); } return(View(ConferenceName)); }
public void Save() { bool needSave = false; if (MainId > 0) { var o = MainObject.GetMain(MainId); if (o != null) { if (ConferenceName?.Trim() != o.ConferenceName) { o.ConferenceName = ConferenceName?.Trim(); needSave = true; } if (ConferenceSponsor?.Trim() != o.ConferenceSponsor) { o.ConferenceSponsor = ConferenceSponsor?.Trim(); needSave = true; } if (ConferenceLocation?.Trim() != o.ConferenceLocation) { o.ConferenceLocation = ConferenceLocation?.Trim(); needSave = true; } if (ConferenceBeginDate != o.ConferenceBeginDate) { o.ConferenceBeginDate = ConferenceBeginDate; needSave = true; } if (ConferenceEndDate != o.ConferenceEndDate) { o.ConferenceEndDate = ConferenceEndDate; needSave = true; } if (needSave) { o.Save(); } } } }
void ReleaseDesignerOutlets() { if (ConferenceDescription != null) { ConferenceDescription.Dispose(); ConferenceDescription = null; } if (ConferenceName != null) { ConferenceName.Dispose(); ConferenceName = null; } if (ConferenceStart != null) { ConferenceStart.Dispose(); ConferenceStart = null; } }
// displays information about the currently selected conference in the navigation panel private static void AddConferenceInformation(XmlNode AMenuNode) { FConferenceKey = TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH"); // Set PartnerKey in conference setup screens for selected conference Ict.Petra.Client.MConference.Gui.TConferenceMain.FPartnerKey = FConferenceKey; XmlNode childNode = AMenuNode.FirstChild; XmlAttribute enabledAttribute; while (childNode != null) { if ((TXMLParser.GetAttribute(childNode, "DependsOnConference").ToLower() == "true") && (FConferenceKey != 0)) { FConferenceSelected = true; // node only displayed if this is true // Create 'Select Conference' Node XmlAttribute LabelAttributeConference = childNode.OwnerDocument.CreateAttribute("Label"); XmlElement SelConferenceElmnt = childNode.OwnerDocument.CreateElement("ConferenceInfo"); XmlNode SelectConferenceNode = childNode.AppendChild(SelConferenceElmnt); SelectConferenceNode.Attributes.Append(LabelAttributeConference); SelectConferenceNode.Attributes["Label"].Value = Catalog.GetString("Current Conference"); // Create conference details Node XmlElement SpecificConferenceElmnt = childNode.OwnerDocument.CreateElement("Conference" + FConferenceKey); XmlNode SpecificConferenceNode = SelectConferenceNode.AppendChild(SpecificConferenceElmnt); XmlAttribute AttributeConferenceName = childNode.OwnerDocument.CreateAttribute("Label"); SpecificConferenceNode.Attributes.Append(AttributeConferenceName); // Disable clicking on node enabledAttribute = childNode.OwnerDocument.CreateAttribute("Enabled"); enabledAttribute.Value = "false"; SpecificConferenceNode.Attributes.Append(enabledAttribute); // Get conference name string ConferenceName; TPartnerClass PartnerClass; TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(FConferenceKey, out ConferenceName, out PartnerClass); if (ConferenceName != String.Empty) { const int BreakPoint = 28; SpecificConferenceNode.Attributes["Label"].Value = ""; // splits the name over multiple lines if it too long while (ConferenceName.Length > BreakPoint) { int IndexOfSpace = ConferenceName.IndexOf(" ", 0); int LastIndexOfSpace = 0; // searches for the last breakpoint for a line while (IndexOfSpace <= BreakPoint && IndexOfSpace != -1) { LastIndexOfSpace = IndexOfSpace; IndexOfSpace = ConferenceName.IndexOf(" ", LastIndexOfSpace + 1); } SpecificConferenceNode.Attributes["Label"].Value += ConferenceName.Substring(0, LastIndexOfSpace) + "\n"; ConferenceName = ConferenceName.Remove(0, LastIndexOfSpace + 1); } SpecificConferenceNode.Attributes["Label"].Value += ConferenceName + "\n"; } else { SpecificConferenceNode.Attributes["Label"].Value = "Conference Key: " + FConferenceKey; } // Set node values SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value; // only dispay dates if they are valid DateTime StartDate = TRemote.MConference.Conference.WebConnectors.GetStartDate(FConferenceKey); DateTime EndDate = TRemote.MConference.Conference.WebConnectors.GetEndDate(FConferenceKey); if (StartDate != DateTime.MinValue) { SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value + "\nStart: " + StartDate.ToLongDateString(); } if (EndDate != DateTime.MinValue) { SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value + "\nEnd: " + EndDate.ToLongDateString(); } childNode = childNode.NextSibling; } else { // Recurse into deeper levels! AddConferenceInformation(childNode); childNode = childNode.NextSibling; } } }
public override int GetHashCode() { return(ConferenceName.GetHashCode() ^ ConferenceDate.GetHashCode()); }