Beispiel #1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int SchoolCampusAdd(Entity.SchoolCampus info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@SchoolId",   SqlDbType.Int,        4, info.SchoolId),
         SqlDB.MakeInParam("@SchoolName", SqlDbType.NVarChar, 200, info.SchoolName),
         SqlDB.MakeInParam("@Campus",     SqlDbType.NVarChar, 200, info.Campus),
         SqlDB.MakeInParam("@Pano",       SqlDbType.NVarChar, 200, info.Pano),
         SqlDB.MakeInParam("@Heading",    SqlDbType.NVarChar, 200, info.Heading),
         SqlDB.MakeInParam("@Pitch",      SqlDbType.NVarChar, 200, info.Pitch),
         SqlDB.MakeInParam("@Zoom",       SqlDbType.NVarChar, 200, info.Zoom),
         SqlDB.MakeInParam("@Url",        SqlDbType.NVarChar, 200, info.Url),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "SchoolCampusAdd", prams).ToString(), -1));
 }
Beispiel #2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.SchoolCampus SchoolCampusEntityGet(int Id)
        {
            Entity.SchoolCampus info = new Entity.SchoolCampus();
            DataTable           dt   = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [SchoolCampus] 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.SchoolName = dt.Rows[0]["SchoolName"].ToString();
                info.Campus     = dt.Rows[0]["Campus"].ToString();
                info.Pano       = dt.Rows[0]["Pano"].ToString();
                info.Heading    = dt.Rows[0]["Heading"].ToString();
                info.Pitch      = dt.Rows[0]["Pitch"].ToString();
                info.Zoom       = dt.Rows[0]["Zoom"].ToString();
                info.Url        = dt.Rows[0]["Url"].ToString();
                return(info);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool SchoolCampusEdit(Entity.SchoolCampus info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",         SqlDbType.Int,        4, info.Id),
                SqlDB.MakeInParam("@SchoolId",   SqlDbType.Int,        4, info.SchoolId),
                SqlDB.MakeInParam("@SchoolName", SqlDbType.NVarChar, 200, info.SchoolName),
                SqlDB.MakeInParam("@Campus",     SqlDbType.NVarChar, 200, info.Campus),
                SqlDB.MakeInParam("@Pano",       SqlDbType.NVarChar, 200, info.Pano),
                SqlDB.MakeInParam("@Heading",    SqlDbType.NVarChar, 200, info.Heading),
                SqlDB.MakeInParam("@Pitch",      SqlDbType.NVarChar, 200, info.Pitch),
                SqlDB.MakeInParam("@Zoom",       SqlDbType.NVarChar, 200, info.Zoom),
                SqlDB.MakeInParam("@Url",        SqlDbType.NVarChar, 200, info.Url),
            };
            int intReturnValue = 0;

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