Esempio n. 1
0
 private void LokEntities_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
 {
     if (e.SingleFilterValue != null)
     {
         if (!e.FilerBySelectedValue)
         {
             var list = bizTableDrivedEntity.GetAllEntities(e.SingleFilterValue);
             e.ResultItemsSource = list;
         }
         else
         {
             var id = Convert.ToInt32(e.SingleFilterValue);
             if (id > 0)
             {
                 lokEntities.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                 var entity = bizTableDrivedEntity.GetTableDrivedEntity(id);
                 e.ResultItemsSource = new List <TableDrivedEntityDTO> {
                     entity
                 };
             }
             else
             {
                 e.ResultItemsSource = null;
             }
         }
     }
 }
Esempio n. 2
0
 private void LokSubject_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
 {
     if (e.SingleFilterValue != null)
     {
         if (!e.FilerBySelectedValue)
         {
             var subjects = bizSecuritySubject.GetSecuritySubjects(e.SingleFilterValue);
             e.ResultItemsSource = subjects;
         }
         else
         {
             var id = Convert.ToInt32(e.SingleFilterValue);
             if (id > 0)
             {
                 var subject = bizSecuritySubject.GetSecuritySubject(id);
                 e.ResultItemsSource = new List <SecuritySubjectDTO> {
                     subject
                 };
             }
             else
             {
                 e.ResultItemsSource = null;
             }
         }
     }
 }
        private void ColUser_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
        {
            if (!string.IsNullOrEmpty(e.SingleFilterValue))
            {
                if (e.FilterBySelectedValue)
                {
                    var id = Convert.ToInt32(e.SingleFilterValue);
                    if (id > 0)
                    {
                        var entity = bizTableDrivedEntity.GetSimpleEntity(MyProjectManager.GetMyProjectManager.GetRequester(), id);;
                        e.ResultItemsSource = new List <TableDrivedEntityDTO> {
                            entity
                        };
                    }
                    else
                    {
                        e.ResultItemsSource = null;
                    }
                }
                else
                {
                    e.ResultItemsSource = bizTableDrivedEntity.GetAllEntities(MyProjectManager.GetMyProjectManager.GetRequester(), e.SingleFilterValue, false);
                }
            }
            //else if (e.Filters.Count > 0)
            //{

            //}
        }
Esempio n. 4
0
        private void LokCodeFunction_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
        {
            if (e.SingleFilterValue != null)
            {
                if (!e.FilterBySelectedValue)
                {
                    List <Enum_CodeFunctionParamType> paramTypes = null;
                    var paramType = Enum_CodeFunctionParamType.KeyColumns;
                    paramTypes = new List <Enum_CodeFunctionParamType>()
                    {
                        paramType
                    };

                    var list = bizCodeFunction.GetAllCodeFunctions(MyProjectManager.GetMyProjectManager.GetRequester(), e.SingleFilterValue, paramTypes);
                    e.ResultItemsSource = list;
                }
                else
                {
                    var id = Convert.ToInt32(e.SingleFilterValue);
                    if (id > 0)
                    {
                        //lokSecondSideEntity.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                        var item = bizCodeFunction.GetCodeFunction(MyProjectManager.GetMyProjectManager.GetRequester(), id);
                        e.ResultItemsSource = new List <CodeFunctionDTO> {
                            item
                        };
                    }
                    else
                    {
                        e.ResultItemsSource = null;
                    }
                }
            }
        }
        private void ColUser_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
        {
            if (!string.IsNullOrEmpty(e.SingleFilterValue))
            {
                if (e.FilterBySelectedValue)
                {
                    var id = Convert.ToInt32(e.SingleFilterValue);
                    if (id > 0)
                    {
                        var user = bizUser.GetUser(id);
                        e.ResultItemsSource = new List <UserDTO> {
                            user
                        };
                    }
                    else
                    {
                        e.ResultItemsSource = null;
                    }
                }
                else
                {
                    e.ResultItemsSource = bizUser.GetAllUsers(e.SingleFilterValue);
                }
            }
            //else if (e.Filters.Count > 0)
            //{

            //}
        }
Esempio n. 6
0
        private void LokDatabaseFunction_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
        {
            if (e.SingleFilterValue != null)
            {
                if (!e.FilterBySelectedValue)
                {
                    Enum_DatabaseFunctionType type = Enum_DatabaseFunctionType.None;

                    var list = bizDatabaseFunction.GetAllDatabaseFunctions(MyProjectManager.GetMyProjectManager.GetRequester(), e.SingleFilterValue, type);
                    e.ResultItemsSource = list;
                }
                else
                {
                    var id = Convert.ToInt32(e.SingleFilterValue);
                    if (id > 0)
                    {
                        //lokSecondSideEntity.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                        var item = bizDatabaseFunction.GetDatabaseFunction(MyProjectManager.GetMyProjectManager.GetRequester(), id);
                        e.ResultItemsSource = new List <DatabaseFunctionDTO> {
                            item
                        };
                    }
                    else
                    {
                        e.ResultItemsSource = null;
                    }
                }
            }
        }
 private void LokEntitiesFirst_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
 {
     if (e.SingleFilterValue != null)
     {
         if (!e.FilterBySelectedValue)
         {
             var list = bizTableDrivedEntity.GetAllEntities(MyProjectManager.GetMyProjectManager.GetRequester(), e.SingleFilterValue, false);
             e.ResultItemsSource = list;
         }
         else
         {
             var id = Convert.ToInt32(e.SingleFilterValue);
             if (id > 0)
             {
                 //lokSecondSideEntity.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                 var entity = bizTableDrivedEntity.GetSimpleEntity(MyProjectManager.GetMyProjectManager.GetRequester(), id);
                 e.ResultItemsSource = new List <TableDrivedEntityDTO> {
                     entity
                 };
             }
             else
             {
                 e.ResultItemsSource = null;
             }
         }
     }
 }
 private void LokDBFunction_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
 {
     if (e.SingleFilterValue != null)
     {
         if (!e.FilterBySelectedValue)
         {
             var list = bizDatabaseFunction.GetDatabaseFunctionEntities(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID);
             list = list.Where(x => x.DatabaseFunction.Type == Enum_DatabaseFunctionType.StoredProcedure).ToList();
             e.ResultItemsSource = list;
         }
         else
         {
             var id = Convert.ToInt32(e.SingleFilterValue);
             if (id > 0)
             {
                 //lokSecondSideEntity.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                 var item = bizDatabaseFunction.GetDatabaseFunctionEntity(MyProjectManager.GetMyProjectManager.GetRequester(), id);
                 e.ResultItemsSource = new List <DatabaseFunction_EntityDTO> {
                     item
                 };
             }
             else
             {
                 e.ResultItemsSource = null;
             }
         }
     }
 }
Esempio n. 9
0
 private void LokCodeFunctionEntity_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
 {
     if (e.SingleFilterValue != null)
     {
         if (!e.FilterBySelectedValue)
         {
             var list = bizCodeFunction.GetCodeFunctionEntityByEntityID(MyProjectManager.GetMyProjectManager.GetRequester(), (int)lokEntity.SelectedValue);
             e.ResultItemsSource = list;
         }
         else
         {
             var id = Convert.ToInt32(e.SingleFilterValue);
             if (id > 0)
             {
                 //lokSecondSideEntity.ItemsSource = bizTableDrivedEntity.GetAllEntities();
                 var item = bizCodeFunction.GetCodeFunctionEntity(MyProjectManager.GetMyProjectManager.GetRequester(), id);
                 e.ResultItemsSource = new List <CodeFunction_EntityDTO> {
                     item
                 };
             }
             else
             {
                 e.ResultItemsSource = null;
             }
         }
     }
 }
        //private Dictionary<object,>
        private object GetDisplayPropertyValueFromItemsource(object dataContext)
        {
            if (dataContext != null)
            {
                var property = dataContext.GetType().GetProperty(this.DataMemberBinding.Path.Path);
                if (property != null)
                {
                    var bindvalue = property.GetValue(dataContext);
                    if (bindvalue != null)
                    {
                        object fItem  = null;
                        var    fItems = FindItemInItemsSource(ItemsSource as IList, bindvalue.ToString());
                        if (fItems.Any())
                        {
                            fItem = fItems.First();
                        }
                        else if (SearchFilterChanged != null)
                        {
                            var filterArg = new MyCommonWPFControls.SearchFilterArg();
                            filterArg.FilterBySelectedValue = true;
                            filterArg.SingleFilterValue     = bindvalue.ToString();
                            SearchFilterChanged(this, filterArg);
                            var displayItemsSource = filterArg.ResultItemsSource;
                            if (displayItemsSource != null && displayItemsSource.Count > 0)
                            {
                                fItem = displayItemsSource[0];
                                AppendToItemsSource(fItem);
                            }
                        }
                        if (fItem != null)
                        {
                            var sourcevalueproperty = fItem.GetType().GetProperty(this.SelectedValueMemberPath);
                            if (sourcevalueproperty != null)
                            {
                                var value = sourcevalueproperty.GetValue(fItem);
                                if (value != null)
                                {
                                    if (bindvalue.ToString() == value.ToString())
                                    {
                                        var sourcedisplayroperty = fItem.GetType().GetProperty(this.DisplayMemberPath);
                                        if (sourcedisplayroperty != null)
                                        {
                                            return(sourcedisplayroperty.GetValue(fItem));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(null);
        }
        private void cmbSecondEntity_SearchFilterChanged(object sender, MyCommonWPFControls.SearchFilterArg e)
        {
            if (!string.IsNullOrEmpty(e.SingleFilterValue))
            {
                if (e.FilterBySelectedValue)
                {
                    var entities = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), Convert.ToInt32(e.SingleFilterValue), EntityColumnInfoType.WithoutColumn, EntityRelationshipInfoType.WithoutRelationships);
                    e.ResultItemsSource = new List <TableDrivedEntityDTO> {
                        entities
                    };
                }
                else
                {
                    var entities = bizTableDrivedEntity.GetAllEntities(MyProjectManager.GetMyProjectManager.GetRequester(), e.SingleFilterValue, null);
                    e.ResultItemsSource = entities;
                }
            }
            //else if (e.Filters.Count > 0)
            //{

            //}
        }
Esempio n. 12
0
        public override void SearchFunction()
        {
            var generalFilterValue = "";

            if (SearchTextbox.Text != "")
            {
                generalFilterValue = SearchTextbox.Text;
            }

            Dictionary <string, string> filters = new Dictionary <string, string>();

            //?بقیه فیلترها

            if (SearchFilterChanged != null)
            {
                var filterArg = new MyCommonWPFControls.SearchFilterArg();
                filterArg.SingleFilterValue = generalFilterValue;
                //   filterArg.Filters = filters;
                SearchFilterChanged(this, filterArg);
                ItemsSource = filterArg.ResultItemsSource;
                Popup(true);
            }
        }
        private void CellEditElement_SearchFilterChanged(object sender, SearchFilterArg e)
        {
            if (e.FilterBySelectedValue)
            {
                //یعنی از داخل صدا زده شده..بالایی
                var foundItems = FindItemInItemsSource(lookupItemsSource, e.SingleFilterValue);
                if (foundItems.Count == 0)
                {
                    //قاعدتا اینجا نباید هیچوقت بیاد
                    //چون در موقع نمایش ایتم سورس با تمام مقادیر ساخته شده
                    var filterArg = new MyCommonWPFControls.SearchFilterArg();
                    filterArg.FilterBySelectedValue = true;
                    filterArg.SingleFilterValue     = e.SingleFilterValue.ToString();
                    SearchFilterChanged(this, filterArg);
                    if (lastSearchItemsSource == null)
                    {
                        lookupItemsSource = filterArg.ResultItemsSource;
                    }
                    else
                    {
                        lookupItemsSource = MergeSources(filterArg.ResultItemsSource, lookupItemsSource);
                    }

                    e.ResultItemsSource = lookupItemsSource;
                }
                else
                {
                    e.ResultItemsSource = lookupItemsSource;
                }
            }
            else if (SearchFilterChanged != null)
            {
                //با خود سرچ لوکاپ میاد اینجا
                SearchFilterChanged(sender, e);
                lastSearchItemsSource = e.ResultItemsSource;
            }
        }