Exemplo n.º 1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int AdvantageProfessionalAdd(Entity.AdvantageProfessional info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@SchoolId",        SqlDbType.Int,       4, info.SchoolId),
         SqlDB.MakeInParam("@ProfessionalId",  SqlDbType.Int,       4, info.ProfessionalId),
         SqlDB.MakeInParam("@IsTeSe",          SqlDbType.Int,       4, info.IsTeSe),
         SqlDB.MakeInParam("@TeSePiCi",        SqlDbType.NVarChar, 20, info.TeSePiCi),
         SqlDB.MakeInParam("@IsXueKePaiMing",  SqlDbType.Int,       4, info.IsXueKePaiMing),
         SqlDB.MakeInParam("@IsYiJiZhongDian", SqlDbType.Int,       4, info.IsYiJiZhongDian),
         SqlDB.MakeInParam("@IsErJiZhongDian", SqlDbType.Int,       4, info.IsErJiZhongDian),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "AdvantageProfessionalAdd", prams).ToString(), -1));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.AdvantageProfessional AdvantageProfessionalEntityGet(int Id)
        {
            Entity.AdvantageProfessional info = new Entity.AdvantageProfessional();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [AdvantageProfessional] WHERE Id = " + Id + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id              = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.SchoolId        = Basic.Utils.StrToInt(dt.Rows[0]["SchoolId"].ToString(), 0);
                info.ProfessionalId  = Basic.Utils.StrToInt(dt.Rows[0]["ProfessionalId"].ToString(), 0);
                info.IsTeSe          = Basic.Utils.StrToInt(dt.Rows[0]["IsTeSe"].ToString(), 0);
                info.TeSePiCi        = dt.Rows[0]["TeSePiCi"].ToString();
                info.IsXueKePaiMing  = Basic.Utils.StrToInt(dt.Rows[0]["IsXueKePaiMing"].ToString(), 0);
                info.IsYiJiZhongDian = Basic.Utils.StrToInt(dt.Rows[0]["IsYiJiZhongDian"].ToString(), 0);
                info.IsErJiZhongDian = Basic.Utils.StrToInt(dt.Rows[0]["IsErJiZhongDian"].ToString(), 0);
            }
            return(info);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool AdvantageProfessionalEdit(Entity.AdvantageProfessional info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",              SqlDbType.Int,       4, info.Id),
                SqlDB.MakeInParam("@SchoolId",        SqlDbType.Int,       4, info.SchoolId),
                SqlDB.MakeInParam("@ProfessionalId",  SqlDbType.Int,       4, info.ProfessionalId),
                SqlDB.MakeInParam("@IsTeSe",          SqlDbType.Int,       4, info.IsTeSe),
                SqlDB.MakeInParam("@TeSePiCi",        SqlDbType.NVarChar, 20, info.TeSePiCi),
                SqlDB.MakeInParam("@IsXueKePaiMing",  SqlDbType.Int,       4, info.IsXueKePaiMing),
                SqlDB.MakeInParam("@IsYiJiZhongDian", SqlDbType.Int,       4, info.IsYiJiZhongDian),
                SqlDB.MakeInParam("@IsErJiZhongDian", SqlDbType.Int,       4, info.IsErJiZhongDian),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "AdvantageProfessionalEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }