private bool DoesAnyAttributeRelationExist(CSAttribute attribute, CSAttributeDetail attributeDetail) { var isGroupExist = DoesAttributeGroupExist(attribute); var isAttributeExist = attributeDetail == null || DoesAttributeExist(attributeDetail); return(isAttributeExist && isGroupExist); }
protected virtual void RecalcAttributesGrid() { CSAttribute[] attributes = GetAdditionalAttributes(); AdditionalAttributes.Current.Values = new string[attributes.Length]; AdditionalAttributes.Current.Descriptions = new string[attributes.Length]; AdditionalAttributes.Current.AttributeIdentifiers = new string[attributes.Length]; AdditionalAttributes.Current.AttributeDisplayNames = new string[attributes.Length]; AdditionalAttributes.Current.ViewNames = new string[attributes.Length]; if (attributes.Length > 0) { for (int attributeIndex = 0; attributeIndex < attributes.Length; attributeIndex++) { CSAttribute attribute = attributes[attributeIndex]; AdditionalAttributes.Current.AttributeIdentifiers[attributeIndex] = attribute.AttributeID; AdditionalAttributes.Current.AttributeDisplayNames[attributeIndex] = attribute.Description; } for (int attributeIndex = 0; attributeIndex < AdditionalAttributes.Current.Values.Length; attributeIndex++) { AddFieldToAttributeGrid(AdditionalAttributes.Cache, attributeIndex); } } AdditionalAttributes.View.RequestRefresh(); }
static ObjCProtocolCompiler() { var arg = new CSSimpleType("NSObject").Typeof(); var argList = new CSArgumentList(); argList.Add(new CSArgument(arg)); kBaseTypeNSObject = new CSAttribute(new CSIdentifier("BaseType"), argList, true); }
/// <summary> /// Configures the type of control for default value field on adding an attribute. Should be used on /// FieldSelecting event for <see cref="CSAttributeGroup.defaultValue"/>. /// </summary> public PXFieldState GetNewReturnState(object returnState, CSAttributeGroup attributeGroup) { attribute = GetAttribute(attributeGroup); attributeDetails = GetAttributeDetails(attributeGroup); var requiredFieldState = attributeGroup.Required.GetValueOrDefault() ? 1 : -1; return(GetNeededReturnState(returnState, requiredFieldState)); }
public virtual IEnumerable ShowDetails(PXAdapter adapter) { CSAttribute CurrentAttibute = PXSelect <CSAttribute, Where <CSAttribute.attributeID, Equal <Current <CSAttributeGroup.attributeID> > > > .Select(this); if (CurrentAttibute != null) { CSAttributeMaint graph = PXGraph.CreateInstance <CSAttributeMaint>(); graph.Clear(); graph.Attributes.Current = CurrentAttibute; throw new PXRedirectRequiredException(graph, CR.Messages.CRAttributeMaint); } return(adapter.Get()); }
private bool IsAttributeRuleTrue(object item, EPAssignmentRule rule) { string field = rule.FieldName.Substring(0, rule.FieldName.Length - "_Attribute".Length - 1); CSAttribute attribute = PXSelectReadonly <CSAttribute> .Search <CSAttribute.attributeID>(this, field); if (attribute == null || rule.Condition == null) { //Field Name is not a valid question. return(false); } var noteId = new EntityHelper(_Graph).GetEntityNoteID(item); CSAnswers ans = PXSelect <CSAnswers, Where <CSAnswers.refNoteID, Equal <Required <CSAnswers.refNoteID> >, And <CSAnswers.attributeID, Equal <Required <CSAnswers.attributeID> > > > > .Select(_Graph ?? this, noteId, field); if (ans == null) { //Answer for the given question doesnot exist. switch (rule.Condition.Value) { case (int)PXCondition.ISNULL: return(true); case (int)PXCondition.ISNOTNULL: return(false); case (int)PXCondition.EQ: return(string.IsNullOrEmpty(rule.FieldValue)); case (int)PXCondition.NE: return(!string.IsNullOrEmpty(rule.FieldValue)); } return(false); } this.currentAttribute = ans; PXFilterRow filter = new PXFilterRow(typeof(CSAnswers.value).Name, (PXCondition)rule.Condition.Value, rule.FieldValue, null); int startRow = 0; int totalRows = 0; List <object> result = attributeView.Select(null, null, null, null, null, new PXFilterRow[] { filter }, ref startRow, 1, ref totalRows); return(result.Count > 0); }
public static Tuple <CSNamespace, CSUsingPackages> CreateTestClass(CodeElementCollection <ICodeElement> callingCode, string testName, string expectedOutput, string nameSpace, string testClassName, CSClass otherClass, string skipReason, PlatformName platform) { var use = GetTestClassUsings(nameSpace); // [TomSkip(skipReason)] // public class TomTesttestName : ITomTest // { // public testClassName() { } // public string TestName { get { return testName; } } // public string ExpectedOutput { get { return expectedOuput; } } // public void Run() { // callingCode; // } // } // otherClass CSNamespace ns = new CSNamespace(nameSpace); if (otherClass != null) { ns.Block.Add(otherClass); } CSCodeBlock body = new CSCodeBlock(callingCode); body.Add(CaptureSwiftOutputPostlude(testName)); CSMethod run = new CSMethod(CSVisibility.Public, CSMethodKind.None, CSSimpleType.Void, new CSIdentifier("Run"), new CSParameterList(), body); CSClass testClass = new CSClass(CSVisibility.Public, new CSIdentifier($"TomTest{testName}"), new CSMethod [] { run }); testClass.Inheritance.Add(new CSIdentifier("ITomTest")); testClass.Properties.Add(MakeGetOnlyStringProp("TestName", testName)); testClass.Properties.Add(MakeGetOnlyStringProp("ExpectedOutput", expectedOutput)); ns.Block.Add(testClass); if (skipReason != null) { CSArgumentList al = new CSArgumentList(); al.Add(CSConstant.Val(skipReason)); CSAttribute attr = new CSAttribute("TomSkip", al); attr.AttachBefore(testClass); } return(new Tuple <CSNamespace, CSUsingPackages> (ns, use)); }
private bool DoesAttributeGroupExist(CSAttribute attribute) { return(new PXSelect <CSAttributeGroup, Where <CSAttributeGroup.attributeID, Equal <Required <CSAttributeGroup.attributeID> > > >(Base) .Any(attribute?.AttributeID)); }
public Question(CSAttribute attr) { this._attr = attr; }