コード例 #1
0
ファイル: FieldConfig.cs プロジェクト: thachgiasoft/abc-erp
        void repositoryItemButtonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DataRow dr = ViewFieldConfig.GetDataRow(ViewFieldConfig.FocusedRowHandle);

            if (dr != null)
            {
                STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr);
                if (configInfo != null)
                {
                    if (ABCDataLib.Tables.StructureProvider.IsForeignKey(configInfo.TableName, configInfo.FieldName))
                    {
                        String strPKTableName = ABCDataLib.Tables.StructureProvider.GetTableNameOfForeignKey(configInfo.TableName, configInfo.FieldName);

                        ABCCommonForms.FilterBuilderForm filterBuilder = new ABCCommonForms.FilterBuilderForm(strPKTableName);
                        String strOldValue = ViewFieldConfig.GetRowCellValue(ViewFieldConfig.FocusedRowHandle, "FilterString").ToString();
                        filterBuilder.SetFilterString(strOldValue);

                        if (filterBuilder.ShowDialog() == DialogResult.OK)
                        {
                            ViewFieldConfig.SetRowCellValue(ViewFieldConfig.FocusedRowHandle, "FilterString", filterBuilder.FilterString);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: FieldConfig.cs プロジェクト: thachgiasoft/abc-erp
        void ViewFieldConfig_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            #region AssignedEnum
            if (e.Column.FieldName == "AssignedEnum")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(e.RowHandle);
                if (dr != null)
                {
                    STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (ABCDataLib.Tables.StructureProvider.DataTablesList.ContainsKey(configInfo.TableName))
                        {
                            if (ABCDataLib.Tables.StructureProvider.GetCSharpVariableType(configInfo.TableName, configInfo.FieldName) == "String")
                            {
                                e.RepositoryItem = repositoryItemComboBox1;
                                return;
                            }
                        }
                    }
                }
                e.RepositoryItem = null;
            }
            #endregion

            if (e.Column.FieldName == "FilterString")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(e.RowHandle);
                if (dr != null)
                {
                    STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (ABCDataLib.Tables.StructureProvider.IsForeignKey(configInfo.TableName, configInfo.FieldName))
                        {
                            e.RepositoryItem = this.repositoryItemButtonEdit1;
                            return;
                        }
                    }
                }

                e.RepositoryItem = null;
            }
        }
コード例 #3
0
ファイル: FieldConfig.cs プロジェクト: thachgiasoft/abc-erp
        void ViewFieldConfig_ShowingEditor(object sender, CancelEventArgs e)
        {
            if (ViewFieldConfig.FocusedColumn.FieldName == "FilterString")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(ViewFieldConfig.FocusedRowHandle);
                if (dr != null)
                {
                    STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (ABCDataLib.Tables.StructureProvider.IsForeignKey(configInfo.TableName, configInfo.FieldName))
                        {
                            return;
                        }
                    }
                }

                e.Cancel = true;
            }
            else if (ViewFieldConfig.FocusedColumn.FieldName == "Enum")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(ViewFieldConfig.FocusedRowHandle);
                if (dr != null)
                {
                    STFieldConfigInfo configInfo = (STFieldConfigInfo) new STFieldConfigController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (ABCDataLib.Tables.StructureProvider.DataTablesList.ContainsKey(configInfo.TableName))
                        {
                            if (ABCDataLib.Tables.StructureProvider.GetCSharpVariableType(configInfo.TableName, configInfo.FieldName) == "String")
                            {
                                return;
                            }
                        }
                    }
                }
                e.Cancel = true;
            }
        }
コード例 #4
0
        void ViewFieldConfig_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            if (e.Column.FieldName == "Format")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(e.RowHandle);
                if (dr != null)
                {
                    STFieldConfigsInfo configInfo = (STFieldConfigsInfo) new STFieldConfigsController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (DataStructureProvider.DataTablesList.ContainsKey(configInfo.TableName))
                        {
                            String strType = DataStructureProvider.GetCodingType(configInfo.TableName, configInfo.FieldName);
                            if (strType == "DateTime" || strType == "Nullable<DataTime>" || strType == "int" || strType == "double" || strType == "decimal")
                            {
                                e.RepositoryItem = repoFormat;
                                return;
                            }
                        }
                    }
                }
                e.RepositoryItem = null;
            }

            #region AssignedEnum
            if (e.Column.FieldName == "AssignedEnum")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(e.RowHandle);
                if (dr != null)
                {
                    STFieldConfigsInfo configInfo = (STFieldConfigsInfo) new STFieldConfigsController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (DataStructureProvider.DataTablesList.ContainsKey(configInfo.TableName))
                        {
                            if (DataStructureProvider.GetCodingType(configInfo.TableName, configInfo.FieldName) == "String")
                            {
                                e.RepositoryItem = repoEnum;
                                return;
                            }
                        }
                    }
                }
                e.RepositoryItem = null;
            }
            #endregion

            if (e.Column.FieldName == "FilterString")
            {
                DataRow dr = ViewFieldConfig.GetDataRow(e.RowHandle);
                if (dr != null)
                {
                    STFieldConfigsInfo configInfo = (STFieldConfigsInfo) new STFieldConfigsController().GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        if (DataStructureProvider.IsForeignKey(configInfo.TableName, configInfo.FieldName))
                        {
                            e.RepositoryItem = this.repoFilter;
                            return;
                        }
                    }
                }

                e.RepositoryItem = null;
            }
        }