Example #1
0
 /// <summary>
 /// 表:Member (根据MName查找对应MID
 /// </summary>
 /// <param name="MName"></param>
 /// <returns></returns>
 public static int GetMID(string MName)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select MID from Member where MName=@MName",
                                new SqlParameter[] {
         new SqlParameter("@MName", MName)
     })));
 }
Example #2
0
 /// <summary>
 /// 表:Member (已注册判断
 /// </summary>
 /// <param name="MName">新用户</param>
 /// <returns>是否已注册</returns>
 public static bool Registered(string MName)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from Member where MName=@MName",
                                new SqlParameter[] {
         new SqlParameter("@MName", MName)
     })) > 0 ? true : false);
 }
Example #3
0
 /// <summary>
 /// 表:Book (查询总行数
 /// </summary>
 /// <returns>查询结果</returns>
 public static int RowCount_BName(string BName)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from Book where BName  like '%'+@BName+'%'",
                                new SqlParameter[] {
         new SqlParameter("@BName", BName)
     })));
 }
Example #4
0
 /// <summary>
 /// 表:Book (判断单个BID是否存在
 /// </summary>
 /// <param name="BID">所需BID</param>
 /// <returns>是否存在</returns>
 public static bool Exists_BID(int BID)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from book where Bid=@BID",
                                new SqlParameter[] {
         new SqlParameter("@BID", BID)
     })) > 0);
 }
Example #5
0
 /// <summary>
 /// 表:Book (根据BID查找BCount
 /// </summary>
 /// <param name="BID">参数数据</param>
 /// <returns>查询结果</returns>
 public static int Select_BCount(int BID)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select BCount from Book where BID=@BID",
                                new SqlParameter[] {
         new SqlParameter("@BID", BID)
     })));
 }
Example #6
0
 /// <summary>
 /// 表:Order (根据OState查询Order表总行数----1=新订单,2=订单确认,3=发货,4=订单结束
 /// </summary>
 /// <returns>查询结果</returns>
 public static int GetRowCount_State(int OState)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from [Order] where OState=@OState",
                                new SqlParameter[] {
         new SqlParameter("@OState", OState)
     })));
 }
Example #7
0
 /// <summary>
 /// 表:Trade (判断数据是否存在
 /// </summary>
 /// <param name="trade">判断的数据</param>
 /// <returns>是否存在</returns>
 public static bool Exits(Trade trade)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from trade where BID=@BID and MID=@MID",
                                new SqlParameter[] {
         new SqlParameter("BID", trade.BID),
         new SqlParameter("MID", trade.MID),
     })) > 0 ? true : false);
 }
Example #8
0
 /// <summary>
 /// 表:Member (登录判断账号密码是否正确
 /// </summary>
 /// <param name="member">登录的用户</param>
 /// <returns>核对信息正确行数</returns>
 public static int Login(Member member)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from Member where MName=@MName and MPassword=@MPassword",
                                new SqlParameter[] {
         new SqlParameter("@MName", member.MName),
         new SqlParameter("@MPassword", member.MPassword)
     })));
 }
Example #9
0
 /// <summary>
 /// 表:Admin (查询对应数据的行数
 /// </summary>
 /// <param name="admin">对应数据</param>
 /// <returns>查询结果</returns>
 public static int Login(Admin admin)
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select count(*) from Admin where AName=@AName and APassword=@APassword",
                                new SqlParameter[] {
         new SqlParameter("@AName", admin.AName),
         new SqlParameter("@APassword", admin.APassword),
     })));
 }
Example #10
0
 /// <summary>
 /// 表:Book (查询最大的BID
 /// </summary>
 /// <returns>查询结果</returns>
 public static int Select_MaxBID()
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar(
                                "select Max(bid) from book",
                                null)));
 }
Example #11
0
 /// <summary>
 /// 表:Book (查询最大的BISBN
 /// </summary>
 /// <returns>查询结果</returns>
 public static ulong Select_MaxBISBN()
 {
     return(Convert.ToUInt64(DBHelp.ExecuteScalar(
                                 "select Max(bisbn) from book",
                                 null).ToString().Trim()));
 }
Example #12
0
 /// <summary>
 /// 表:Book (查询总行数
 /// </summary>
 /// <returns>查询结果</returns>
 public static int RowCount()
 {
     return(Convert.ToInt32(DBHelp.ExecuteScalar("select count(*) from Book", null)));
 }
Example #13
0
 /// <summary>
 /// 表:Order (获取新产生列OID
 /// </summary>
 /// <returns>新产生列OID</returns>
 public static string ObtainOID()
 {
     return(DBHelp.ExecuteScalar("select dbo.ObtainOID()", null).ToString());
 }