public void UpdateTemplate(MessageTemplate template) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_MessageTemplates SET EmailSubject = @EmailSubject, EmailBody = @EmailBody, InnerMessageSubject = @InnerMessageSubject, InnerMessageBody = @InnerMessageBody,WeixinTemplateId=@WeixinTemplateId, SMSBody = @SMSBody WHERE LOWER(MessageType) = LOWER(@MessageType)"); this.database.AddInParameter(sqlStringCommand, "EmailSubject", DbType.String, template.EmailSubject); this.database.AddInParameter(sqlStringCommand, "EmailBody", DbType.String, template.EmailBody); this.database.AddInParameter(sqlStringCommand, "InnerMessageSubject", DbType.String, template.InnerMessageSubject); this.database.AddInParameter(sqlStringCommand, "InnerMessageBody", DbType.String, template.InnerMessageBody); this.database.AddInParameter(sqlStringCommand, "SMSBody", DbType.String, template.SMSBody); this.database.AddInParameter(sqlStringCommand, "MessageType", DbType.String, template.MessageType); this.database.AddInParameter(sqlStringCommand, "WeixinTemplateId", DbType.String, template.WeixinTemplateId); this.database.ExecuteNonQuery(sqlStringCommand); }
private void btnSaveSendSetting_Click(object sender, EventArgs e) { List<MessageTemplate> templates = new List<MessageTemplate>(); foreach (GridViewRow row in this.grdEmailTemplets.Rows) { MessageTemplate item = new MessageTemplate(); CheckBox box = (CheckBox) row.FindControl("chkWeixinMessage"); item.SendWeixin = box.Checked; item.MessageType = (string) this.grdEmailTemplets.DataKeys[row.RowIndex].Value; templates.Add(item); } VShopHelper.UpdateSettings(templates); this.ShowMsg("保存设置成功", true); }
public static void UpdateTemplate(MessageTemplate template) { if (template != null) { new MessageTemplateHelperDao().UpdateTemplate(template); HiCache.Remove(string.Format("Message-{0}", template.MessageType.ToLower())); } }