예제 #1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int ZhiShiDianRelationAdd(Entity.ZhiShiDianRelation info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@ZhenTiZSDId", SqlDbType.Int, 4, info.ZhenTiZSDId),
         SqlDB.MakeInParam("@KMZSDId",     SqlDbType.Int, 4, info.KMZSDId),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "ZhiShiDianRelationAdd", prams).ToString(), -1));
 }
예제 #2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.ZhiShiDianRelation ZhiShiDianRelationEntityGet(int Id)
        {
            Entity.ZhiShiDianRelation info = new Entity.ZhiShiDianRelation();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [ZhiShiDianRelation] WHERE Id = " + Id + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id          = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.ZhenTiZSDId = Basic.Utils.StrToInt(dt.Rows[0]["ZhenTiZSDId"].ToString(), 0);
                info.KMZSDId     = Basic.Utils.StrToInt(dt.Rows[0]["KMZSDId"].ToString(), 0);
            }
            return(info);
        }
예제 #3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool ZhiShiDianRelationEdit(Entity.ZhiShiDianRelation info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",          SqlDbType.Int, 4, info.Id),
                SqlDB.MakeInParam("@ZhenTiZSDId", SqlDbType.Int, 4, info.ZhenTiZSDId),
                SqlDB.MakeInParam("@KMZSDId",     SqlDbType.Int, 4, info.KMZSDId),
            };
            int intReturnValue = 0;

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