Пример #1
0
        /// <summary>
        /// 查询组织机构
        /// </summary>
        /// <param name="otherKnowledgeID"></param>
        /// <param name="parentID"></param>
        /// <param name="idPath"></param>
        /// <param name="levelNum"></param>
        /// <param name="orderIndex"></param>
        /// <param name="otherKnowledgeName"></param>
        /// <param name="description"></param>
        /// <param name="memo"></param>
        /// <param name="startRowIndex">起始记录行</param>
        /// <param name="maximumRows">每页记录条数</param>
        /// <param name="orderBy">排序字符串,如"FieldName ASC"</param>
        /// <returns></returns>
        public IList <OtherKnowledge> GetOtherKnowledge(int otherKnowledgeID, int parentID, string idPath, int levelNum, int orderIndex,
                                                        string otherKnowledgeName, string description, string memo, int startRowIndex, int maximumRows, string orderBy)
        {
            IList <OtherKnowledge> otherKnowledges = new List <OtherKnowledge>();

            Database db = DatabaseFactory.CreateDatabase();

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

            db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, startRowIndex);
            db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, maximumRows);
            db.AddInParameter(dbCommand, "p_order_by", DbType.AnsiString, GetMappingOrderBy(orderBy));
            db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4);

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

                    otherKnowledges.Add(otherKnowledge);
                }
            }

            _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count"));

            return(otherKnowledges);
        }
Пример #2
0
        public void UpdateOtherKnowledge(OtherKnowledge otherKnowledge)
        {
            Database db = DatabaseFactory.CreateDatabase();

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

            db.AddInParameter(dbCommand, "p_Other_Knowledge_id", DbType.Int32, otherKnowledge.OtherKnowledgeID);
            db.AddInParameter(dbCommand, "p_parent_id", DbType.Int32, otherKnowledge.ParentID);
            db.AddInParameter(dbCommand, "p_id_path", DbType.String, otherKnowledge.IdPath);
            db.AddInParameter(dbCommand, "p_level_num", DbType.Int32, otherKnowledge.LevelNum);
            db.AddInParameter(dbCommand, "p_order_index", DbType.Int32, otherKnowledge.OrderIndex);
            db.AddInParameter(dbCommand, "p_Other_Knowledge_name", DbType.String, otherKnowledge.OtherKnowledgeName);
            db.AddInParameter(dbCommand, "p_description", DbType.String, otherKnowledge.Description);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, otherKnowledge.Memo);

            DbConnection connection = db.CreateConnection();

            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                db.ExecuteNonQuery(dbCommand, transaction);

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            connection.Close();
        }
Пример #3
0
        public OtherKnowledge GetOtherKnowledge(int OtherKnowledgeID)
        {
            OtherKnowledge otherKnowledge = null;

            Database db = DatabaseFactory.CreateDatabase();

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

            db.AddInParameter(dbCommand, "p_Other_Knowledge_id", DbType.Int32, OtherKnowledgeID);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    otherKnowledge = CreateModelObject(dataReader);
                }
            }

            return(otherKnowledge);
        }
Пример #4
0
        public int AddOtherKnowledge(OtherKnowledge otherKnowledge)
        {
            int      id = 0;
            Database db = DatabaseFactory.CreateDatabase();

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

            db.AddOutParameter(dbCommand, "p_other_knowledge_id", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "p_parent_id", DbType.Int32, otherKnowledge.ParentID);
            db.AddOutParameter(dbCommand, "p_id_path", DbType.String, 20);
            db.AddOutParameter(dbCommand, "p_level_num", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "p_order_index", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "p_Other_Knowledge_name", DbType.String, otherKnowledge.OtherKnowledgeName);
            db.AddInParameter(dbCommand, "p_description", DbType.String, otherKnowledge.Description);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, otherKnowledge.Memo);

            DbConnection connection = db.CreateConnection();

            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                db.ExecuteNonQuery(dbCommand, transaction);
                id = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_Other_Knowledge_id"));

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            connection.Close();

            return(id);
        }
Пример #5
0
 public void DeleteOtherKnowledge(OtherKnowledge otherKnowledge)
 {
     DeleteOtherKnowledge(otherKnowledge.OtherKnowledgeID);
 }
Пример #6
0
 public void UpdateOtherKnowledge(OtherKnowledge otherKnowledge)
 {
     objLogBll.WriteLog("修改其它知识“" + otherKnowledge.OtherKnowledgeName + "”基本信息");
     dal.UpdateOtherKnowledge(otherKnowledge);
 }
Пример #7
0
 public int AddOtherKnowledge(OtherKnowledge otherKnowledge)
 {
     objLogBll.WriteLog("新增其它知识“" + otherKnowledge.OtherKnowledgeName + "”基本信息");
     return(dal.AddOtherKnowledge(otherKnowledge));
 }