public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
            CRFieldNewValues row = e.Row as CRFieldNewValues;

            if (row != null && _valuesDic.ContainsKey(row.DataField))
            {
                if (string.Compare(row.DataFieldType, typeof(bool).Name, true) == 0)
                {
                    e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(Boolean), false, null,
                                                                -1, null, null, null, base._FieldName, null, null, null,
                                                                PXErrorLevel.Undefined, null, null, PXUIVisibility.Undefined, null, null, null);
                }
                else
                if (!string.IsNullOrEmpty(row.SelectorViewName))
                {
                    e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(string), false, null,
                                                                -1, null, null, null, base._FieldName, row.SelectorDescriptionName, row.SelectorDescription, null, null,
                                                                PXErrorLevel.Undefined, null, null, PXUIVisibility.Undefined, row.SelectorViewName, null, null);
                }
                else
                {
                    string[] values = Array.ConvertAll <object, string>(_valuesDic[row.DataField], CRHelper.ObjectToString);
                    e.ReturnState = PXStringState.CreateInstance(e.ReturnState, null, base._FieldName, null,
                                                                 -1, null, values, _labelsDic.ContainsKey(row.DataField) ?
                                                                 _labelsDic[row.DataField] : values, (bool?)true);
                }
            }
        }
            protected override void AddMergingViews()
            {
                base.AddMergingViews();

                foreach (string field in _leadCache.Fields)
                {
                    if (CRFieldNewValues.GetSelectorAttribute(_leadCache, field) != null || CRFieldNewValues.GetDimensionAttribute(_leadCache, field) != null)
                    {
                        AddMergingView(_leadCache, GetViewName(_leadCache, field), field);
                    }
                }
            }
        public virtual void FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            CRFieldNewValues row = e.Row as CRFieldNewValues;

            if (row != null)
            {
                PXCache fieldCache = GetCacheByField(sender.Graph, row.DataField);
                if (fieldCache != null)
                {
                    //TODO: need impelement RaiseFieldVerifying
                    //object value = e.NewValue;
                    //fieldCache.RaiseFieldVerifying(row.DataField, null, ref value);
                    //e.NewValue = value;
                }
            }
        }
            protected override IEnumerable <CRFieldNewValues> GetFields(List <string> avaliableProperties)
            {
                List <CRFieldNewValues> result = new List <CRFieldNewValues>(base.GetFields(avaliableProperties));

                foreach (CRFieldNewValues item in CRFieldNewValues.GetFields(typeof(CRMergeNewValues <CRContactBatch>), _leadCache, avaliableProperties, GetMergingViewName))
                {
                    if (result.Find(delegate(CRFieldNewValues obj) { return(obj.DataField == item.DataField); }) == null)
                    {
                        result.Add(item);
                    }
                }
                result.Sort(new Comparison <CRFieldNewValues>(
                                delegate(CRFieldNewValues x, CRFieldNewValues y)
                {
                    return(string.Compare(x.DataFieldName, y.DataFieldName, false));
                }));
                return(result);
            }
 protected override object GetValueExt(object row, CRFieldNewValues item)
 {
     return(base.GetValueExt(row, item) ?? _leadCache.GetValueExt(row, item.DataField));
 }