Ejemplo n.º 1
0
        private FormulaObject GetMainFormulaObject(DP_DataRepository mainDataItem)
        {
            FormulaObject formulaObject = new FormulaObject();

            formulaObject.DataItem = mainDataItem;
            return(formulaObject);
        }
Ejemplo n.º 2
0
        private FormulaObject GetMainFormulaObject(DP_DataRepository mainDataItem)
        {
            FormulaObject formulaObject = new FormulaObject();

            if (!mainDataItem.IsNewItem && MyDataHelper.DataItemPrimaryKeysHaveValue(mainDataItem) && !MyDataHelper.DataItemNonPrimaryKeysHaveValues(mainDataItem))
            {
                SearchRequestManager searchProcessor = new SearchRequestManager();
                DP_SearchRepository  searchDataItem  = new DP_SearchRepository(mainDataItem.TargetEntityID);
                foreach (var property in mainDataItem.GetProperties())
                {
                    searchDataItem.Phrases.Add(new SearchProperty()
                    {
                        ColumnID = property.ColumnID, Value = property.Value
                    });
                }

                //سکوریتی داده اعمال میشود
                //یعنی ممکن است به خود داده دسترسی نداشته باشد و یا حتی به بعضی از فیلدها و روابط
                DR_SearchFullDataRequest request = new DR_SearchFullDataRequest(Requester, searchDataItem);
                var result = searchProcessor.Process(request);
                if (result.Result == Enum_DR_ResultType.SeccessfullyDone)
                {
                    formulaObject.DataItem = result.ResultDataItems.FirstOrDefault(); // searchProcessor.GetDataItemsByListOFSearchProperties(Requester, searchDataItem).FirstOrDefault();
                }
                else if (result.Result == Enum_DR_ResultType.ExceptionThrown)
                {
                    throw (new Exception(result.Message));
                }
            }
            else
            {
                formulaObject.DataItem = mainDataItem;
            }
            return(formulaObject);
        }
Ejemplo n.º 3
0
        private void SetMainFormulaObject(DP_DataRepository mainDataItem, TableDrivedEntityDTO mainEntity)
        {
            MainFormulaObject = GetMainFormulaObject(mainDataItem);

            var properties = FormulaInstanceInternalHelper.GetProperties(mainEntity, null, true, true);

            MainFormulaObject.SetProperties(properties);
            MainFormulaObject.PropertyGetCalled += BindableTypeDescriptor_PropertyGetCalled;
            //MainFormulaObject.PropertySetChanged += FormulaObject_PropertySetChanged;
            //MainFormulaObject.PropertyChanged += FormulaObject_PropertyChanged;
        }
        //private static Type GetPersianDateType()
        //{
        //    return typeof(PersianDate);
        //}
        //private static PersianDate GetPersianDateDefaultValue()
        //{
        //    return new PersianDate() { Value = "1397/01/01" };
        //}
        //private static Type GetCustomTypePropertyType(MyPropertyInfo propertyInfo, ValueCustomType valueCustomType)
        //{
        //    if (valueCustomType == ValueCustomType.IsPersianDate)
        //    {
        //        return typeof(PersianDate);
        //    }
        //    return null;
        //}
        //private static object GetCustomTypePropertyDefaultValue(MyPropertyInfo propertyInfo, ValueCustomType valueCustomType)
        //{
        //    if (valueCustomType == ValueCustomType.IsPersianDate)
        //    {
        //        return new PersianDate() { Value = "1397/01/01" };
        //    }
        //    return null;
        //}
        //private static object GetCustomTypePropertyValue(MyPropertyInfo propertyInfo, ValueCustomType valueCustomType, string value)
        //{//<NULL> چی مقدار
        //    if (valueCustomType == ValueCustomType.IsPersianDate)
        //    {
        //        return new PersianDate() { Value = value };
        //    }
        //    return null;
        //}

        public static FormulaObject GetNewFormulaObject(MyPropertyInfo propertyInfo)
        {
            FormulaObject result = null;

            //short propertyInfo.RelationshipLevel = 0;
            //if (propertyInfo != null)
            //    propertyInfo.RelationshipLevel = propertyInfo.RelationshipLevel;
            if (propertyInfo.RelationshipLevel == 0)
            {
                result = new BindableTypeDescriptor <tempClass1>();
            }
            else if (propertyInfo.RelationshipLevel == 1)
            {
                result = new BindableTypeDescriptor <tempClass2>();
            }
            else if (propertyInfo.RelationshipLevel == 2)
            {
                result = new BindableTypeDescriptor <tempClass3>();
            }
            else if (propertyInfo.RelationshipLevel == 3)
            {
                result = new BindableTypeDescriptor <tempClass4>();
            }
            else if (propertyInfo.RelationshipLevel == 4)
            {
                result = new BindableTypeDescriptor <tempClass5>();
            }
            else if (propertyInfo.RelationshipLevel == 5)
            {
                result = new BindableTypeDescriptor <tempClass6>();
            }
            else if (propertyInfo.RelationshipLevel == 6)
            {
                result = new BindableTypeDescriptor <tempClass7>();
            }
            else if (propertyInfo.RelationshipLevel == 7)
            {
                result = new BindableTypeDescriptor <tempClass8>();
            }
            else if (propertyInfo.RelationshipLevel == 8)
            {
                result = new BindableTypeDescriptor <tempClass9>();
            }

            //var aa = (result as BindableTypeDescriptor<tempClass3>).WordCount();
            return(result);
        }