Esempio n. 1
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;
                }
            }
        }
        private void SetColumns()
        {
            BizColumn bizColumn = new BizColumn();

            cmbColumns.ItemsSource       = bizColumn.GetColumns(EntityID, true);
            cmbColumns.DisplayMemberPath = "Name";
            cmbColumns.SelectedValuePath = "ID";
        }
Esempio n. 3
0
        private void SetColumns()
        {
            BizColumn bizColumn = new BizColumn();

            colColumn.SelectedValueMemberPath = "ID";
            colColumn.DisplayMemberPath       = "Name";
            colColumn.ItemsSource             = bizColumn.GetAllColumns(EntityID, true).Where(x => x.PrimaryKey).ToList();
        }
        private void CheckPermissoinToEdit(DR_Requester requester, BaseResult result, List <QueryItem> allQueryItems)
        {
            BizTableDrivedEntity bizTableDrivedEntity = new BizTableDrivedEntity();
            bool permission = true;

            foreach (var entityGroup in allQueryItems.GroupBy(x => x.TargetEntity.ID))
            {
                if (!bizTableDrivedEntity.DataIsAccessable(requester, entityGroup.Key, new List <SecurityAction>()
                {
                    SecurityAction.EditAndDelete
                }))
                {
                    permission = false;
                    var entity = allQueryItems.First(x => x.TargetEntity.ID == entityGroup.Key).TargetEntity;
                    result.Details.Add(ToResultDetail("عدم دسترسی", "عدم دسترسی ثبت به موجودیت" + " " + entity.Alias, ""));
                }
                else if (bizTableDrivedEntity.DataIsReadonly(requester, entityGroup.Key))
                {
                    permission = false;
                    var entity = allQueryItems.First(x => x.TargetEntity.ID == entityGroup.Key).TargetEntity;
                    result.Details.Add(ToResultDetail("عدم دسترسی", "عدم دسترسی ثبت به موجودیت" + " " + entity.Alias, ""));
                }
            }
            if (permission)
            {
                BizColumn bizColumn = new BizColumn();
                foreach (var query in allQueryItems)
                {
                    foreach (var column in query.EditingProperties)
                    {
                        if (!bizColumn.DataIsAccessable(requester, column.ColumnID) || column.IsHidden)
                        {
                            permission = false;
                            result.Details.Add(ToResultDetail("عدم دسترسی", "عدم دسترسی به ستون" + " " + column.Column.Alias, ""));
                        }
                        else if (column.ValueIsChanged && (bizColumn.DataIsReadonly(requester, column.ColumnID) || column.IsReadonly))
                        {
                            permission = false;
                            result.Details.Add(ToResultDetail("عدم دسترسی", "عدم دسترسی ثبت به ستون" + " " + column.Column.Alias, ""));
                        }
                    }
                }
            }

            if (permission == false)
            {
                result.Result  = Enum_DR_ResultType.ExceptionThrown;
                result.Message = "خطا در ثبت";
            }
        }
        public DP_DataView ToDataViewDTO(DR_Requester requester, MyDataItem dbDataItem, bool lastInfo)
        {
            DP_DataView result = null;
            bool        error  = false;

            if (lastInfo)
            {
                DP_SearchRepository searchDataItem = new DP_SearchRepository(dbDataItem.TableDrivedEntityID);
                foreach (var property in dbDataItem.MyDataItemKeyColumns)
                {
                    searchDataItem.Phrases.Add(new SearchProperty()
                    {
                        ColumnID = property.ColumnID, Value = property.Value
                    });
                }
                DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchDataItem);
                var searchResult             = searchRequestManager.Process(request);
                if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
                {
                    result = searchResult.ResultDataItems.FirstOrDefault();
                }
                else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown)
                {
                    error = true;
                }
            }

            if (!lastInfo || error)
            {
                result            = new DP_DataView(dbDataItem.TableDrivedEntityID, "");
                result.DataItemID = dbDataItem.ID;
                //result.TargetEntityID = dbDataItem.TableDrivedEntityID;
                //   List<EntityInstanceProperty> listProperties = new List<EntityInstanceProperty>();
                BizColumn bizColumn = new BizColumn();

                foreach (var property in dbDataItem.MyDataItemKeyColumns)
                {
                    result.Properties.Add(new EntityInstanceProperty(bizColumn.GetColumn(property.ColumnID, true))
                    {
                        Value = property.Value
                    });
                }
            }
            return(result);
            //result.SetProperties(listProperties);
        }
Esempio n. 6
0
        public ActionResultEnum Execute(object[] objects)
        {
            var entity = ObjectExtractor.Extract <TableDrivedEntity>(objects);

            if (entity.IsDataReference == null && entity.IsStructurReferencee == null)
            {
                if (entity.Relationship.Where(x => x.RelationshipType != null && x.RelationshipType.OneToManyRelationshipType != null).Count() > 0)
                {
                    if (entity.Relationship.Where(x => x.RelationshipType != null && (x.RelationshipType.ImplicitOneToOneRelationshipType != null ||
                                                                                      x.RelationshipType.SuperToSubRelationshipType != null ||
                                                                                      (x.RelationshipType.UnionToSubUnionRelationshipType != null && x.RelationshipType.UnionToSubUnionRelationshipType.UnionRelationshipType.UnionHoldsKeys == true) ||
                                                                                      (x.RelationshipType.SubUnionToUnionRelationshipType != null && x.RelationshipType.SubUnionToUnionRelationshipType.UnionRelationshipType.UnionHoldsKeys == false))).Count() == 0)
                    {
                        BizColumn biz     = new BizColumn();
                        var       columns = biz.GetAllColumns(entity.ID, true);
                        if (columns.Count <= 4)
                        {
                            if (columns.Any(x => x.ColumnType == Enum_ColumnType.String))
                            {
                                entity.IsDataReference = true;
                            }
                        }
                    }
                }
            }

            if (entity.IsDataReference == null && entity.IsStructurReferencee == null)
            {
                if (entity.Relationship.Count(x => x.RelationshipType != null && x.RelationshipType.ImplicitOneToOneRelationshipType != null) > 1)
                {
                    if (entity.Relationship.Where(x => x.RelationshipType != null && (x.RelationshipType.OneToManyRelationshipType != null ||
                                                                                      x.RelationshipType.SuperToSubRelationshipType != null ||
                                                                                      (x.RelationshipType.UnionToSubUnionRelationshipType != null && x.RelationshipType.UnionToSubUnionRelationshipType.UnionRelationshipType.UnionHoldsKeys == true) ||
                                                                                      (x.RelationshipType.SubUnionToUnionRelationshipType != null && x.RelationshipType.SubUnionToUnionRelationshipType.UnionRelationshipType.UnionHoldsKeys == false))).Count() == 0)
                    {
                        if (entity.IsStructurReferencee == null)
                        {
                            entity.IsStructurReferencee = true;
                        }
                    }
                }
            }
            return(ActionResultEnum.Successful);
        }
        private void SetColumnValueGrid()
        {
            //   BizColumnValue biz = new BizColumnValue();
            ////dtgColumnValues.ItemsSource = biz.GetColumnValues(ColumnID);


            BizColumn bizColumn = new BizColumn();
            var       col       = dtgColumnValue_Columns.Columns[0] as GridViewComboBoxColumn;

            col.ItemsSource             = bizColumn.GetOtherColums(ColumnID);
            col.DisplayMemberPath       = "Name";
            col.SelectedValueMemberPath = "ID";
            var rel    = dtgColumnValue_Relationships.Columns[0] as GridViewComboBoxColumn;
            var column = bizColumn.GetColumn(ColumnID, true);

            BizRelationship bizRelationship = new BizRelationship();

            rel.ItemsSource             = bizRelationship.GetRelationshipsByTableID(column.TableID);
            rel.DisplayMemberPath       = "Name";
            rel.SelectedValueMemberPath = "ID";
        }
Esempio n. 8
0
        private void btnImportKeyValues_Click(object sender, RoutedEventArgs e)
        {
            //if (optValueComesFromTitle.IsChecked == false && optValueComesFromValue.IsChecked == false)
            //{
            //    MessageBox.Show("لطفا نوع جایگذاری مقادیر ستون در عنوان یا مقدار را مشخص نمایید");
            //    return;
            //}
            BizDatabase bizDatabase = new BizDatabase();
            BizColumn   bizColumn   = new BizColumn();
            var         column      = bizColumn.GetColumn(ColumnID, true);
            var         database    = bizDatabase.GetDatabaseByTableID(column.TableID);
            var         dbHelper    = MyModelGenerator.ModelGenerator.GetDatabaseImportHelper(database);
            var         result      = dbHelper.GetColumnValueRange(ColumnID);

            if (result != null)
            {
                Message.Details = result.Details;
                dtgColumnKeyValue.ItemsSource = null;
                dtgColumnKeyValue.ItemsSource = Message.Details;
            }
        }