Пример #1
0
        public static Step Insert(IDbConnection dbConn
                                  , String name
                                  , Map map
                                  , Queue queue
                                  , Step nextStep
                                  , StepType type
                                  )

        {
            IDbCommand command = dbConn.CreateCommand();

            command.CommandText = INSERT + " ; " + DbUtil.GET_KEY;
            DbUtil.AddParameter(command, "@name", name);
            DbUtil.AddParameter(command, "@map_id", map.Id);
            DbUtil.AddParameter(command, "@queue_id", queue.Id);
            if (nextStep == null)
            {
                DbUtil.AddNullParameter(command, "@next_step_id");
            }
            else
            {
                DbUtil.AddParameter(command, "@next_step_id", nextStep.Id);
            }
            DbUtil.AddParameter(command, "@type", (int)type);
            int  id  = Convert.ToInt32(command.ExecuteScalar());
            Step tmp = new Step(id
                                , name
                                , map.Id
                                , queue.Id
                                , nextStep == null ? NO_NEXT_STEP : nextStep.Id
                                , type
                                );

            return(tmp);
        }