拍卖车辆基本信息表
예제 #1
0
        /// <summary>
        /// 添加拍卖车辆
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddAuctionCar(AuctionCarInfoModel model)
        {
            //添加拍卖车辆
            const string sql = @"INSERT INTO `auction_carinfo`
                                (innerid, carid, carno,no, mobile, dealrewards, transferrisk, remind, tips, status, lowestprice, isoperation, certificatesdeliver, isnewcar, vin, enginenum, transfer, violationdes, configuredes, supplementdes, picturedes, havepurchasetax, evaluationtest, introduction, address, evaluationpics,createrid, createdtime, modifierid, modifiedtime, deleterid, deletedtime, deletedesc, publisherid, publishedtime, dealerid, dealedtime, dealedprice, dealdesc, dealmobile, validtime,sellername,sellermobile,operatedid)
                                VALUES
                                (@Innerid, @carid, @carno,@no, @mobile, @dealrewards, @transferrisk, @remind, @tips, @status, @lowestprice, @isoperation, @certificatesdeliver, @isnewcar, @vin, @enginenum, @transfer, @violationdes, @configuredes, @supplementdes, @picturedes, @havepurchasetax, @evaluationtest, @introduction, @address,@evaluationpics, @createrid, @createdtime, @modifierid, @modifiedtime, @deleterid, @deletedtime, @deletedesc, @publisherid, @publishedtime, @dealerid, @dealedtime, @dealedprice, @dealdesc, @dealmobile, @validtime,@sellername,@sellermobile,@operatedid);";

            using (var conn = Helper.GetConnection())
            {
                int result;
                var tran = conn.BeginTransaction();
                try
                {
                    conn.Execute(sql, model, tran);
                    tran.Commit();
                    result = 1;
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    LoggerFactories.CreateLogger().Write("添加拍卖车辆异常:", TraceEventType.Information, ex);
                    result = 0;
                }

                return result;
            }
        }
예제 #2
0
 /// <summary>
 /// 删除拍卖车辆 
 /// </summary>
 /// <param name="model">删除成交model</param>
 /// <returns>1.操作成功</returns>
 public int DeleteAuctionCar(AuctionCarInfoModel model)
 {
     try
     {
         const string sql = "update auction_carinfo set status=0,deleterid=@deleterid,deletedtime=@deletedtime,deletedesc=@deletedesc where `innerid`=@innerid;";
         Helper.Execute(sql, new
         {
             innerid = model.Innerid,
             model.deleterid,
             model.deletedtime,
             model.deletedesc
         });
     }
     catch (Exception ex)
     {
         LoggerFactories.CreateLogger().Write("修改拍卖车辆异常:", TraceEventType.Information, ex);
         return 0;
     }
     return 1;
 }
예제 #3
0
 /// <summary>
 /// 修改拍卖车辆
 /// </summary>
 /// <param name="model">车辆信息</param>
 /// <returns></returns>
 public int UpdateAuctionCar(AuctionCarInfoModel model)
 {
     var sql = new StringBuilder("update `auction_carinfo` set ");
     sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));
     sql.Append(" where innerid = @innerid");
     int result;
     try
     {
         result = Helper.Execute(sql.ToString(), model);
     }
     catch (Exception ex)
     {
         result = 0;
         LoggerFactories.CreateLogger().Write("修改拍卖车辆异常:", TraceEventType.Information, ex);
     }
     return result;
 }
예제 #4
0
        /// <summary>
        /// 修改拍卖车辆
        /// </summary>
        /// <param name="model">车辆信息</param>
        /// <returns></returns>
        public int UpdateAuctionCarStatus(AuctionCarInfoModel model)
        {
            //更新拍卖信息状态
            var sql = new StringBuilder("update `auction_carinfo` set `status`=@status where innerid = @innerid;");
            //更车辆状态
            var sqlcar = new StringBuilder("update `car_info`  ");
            if (model.status == 7)
            {
                sqlcar.Append(" set status=2 where innerid =@carid; ");
            }
            else if (model.status == 8)
            {
                sqlcar.Append(" set status=1 where innerid =@carid; ");
            }
            else if (model.status == 6)//上线
            {
                sqlcar.Append(" set status=3 where innerid =@carid; ");
            }
            int result;
            using (var conn = Helper.GetConnection())
            {
                var tran = conn.BeginTransaction();
                try
                {
                    conn.Execute(sql.ToString(), model, tran);
                    if (model.status == 6 || model.status == 7 || model.status == 8)
                    {
                        conn.Execute(sqlcar.ToString(), model, tran);
                    }

                    tran.Commit();
                    result = 1;
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    result = 0;
                    LoggerFactories.CreateLogger().Write("修改拍卖车辆异常:", TraceEventType.Information, ex);
                }
            }
            return result;
        }
예제 #5
0
 /// <summary>
 /// 发布拍卖车辆
 /// </summary>
 /// <param name="model"></param>
 /// <returns>1.操作成功</returns>
 public int PublishAuctionCar(AuctionCarInfoModel model)
 {
     try
     {
         model.status = model.status == 1 ? 2 : 1;
         const string sql = "update auction_carinfo set status=@status,publisherid=@publisherid,publishedtime=@publishedtime where `innerid`=@innerid;";
         Helper.Execute(sql, new
         {
             innerid = model.Innerid,
             model.publisherid,
             model.publishedtime,
             model.status
         });
     }
     catch (Exception ex)
     {
         LoggerFactories.CreateLogger().Write("发布拍卖车辆异常:", TraceEventType.Information, ex);
         return 0;
     }
     return 1;
 }