本文整理汇总了C#中Mission.getId方法的典型用法代码示例。如果您正苦于以下问题:C# Mission.getId方法的具体用法?C# Mission.getId怎么用?C# Mission.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mission
的用法示例。
在下文中一共展示了Mission.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: deleteMission
public static void deleteMission(Mission mission)
{
writeXmlLog(mission, LogAction.Delete);
String parameter = "id";
String query = "DELETE FROM "
+ Net7.Tables.missions
+ DB.WHERE
+ ColumnData.GetName(Net7.Table_missions._mission_id)
+ DB.EQUALS
+ DB.QueryParameterCharacter + parameter;
DB.Instance.executeQuery(query, new String[]{ parameter }, new String[]{ mission.getId() });
}
示例2: setMission
public void setMission(Mission mission)
{
m_mission = mission;
guiIdTxt.Text = m_mission.getId();
guiTypeCbo.SelectedItem = m_mission.getType();
guiKeyTxt.Text = m_mission.getKey();
guiNameTxt.Text = m_mission.getName();
guiSummaryTxt.Text = m_mission.getSummary();
guiTimeTxt.Text = m_mission.getAllowedTime().ToString();
guiForfeitableChk.Checked = m_mission.isForfeitable();
guiConditionsTbl.Items.Clear();
if (m_mission.hasConditions())
{
foreach (Condition condition in m_mission.getConditions())
{
ListViewItem item = new ListViewItem(new String[] { condition.getConditionType().ToString(),
condition.getFormattedValue() });
guiConditionsTbl.Items.Add(item);
item.Tag = condition;
}
guiConditionsTbl.Items[0].Selected = true;
}
guiStagesTbl.Items.Clear();
if (m_mission.hasStages())
{
foreach (Stage stage in m_mission.getStages())
{
ListViewItem item = new ListViewItem(new String[] { stage.getId(),
stage.getDescription() });
guiStagesTbl.Items.Add(item);
item.Tag = stage;
}
guiStagesTbl.Items[0].Selected = true;
}
}
示例3: writeXmlLog
// http://www.tkachenko.com/blog/archives/000053.html
// http://www.codeproject.com/KB/XML/XmlAppending.aspx
private static void writeXmlLog(Mission mission, LogAction logAction)
{
if (!File.Exists(LOG_FILE))
{
XmlTextWriter textWritter = new XmlTextWriter(LOG_FILE, Encoding.Unicode);
textWritter.WriteStartElement(LogXmlTag.Missions.ToString());
textWritter.WriteEndElement();
textWritter.Close();
}
DateTime dateTime = DateTime.Now;
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(LOG_FILE);
// TODO: Prune old entries
XmlElement subRoot = xmlDoc.CreateElement(LogXmlTag.Mission.ToString());
subRoot.SetAttribute(LogXmlTag.Date.ToString(), dateTime.ToString("yyyy/MM/dd"));
subRoot.SetAttribute(LogXmlTag.Time.ToString(), dateTime.ToString("HH:mm:ss"));
subRoot.SetAttribute(LogXmlTag.Action.ToString(), logAction.ToString());
subRoot.SetAttribute(LogXmlTag.Id.ToString(), mission.getId());
subRoot.SetAttribute(LogXmlTag.Name.ToString(), mission.getName());
subRoot.SetAttribute(LogXmlTag.Type.ToString(), mission.getType().ToString());
subRoot.SetAttribute(LogXmlTag.Key.ToString(), mission.getKey());
XmlText xmlTextMission = xmlDoc.CreateTextNode(mission.getXML());
subRoot.AppendChild(xmlTextMission);
xmlDoc.DocumentElement.AppendChild(subRoot);
/*XmlTextWriter writer = new XmlTextWriter(LOG_FILE, Encoding.Unicode);
writer.Formatting = Formatting.Indented;
writer.Indentation = 3;
xmlDoc.Save(writer);*/
xmlDoc.Save(LOG_FILE);
}
示例4: 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);
}