Ejemplo n.º 1
0
        /// <summary>
        /// 自动加载进所有编辑控件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAll_Click(object sender, EventArgs e)
        {
            this._saves.Clear();
            this._warningTable.Clear();

            DataEntity dataEntity = _formDataEntityTreeChoose.SelectedDataEntity;

            WindowEntity          windowEntity          = this.HostAdapter.HostFormEntity;
            DataSourceProvideArgs dataSourceProvideArgs = new DataSourceProvideArgs()
            {
                WindowEntity = windowEntity
            };

            foreach (UIElement formElement in windowEntity.Elements)
            {
                if (formElement.DataSourceUseable == false)
                {
                    continue;
                }

                IUIElementEditControl iFormElementEditControl = formElement as IUIElementEditControl;
                if (iFormElementEditControl == null)
                {
                    continue;
                }

                if (String.IsNullOrEmpty(iFormElementEditControl.DataItemId))
                {
                    continue;
                }

                string[] ids          = iFormElementEditControl.DataItemId.Split('.');
                string   dataEntityId = ids[0];
                string   dataItemId   = ids[1];

                if (dataEntityId != dataEntity.Id)
                {
                    continue;
                }

                DataItemEntity dataItemEntity = dataEntity.Items.GetEntityById(dataItemId);
                if (dataItemEntity == null)
                {
                    continue;
                }

                string source     = _dataSourceProvideFactory.GetDataSourceString(formElement, dataSourceProvideArgs);
                string sourceName = _dataSourceProvideFactory.GetDisplayString(source, dataSourceProvideArgs);

                SaveDataEvent.SaveItem save = new SaveDataEvent.SaveItem()
                {
                    DataItem     = dataItemId,
                    DataItemName = dataItemEntity.Name,
                    Source       = source,
                    SourceName   = sourceName
                };

                this._saves.Add(save);
            }
        }
Ejemplo n.º 2
0
 public static void CheckWarning(SaveDataDev entity)
 {
     entity.Warning.Clear();
     if (entity.SaveMode == SaveDataEvent.EnumSaveDataMode.DataEntity)
     {
         DataEntity dataEntity = _dataEntityComponentService.GetDataEntity(entity.DataEntityId);
         if (dataEntity == null)
         {
             entity.Warning.AddWarningSign(entity, Language.Current.EventDev_SaveFormDataDev_DataEntityNotExist);
         }
         DataSourceProvideArgs args = new DataSourceProvideArgs()
         {
             WindowEntity = entity.HostFormEntity
         };
         foreach (SaveDataEvent.SaveItem save in entity.Save)
         {
             if (dataEntity != null)
             {
                 if (dataEntity.Items.Contains(save.DataItem) == false)
                 {
                     entity.Warning.AddWarningSign(entity, Language.Current.EventDev_SaveFormDataDev_DataItemEntityNotExist);
                 }
             }
             if (_dataSourceProvideFactory.Validate(save.Source, args) == false)
             {
                 entity.Warning.AddWarningSign(entity, Language.Current.EventDev_SaveFormDataDev_FormElementNotExist);
             }
         }
     }
 }
Ejemplo n.º 3
0
        public static void CheckWarning(DataListAddRowDev entity)
        {
            entity.Warning.Clear();
            if (entity.TargetWindow == EnumTargetWindow.Current)
            {
                if (entity.HostFormEntity.Elements.Contains(entity.DataList) == false)
                {
                    entity.Warning.AddWarningSign(entity, Language.Current.EventDev_DataListOperatorDev_DataListNotExist);
                }
                else
                {
                    foreach (DataListAddRowEvent.DataItem data in entity.Data)
                    {
                        if (entity.HostFormEntity.Elements.Contains(data.DataColumn) == false)
                        {
                            entity.Warning.AddWarningSign(entity, Language.Current.EventDev_DataListOperatorDev_DataColumnNotExist);
                        }
                    }
                }
            }
            else if (entity.TargetWindow == EnumTargetWindow.Caller)
            {
                if (_windowComponentService.CheckElementExistByCode(
                        entity.DataList, FormElementEntityDevTypes.Instance.GetProvideAttribute(typeof(UIElementDataListEntity))) == false)
                {
                    entity.Warning.AddWarningSign(entity, Language.Current.EventDev_DataListOperatorDev_DataListNotExist);
                }
                else
                {
                    foreach (DataListAddRowEvent.DataItem data in entity.Data)
                    {
                        if (_windowComponentService.CheckDataColumnExistByCode(entity.DataList, data.DataColumn) == false)
                        {
                            entity.Warning.AddWarningSign(entity, Language.Current.EventDev_DataListOperatorDev_DataColumnNotExist);
                        }
                    }
                }
            }
            DataSourceProvideArgs args = new DataSourceProvideArgs()
            {
                WindowEntity = entity.HostFormEntity
            };

            foreach (DataListAddRowEvent.DataItem data in entity.Data)
            {
                if (_dataSourceProvideFactory.Validate(data.Source, args) == false)
                {
                    entity.Warning.AddWarningSign(entity, Language.Current.EventDev_DataListOperatorDev_FormElementNotExist);
                }
            }
        }
        public override void SetParameter(EventBase even)
        {
            DataListAddRowDev _event = even as DataListAddRowDev;

            this.DataListId   = _event.DataList;
            this.TargetWindow = _event.TargetWindow;
            this._datas       = new BindingList <DataListAddRowEvent.DataItem>(_event.Data);
            this._warningTable.Clear();
            bool warningRow            = false;
            DataSourceProvideArgs args = new DataSourceProvideArgs()
            {
                WindowEntity = this.HostAdapter.HostFormEntity
            };

            foreach (DataListAddRowEvent.DataItem data in _event.Data)
            {
                data.SourceName = DataSourceProvideFactory.Instance.GetDisplayString(data.Source, args);
                if (String.IsNullOrEmpty(data.SourceName))
                {
                    warningRow = true;
                }
                if (this.TargetWindow == EnumTargetWindow.Current)
                {
                    UIElement formElementDataList = this.HostAdapter.HostFormEntity.FindFormElementById(_event.DataList);
                    if (formElementDataList == null)
                    {
                        warningRow = true;
                    }
                    else
                    {
                        UIElementDataListEntity dataList = (UIElementDataListEntity)formElementDataList;
                        UIElementDataListColumnEntityAbstract dataColumn = dataList.GetDataColumn(data.DataColumn);
                        if (dataColumn == null)
                        {
                            warningRow = true;
                        }
                        else
                        {
                            data.DataColumnName = dataColumn.Name;
                        }
                    }
                }
                else
                {
                    data.DataColumnName = data.DataColumn;
                }
                this._warningTable.Add(data, warningRow);
            }
            this.dataGridViewDataSet.DataSource = this._datas;
        }
Ejemplo n.º 5
0
        private void provideSelector_SelectedValueChanged(object sender, Controls.SEComboSelector2.OnSelectedValueChangedEventArgs e)
        {
            IDataSourceProvide dataSourceProvide = e.Value as IDataSourceProvide;

            if (dataSourceProvide == null)
            {
                dataSourceSelector.Clear();
            }
            else
            {
                DataSourceProvideArgs args = new DataSourceProvideArgs()
                {
                    WindowEntity = this.WindowEntity
                };
                dataSourceSelector.DataBind(dataSourceProvide.GetAvailableDataSource(args));
            }
        }
Ejemplo n.º 6
0
        public override void SetParameter(EventBase even)
        {
            SaveDataDev _event = even as SaveDataDev;

            this.DataEntityId = _event.DataEntityId;
            this._formDataEntityTreeChoose.SelectedId = this.DataEntityId;

            DataEntity dataEntity = _dataEntityComponentService.GetDataEntity(this.DataEntityId);

            this._saves = new BindingList <SaveDataEvent.SaveItem>(_event.Save);
            this._warningTable.Clear();

            //为用于显示的DataColumnName和SourceName赋值
            bool warningRow            = false;
            DataSourceProvideArgs args = new DataSourceProvideArgs()
            {
                WindowEntity = this.HostAdapter.HostFormEntity
            };

            foreach (SaveDataEvent.SaveItem save in _saves)
            {
                save.SourceName = DataSourceProvideFactory.Instance.GetDisplayString(save.Source, args);
                if (String.IsNullOrEmpty(save.SourceName))
                {
                    warningRow = true;
                }

                DataItemEntity dataItemEntity = dataEntity.Items.GetEntityById(save.DataItem);
                if (dataItemEntity == null)
                {
                    save.DataItemName = String.Empty;
                    warningRow        = true;
                }
                else
                {
                    save.DataItemName = dataItemEntity.Name;
                }

                _warningTable.Add(save, warningRow);
            }

            this.dataGridViewSaveData.DataSource = this._saves;
        }
Ejemplo n.º 7
0
 private void linkLabelDataSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     using (DataSourceEditView view = new DataSourceEditView())
     {
         view.WindowEntity = _windowEntity;
         if (view.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             if (_dataSource == null || _dataSource.String != view.DataSource.String)
             {
                 _dataSource = view.DataSource;
                 DataSourceProvideArgs args = new DataSourceProvideArgs()
                 {
                     WindowEntity = _windowEntity
                 };
                 _dataSourceName          = DataSourceProvideFactory.Instance.GetDisplayString(_dataSource.ToString(), args);
                 linkLabelDataSource.Text = _dataSourceName;
                 OnDataSourceChanged();
             }
         }
     }
 }
Ejemplo n.º 8
0
        public override void SetParameter(EventBase even)
        {
            DataListDeleteRowDev _event = even as DataListDeleteRowDev;

            this.DataListId = _event.DataList;

            this.TargetWindow = _event.TargetWindow;

            this._wheres = new BindingList <DataListDeleteRowEvent.WhereItem>(_event.Where);
            this._warningTable.Clear();

            //为用于显示的DataColumnName和SourceName赋值
            bool warningRow            = false;
            DataSourceProvideArgs args = new DataSourceProvideArgs()
            {
                WindowEntity = this.HostAdapter.HostFormEntity
            };

            foreach (DataListDeleteRowEvent.WhereItem where in _wheres)
            {
                //where.SourceName = StringParserLogic.DataSourceVisibleString(this.HostAdapter.HostFormEntity, where.Source.ToString(), out warningRow);
                where.SourceName = DataSourceProvideFactory.Instance.GetDisplayString(where.Source, args);
                if (String.IsNullOrEmpty(where.SourceName))
                {
                    warningRow = true;
                }

                //如果是当前窗体
                if (this.TargetWindow == EnumTargetWindow.Current)
                {
                    UIElement formElementDataList = this.HostAdapter.HostFormEntity.FindFormElementById(_event.DataList);
                    if (formElementDataList == null)
                    {
                        warningRow = true;
                    }
                    else
                    {
                        //FormElementDataListEntityDev
                        UIElementDataListEntity dataList = (UIElementDataListEntity)formElementDataList;
                        UIElementDataListColumnEntityAbstract dataColumn = dataList.GetDataColumn(where.DataColumn);

                        if (dataColumn == null)
                        {
                            warningRow = true;
                        }
                        else
                        {
                            where.DataColumnName = dataColumn.Name;
                        }
                    }
                }
                //如果是调用者窗体
                else
                {
                    where.DataColumnName = where.DataColumn;
                }

                this._warningTable.Add(where, warningRow);
            }

            this.dataGridViewDataSet.DataSource = this._wheres;
        }