codebak
public int ExecuteSystemItem(ZYDBConnection conn, ArrayList OutItems)
{
int num;
int count = OutItems.Count;
try
{
int num3;
IDbCommand command;
KB_Item item;
ArrayList list = new ArrayList();
if ((!StringCommon.isBlankString(this.strListSQL) && (conn != null)) && conn.isOpened())
{
using (command = conn.CreateCommand())
{
command.CommandText = this.strListSQL;
IDataReader reader = command.ExecuteReader();
ArrayList list2 = new ArrayList();
while (reader.Read())
{
item = new KB_Item {
ItemStyle = 1,
OwnerList = this,
ItemText = reader.IsDBNull(0) ? "" : reader.GetString(0)
};
if (reader.FieldCount > 1)
{
item.ItemValue = reader.IsDBNull(1) ? " " : reader.GetString(1);
}
else
{
item.ItemValue = item.ItemText;
}
if (item.isNormalItem())
{
OutItems.Add(item);
}
else
{
list.Add(item);
}
item.DataState = DataRowState.Unchanged;
}
reader.Close();
command.Parameters.Clear();
}
conn.ExecuteCompleted();
}
if (this.myItems != null)
{
for (int i = this.myItems.Count - 1; i >= 0; i--)
{
KB_Item item2 = (KB_Item) this.myItems[i];
if (item2.isSystemItem())
{
list.Add(item2);
}
else
{
OutItems.Insert(0, item2);
}
}
}
if (!(((list.Count > 0) && (conn != null)) && conn.isOpened()))
{
goto Label_058E;
}
using (command = conn.CreateCommand())
{
foreach (KB_Item item3 in list)
{
IDataReader reader2;
switch (item3.ItemStyle)
{
case 11:
{
command.CommandText = (Variables == null) ? item3.ItemText : Variables.FixVariableString(item3.ItemText);
continue;
}
case 12:
{
ZYDBConnection.AddParameter(command, (Variables == null) ? item3.ItemText : Variables.FixVariableString(item3.ItemText));
continue;
}
case 13:
reader2 = command.ExecuteReader();
goto Label_04BF;
case 14:
{
command.ExecuteNonQuery();
continue;
}
case 15:
{
foreach (KB_Item item2 in OutItems)
{
if (item2.ItemText == item3.ItemText)
{
item2.ItemText = item3.ItemValue;
}
}
continue;
}
case 0x10:
{
foreach (KB_Item item2 in OutItems)
{
item2.ItemText = StringCommon.FormatDateTime(item2.ItemText, item3.ItemText, item3.ItemValue);
}
continue;
}
case 0x11:
{
KB_Item item4 = new KB_Item {
ItemText = (Variables == null) ? item3.ItemText : Variables.FixVariableString(item3.ItemText)
};
OutItems.Add(item4);
continue;
}
case 0x12:
{
if (Variables != null)
{
Variables.SetValue(item3.ItemText, item3.ItemValue);
}
continue;
}
case 0x13:
goto Label_052D;
default:
{
continue;
}
}
Label_0432:
item = new KB_Item {
OwnerList = this,
ItemText = reader2.IsDBNull(0) ? " " : reader2[0].ToString()
};
if (reader2.FieldCount > 1)
{
item.ItemValue = reader2.IsDBNull(1) ? " " : reader2[1].ToString();
}
else
{
item.ItemValue = item.ItemText;
}
OutItems.Add(item);
Label_04BF:
if (reader2.Read())
{
goto Label_0432;
}
reader2.Close();
}
}
conn.ExecuteCompleted();
Label_052D:
num3 = 0;
foreach (KB_Item item2 in OutItems)
{
item2.ListIndex = num3;
item2.DataState = DataRowState.Unchanged;
num3++;
}
Label_058E:
num = OutItems.Count - count;
}
catch (Exception exception)
{
MessageBox.Show(null, "程序运行错误\r\n" + exception.ToString(), "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
this.myItems = new ArrayList();
this.NewItem("知识库列表加载错误!!!");
if (conn != null)
{
conn.ExecuteCompleted();
}
num = 0;
}
return num;
}
posted on 2010-07-15 15:13 gds通用软件开发系统 阅读(165) 评论(0) 编辑 收藏 举报