当前位置: 首页>>代码示例>>C#>>正文


C# Mission.setId方法代码示例

本文整理汇总了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;
 }
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:28,代码来源:Database.cs

示例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);
        }
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:71,代码来源:Database.cs


注:本文中的Mission.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。