예제 #1
0
        /// <summary>
        /// ¸ù¾ÝÅàѵ¹æ·¶IDÈ·¶¨Î¨Ò»µÄÅàѵ¹æ·¶
        /// </summary>
        /// <param name="trainstandardid">Åàѵ¹æ·¶ID</param>
        /// <returns></returns>
        public TrainStandard GetTrainStandardInfo(int trainstandardid)
        {
            TrainStandard obj          = new TrainStandard();
            TrainTypeDAL  objTrainType = new TrainTypeDAL();
            PostDAL       objPost      = new PostDAL();
            Database      db           = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_TRAIN_STANDARD_G";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_train_standard_id", DbType.Int32, trainstandardid);
            db.AddInParameter(dbCommand, "p_post_id", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "p_type_id", DbType.Int32, 0);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    obj = CreateModelObject(dataReader);


                    obj.PostName = objPost.GetPost(obj.PostID).PostName;
                    obj.TypeName = objTrainType.GetTrainTypeInfo(obj.TypeID).TypeName;
                }
            }

            return(obj);
        }
예제 #2
0
        private string GetTrainTypeNames(string strName, int nID)
        {
            string strTrainTypeName = string.Empty;

            if (nID != 0)
            {
                TrainTypeDAL trainTypeDAL = new TrainTypeDAL();
                TrainType    trainType    = trainTypeDAL.GetTrainTypeInfo(nID);

                if (trainType.ParentID != 0)
                {
                    strTrainTypeName = GetTrainTypeNames("/" + trainType.TypeName, trainType.ParentID) + strName;
                }
                else
                {
                    strTrainTypeName = trainType.TypeName + strName;
                }
            }

            return(strTrainTypeName);
        }