Exemplo n.º 1
0
        /// <summary>
        /// 添加车辆
        /// </summary>
        /// <param name="model">车辆信息</param>
        /// <returns></returns>
        public int AddCar(CarInfoModel model)
        {
            const string sql = @"INSERT INTO `car_info`
                                (`innerid`,`custid`,`carid`,`title`,`pic_url`,`provid`,`cityid`,`brand_id`,`series_id`,`model_id`,`colorid`,`mileage`,`register_date`,`buytime`,`buyprice`,`price`,`dealprice`,`isproblem`,`remark`,`ckyear_date`,`tlci_date`,`audit_date`,`istain`,`sellreason`,`masterdesc`,`dealdesc`,`deletedesc`,`estimateprice`,`status`,`createdtime`,`modifiedtime`,`seller_type`,`post_time`,`audit_time`,`sold_time`,`keep_time`,`eval_price`,`next_year_eval_price`)
                                VALUES
                                (@innerid,@custid,@carid,@title,@pic_url,@provid,@cityid,@brand_id,@series_id,@model_id,@colorid,@mileage,@register_date,@buytime,@buyprice,@price,@dealprice,@isproblem,@remark,@ckyear_date,@tlci_date,@audit_date,@istain,@sellreason,@masterdesc,@dealdesc,@deletedesc,@estimateprice,@status,@createdtime,@modifiedtime,@seller_type,@post_time,@audit_time,@sold_time,@keep_time,@eval_price,@next_year_eval_price);";
            int result;
            try
            {
                result = Helper.Execute(sql, model);
            }
            catch (Exception ex)
            {
                result = 0;
            }

            return result;
        }
Exemplo n.º 2
0
        public void AddCar()
        {
            var model = new CarInfoModel
            {
                Innerid = Guid.NewGuid().ToString(),
                supplierid = "",
                title = "",
                pic_url = "",
                provid = 0,
                cityid = 0,
                brand_id = 0,
                series_id = 0,
                model_id = 0,
                colorid = 0,
                buytime = DateTime.Now,
                buyprice = 0,
                dealprice = 0,
                isproblem = 0,
                sellreason = "转让原因",
                masterdesc = "原车主信息",
                dealdesc = "成交备注",
                deletedesc = "删除备注",
                ckyear_date = DateTime.Now,
                tlci_date = DateTime.Now,
                istain = 0,
                price = 0,
                mileage = 0,
                register_date = DateTime.Now,
                seller_type = 2,
                status = 1,
                remark = "车况备注/优势",
                createdtime = DateTime.Now,
                modifiedtime = DateTime.Now,
                post_time = DateTime.Now,
                audit_time = DateTime.Now,
                sold_time = DateTime.Now,
                estimateprice = "车源估值情况",
                eval_price = 0,
                next_year_eval_price = 0,
                audit_date = DateTime.Now,
                custid = "会员ID",
                provname = "省份",
                cityname = "城市",
                brand_name = "品牌",
                series_name = "车系",
                model_name = "车型",
                geartype = "变速箱类型",
                color = "颜色",
                liter = "排量",
                dischargeName = "排放标准"

            };
            var value = cms.AddCar(model);
            Assert.IsTrue(value.errcode == 0);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 添加车辆
 /// </summary>
 /// <param name="model">车辆信息</param>
 /// <returns></returns>
 public int UpdateCar(CarInfoModel model)
 {
     var sql = new StringBuilder("update `car_info` 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;
     }
     return result;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 删除车辆
 /// </summary>
 /// <param name="model">删除成交model</param>
 /// <returns>1.操作成功</returns>
 public int DeleteCar(CarInfoModel model)
 {
     try
     {
         const string sql = "update car_info set status=0,deletedesc=@deletedesc where `innerid`=@innerid;";
         Helper.Execute(sql, new { innerid = model.Innerid, model.deletedesc });
     }
     catch (Exception ex)
     {
         return 0;
     }
     return 1;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 车辆成交
 /// </summary>
 /// <param name="model">车辆成交model</param>
 /// <returns>1.操作成功</returns>
 public int DealCar(CarInfoModel model)
 {
     try
     {
         const string sql = "update car_info set status=2,dealprice=@dealprice,dealdesc=@dealdesc,sold_time=@sold_time where `innerid`=@innerid;";
         Helper.Execute(sql, new { innerid = model.Innerid,model.dealprice, model.dealdesc });
     }
     catch (Exception ex)
     {
         return 0;
     }
     return 1;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 修改车辆
        /// </summary>
        /// <param name="model">车辆信息</param>
        /// <returns></returns>
        public int UpdateCar(CarInfoModel model)
        {
            var sql = new StringBuilder("update `car_info` set ");
            sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));

            //非必填字段的修改
            if (!model.buytime.HasValue)
            {
                sql.Append(",buytime=null");
            }
            if (!model.buyprice.HasValue)
            {
                sql.Append(",buyprice=null");
            }
            if (!model.ckyear_date.HasValue)
            {
                sql.Append(",ckyear_date=null");
            }
            if (!model.tlci_date.HasValue)
            {
                sql.Append(",tlci_date=null");
            }
            if (!model.audit_date.HasValue)
            {
                sql.Append(",audit_date=null");
            }

            sql.Append(" where innerid = @innerid");
            int result;
            try
            {
                result = Helper.Execute(sql.ToString(), model);
            }
            catch (Exception ex)
            {
                LoggerFactories.CreateLogger().Write("车辆修改:", TraceEventType.Error, ex);
                result = 0;
            }
            return result;
        }
Exemplo n.º 7
0
 /// <summary>
 /// 回复车辆
 /// </summary>
 /// <param name="model">回复成交model</param>
 /// <returns>1.操作成功</returns>
 public int RecoveryCar(CarInfoModel model)
 {
     try
     {
         const string sql = "update car_info set `status`=ifnull(eval_price,1),eval_price=null,deletedesc=concat(ifnull(deletedesc,''),@deletedesc) where `innerid`=@innerid;";
         model.deletedesc = string.Concat("\n@", model.deletedesc);
         Helper.Execute(sql, new { innerid = model.Innerid, model.deletedesc });
     }
     catch (Exception ex)
     {
         return 0;
     }
     return 1;
 }
Exemplo n.º 8
0
        /// <summary>
        /// 添加车辆
        /// </summary>
        /// <param name="model">车辆信息</param>
        /// <returns></returns>
        public int AddCar(CarInfoModel model)
        {
            const string sql = @"INSERT INTO `car_info`
                                (`innerid`,`custid`,`supplierid`,`carno`,`title`,`pic_url`,`provid`,`cityid`,`brand_id`,`series_id`,`model_id`,`colorid`,`mileage`,`register_date`,`buytime`,`buyprice`,`price`,`dealprice`,`isproblem`,`remark`,`ckyear_date`,`tlci_date`,`audit_date`,`istain`,`sellreason`,`masterdesc`,`dealdesc`,`deletedesc`,`estimateprice`,`status`,`createdtime`,`modifiedtime`,`seller_type`,`post_time`,`audit_time`,`sold_time`,`closecasetime`,`eval_price`,`next_year_eval_price`,`refreshtime`, `istop`, `istransferfee`)
                                VALUES
                                (@innerid,@custid,@supplierid,@carno,@title,@pic_url,@provid,@cityid,@brand_id,@series_id,@model_id,@colorid,@mileage,@register_date,@buytime,@buyprice,@price,@dealprice,@isproblem,@remark,@ckyear_date,@tlci_date,@audit_date,@istain,@sellreason,@masterdesc,@dealdesc,@deletedesc,@estimateprice,@status,@createdtime,@modifiedtime,@seller_type,@post_time,@audit_time,@sold_time,@closecasetime,@eval_price,@next_year_eval_price,@refreshtime, @istop, @istransferfee);";

            using (var conn = Helper.GetConnection())
            {
                int result;
                try
                {
                    if (model.seller_type != 3)
                    {
                        var num = conn.Query<int?>("select `type` from cust_info where innerid=@custid;", new { model.custid }).FirstOrDefault();
                        if (num == null || num == 0)
                        {
                            return -1;
                        }
                        model.seller_type = num;
                    }

                    result = conn.Execute(sql, model);
                }
                catch (Exception ex)
                {
                    LoggerFactories.CreateLogger().Write("添加车辆异常:", TraceEventType.Information, ex);
                    result = 0;
                }

                return result;
            }
        }