|
@@ -43,17 +43,27 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
if (dt != null)
|
|
|
{
|
|
|
+ STDGroups new_data = new STDGroups();
|
|
|
+ new_data.name = "Default";
|
|
|
+ new_data.color = "#FFFFFF";
|
|
|
+ new_data.iorder = 999;
|
|
|
+ MineralGroupDictionary.Add(0, new_data);
|
|
|
+
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
{
|
|
|
- STDGroups new_STDdata = new STDGroups();
|
|
|
- new_STDdata.name = item["name"].ToString();
|
|
|
- new_STDdata.color = item["color"].ToString();
|
|
|
- new_STDdata.iorder = int.Parse(item["iorder"].ToString());
|
|
|
- MineralGroupDictionary.Add(int.Parse(item["id"].ToString()), new_STDdata);
|
|
|
+ if (item["name"].ToString() != "Default")
|
|
|
+ {
|
|
|
+ STDGroups new_STDdata = new STDGroups();
|
|
|
+ new_STDdata.name = item["name"].ToString();
|
|
|
+ new_STDdata.color = item["color"].ToString();
|
|
|
+ new_STDdata.iorder = int.Parse(item["iorder"].ToString());
|
|
|
+ MineralGroupDictionary.Add(int.Parse(item["id"].ToString()), new_STDdata);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
m_dbConnection.Close();
|
|
@@ -172,7 +182,10 @@ namespace OTSPartA_STDEditor
|
|
|
{
|
|
|
for (int i = 1; i < Grid_FroupId.RowsCount; i++)
|
|
|
{
|
|
|
- MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder = i;
|
|
|
+ if(MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder!=999)
|
|
|
+ {
|
|
|
+ MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder = i-1;
|
|
|
+ }
|
|
|
}
|
|
|
System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
|
|
|
m_dbConnection.Open();
|
|
@@ -220,7 +233,7 @@ namespace OTSPartA_STDEditor
|
|
|
lan = new Language(this);
|
|
|
table_GroupId = lan.GetNameTable("Form_GroupId");
|
|
|
|
|
|
- bool result = LoadDataFromDb(MineralGroupDBAddress);
|
|
|
+ bool result = LoadDataFromDb(MineralGroupDBAddress);
|
|
|
if(result)
|
|
|
{
|
|
|
Grid_FroupId.Redim(MineralGroupDictionary.Count + 1, 2);
|
|
@@ -371,6 +384,11 @@ namespace OTSPartA_STDEditor
|
|
|
int y = Grid_FroupId.Selection.ActivePosition.Column;
|
|
|
if (x > 0 && (y == 0|| y == 1))
|
|
|
{
|
|
|
+ if(x==1)
|
|
|
+ {
|
|
|
+ MessageBox.Show("Group by default,can not be deleted!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
RemoveMineralGroupDictionaryItem((int)Grid_FroupId[x, 0].Tag);
|
|
|
Grid_FroupId.Rows.Remove(x);
|
|
|
Grid_FroupId.Refresh();
|
|
@@ -477,22 +495,25 @@ namespace OTSPartA_STDEditor
|
|
|
/// 保证鼠标点击的GRID行和列是有效的
|
|
|
if (i >= 0 && j >= 0)
|
|
|
{
|
|
|
- if (i == 1)
|
|
|
+ if (i == ls_gd.RowsCount - 1)
|
|
|
{
|
|
|
- button_up.Enabled = false;
|
|
|
+ button_down.Enabled = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- button_up.Enabled = true;
|
|
|
+ button_down.Enabled = true;
|
|
|
}
|
|
|
- if (i == ls_gd.RowsCount - 1)
|
|
|
+ if (i == 1)
|
|
|
{
|
|
|
- button_down.Enabled = false;
|
|
|
+ button_up.Enabled = false;
|
|
|
+ MessageBox.Show("Group by default, not editable!");
|
|
|
+ return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- button_down.Enabled = true;
|
|
|
+ button_up.Enabled = true;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|