//Refactor - Generalize if possible!!! private IBqlTable GetItemRecord(EPAssignmentRule rule, IBqlTable item) { PXGraph graph = this.processGraph; Type itemType = item.GetType(); Type ruleType = GraphHelper.GetType(rule.Entity); if (ruleType.IsAssignableFrom(itemType)) { return(item); } if (processMapType.IsAssignableFrom(ruleType) && graph != null) { return(graph.Caches[processMapType].Current as IBqlTable); } if (graph != null) { foreach (CacheEntityItem entry in EMailSourceHelper.TemplateEntity(this, null, item.GetType().FullName, graph.GetType().FullName)) { Type entityType = GraphHelper.GetType(entry.SubKey); if (ruleType.IsAssignableFrom(entityType) && graph.Views.ContainsKey(entry.Key)) { PXView view = graph.Views[entry.Key]; object result = view.SelectSingleBound(new object[] { item }); return((result is PXResult ? ((PXResult)result)[0] : result) as IBqlTable); } } } return(item); }
protected virtual bool CheckCondition(PXCache sender, object row) { object[] selectParams = GetParams(sender, row); BqlCommand cmd = BqlCommand.CreateInstance(_ConditionSelect); PXView view = sender.Graph.TypedViews.GetView(cmd, true); object result = view.SelectSingleBound(new object[] { row }, selectParams); return(result != null); }
public static object ParentSelect(PXCache cache, object row, Type ParentType) { foreach (PXEventSubscriberAttribute attr in cache.GetAttributes(null)) { if (attr is PXParentAttribute && ((PXParentAttribute)attr).ParentType.IsAssignableFrom(ParentType)) { PXView parentview = ((PXParentAttribute)attr).GetParentSelect(cache); return(parentview.SelectSingleBound(new object[] { row })); } } return(null); }
public static object SelectFirst(this IBqlSearch command, PXGraph graph, object data, bool isReadOnly = true) { PXView view = graph.TypedViews.GetView((BqlCommand)command, isReadOnly); object row = view.SelectSingleBound(new object[] { data }); if (row is PXResult) { return(((PXResult)row)[command.GetField()]); } return(null); }
protected virtual bool CheckCondition(PXCache sender, object row) { if (_OrigModule != null && (string)sender.GetValue(row, _OrigModule.Name) == GL.BatchModule.EP) { return(false); } object[] selectParams = GetParams(sender, row); BqlCommand cmd = BqlCommand.CreateInstance(_ConditionSelect); PXView view = sender.Graph.TypedViews.GetView(cmd, true); object result = view.SelectSingleBound(new object[] { row }, selectParams); return(result != null); }
protected virtual string FindMask(PXCache sender, object row) { if (_Select != null) { PXView view = sender.Graph.TypedViews.GetView(_Select, false); object item = view.SelectSingleBound(new object[] { row }); if (item != null && item is PXResult) { item = ((PXResult)item)[_SourceType]; } string result = (string)sender.Graph.Caches[_SourceType].GetValue(item, _SourceField == null ? _FieldName : _SourceField); return(result); } return(null); }
protected virtual string FindValidationRegexp(PXCache sender, object row, out int?controlType) { controlType = null; if (_Select != null) { PXView view = sender.Graph.TypedViews.GetView(_Select, false); object item = view.SelectSingleBound(new object[] { row }); if (item != null && item is PXResult) { item = ((PXResult)item)[_SourceType]; } string result = (string)sender.Graph.Caches[_SourceType].GetValue(item, _SourceField == null ? _FieldName : _SourceField); if (typeof(CSAttribute).IsAssignableFrom(_SourceType) && item != null) { controlType = ((int?)sender.Graph.Caches[_SourceType].GetValue <CSAttribute.controlType>(item)); } return(result); } return(null); }