public virtual IEnumerable captions() { INSetupExt setupExt = Base.insetup.Current.GetExtension <INSetupExt>(); AttributeCaptions row = new AttributeCaptions(); foreach (CSAttributeDetail2 detail in this.AttributeDetails.Select(setupExt.UsrCategoryAttribute)) { switch (detail.SortOrder) { case 1: row.Caption1 = detail.Description; break; case 2: row.Caption2 = detail.Description; break; case 3: row.Caption3 = detail.Description; break; case 4: row.Caption4 = detail.Description; break; case 5: row.Caption5 = detail.Description; break; case 6: row.Caption6 = detail.Description; break; case 7: row.Caption7 = detail.Description; break; case 8: row.Caption8 = detail.Description; break; case 9: row.Caption9 = detail.Description; break; } } yield return(row); }
private PXResultset <CSAnswers, CSAttributeGroup, CSAttributeDetail2> GenerateAttributeList(int attributeNum) { PXResultset <CSAnswers, CSAttributeGroup, CSAttributeDetail2> list = new PXResultset <CSAnswers, CSAttributeGroup, CSAttributeDetail2>(); PXSelectBase <CSAttributeGroup> query = new PXSelectJoin <CSAttributeGroup, InnerJoin <CSAttributeDetail2, On <CSAttributeGroupExt.usrCategory, Equal <CSAttributeDetail2.valueID>, And <CSAttributeDetail2.attributeID, Equal <Required <INSetupExt.usrCategoryAttribute> >, And <CSAttributeDetail2.sortOrder, Equal <Required <CSAttributeDetail2.sortOrder> >, And <CSAttributeDetail2.disabled, Equal <False> > > > > >, Where <CSAttributeGroup.entityClassID, Equal <Required <InventoryItem.itemClassID> > , And <CSAttributeGroup.entityType, Equal <PCBConst.entityTypeIN> > >, OrderBy <Asc <CSAttributeGroup.sortOrder> > >(Base); InventoryItem current = Base.Item.Current; INSetupExt setupExt = Base.insetup.Current.GetExtension <INSetupExt>(); if (current != null && current.InventoryID != null && setupExt != null) //&& current.InventoryID > 0 { foreach (PXResult <CSAttributeGroup, CSAttributeDetail2> item in query.Select(setupExt.UsrCategoryAttribute, attributeNum, current.ItemClassID)) { CSAttributeGroup attribute = item; CSAttributeDetail2 detail = item; CSAnswers answerCheck = PXSelect <CSAnswers, Where <CSAnswers.refNoteID, Equal <Required <CSAnswers.refNoteID> >, And <CSAnswers.attributeID, Equal <Required <CSAnswers.attributeID> > > > > .Select(Base, current.NoteID, attribute.AttributeID); if (answerCheck == null) { CSAnswers newAnswer = new CSAnswers(); newAnswer.AttributeID = attribute.AttributeID; newAnswer.Value = string.Empty; newAnswer.Order = attribute.SortOrder; newAnswer.IsRequired = attribute.Required; newAnswer.RefNoteID = current.NoteID; list.Add(new PXResult <CSAnswers, CSAttributeGroup, CSAttributeDetail2>(newAnswer, attribute, detail)); } else { list.Add(new PXResult <CSAnswers, CSAttributeGroup, CSAttributeDetail2>(answerCheck, attribute, detail)); } } } return(list); }
protected virtual void AttributeCaptions_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { AttributeCaptions row = (AttributeCaptions)e.Row; if (row == null) { return; } INSetupExt setupExt = Base.insetup.Current.GetExtension <INSetupExt>(); this.Attributes1.AllowSelect = false; this.Attributes2.AllowSelect = false; this.Attributes3.AllowSelect = false; this.Attributes4.AllowSelect = false; this.Attributes5.AllowSelect = false; this.Attributes6.AllowSelect = false; this.Attributes7.AllowSelect = false; this.Attributes8.AllowSelect = false; this.Attributes9.AllowSelect = false; foreach (CSAttributeDetail2 detail in this.AttributeDetails.Select(setupExt.UsrCategoryAttribute)) { switch (detail.SortOrder) { case 1: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption1>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes1.AllowSelect = true; break; case 2: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption2>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes2.AllowSelect = true; break; case 3: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption3>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes3.AllowSelect = true; break; case 4: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption4>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes4.AllowSelect = true; break; case 5: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption5>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes5.AllowSelect = true; break; case 6: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption6>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes6.AllowSelect = true; break; case 7: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption7>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes7.AllowSelect = true; break; case 8: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption8>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes8.AllowSelect = true; break; case 9: PXUIFieldAttribute.SetVisible <AttributeCaptions.caption9>(Base.Caches[typeof(AttributeCaptions)], null, true); this.Attributes8.AllowSelect = true; break; } } }