本文整理汇总了C#中Mission.setId方法的典型用法代码示例。如果您正苦于以下问题:C# Mission.setId方法的具体用法?C# Mission.setId怎么用?C# Mission.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mission
的用法示例。
在下文中一共展示了Mission.setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getMission
public static Mission getMission(String id)
{
Mission mission = null;
String parameter = "id";
String query = DB.SELECT
+ "*"
+ DB.FROM
+ Net7.Tables.missions
+ DB.WHERE
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ DB.EQUALS
+ DB.QueryParameterCharacter
+ parameter;
DataTable dataTable = DB.Instance.executeQuery(query, new String[]{parameter}, new String[] {id});
if (dataTable.Rows.Count == 1)
{
mission = new Mission();
mission.setId(id);
mission.setXml(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_XML));
mission.setName(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_name));
String type = ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_type);
CommonTools.MissionType missionType;
CommonTools.Enumeration.TryParse<CommonTools.MissionType>(type, out missionType);
mission.setType(missionType);
mission.setKey(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_key));
}
return mission;
}
示例2: setMission
public static void setMission(Mission mission, Boolean newMission)
{
String query;
String[] parameters = new String[]{ "id", "xml", "name", "key", "type" };
String[] values = new String[] { mission.getId(), mission.getXML(), mission.getName(), mission.getKey(), ((int)mission.getType()).ToString() };
if (newMission)
{
writeXmlLog(mission, LogAction.Add);
query = "INSERT INTO "
+ Net7.Tables.missions
+ " ( "
+ ColumnData.GetName(Net7.Table_missions._mission_XML) + ","
+ ColumnData.GetName(Net7.Table_missions._mission_name) + ","
+ ColumnData.GetName(Net7.Table_missions._mission_key) + ","
+ ColumnData.GetName(Net7.Table_missions._mission_type)
+ " )"
+ " VALUES ("
+ DB.QueryParameterCharacter + parameters[1] + ","
+ DB.QueryParameterCharacter + parameters[2] + ","
+ DB.QueryParameterCharacter + parameters[3] + ","
+ DB.QueryParameterCharacter + parameters[4]
+ "); "
+ DB.SELECT
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ DB.FROM
+ Net7.Tables.missions
+ DB.WHERE
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ " IS NULL;"; // Retrieve the last inserted row
DataTable dataTable = DB.Instance.executeQuery(query, parameters, values);
// Update the XML mission ID with that of the database auto-created ID
mission.setId(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_id));
values[0] = mission.getId();
values[1] = mission.getXML();
query = "UPDATE "
+ Net7.Tables.missions
+ " SET "
+ ColumnData.GetName(Net7.Table_missions._mission_XML)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[1]
+ DB.WHERE
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[0];
}
else
{
writeXmlLog(mission, LogAction.Edit);
query = "UPDATE "
+ Net7.Tables.missions
+ " SET "
+ ColumnData.GetName(Net7.Table_missions._mission_XML)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[1] + ","
+ ColumnData.GetName(Net7.Table_missions._mission_name)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[2] + ","
+ ColumnData.GetName(Net7.Table_missions._mission_key)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[3] + ","
+ ColumnData.GetName(Net7.Table_missions._mission_type)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[4]
+ DB.WHERE
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameters[0];
}
DB.Instance.executeQuery(query, parameters, values);
}