예제 #1
0
        void GetFieldsInformation()
        {
            //Очистка
            FieldsList       = new List <DocFieldInfo>();
            CountExtraFields = 0;

            //Загрузка информации о дополнительных полях
            QSMain.CheckConnectionAlive();
            System.Data.DataTable schema = QSMain.connectionDB.GetSchema("Columns", new string[4] {
                null, QSMain.connectionDB.Database, "extra_" + DBTableName, null
            });

            string sql = "SELECT * FROM extra_fields WHERE doc_type_id = @id";

            MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB);

            cmd.Parameters.AddWithValue("@id", TypeId);
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                DocFieldInfo item = new DocFieldInfo();
                item.ID      = rdr.GetInt32("id");
                item.Name    = rdr.GetString("name");
                item.DBName  = rdr.GetString("db_name");
                item.Display = rdr.GetBoolean("display");
                item.Search  = rdr.GetBoolean("search");

                foreach (System.Data.DataRow row in schema.Rows)
                {
                    if (row["COLUMN_NAME"].ToString() == item.DBName)
                    {
                        item.Type = row["DATA_TYPE"].ToString();
                    }
                }
                CountExtraFields++;
                FieldsList.Add(item);
            }
            rdr.Close();
        }
예제 #2
0
        void GetFieldsInformation()
        {
            //Очистка
            FieldsList = new List<DocFieldInfo>();
            CountExtraFields = 0;

            //Загрузка информации о дополнительных полях
            QSMain.CheckConnectionAlive();
            System.Data.DataTable schema = QSMain.connectionDB.GetSchema("Columns", new string[4] { null, QSMain.connectionDB.Database, "extra_" + DBTableName, null});

            string  sql = "SELECT * FROM extra_fields WHERE doc_type_id = @id";

            MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB);
            cmd.Parameters.AddWithValue ("@id", TypeId);
            MySqlDataReader rdr = cmd.ExecuteReader ();

            while(rdr.Read ())
            {
                DocFieldInfo item = new DocFieldInfo();
                item.ID = rdr.GetInt32 ("id");
                item.Name = rdr.GetString ("name");
                item.DBName = rdr.GetString ("db_name");
                item.Display = rdr.GetBoolean ("display");
                item.Search = rdr.GetBoolean ("search");

                foreach (System.Data.DataRow row in schema.Rows)
                {
                    if(row["COLUMN_NAME"].ToString () == item.DBName)
                        item.Type = row["DATA_TYPE"].ToString ();
                }
                CountExtraFields++;
                FieldsList.Add (item);
            }
            rdr.Close ();
        }