public static bool UpdateBaoYangRecommendServiceConfig(BaoYangRecommendServiceConfig model)
        {
            const string sql          = @"UPDATE Configuration..BaoYangRecommendServiceConfig SET                                      
                                           [ServiceType]=@ServiceType
                                          ,[ServiceName]=@ServiceName
                                          ,[GetRuleGUID]=@GetRuleGUID
                                          ,[CouponNames]=@CouponNames
                                          ,[Recommend]=@Recommend
                                          ,Tag=@Tag
                                          ,[Status]=@Status                                        
                                          ,[UpdateTime]=GETDATE()                                        
                                WHERE Id=@Id";
            var          sqlParameter = new SqlParameter[]
            {
                new SqlParameter("@ServiceType", model.ServiceType ?? string.Empty),
                new SqlParameter("@ServiceName", model.ServiceName ?? string.Empty),
                new SqlParameter("@GetRuleGUID", model.GetRuleGUID ?? string.Empty),
                new SqlParameter("@CouponNames", model.CouponNames ?? string.Empty),
                new SqlParameter("@Recommend", model.Recommend),
                new SqlParameter("@Status", model.Status),
                new SqlParameter("@Id", model.Id),
                new SqlParameter("@Tag", model.Tag ?? string.Empty)
            };

            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0);
        }
        /// <summary>
        /// 服务不能重复
        /// </summary>
        /// <returns></returns>
        public static bool CheckService(BaoYangRecommendServiceConfig model)
        {
            const string sql = @"SELECT COUNT(0)                                    
                              FROM [Configuration].[dbo].[BaoYangRecommendServiceConfig] WITH (NOLOCK) WHERE ServiceType=@ServiceType";

            return((int)SqlHelper.ExecuteScalar(connOnRead, CommandType.Text, sql, new SqlParameter("@ServiceType", model.ServiceType)) > 0);
        }
Beispiel #3
0
        public bool CheckService(BaoYangRecommendServiceConfig model)
        {
            var result = false;

            try
            {
                result = DALBaoYangRecommendServiceConfig.CheckService(model);
            }
            catch (Exception ex)
            {
                Logger.Error("CheckService", ex);
            }
            return(result);
        }
 public bool CheckService(BaoYangRecommendServiceConfig model)
 {
     try
     {
         return(DALBaoYangRecommendServiceConfig.CheckService(model));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new BaoYangRecommendServiceConfigException(1, "CheckService", ex);
         Logger.Log(Level.Error, "CheckService", exception);
         throw ex;
     }
 }
Beispiel #5
0
        public ActionResult Edit(int id = 0)
        {
            List <BaoYangPackage> packages = GetBaoYangPackage();

            packages.Add(new BaoYangPackage {
                Type = "tire", Name = "保养轮胎"
            });
            ViewBag.BaoYangPack = packages;
            if (id == 0)
            {
                BaoYangRecommendServiceConfig model = new BaoYangRecommendServiceConfig();
                return(View(model));
            }
            else
            {
                return(View(BaoYangRecommendServiceConfigManager.GetBaoYangRecommendServiceConfig(id)));
            }
        }
        public static bool InsertBaoYangRecommendServiceConfig(BaoYangRecommendServiceConfig model)
        {
            const string sql = @"INSERT INTO Configuration..BaoYangRecommendServiceConfig
                                          (                                       
                                           [Number]
                                          ,[ServiceType]
                                          ,[ServiceName]
                                          ,[GetRuleGUID]
                                          ,[CouponNames]
                                          ,[Recommend]
                                          ,[Status]
                                          ,[CreateTime]
                                          ,[UpdateTime]
                                          ,[Tag]
                                          )
                                  VALUES(  
                                           NEWID()
                                          ,@ServiceType
                                          ,@ServiceName
                                          ,@GetRuleGUID
                                          ,@CouponNames
                                          ,@Recommend
                                          ,@Status
                                          ,GETDATE()
                                          ,GETDATE()
                                          ,@Tag
                                          )";

            var sqlParameter = new SqlParameter[]
            {
                new SqlParameter("@GetRuleGUID", model.GetRuleGUID ?? string.Empty),
                new SqlParameter("@CouponNames", model.CouponNames ?? string.Empty),
                new SqlParameter("@Recommend", model.Recommend),
                new SqlParameter("@ServiceName", model.ServiceName ?? string.Empty),
                new SqlParameter("@ServiceType", model.ServiceType ?? string.Empty),
                new SqlParameter("@Status", model.Status),
                new SqlParameter("@Tag", model.Tag ?? string.Empty)
            };

            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0);
        }
Beispiel #7
0
        public bool InsertBaoYangRecommendServiceConfig(BaoYangRecommendServiceConfig model)
        {
            var result = false;

            try
            {
                if (DALBaoYangRecommendServiceConfig.InsertBaoYangRecommendServiceConfig(model))
                {
                    using (var client = new CacheClient())
                    {
                        client.UpdateTuhuRecommendConfigAsync();
                    }
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("InsertBaoYangRecommendServiceConfig", ex);
            }
            return(result);
        }
Beispiel #8
0
        public ActionResult Edit(BaoYangRecommendServiceConfig model)
        {
            if (model.Id != 0)
            {
                //if (BaoYangRecommendServiceConfigManager.CheckService(model))
                //{
                //    return Json(-100);
                //}

                return(Json(BaoYangRecommendServiceConfigManager.UpdateBaoYangRecommendServiceConfig(model)));
            }
            else
            {
                if (BaoYangRecommendServiceConfigManager.CheckService(model))
                {
                    return(Json(-100));
                }

                return(Json(BaoYangRecommendServiceConfigManager.InsertBaoYangRecommendServiceConfig(model)));
            }
        }