Ejemplo n.º 1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int OldProfessionalAdd(Entity.OldProfessional info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@Code",              SqlDbType.NVarChar,  20, info.Code),
         SqlDB.MakeInParam("@ProfessionalName",  SqlDbType.NVarChar, 100, info.ProfessionalName),
         SqlDB.MakeInParam("@Remark",            SqlDbType.NVarChar, 100, info.Remark),
         SqlDB.MakeInParam("@ProfessionalGrade", SqlDbType.Int,        4, info.ProfessionalGrade),
         SqlDB.MakeInParam("@ParentId",          SqlDbType.Int,        4, info.ParentId),
         SqlDB.MakeInParam("@ProfessionalIntro", SqlDbType.NVarChar,   0, info.ProfessionalIntro),
         SqlDB.MakeInParam("@IsBen",             SqlDbType.Int,        4, info.IsBen),
         SqlDB.MakeInParam("@NewProfessionalId", SqlDbType.Int,        4, info.NewProfessionalId),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "OldProfessionalAdd", prams).ToString(), -1));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.OldProfessional OldProfessionalEntityGet(int Id)
        {
            Entity.OldProfessional info = new Entity.OldProfessional();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [OldProfessional] WHERE Id = " + Id + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id                = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.Code              = dt.Rows[0]["Code"].ToString();
                info.ProfessionalName  = dt.Rows[0]["ProfessionalName"].ToString();
                info.Remark            = dt.Rows[0]["Remark"].ToString();
                info.ProfessionalGrade = Basic.Utils.StrToInt(dt.Rows[0]["ProfessionalGrade"].ToString(), 0);
                info.ParentId          = Basic.Utils.StrToInt(dt.Rows[0]["ParentId"].ToString(), 0);
                info.ProfessionalIntro = dt.Rows[0]["ProfessionalIntro"].ToString();
                info.IsBen             = Basic.Utils.StrToInt(dt.Rows[0]["IsBen"].ToString(), 0);
                info.NewProfessionalId = Basic.Utils.StrToInt(dt.Rows[0]["NewProfessionalId"].ToString(), 0);
            }
            return(info);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool OldProfessionalEdit(Entity.OldProfessional info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",                SqlDbType.Int,        4, info.Id),
                SqlDB.MakeInParam("@Code",              SqlDbType.NVarChar,  20, info.Code),
                SqlDB.MakeInParam("@ProfessionalName",  SqlDbType.NVarChar, 100, info.ProfessionalName),
                SqlDB.MakeInParam("@Remark",            SqlDbType.NVarChar, 100, info.Remark),
                SqlDB.MakeInParam("@ProfessionalGrade", SqlDbType.Int,        4, info.ProfessionalGrade),
                SqlDB.MakeInParam("@ParentId",          SqlDbType.Int,        4, info.ParentId),
                SqlDB.MakeInParam("@ProfessionalIntro", SqlDbType.NVarChar,   0, info.ProfessionalIntro),
                SqlDB.MakeInParam("@IsBen",             SqlDbType.Int,        4, info.IsBen),
                SqlDB.MakeInParam("@NewProfessionalId", SqlDbType.Int,        4, info.NewProfessionalId),
            };
            int intReturnValue = 0;

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