public bool InsertShopNotificationRecord(ShopNotificationRecord model) { try { return(DALMeiRongAcitivityConfig.InsertShopNotificationRecord(model)); } catch (Exception ex) { Logger.Log(Level.Error, ex, "InsertShopNotificationRecord"); throw ex; } }
public static bool InsertShopNotificationRecord(ShopNotificationRecord model) { const string sql = @" INSERT INTO Tuhu_Groupon.dbo.[ShopNotificationRecord] ( [ActivityId] ,[ShopId] ,[Notification] ) VALUES ( @ActivityId ,@ShopId ,@Notification )"; var sqlParameter = new SqlParameter[] { new SqlParameter("@ActivityId", model.ActivityId), new SqlParameter("@Notification", model.Notification ?? string.Empty), new SqlParameter("@ShopId", model.ShopId), }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public JsonResult SendMessage(string Regions, string ShopBusinessType, string ShopServices, string ShopTechLevel, int activityId, string notification) { Dictionary <string, object> dic = new Dictionary <string, object>(); if (string.IsNullOrWhiteSpace(Regions)) { dic.Add("Succeed", "False"); dic.Add("Message", "请选择地区!"); return(Json(dic)); } if (string.IsNullOrWhiteSpace(ShopBusinessType)) { dic.Add("Succeed", "False"); dic.Add("Message", "请选择门店类型!"); return(Json(dic)); } if (string.IsNullOrWhiteSpace(ShopServices)) { dic.Add("Succeed", "False"); dic.Add("Message", "请选择门店服务!"); return(Json(dic)); } if (string.IsNullOrWhiteSpace(ShopTechLevel)) { dic.Add("Succeed", "False"); dic.Add("Message", "请选择门店等级!"); return(Json(dic)); } if (string.IsNullOrWhiteSpace(notification)) { dic.Add("Succeed", "False"); dic.Add("Message", "通知内容不能为没空!"); return(Json(dic)); } if (activityId == 0) { dic.Add("Succeed", "False"); dic.Add("Message", "活动为空!"); return(Json(dic)); } List <Shop> result = GetShop(Regions, ShopBusinessType, ShopServices, ShopTechLevel); if (result == null || !result.Any()) { dic.Add("Succeed", "False"); dic.Add("Message", "该条件无门店!"); return(Json(dic)); } try { foreach (var item in result) { ShopNotificationRecord model = new ShopNotificationRecord(); model.ActivityId = activityId; model.Notification = notification; model.ShopId = item.PKID; MeiRongAcitivityConfigManager.InsertShopNotificationRecord(model); if (!Request.Url.Host.Contains(".tuhu.cn")) { //TuhuMessage.SendSms("18521709141", "亲爱的测试你好!"); } else { if (!string.IsNullOrWhiteSpace(item.Mobile)) { //TuhuMessage.SendSms(item.Mobile, ""); } } } dic.Add("Succeed", "True"); dic.Add("Message", "成功发送!"); return(Json(result)); } catch (Exception) { dic.Add("Succeed", "False"); dic.Add("Message", "服务器错误!"); return(Json(result)); } }