Ejemplo n.º 1
0
        public bool UpdateBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string    query            = "update Hishop_BargainDetial set  Price=Price-@BargainPrice,NumberOfParticipants=NumberOfParticipants+1 where id=@id";
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);

            this.database.AddInParameter(sqlStringCommand, "BargainPrice", DbType.Decimal, helpBargainDetial.BargainPrice);
            this.database.AddInParameter(sqlStringCommand, "id", DbType.Int32, helpBargainDetial.BargainDetialId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Ejemplo n.º 2
0
        public bool ExistsHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string    query            = "select count(*) from Hishop_HelpBargainDetial where BargainDetialId=@BargainDetialId and UserId=@UserId and BargainId=@BargainId";
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);

            this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, helpBargainDetial.BargainDetialId);
            this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, helpBargainDetial.UserId);
            this.database.AddInParameter(sqlStringCommand, "BargainId", DbType.Int32, helpBargainDetial.BargainId);
            return(int.Parse(this.database.ExecuteScalar(sqlStringCommand).ToString()) > 0);
        }
Ejemplo n.º 3
0
        public HelpBargainDetialInfo GeHelpBargainDetialInfo(int bargainDetialId, int userId)
        {
            HelpBargainDetialInfo info             = new HelpBargainDetialInfo();
            DbCommand             sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_HelpBargainDetial WHERE BargainDetialId = @BargainDetialId and UserId=@UserId");

            this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, bargainDetialId);
            this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                return(ReaderConvert.ReaderToModel <HelpBargainDetialInfo>(reader));
            }
        }
Ejemplo n.º 4
0
        public bool InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string    query            = "insert into Hishop_HelpBargainDetial(BargainDetialId,UserId,BargainPrice,CreateDate,BargainId) values(@BargainDetialId,@UserId,@BargainPrice,@CreateDate,@BargainId)";
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);

            this.database.AddInParameter(sqlStringCommand, "BargainDetialId", DbType.Int32, helpBargainDetial.BargainDetialId);
            this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, helpBargainDetial.UserId);
            this.database.AddInParameter(sqlStringCommand, "BargainPrice", DbType.Decimal, helpBargainDetial.BargainPrice);
            this.database.AddInParameter(sqlStringCommand, "CreateDate", DbType.DateTime, helpBargainDetial.CreateDate);
            this.database.AddInParameter(sqlStringCommand, "BargainId", DbType.Int32, helpBargainDetial.BargainId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Ejemplo n.º 5
0
        public HelpBargainDetialInfo GeHelpBargainDetialInfo(int bargainDetialId, int userId)
        {
            HelpBargainDetialInfo result = new HelpBargainDetialInfo();

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_HelpBargainDetial WHERE BargainDetialId = @BargainDetialId and UserId=@UserId");
            this.database.AddInParameter(sqlStringCommand, "BargainDetialId", System.Data.DbType.Int32, bargainDetialId);
            this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, userId);
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                result = ReaderConvert.ReaderToModel <HelpBargainDetialInfo>(dataReader);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string str2 = new BargainDao().IsCanBuyByBarginId(helpBargainDetial.BargainId);

            if (str2 != "1")
            {
                return(str2);
            }
            if (new BargainDao().InsertHelpBargainDetial(helpBargainDetial))
            {
                new BargainDao().UpdateBargainDetial(helpBargainDetial);
            }
            return("1");
        }
Ejemplo n.º 7
0
        public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string result = string.Empty;
            string text   = new BargainDao().IsCanBuyByBarginId(helpBargainDetial.BargainId);

            if (text != "1")
            {
                result = text;
            }
            else
            {
                if (new BargainDao().InsertHelpBargainDetial(helpBargainDetial))
                {
                    new BargainDao().UpdateBargainDetial(helpBargainDetial);
                }
                result = "1";
            }
            return(result);
        }
Ejemplo n.º 8
0
        public static string InsertHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
        {
            string empty = string.Empty;
            string str   = (new BargainDao()).IsCanBuyByBarginId(helpBargainDetial.BargainId);

            if (!(str != "1"))
            {
                if ((new BargainDao()).InsertHelpBargainDetial(helpBargainDetial))
                {
                    (new BargainDao()).UpdateBargainDetial(helpBargainDetial);
                }
                empty = "1";
            }
            else
            {
                empty = str;
            }
            return(empty);
        }
Ejemplo n.º 9
0
 public static bool ExistsHelpBargainDetial(HelpBargainDetialInfo helpBargainDetial)
 {
     return(new BargainDao().ExistsHelpBargainDetial(helpBargainDetial));
 }
Ejemplo n.º 10
0
 public static bool UpdateBargainDetial(HelpBargainDetialInfo helpBargainDetial)
 {
     return(new BargainDao().UpdateBargainDetial(helpBargainDetial));
 }