private void PopulateTree()
 {
     if (EntityID != 0)
     {
         var entity   = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithoutColumn, EntityRelationshipInfoType.WithRelationships);
         var rootNode = AddRootNode(treeItems.Items, (string.IsNullOrEmpty(entity.Alias) ? entity.Name : entity.Alias));
         PopulateTreeItems(rootNode, entity);
     }
 }
 public void SetEntityID(int entityID)
 {
     if (MainEntity == null || MainEntity.ID != entityID)
     {
         MainEntity = bizEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
         if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
         {
             PopulateTree();
         }
     }
 }
Esempio n. 3
0
        private void SetColumns()
        {
            BizColumn            bizColumn = new BizColumn();
            BizTableDrivedEntity biz       = new BizTableDrivedEntity();
            var entityID = 0;

            if (lokRelationshipTail.SelectedItem == null)
            {
                entityID = EntityID;
            }
            else
            {
                EntityRelationshipTailDTO item = lokRelationshipTail.SelectedItem as EntityRelationshipTailDTO;
                entityID = item.TargetEntityID;
            }
            var entity  = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
            var columns = entity.Columns;  //  .Where(x => x.ForeignKey == false).ToList();

            //  برای وضعیتهایی که به دسترسی داده وصل میشن همه ستونها لازمند چون مثلا برای درخواست سرویس شناسه دفتر با شناسه خاری سازمان کاربر چک میشود. اما برای وضعیتهای فرم کلید خارجی ها کنترل نمی شوند که باعث فعال شدن اقدامات بشوند. چون داینامیک تغییر نمی کنند. البته بعهتر است برنامه تغییر کند که کلید خارجی ها با تغییر رابطه تغییر کنند.

            cmbColumns.DisplayMemberPath = "Alias";
            cmbColumns.SelectedValuePath = "ID";
            cmbColumns.ItemsSource       = columns;
            if (Message != null && Message.ID != 0)
            {
                if (Message.ColumnID != 0)
                {
                    cmbColumns.SelectedValue = Message.ColumnID;
                }
            }
        }
Esempio n. 4
0
        public EntityListViewDTO GetEntityKeysListView(DR_Requester requester, int entityID)
        {
            BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity();
            var entityDTO = bizTableDrivedEntity.GetTableDrivedEntity(requester, entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);

            return(ToEntityKeysListView(entityDTO));
        }
Esempio n. 5
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;
             }
         }
     }
 }
        public frmEntitySearch(int entityID, int entitySearchID)
        {
            InitializeComponent();
            EntityID = entityID;
            BizTableDrivedEntity biz = new BizTableDrivedEntity();
            var entity = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);

            if (entity.IsView)
            {
                colRelationshipTail.IsVisible = false;
            }
            EntitySearchID = entitySearchID;
            SetRelationshipTails();
            if (EntitySearchID == 0)
            {
                Message = new EntitySearchDTO();
                ShowMessage();
            }
            else
            {
                GetEntityEntitySearch(EntitySearchID);
            }
            dtgColumns.CellEditEnded            += DtgConditions_CellEditEnded;
            dtgColumns.RowLoaded                += DtgColumns_RowLoaded;
            colRelationshipTail.EditItemClicked += ColRelationshipTail_EditItemClicked;
            ControlHelper.GenerateContextMenu(dtgColumns);
        }
Esempio n. 7
0
        //private void cmbRelationshipTail_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    SetColumnValueColumns();
        //}

        private void SetColumnValueColumns()
        {
            TableDrivedEntityDTO targetEntity = null;

            //if (cmbColumnValueRelationshipTail.SelectedItem != null)
            //{
            //    var item = cmbColumnValueRelationshipTail.SelectedItem as EntityRelationshipTailDTO;
            //    targetEntity = bizTableDrivedEntity.GetTableDrivedEntity(item.RelationshipTargetEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);

            //}
            //else
            targetEntity = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);

            colColumnValueColumn.ItemsSource             = targetEntity.Columns;
            colColumnValueColumn.DisplayMemberPath       = "Alias";
            colColumnValueColumn.SelectedValueMemberPath = "ID";
        }
        public DP_EntityResult GetEntity(DP_EntityRequest request, EntityColumnInfoType entityColumnInfoType, EntityRelationshipInfoType entityRelationshipInfoType)
        {
            DP_EntityResult      result = new DP_EntityResult();
            BizTableDrivedEntity biz    = new BizTableDrivedEntity();

            result.Entity = biz.GetTableDrivedEntity(request.Requester, request.EntityID, entityColumnInfoType, entityRelationshipInfoType);
            return(result);
        }
Esempio n. 9
0
 public frmEntityTree(int entityId)
 {
     InitializeComponent();
     entity = bizEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityId, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
     if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
     {
         PopulateEntityTree();
     }
 }
        private void SetColumns(EntitySearchColumnsDTO condition)
        {
            colColumns.DisplayMemberPath       = "Name";
            colColumns.SelectedValueMemberPath = "ID";
            BizTableDrivedEntity biz = new BizTableDrivedEntity();

            if (condition.RelationshipTailID == 0)
            {
                var entity = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
                condition.vwValueColumns = entity.Columns;;
            }
            else
            {
                var relationshipTail = bizEntityRelationshipTail.GetEntityRelationshipTail(MyProjectManager.GetMyProjectManager.GetRequester(), condition.RelationshipTailID);
                var entity           = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), relationshipTail.TargetEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
                condition.vwValueColumns = entity.Columns;
            }
        }
        //private void TreeItems_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        //{
        //    e.Handled = true;
        //    if (treeItems.SelectedItem != null)
        //    {
        //        CheckSelectedItem(treeItems.SelectedItem as RadTreeViewItem);
        //    }
        //}

        //private void CheckSelectedItem(RadTreeViewItem treeViewItem)
        //{
        //    if (ItemSelected != null)
        //    {
        //        TreeFormulaParameterSelectedArg arg = new TreeFormulaParameterSelectedArg(); ;
        //        var selectedItem = treeViewItem.DataContext;
        //        if (selectedItem is ColumnDTO)
        //        {
        //            var column = (selectedItem as ColumnDTO);

        //            var columnFormulaParameter = new ColumnFormulaParameter();
        //            columnFormulaParameter.ColumnID = column.ID;
        //            columnFormulaParameter.FormulaParameterFullPath = GetColumnParameterName(treeViewItem, column, "");
        //            columnFormulaParameter.ParameterTitle = column.Alias;
        //            columnFormulaParameter.ParameterType = bizColumn.GetColumnDotNetType(column);
        //            arg.Parameter = columnFormulaParameter;
        //        }
        //        else if (selectedItem is FormulaParameterDTO)
        //        {
        //            var paremeter = (selectedItem as FormulaParameterDTO);

        //            var existingFormulaParameter = new ExistingFormulaParameter();
        //            existingFormulaParameter.FormulaParameterID = paremeter.ID;
        //            existingFormulaParameter.FormulaParameterFullPath = GetParameterName(treeViewItem, paremeter, "");
        //            existingFormulaParameter.ParameterTitle = paremeter.Title;
        //            existingFormulaParameter.ParameterType = bizFormula.GetFormulaDotNetType(paremeter.FormulaID);
        //            arg.Parameter = existingFormulaParameter;
        //        }
        //        else if (selectedItem is RelationshipDTO)
        //        {
        //            var relationship = (selectedItem as RelationshipDTO);

        //            var relationshipFormulaParameter = new RelationshipFormulaParameter();
        //            relationshipFormulaParameter.FormulaParameterFullPath = GetRelaionshipName(treeViewItem, relationship, "");
        //            relationshipFormulaParameter.ParameterTitle = relationship.Entity2;
        //            relationshipFormulaParameter.ParameterType = null;
        //            arg.Parameter = relationshipFormulaParameter;
        //        }
        //        //if (arg.Parameter.ParameterName.EndsWith("." + singleName))
        //        //    arg.Parameter.FormulaParameterPath = arg.Parameter.ParameterName.Replace("." + singleName, "");
        //        //else
        //        //    arg.Parameter.FormulaParameterPath = "";
        //        ItemSelected(this, arg);
        //    }
        //}

        //private string GetColumnParameterName(RadTreeViewItem treeViewItem, ColumnDTO column, string result = "")
        //{
        //    if (treeViewItem.Parent is RadTreeViewItem)
        //    {
        //        if ((treeViewItem.Parent as RadTreeViewItem).Parent == treeItems.Items[0])
        //            return result + (result == "" ? "" : ".") + column.Name;
        //        else if ((treeViewItem.Parent as RadTreeViewItem).DataContext is RelationshipDTO)
        //        {
        //            var relationship = (treeViewItem.Parent as RadTreeViewItem).DataContext as RelationshipDTO;
        //            result = formulaHelper.GetRelationshipIdentifier(relationship) + (result == "" ? "" : ".") + result;
        //            return GetColumnParameterName(treeViewItem.Parent as RadTreeViewItem, column, result);
        //        }
        //        else
        //            return GetColumnParameterName(treeViewItem.Parent as RadTreeViewItem, column, result);
        //    }
        //    return "";

        //}
        //private string GetParameterName(RadTreeViewItem treeViewItem, FormulaParameterDTO parameter, string result = "")
        //{
        //    if (treeViewItem.Parent is RadTreeViewItem)
        //    {
        //        if ((treeViewItem.Parent as RadTreeViewItem).Parent == treeItems.Items[0])
        //            return result + (result == "" ? "" : ".") + parameter.Name;
        //        else if ((treeViewItem.Parent as RadTreeViewItem).DataContext is RelationshipDTO)
        //        {
        //            var relationship = (treeViewItem.Parent as RadTreeViewItem).DataContext as RelationshipDTO;
        //            result = formulaHelper.GetRelationshipIdentifier(relationship) + (result == "" ? "" : ".") + result;
        //            return GetParameterName(treeViewItem.Parent as RadTreeViewItem, parameter, result);
        //        }
        //        else
        //            return GetParameterName(treeViewItem.Parent as RadTreeViewItem, parameter, result);
        //    }
        //    return "";

        //}


        //private string GetRelaionshipName(RadTreeViewItem treeViewItem,RelationshipDTO relationship, string result = "")
        //{
        //    if (treeViewItem.Parent is RadTreeViewItem)
        //    {
        //        if ((treeViewItem.Parent as RadTreeViewItem).Parent == null)
        //            return result;
        //        else if ((treeViewItem as RadTreeViewItem).DataContext is RelationshipDTO)
        //        {
        //            var currentRelationship = (treeViewItem as RadTreeViewItem).DataContext as RelationshipDTO;
        //            result = formulaHelper.GetRelationshipIdentifier(currentRelationship) + (result == "" ? "" : ".") + result;
        //            return GetRelaionshipName(treeViewItem.Parent as RadTreeViewItem, relationship, result);
        //        }
        //        else
        //            return GetRelaionshipName(treeViewItem.Parent as RadTreeViewItem, relationship, result);
        //    }
        //    return result;

        //}



        private void PopulateTree()
        {
            if (EntityID != 0)
            {
                BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity();
                var entity   = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithoutColumn, EntityRelationshipInfoType.WithoutRelationships);
                var rootNode = AddFormulaObjectNode(treeItems.Items, DatabaseObjectCategory.Entity, 0, (string.IsNullOrEmpty(entity.Alias) ? entity.Name : entity.Alias));
                PopulateTreeItems(rootNode.Items, EntityID);
                rootNode.IsExpanded = true;
            }
        }
 public frmFormulaTree(int entityID)
 {
     InitializeComponent();
     EntityID = entityID;
     Entity   = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
     //treeItems.SelectedItemChanged += TreeItems_SelectedItemChanged;
     if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
     {
         PopulateTree();
     }
 }
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (txtViewName.Text == "")
     {
         MessageBox.Show("عنوان مناسب تعریف نشده است");
         return;
     }
     foreach (var item in Message.EntitySearchAllColumns)
     {
         if (item.RelationshipTailID != 0)
         {
             var relationshipTail = bizEntityRelationshipTail.GetEntityRelationshipTail(MyProjectManager.GetMyProjectManager.GetRequester(), item.RelationshipTailID);
             BizTableDrivedEntity bizTableDrivedEntity = new MyModelManager.BizTableDrivedEntity();
             var entity = bizTableDrivedEntity.GetSimpleEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID);;
             var linkedServerMessage = bizEntityRelationshipTail.CheckLinkedServers(entity, relationshipTail);
             if (linkedServerMessage != "")
             {
                 var message = "اشکال در تعریف لینک سرور برای ستون" + " " + (string.IsNullOrEmpty(item.Alias) ? item.ColumnID.ToString() : item.Alias);
                 message += Environment.NewLine + linkedServerMessage;
                 MessageBox.Show(message);
                 return;
             }
         }
     }
     foreach (var item in Message.EntitySearchAllColumns)
     {
         if (item.RelationshipTailID != 0)
         {
             if (item.ColumnID == 0)
             {
                 BizTableDrivedEntity biz = new BizTableDrivedEntity();
                 var relationshipTail     = bizEntityRelationshipTail.GetEntityRelationshipTail(MyProjectManager.GetMyProjectManager.GetRequester(), item.RelationshipTailID);
                 var entity = biz.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), relationshipTail.TargetEntityID, EntityColumnInfoType.WithoutColumn, EntityRelationshipInfoType.WithoutRelationships);
                 if (entity.IsView)
                 {
                     MessageBox.Show("به منظور استفاده از رشته رابطه" + " " + relationshipTail.EntityPath + " " + "، به علت منتهی شدن با نما، انتخاب ستون هدف اجباری می باشد");
                     return;
                 }
             }
         }
     }
     Message.TableDrivedEntityID = EntityID;
     Message.Title = txtViewName.Text;
     Message.ID    = bizEntitySearch.UpdateEntitySearchs(Message);
     if (EntitySearchUpdated != null)
     {
         EntitySearchUpdated(this, new MyProject_WPF.EntitySearchUpdatedArg()
         {
             ID = Message.ID
         });
     }
     MessageBox.Show("اطلاعات ثبت شد");
 }
        public frmDataMenuSetting(int entityID, int dataMenuSettingID)
        {
            InitializeComponent();
            EntityID = entityID;
            SetRelationshipTails();
            SetDataViewList();
            SetDataItemReports();
            if (dataMenuSettingID == 0)
            {
                Message = new DataMenuSettingDTO();
                ShowMessage();
            }
            else
            {
                GetDataMenuSetting(dataMenuSettingID);
            }
            Entity = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
            SetTabVisiblities();
            SetBaseTables();

            ControlHelper.GenerateContextMenu(dtgDataGridRelationships);
            ControlHelper.GenerateContextMenu(dtgDataViewRelationships);
            ControlHelper.GenerateContextMenu(dtgReportRelationships);
            ControlHelper.GenerateContextMenu(dtgDataItemReport);

            //ControlHelper.GenerateContextMenu(dtgExternalReports);
            dtgReportRelationships.RowLoaded     += DtgColumns_RowLoaded;
            dtgReportRelationships.CellEditEnded += DtgConditions_CellEditEnded;

            dtgDataViewRelationships.RowLoaded     += DtgColumns_RowLoaded;
            dtgDataViewRelationships.CellEditEnded += DtgConditions_CellEditEnded;

            dtgDataGridRelationships.RowLoaded     += DtgColumns_RowLoaded;
            dtgDataGridRelationships.CellEditEnded += DtgConditions_CellEditEnded;

            colReportRelationshipTail.EditItemClicked   += ColRelationshipTail_EditItemClicked;
            colDataViewRelationshipTail.EditItemClicked += ColRelationshipTail_EditItemClicked;
            colDataGridRelationshipTail.EditItemClicked += ColRelationshipTail_EditItemClicked;

            colDataGridRelTargetDataMenuSetting.NewItemEnabled   = true;
            colDataViewRelTargetDataMenuSetting.NewItemEnabled   = true;
            colDataGridRelTargetDataMenuSetting.EditItemEnabled  = true;
            colDataViewRelTargetDataMenuSetting.EditItemEnabled  = true;
            colDataViewRelTargetDataMenuSetting.EditItemClicked += ColDataGridRelTargetDataMenuSetting_EditItemClicked;
            colDataGridRelTargetDataMenuSetting.EditItemClicked += ColDataGridRelTargetDataMenuSetting_EditItemClicked;

            lokRelationship.SelectionChanged   += LokRelationship_SelectionChanged;
            lokDataMenuSetting.EditItemClicked += LokDataMenuSetting_EditItemClicked;
            lokDataMenuSetting.EditItemEnabled  = true;
            lokDataMenuSetting.NewItemEnabled   = true;
        }
 public frmDataSelect(int entityID)
 {
     InitializeComponent();
     Entity         = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
     lblEntity.Text = Entity.Alias;
     foreach (var col in Entity.Columns.Where(x => x.PrimaryKey))
     {
         EntityInstanceProperty keyColumn = new EntityInstanceProperty(col);
         //  keyColumn.ColumnID = col.ID;
         //keyColumn.IsKey = true;
         //keyColumn.Name = col.Name;
         keyColumns.Add(keyColumn);
     }
     dtgKeyColumns.ItemsSource = keyColumns;
 }
        public void UpdateUIComposition(DR_Requester requester, int entityID)
        {
            BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity();
            var entity = bizTableDrivedEntity.GetTableDrivedEntity(requester, entityID, EntityColumnInfoType.WithFullColumns, EntityRelationshipInfoType.WithRelationships);
            //اینجا کش شدن روابط توجه شود
            List <EntityUICompositionDTO> generetedUIComposition = null;

            if (!EntityHasUIComposition(entity))
            {
                generetedUIComposition = GenerateUIComposition(entity);
                Save(entityID, generetedUIComposition);
            }
            else
            {
                var entityUICompositions = GetEntityUICompositionTree(entityID);
                generetedUIComposition = new List <EntityUICompositionDTO>();
                //var rootItem = new List<EntityUICompositionDTO>();
                //List<EntityUICompositionDTO> result = new List<EntityUICompositionDTO>();
                List <RelationshipDTO> candidateRelationships = GetCandidUpdateRelationships(entityUICompositions, entity);
                if (candidateRelationships.Any())
                {
                    var tabControl = GetOrCreateRelationshipTabControl(entityUICompositions.RootItem);
                    if (tabControl.ID == 0)
                    {
                        generetedUIComposition.Add(tabControl);
                    }
                    foreach (var relationship in candidateRelationships)
                    {
                        AddTabPageRelationship(tabControl, relationship, generetedUIComposition);
                    }
                }
                if (generetedUIComposition.Any())
                {
                    using (var projectContext = new DataAccess.MyProjectEntities())
                    {
                        foreach (var parentGroup in generetedUIComposition.Where(x => x.ParentItem.ID != 0).GroupBy(x => x.ParentItem))
                        {
                            var parentDBItem = projectContext.EntityUIComposition.First(x => x.ID == parentGroup.Key.ID);
                            CheckAddItems(entityID, generetedUIComposition, parentGroup.Key, parentDBItem, projectContext);
                        }
                        projectContext.SaveChanges();
                    }
                }
                //AddPrimaryToForeignRelationshipUICompositionItem(result[0], result, entity.Relationships.Where(x => x.DataEntryEnabled == true && x.MastertTypeEnum == Enum_MasterRelationshipType.FromPrimartyToForeign).ToList(), index);
            }
        }
 public frmMainLetterTemplate(int entityID, int letterTempleteID)
 {
     InitializeComponent();
     EntityID = entityID;
     Entity   = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
     SetLetterTemplateTypes();
     ucFields.SetEntity(entityID);
     if (letterTempleteID == 0)
     {
         Message = new MainLetterTemplateDTO();
         grdViewFile.Visibility = Visibility.Collapsed;
         grdAddFile.Visibility  = Visibility.Visible;
     }
     else
     {
         GetLetterTepmplate(letterTempleteID);
     }
 }
Esempio n. 18
0
 public frmCodeFunction_Entity(int ID, int entityID)
 {
     InitializeComponent();
     //    CodeFunctionParamTypes = codeFunctionParamTypes;
     Entity = bizEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
     SetLookups();
     if (ID == 0)
     {
         CodeFunctionEntity = new CodeFunction_EntityDTO();
         //lokCodeFunction.ItemsSource = bizCodeFunction.GetCodeFunctionsByEntityID(MyProjectManager.GetMyProjectManager.GetRequester(), Entity.ID);
     }
     else
     {
         //lokCodeFunction.Visibility = Visibility.Collapsed;
         GetCodeFunctionEntity(ID);
     }
     SetDataGridColumns();
 }
Esempio n. 19
0
 public frmDatabaseFunction_Entity(int ID, int entityID)
 {
     InitializeComponent();
     //    DatabaseFunctionParamTypes = DatabaseFunctionParamTypes;
     Entity = bizEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
     SetLookups();
     if (ID == 0)
     {
         DatabaseFunctionEntity          = new DatabaseFunction_EntityDTO();
         lokDatabaseFunction.ItemsSource = bizDatabaseFunction.GetDatabaseFunctions(MyProjectManager.GetMyProjectManager.GetRequester(), Enum_DatabaseFunctionType.None, Entity.DatabaseID);
     }
     else
     {
         lokDatabaseFunction.Visibility = Visibility.Collapsed;
         GetDatabaseFunctionEntity(ID);
     }
     SetDataGridColumns();
 }
        private void SetArcGroupGrid()
        {
            BizArcRelationship biz = new BizArcRelationship();

            dtgArcGroup.ItemsSource = biz.GetArcRelationshipGroups(TableDrivedEntityID);

            //روابط هر دو طرف تکرار میشوند
            BizRelationship      bizRelationship      = new BizRelationship();
            BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity();
            var entity            = bizTableDrivedEntity.GetTableDrivedEntity(TableDrivedEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
            var listRelationships = entity.Relationships;

            var rel = dtgArcRelationships.Columns[0] as GridViewComboBoxColumn;

            rel.ItemsSource             = listRelationships;
            rel.DisplayMemberPath       = "Name";
            rel.SelectedValueMemberPath = "ID";
        }
Esempio n. 21
0
        //private void SetCommands()
        //{
        //    if (cmbEntities.SelectedItem != null)
        //    {
        //        var entity = cmbEntities.SelectedItem as TableDrivedEntityDTO;
        //        BizEntityCommand bizEntityCommand = new BizEntityCommand();
        //        var commands = bizEntityCommand.GetEntityCommands(entity.ID, false);
        //        cmbCommands.ItemsSource = commands;
        //        cmbCommands.DisplayMemberPath = "Title";
        //        cmbCommands.SelectedValuePath = "ID";
        //    }
        //}
        private void SetColumns(int entityID)
        {
            //if (lokEntities.SelectedItem != null)
            //{
            //    var entity = lokEntities.SelectedItem as TableDrivedEntityDTO;
            //var columns = bizColumn.GetColumns(entity.ID, true);
            //columns.Add(null);
            //cmbColumns.ItemsSource = columns;
            //cmbColumns.DisplayMemberPath = "Name";
            //cmbColumns.SelectedValuePath = "ID";

            BizTableDrivedEntity biz = new BizTableDrivedEntity();
            var entity = biz.GetTableDrivedEntity(entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);

            cmbConditionalColumns.ItemsSource       = entity.Columns;
            cmbConditionalColumns.DisplayMemberPath = "Name";
            cmbConditionalColumns.SelectedValuePath = "ID";
            //}
        }
Esempio n. 22
0
        DP_DataView CreateDataView(DR_Requester requester, DP_DataView sourceDataItem, RelationshipDTO relationsip)
        {
            var entity   = bizTableDrivedEntity.GetTableDrivedEntity(requester, relationsip.EntityID2, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
            var dataView = new DP_DataView(relationsip.EntityID2, relationsip.Entity2);

            foreach (var relCol in relationsip.RelationshipColumns)
            {
                var property = sourceDataItem.GetProperty(relCol.FirstSideColumnID);
                if (property == null)
                {
                    return(null);
                }
                dataView.Properties.Add(new EntityInstanceProperty(relCol.SecondSideColumn)
                {
                    Value = sourceDataItem.GetProperty(relCol.FirstSideColumnID).Value
                });
            }
            return(dataView);
        }
        private void CmbFirstEntity_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, false);
                    e.ResultItemsSource = entities;
                }
            }
            //else if (e.Filters.Count > 0)
            //{

            //}
        }
Esempio n. 24
0
 public TableDrivedEntityDTO GetEntityWithSimpleColumns(DR_Requester requester, int entityID, List <SecurityAction> specificActions = null)
 {
     return(bizTableDrivedEntity.GetTableDrivedEntity(requester, entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships, specificActions));
 }
Esempio n. 25
0
        private DataLogDTO ToDataLogDTO(DR_Requester requester, DataLog item, bool withDetails)
        {
            var message = new DataLogDTO();

            message.ID = item.ID;
            if (item.MyDataItemID != null && item.MyDataItemID != 0)
            {
                message.DatItem = bizDataItem.ToDataViewDTO(requester, item.MyDataItem, withDetails);
            }
            message.Date          = item.Date;
            message.vwPersianDate = GeneralHelper.GetShamsiDate(item.Date);
            //  message.DataInfo = item.DataInfo;
            var entity = bizTableDrivedEntity.GetTableDrivedEntity(requester, item.MyDataItem.TableDrivedEntityID, ModelEntites.EntityColumnInfoType.WithSimpleColumns, ModelEntites.EntityRelationshipInfoType.WithoutRelationships);

            if (item.MyDataItem != null)
            {
                //بهتر شود

                message.vwEntityAlias = entity.Alias;
            }
            message.Duration       = item.Duration ?? 0;
            message.MajorException = item.MajorFunctionException;
            message.MinorException = item.MinorFunctionException;
            message.MajorFunctionExceptionMessage = item.MajorFunctionExceptionMessage;
            message.LocationInfo = item.LocationInfo;
            message.PackageGuid  = item.PackageGuid;
            message.Time         = item.Time;
            message.MainType     = (DataLogType)item.MainType;
            message.UserID       = item.UserID;
            message.vwUserInfo   = bizUser.GetUserFullName(item.UserID);
            if (withDetails)
            {
                foreach (var columnLog in item.EditDataItemColumnDetails)
                {
                    var colMsg = new EditDataItemColumnDetailsDTO();
                    colMsg.ColumnID = columnLog.ColumnID;
                    var column = entity.Columns.FirstOrDefault(x => x.ID == colMsg.ColumnID);
                    if (column != null)
                    {
                        colMsg.vwColumnName  = column.Name;
                        colMsg.vwColumnAlias = column.Alias;
                    }
                    colMsg.Info     = columnLog.Info;
                    colMsg.NewValue = columnLog.NewValue;
                    colMsg.OldValue = columnLog.OldValue;
                    message.EditDataItemColumnDetails.Add(colMsg);
                    colMsg.FormulaException = columnLog.FormulaException;
                    colMsg.FormulaID        = columnLog.FormulaID ?? 0;
                    foreach (var formulaParam in columnLog.FormulaUsageParemeters)
                    {
                        FormulaUsageParemetersDTO paramDTO = new FormulaUsageParemetersDTO();
                        paramDTO.ID                       = formulaParam.ID;
                        paramDTO.ParameterName            = formulaParam.ParameterName;
                        paramDTO.ParameterValue           = formulaParam.ParameterValue;
                        paramDTO.RelationshipPropertyTail = formulaParam.RelationshipKeyColumnTail;
                        colMsg.FormulaUsageParemeters.Add(paramDTO);
                    }
                }
                if (item.EditDataItemExceptionLog != null)
                {
                    message.EditDataItemExceptionLog = new EditDataItemExceptionLogDTO();
                    message.EditDataItemExceptionLog.AfterSaveActionExceptionMessage = item.EditDataItemExceptionLog.AfterSaveActionExceptionMessage;
                    //message.EditDataItemExceptionLog.BeforeSaveActionExceptionMessage = item.EditDataItemExceptionLog.BeforeSaveActionExceptionMessage;
                    //message.EditDataItemExceptionLog.DataUpdateExceptionMessage = item.EditDataItemExceptionLog.DataUpdateExceptionMessage;
                    message.EditDataItemExceptionLog.DataUpdateQuery = item.EditDataItemExceptionLog.DataUpdateQuery;
                    //message.EditDataItemExceptionLog.ForumulaUsageExceptionMessage = item.EditDataItemExceptionLog.FormulaUsageExceptionMessage;
                    message.EditDataItemExceptionLog.ID = item.EditDataItemExceptionLog.ID;
                }
                //if (item.ArchiveItemLog != null)
                //{
                //    message.ArchiveItemLog = new  ArchiveItemLogDTO();
                //    message.ArchiveItemLog.ID = item.ArchiveItemLog.ID;
                //    message.ArchiveItemLog.Exception = item.ArchiveItemLog.Exception;
                //}
            }

            return(message);
        }
Esempio n. 26
0
        public bool GetTreeItems(DR_Requester requester, DP_DataRepository deleteDataItem, DP_DataRepository rootDeleteItem)
        {
            List <ChildRelationshipInfo> result = new List <ChildRelationshipInfo>();
            bool loop = false;
            //   DP_DataRepository resultItem = item;
            var entity = bizTableDrivedEntity.GetTableDrivedEntity(requester, deleteDataItem.TargetEntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);

            foreach (var relationship in entity.Relationships.Where(x => x.MastertTypeEnum == Enum_MasterRelationshipType.FromPrimartyToForeign))
            {
                if (!loop)

                {
                    var searchRepository = RelationshipDataManager.GetSecondSideSearchDataItemByRelationship(deleteDataItem, relationship.ID);
                    var newrequester     = new DR_Requester();
                    newrequester.SkipSecurity = true;
                    DR_SearchViewRequest searchViewRequest = new DR_SearchViewRequest(newrequester, searchRepository);
                    var searchViewResult = SearchRequestManager.Process(searchViewRequest);
                    if (searchViewResult.ResultDataItems.Any())
                    {
                        var childRelationshipInfo = new ChildRelationshipInfo();
                        childRelationshipInfo.SourceData   = deleteDataItem;
                        childRelationshipInfo.Relationship = relationship;
                        result.Add(childRelationshipInfo);
                        childRelationshipInfo.RelationshipDeleteOption = relationship.DeleteOption;
                        deleteDataItem.ChildRelationshipInfos.Add(childRelationshipInfo);
                        if (childRelationshipInfo.RelationshipDeleteOption == RelationshipDeleteOption.SetNull)
                        {
                            foreach (var childItem in searchViewResult.ResultDataItems)
                            {
                                DP_DataRepository dataItem = new DP_DataRepository(childItem.TargetEntityID, childItem.TargetEntityAlias);
                                dataItem.DataView = childItem;
                                dataItem.ParantChildRelationshipInfo = childRelationshipInfo;
                                childRelationshipInfo.RelatedData.Add(dataItem);
                            }
                        }
                        else
                        {
                            bool repeatedInParents = false;
                            foreach (var childItem in searchViewResult.ResultDataItems)
                            {//هردفعه پرنتها برای هر ایتم گرفته نشود
                                List <DP_DataRepository> parents = GetParentDataItems(childRelationshipInfo);
                                if (parents.Any(z => z.TargetEntityID == childItem.TargetEntityID && z.KeyProperties.All(x => childItem.Properties.Any(y => y.IsKey && x.ColumnID == y.ColumnID && x.Value == y.Value))))
                                {
                                    var parentRepeted = parents.First(z => z.TargetEntityID == childItem.TargetEntityID && z.KeyProperties.All(x => childItem.Properties.Any(y => y.IsKey && x.ColumnID == y.ColumnID && x.Value == y.Value)));
                                    loop = true;
                                    repeatedInParents = true;
                                    DP_DataRepository dataItem = new DP_DataRepository(childItem.TargetEntityID, childItem.TargetEntityAlias);
                                    dataItem.DataView = childItem;
                                    dataItem.ParantChildRelationshipInfo = childRelationshipInfo;
                                    dataItem.Error = "وابستگی تکراری با " + parentRepeted.ViewInfo;
                                    childRelationshipInfo.RelatedData.Add(dataItem);
                                }
                            }
                            if (!repeatedInParents)
                            {
                                foreach (var childItem in searchViewResult.ResultDataItems)
                                {
                                    if (ChildItemExistInTree(rootDeleteItem, childItem))
                                    {
                                    }
                                    else
                                    {
                                        DP_DataRepository dataItem = new DP_DataRepository(childItem.TargetEntityID, childItem.TargetEntityAlias);
                                        dataItem.DataView = childItem;
                                        dataItem.ParantChildRelationshipInfo = childRelationshipInfo;
                                        childRelationshipInfo.RelatedData.Add(dataItem);
                                        var innerloop = GetTreeItems(requester, dataItem, rootDeleteItem);
                                        if (innerloop)
                                        {
                                            loop = true;
                                            return(loop);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(loop);
        }
Esempio n. 27
0
        private void SetEntities()
        {
            Message.BaseEntity = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), EntityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
            lblEntityName.Text = Message.BaseEntity.Name;

            BizISARelationship bizISARelationship = new BizISARelationship();

            Message.ISARelationship = bizISARelationship.GetInternalTableISARelationships(EntityID);
            if (Message.ISARelationship != null)
            {
                if (Message.ISARelationship.IsTolatParticipation)
                {
                    optIsTolatParticipation.IsChecked = true;
                }
                else
                {
                    optIsPartialParticipation.IsChecked = true;
                }
                if (Message.ISARelationship.IsDisjoint)
                {
                    optIsDisjoint.IsChecked = true;
                }
                else
                {
                    optIsOverlap.IsChecked = true;
                }
            }
            else
            {
                Message.ISARelationship = new ISARelationshipDTO();
            }

            if (Message.ISARelationship.ID != 0)
            {
                List <SuperToSubRelationshipDTO> listSuperToSubRels = new List <SuperToSubRelationshipDTO>();
                var drivedEntities = bizTableDrivedEntity.GetOtherDrivedEntityIDs(Message.ISARelationship);
                foreach (var id in drivedEntities)
                {
                    var entity = bizTableDrivedEntity.GetTableDrivedEntity(MyProjectManager.GetMyProjectManager.GetRequester(), id, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
                    List <RelationshipDTO>    removeRelationships    = new List <RelationshipDTO>();
                    SubToSuperRelationshipDTO subToSuperRelationship = null;
                    SuperToSubRelationshipDTO superToSubRelationship = null;

                    foreach (var item in entity.Relationships.Where(x => x.TypeEnum == Enum_RelationshipType.SubToSuper))
                    {
                        if (item is SubToSuperRelationshipDTO)
                        {
                            if ((item as SubToSuperRelationshipDTO).ISARelationship.ID == Message.ISARelationship.ID)
                            {
                                subToSuperRelationship = (item as SubToSuperRelationshipDTO);
                                superToSubRelationship = Message.BaseEntity.Relationships.FirstOrDefault(x => x.ID == (item as SubToSuperRelationshipDTO).PairRelationshipID) as SuperToSubRelationshipDTO;
                            }
                        }
                    }

                    if (subToSuperRelationship != null && superToSubRelationship != null)
                    {
                        entity.Relationships.Remove(subToSuperRelationship);
                        Message.BaseEntity.Relationships.Remove(superToSubRelationship);

                        AddDrivedEntityTab(new Tuple <SuperToSubRelationshipDTO, SubToSuperRelationshipDTO, TableDrivedEntityDTO>(superToSubRelationship, subToSuperRelationship, entity));
                    }
                }
            }
            dtgRelationships.ItemsSource = Message.BaseEntity.Relationships;
            dtgColumns.ItemsSource       = Message.BaseEntity.Columns;
        }