/// <summary>
        /// 获得数据List
        /// </summary>
        public Plan_Beginwork_StepList GetDataList(Plan_Beginwork_StepQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            if (QueryCondition.page == 0)
            {
                strSql.Append("select * ");
                strSql.Append(" FROM TAB_Plan_Beginwork_Step where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_Beginwork_Step where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_Beginwork_Step where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            Plan_Beginwork_StepList list = null;

            if (dt.Rows.Count > 0)
            {
                list = new Plan_Beginwork_StepList();
                foreach (DataRow dr in dt.Rows)
                {
                    Plan_Beginwork_Step _Plan_Beginwork_Step = new Plan_Beginwork_Step();
                    DataRowToModel(_Plan_Beginwork_Step, dr);
                    list.Add(_Plan_Beginwork_Step);
                }
            }
            return(list);
        }
        /// <summary>
        /// 获得记录总数
        /// </summary>
        public int GetDataCount(Plan_Beginwork_StepQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(*) ");
            strSql.Append(" FROM TAB_Plan_Beginwork_Step where 1=1" + strSqlOption.ToString());
            return(ObjectConvertClass.static_ext_int(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams)));
        }
        /// <summary>
        /// 添加数据
        /// </summary>
        public bool AddList(List <Plan_Beginwork_Step> modelList)
        {
            bool           result      = true;
            SqlConnection  connection  = new SqlConnection();
            SqlTransaction transaction = null;
            SqlCommand     command     = new SqlCommand();

            command.Connection          = connection;
            connection.ConnectionString = SqlHelper.ConnString;

            connection.Open();
            transaction         = connection.BeginTransaction();
            command.Transaction = transaction;
            Plan_Beginwork_StepQueryCondition QueryCondition = new Plan_Beginwork_StepQueryCondition();

            try
            {
                foreach (Plan_Beginwork_Step model in modelList)
                {
                    QueryCondition.strTrainPlanGUID = model.strTrainPlanGUID;
                    QueryCondition.strTrainmanGUID  = model.strTrainmanGUID;
                    QueryCondition.nStepID          = model.nStepID;
                    Plan_Beginwork_Step tempModel = GetModel(model.strTrainPlanGUID, model.strTrainmanGUID, model.nStepID, command);
                    if (tempModel == null)
                    {
                        Add(model, command);
                    }
                    else
                    {
                        model.nID = tempModel.nID;
                        Update(model, command);
                    }
                }
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                result = false;
            }
            finally
            {
                if (connection.State != ConnectionState.Closed)
                {
                    connection.Close();
                }
                command.Dispose();
                connection.Dispose();
            }
            return(result);
        }
        /// <summary>
        /// 获得数据DataTable
        /// </summary>
        public DataTable GetDataTable(Plan_Beginwork_StepQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            if (QueryCondition.page == 0)
            {
                strSql.Append("select * ");
                strSql.Append(" FROM TAB_Plan_Beginwork_Step where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_Plan_Beginwork_Step where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_Plan_Beginwork_Step where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            return(SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0]);
        }