Example #1
0
        private void InitReferenceDiagram(String Cell)
        {
            tableFlow1.Clear();

            SheetReference Reference = CellType.ReferenceInfo as SheetReference;

            if (Reference != null && !String.IsNullOrEmpty(Reference.ReferenceXml))
            {
                TableName  = Reference.TableName;
                ColumnName = Reference.ColumnName;
                DataFilter = Reference.DataFilter;
                LoadFromXml(Reference.ReferenceXml);
            }
            else
            {
                DataTableSchema DataTable = SheetConfiguration.DataTableSchema;
                bool            HaveItem  = DataTable.HaveDataItem(Cell);
                if (HaveItem)
                {
                    FieldDefineInfo FieldInfo = DataTable.GetDataItem(Cell);
                    if (FieldInfo != null && DataTable.Schema != null)
                    {
                        TableName  = DataTable.Schema.Name;
                        ColumnName = FieldInfo.FieldName;
                        AppendTableByTableName(TableName, false);
                    }
                    else
                    {
                        MessageBox.Show("表单‘" + SheetConfiguration.Description + "’没有设置数据项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Example #2
0
        private void Button_Ok_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 0)
            {
                FieldDefineInfo FieldInfo = fpSpread1.ActiveSheet.ActiveCell.Tag as FieldDefineInfo;
                if (FieldInfo == null)
                {
                    return;
                }

                ModelField.Index       = string.Format("{0}.{1}", FieldInfo.TableInfo.Name, FieldInfo.FieldName);
                ModelField.Description = string.Format("{0}.{1}", FieldInfo.TableInfo.Description, FieldInfo.Description);
            }
            else if (tabControl1.SelectedIndex == 1 && lView_ExtentDataItems.SelectedItems.Count > 0)
            {
                FieldDefineInfo FieldInfo = lView_ExtentDataItems.SelectedItems[0].Tag as FieldDefineInfo;
                ModelField.Index       = string.Format("{0}.{1}", ModelInfo.ExtentDataSchema.Name, FieldInfo.FieldName);
                ModelField.Description = string.Format("{0}.{1}", ModelInfo.ExtentDataSchema.Description, FieldInfo.Description);
            }

            this.DialogResult = DialogResult.OK;
            Close();
        }
Example #3
0
 public Boolean IsUniqueField(String TestRoomCode, String DataID, FieldDefineInfo Field, object FieldValue)
 {
     return(Convert.ToBoolean(Agent.CallService("Yqun.BO.BusinessManager.dll", "IsUniqueField", new object[] { TestRoomCode, DataID, Field, FieldValue })));
 }
Example #4
0
        public List <SheetConfiguration> InitSheetConfiguration(string[] Indexes)
        {
            SheetConfiguration[] Configurations = new SheetConfiguration[Indexes.Length];

            StringBuilder Sql_Sheets = new StringBuilder();

            //增加查询条件Scdel=0   2013-10-19
            Sql_Sheets.Append("Select ID,Description,CatlogCode,SheetStyle,DataTable from sys_biz_Sheet where Scdel=0 and ID in ('");
            Sql_Sheets.Append(string.Join("','", Indexes));
            Sql_Sheets.Append("')");

            StringBuilder Sql_Tables = new StringBuilder();

            //增加查询条件Scdel=0   2013-10-19
            Sql_Tables.Append("Select * from sys_Tables where Scdel=0 and TableName in (");
            Sql_Tables.Append("Select DataTable from sys_biz_Sheet where Scdel=0 and ID in ('");
            Sql_Tables.Append(string.Join("','", Indexes));
            Sql_Tables.Append("'))");

            StringBuilder Sql_FieldInfos = new StringBuilder();

            //增加查询条件Scdel=0   2013-10-19
            Sql_FieldInfos.Append("Select * from sys_Columns where Scdel=0 and TableName in (");
            Sql_FieldInfos.Append("Select DataTable from sys_biz_Sheet where Scdel=0 and ID in ('");
            Sql_FieldInfos.Append(string.Join("','", Indexes));
            Sql_FieldInfos.Append("'))");
            Sql_FieldInfos.Append(" order by scts");

            StringBuilder Sql_DataAreas = new StringBuilder();

            //增加查询条件Scdel=0   2013-10-19
            Sql_DataAreas.Append("Select SheetID,TableName,ColumnName,Range From sys_biz_DataArea Where Scdel=0 and SheetID in ('");
            Sql_DataAreas.Append(string.Join("','", Indexes));
            Sql_DataAreas.Append("')");

            List <string> sql_Commands = new List <string>();

            sql_Commands.Add(Sql_Sheets.ToString());
            sql_Commands.Add(Sql_Tables.ToString());
            sql_Commands.Add(Sql_FieldInfos.ToString());
            sql_Commands.Add(Sql_DataAreas.ToString());

            DataSet dataset = GetDataSet(sql_Commands.ToArray());

            if (dataset != null)
            {
                DataTable DataSheets = dataset.Tables["sys_biz_Sheet"];
                DataTable DataTables = dataset.Tables["sys_Tables"];
                DataTable DataFields = dataset.Tables["sys_Columns"];
                DataTable DataAreas  = dataset.Tables["sys_biz_DataArea"];

                foreach (DataRow SheetRow in DataSheets.Rows)
                {
                    SheetConfiguration Configuration = new SheetConfiguration();
                    Configuration.Index       = SheetRow["ID"].ToString();
                    Configuration.Code        = SheetRow["CatlogCode"].ToString();
                    Configuration.SheetStyle  = SheetRow["SheetStyle"].ToString();
                    Configuration.Description = SheetRow["Description"].ToString();

                    string DataTable = SheetRow["DataTable"].ToString();
                    if (!string.IsNullOrEmpty(DataTable))
                    {
                        DataRow[] TableRows = DataTables.Select("TableName = '" + DataTable + "'");
                        if (TableRows.Length > 0)
                        {
                            Configuration.DataTableSchema.Schema             = new TableDefineInfo();
                            Configuration.DataTableSchema.Schema.Name        = DataTable;
                            Configuration.DataTableSchema.Schema.Description = TableRows[0]["DESCRIPTION"].ToString();
                            Configuration.DataTableSchema.Schema.Index       = TableRows[0]["ID"].ToString();

                            DataRow[] FieldRows = DataFields.Select("TableName = '" + DataTable + "'", "colname");
                            foreach (DataRow FieldRow in FieldRows)
                            {
                                FieldDefineInfo FieldInfo = new FieldDefineInfo(Configuration.DataTableSchema.Schema);
                                FieldInfo.Index       = FieldRow["ID"].ToString();
                                FieldInfo.Description = FieldRow["DESCRIPTION"].ToString();
                                FieldInfo.FieldName   = FieldRow["COLNAME"].ToString();
                                FieldInfo.IsKeyField  = (FieldRow["IsKeyField"] != DBNull.Value ? Convert.ToBoolean(FieldRow["IsKeyField"]) : false);

                                String scpt = FieldRow["scpt"].ToString();
                                FieldInfo.IsNotNull  = ((scpt.Length > 0 ? scpt.Substring(0, 1) : "0") == "1" ? true : false);
                                FieldInfo.IsNotCopy  = ((scpt.Length > 1 ? scpt.Substring(1, 1) : "0") == "1" ? true : false);
                                FieldInfo.IsPingxing = ((scpt.Length > 2 ? scpt.Substring(2, 1) : "0") == "1" ? true : false);
                                FieldInfo.IsReadOnly = ((scpt.Length > 3 ? scpt.Substring(3, 1) : "0") == "1" ? true : false);

                                String ColType = FieldRow["COLType"].ToString();
                                FieldInfo.FieldType = FieldType.GetFieldType(ColType);

                                DataRow[] dataAreas = DataAreas.Select("SheetID='" + Configuration.Index + "' and TableName='" + DataTable + "' and ColumnName='" + FieldInfo.FieldName + "'");
                                if (dataAreas.Length > 0)
                                {
                                    FieldInfo.RangeInfo = dataAreas[0]["Range"].ToString();
                                }
                            }
                        }
                    }

                    int Index = Array.IndexOf(Indexes, Configuration.Index);
                    Configurations[Index] = Configuration;
                }
            }

            return(new List <SheetConfiguration>(Configurations));
        }
Example #5
0
        public ModuleConfiguration InitModuleConfiguration(String Index)
        {
            ModuleConfiguration Configuration = null;

            StringBuilder Sql_Select = new StringBuilder();

            //增加查询条件Scdel=0     2013-10-19
            Sql_Select.Append("Select ID,CatlogCode,Description,Sheets from sys_biz_Module where Scdel=0 and ID ='");
            Sql_Select.Append(Index);
            Sql_Select.Append("'");

            String ExtentTableName = "biz_norm_extent_" + Index;

            StringBuilder Sql_ExtentSheet = new StringBuilder();

            //增加查询条件Scdel=0     2013-10-19
            Sql_ExtentSheet.Append("Select * From sys_Tables Where Scdel=0 and TABLENAME ='");
            Sql_ExtentSheet.Append(ExtentTableName);
            Sql_ExtentSheet.Append("'");

            StringBuilder Sql_FieldInfos = new StringBuilder();

            //增加查询条件Scdel=0     2013-10-19
            Sql_FieldInfos.Append("Select * from sys_Columns where Scdel=0 and TableName ='");
            Sql_FieldInfos.Append(ExtentTableName);
            Sql_FieldInfos.Append("' order by colname");

            List <string> Sql_Commands = new List <string>();

            Sql_Commands.Add(Sql_Select.ToString());
            Sql_Commands.Add(Sql_ExtentSheet.ToString());
            Sql_Commands.Add(Sql_FieldInfos.ToString());

            DataSet dataset = GetDataSet(Sql_Commands.ToArray());

            if (dataset != null)
            {
                DataTable data_tables  = dataset.Tables["sys_Tables"];
                DataTable data_columns = dataset.Tables["sys_Columns"];
                DataTable data_module  = dataset.Tables["sys_biz_Module"];

                if (data_module.Rows.Count > 0)
                {
                    DataRow Row = data_module.Rows[0];

                    Configuration             = new ModuleConfiguration();
                    Configuration.Index       = Row["ID"].ToString();
                    Configuration.Code        = Row["CatlogCode"].ToString();
                    Configuration.Description = Row["Description"].ToString();

                    string Sheets = Row["Sheets"].ToString();
                    if (!string.IsNullOrEmpty(Sheets))
                    {
                        String[] SheetList = Sheets.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        List <SheetConfiguration> SheetObjects = SheetManager.InitSheetConfiguration(SheetList);
                        Configuration.Sheets.AddRange(SheetObjects);
                    }

                    DataRow[] tableRows = data_tables.Select("TABLENAME = 'biz_norm_extent_" + Row["ID"].ToString() + "'");
                    if (tableRows != null && tableRows.Length > 0)
                    {
                        DataRow tableRow = tableRows[0];
                        Configuration.ExtentDataSchema.Index       = tableRow["ID"].ToString();
                        Configuration.ExtentDataSchema.Name        = tableRow["TABLENAME"].ToString();
                        Configuration.ExtentDataSchema.Description = tableRow["DESCRIPTION"].ToString();

                        DataRow[] columnRows = data_columns.Select("TABLENAME = 'biz_norm_extent_" + Row["ID"].ToString() + "'", "colname");
                        foreach (DataRow columnRow in columnRows)
                        {
                            FieldDefineInfo FieldInfo = new FieldDefineInfo(Configuration.ExtentDataSchema);
                            FieldInfo.Index       = columnRow["ID"].ToString();
                            FieldInfo.Description = columnRow["DESCRIPTION"].ToString();
                            FieldInfo.FieldName   = columnRow["COLNAME"].ToString();
                            FieldInfo.IsKeyField  = (columnRow["IsKeyField"] != DBNull.Value ? Convert.ToBoolean(columnRow["IsKeyField"]) : false);

                            String ColType = columnRow["COLType"].ToString();
                            FieldInfo.FieldType = FieldType.GetFieldType(ColType);
                        }
                    }
                }
                else
                {
                    logger.Error(string.Format("sys_biz_Module 中未找到模板ID为 {0} 的记录", Index));
                }
            }

            return(Configuration);
        }
Example #6
0
        public static Boolean Update(FieldDefineInfo Info)
        {
            Boolean Result = Convert.ToBoolean(Agent.CallService("Yqun.BO.BusinessManager.dll", "UpdateFieldDefineInfo", new object[] { Info }));

            return(Result);
        }