/// <summary> /// 修改时的默认值 /// </summary> protected void loadData() { model = bll.GetModel(tId); if (model != null) { ddlSType.SelectedValue = model.SType; txtUserId.Text = model.UserId; txtUserName.Text = model.UserName; txtPassword.Text = model.PassWord; txtContent.Text = model.Content; txtMobile.Text = model.Mobile; this.ddlMethod.SelectedValue = model.Method; this.txtUrl.Text = model.MsgUrl; if (model.IsStart == 1) { rbtisLast0.Checked = false; rbtisLast1.Checked = true; } else { rbtisLast1.Checked = false; rbtisLast0.Checked = true; } } }
public bool Update(Model_SendMessageTemplate model) { StringBuilder builder = new StringBuilder(); builder.Append("update SendMessageTemplate set "); builder.Append("SType=@SType,"); builder.Append("UserName=@UserName,"); builder.Append("PassWord=@PassWord,"); builder.Append("Content=@Content,"); builder.Append("IsStart=@IsStart,"); builder.Append("MsgUrl=@MsgUrl,"); builder.Append("Method=@Method,"); builder.Append("CTime=@CTime,"); builder.Append("CUser=@CUser,"); builder.Append("UserId=@UserId,"); builder.Append("Mobile=@Mobile"); builder.Append(" where SendSMSTemplateId=@SendSMSTemplateId "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SType", SqlDbType.VarChar, 50), new SqlParameter("@UserName", SqlDbType.NVarChar, 200), new SqlParameter("@PassWord", SqlDbType.NVarChar, 200), new SqlParameter("@Content", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@IsStart", SqlDbType.Int, 4), new SqlParameter("@MsgUrl", SqlDbType.NVarChar, 200), new SqlParameter("@Method", SqlDbType.NVarChar, 200), new SqlParameter("@CTime", SqlDbType.DateTime), new SqlParameter("@CUser", SqlDbType.Char, 0x24), new SqlParameter("@UserId", SqlDbType.VarChar, 50), new SqlParameter("@Mobile", SqlDbType.VarChar, 50), new SqlParameter("@SendSMSTemplateId", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.SType; cmdParms[1].Value = model.UserName; cmdParms[2].Value = model.PassWord; cmdParms[3].Value = model.Content; cmdParms[4].Value = model.IsStart; cmdParms[5].Value = model.MsgUrl; cmdParms[6].Value = model.Method; cmdParms[7].Value = model.CTime; cmdParms[8].Value = model.CUser; cmdParms[9].Value = model.UserId; cmdParms[10].Value = model.Mobile; cmdParms[11].Value = model.SendSMSTemplateId; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Model_SendMessageTemplate model = new Model_SendMessageTemplate(); BLL_SendMessageTemplate bll = new BLL_SendMessageTemplate(); model = bll.GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.ALIPAY.ToString()); if (model != null && model.IsStart == 1) { //合作身份者ID,以2088开头由16位纯数字组成的字符串 //partner = "2088421306789431"; partner = model.UserName; //收款支付宝账号 //seller_email = "*****@*****.**"; seller_email = model.PassWord; //交易安全检验码,由数字和字母组成的32位字符串 //key = "kdm76wus83ifdvo7cwutb2p1alw5d38i"; key = model.MsgUrl; } //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式,选择项:RSA、DSA、MD5 sign_type = "MD5"; }
public Model_SendMessageTemplate DataRowToModel(DataRow row) { Model_SendMessageTemplate template = new Model_SendMessageTemplate(); if (row != null) { if (row["SendSMSTemplateId"] != null) { template.SendSMSTemplateId = row["SendSMSTemplateId"].ToString(); } if (row["SType"] != null) { template.SType = row["SType"].ToString(); } if (row["UserName"] != null) { template.UserName = row["UserName"].ToString(); } if (row["PassWord"] != null) { template.PassWord = row["PassWord"].ToString(); } if (row["Content"] != null) { template.Content = row["Content"].ToString(); } if ((row["IsStart"] != null) && (row["IsStart"].ToString() != "")) { template.IsStart = new int?(int.Parse(row["IsStart"].ToString())); } if (row["MsgUrl"] != null) { template.MsgUrl = row["MsgUrl"].ToString(); } if (row["Method"] != null) { template.Method = row["Method"].ToString(); } if ((row["CTime"] != null) && (row["CTime"].ToString() != "")) { template.CTime = new DateTime?(DateTime.Parse(row["CTime"].ToString())); } if (row["CUser"] != null) { template.CUser = row["CUser"].ToString(); } if (row["UserId"] != null) { template.UserId = row["UserId"].ToString(); } if (row["Mobile"] != null) { template.Mobile = row["Mobile"].ToString(); } } return(template); }
static WxPayConfig() { Model_SendMessageTemplate model = new Model_SendMessageTemplate(); BLL_SendMessageTemplate bll = new BLL_SendMessageTemplate(); model = bll.GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.WXPAY.ToString()); if (model != null && model.IsStart == 1) { APPID = model.UserName; MCHID = model.PassWord; KEY = model.MsgUrl; } }
public List <Model_SendMessageTemplate> DataTableToList(DataTable dt) { List <Model_SendMessageTemplate> list = new List <Model_SendMessageTemplate>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_SendMessageTemplate item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Add(Model_SendMessageTemplate model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into SendMessageTemplate("); builder.Append("SendSMSTemplateId,SType,UserName,PassWord,Content,IsStart,MsgUrl,Method,CTime,CUser,UserId,Mobile)"); builder.Append(" values ("); builder.Append("@SendSMSTemplateId,@SType,@UserName,@PassWord,@Content,@IsStart,@MsgUrl,@Method,@CTime,@CUser,@UserId,@Mobile)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SendSMSTemplateId", SqlDbType.Char, 0x24), new SqlParameter("@SType", SqlDbType.VarChar, 50), new SqlParameter("@UserName", SqlDbType.NVarChar, 200), new SqlParameter("@PassWord", SqlDbType.NVarChar, 200), new SqlParameter("@Content", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@IsStart", SqlDbType.Int, 4), new SqlParameter("@MsgUrl", SqlDbType.NVarChar, 200), new SqlParameter("@Method", SqlDbType.NVarChar, 200), new SqlParameter("@CTime", SqlDbType.DateTime), new SqlParameter("@CUser", SqlDbType.Char, 0x24), new SqlParameter("@UserId", SqlDbType.VarChar, 50), new SqlParameter("@Mobile", SqlDbType.VarChar, 50) }; cmdParms[0].Value = model.SendSMSTemplateId; cmdParms[1].Value = model.SType; cmdParms[2].Value = model.UserName; cmdParms[3].Value = model.PassWord; cmdParms[4].Value = model.Content; cmdParms[5].Value = model.IsStart; cmdParms[6].Value = model.MsgUrl; cmdParms[7].Value = model.Method; cmdParms[8].Value = model.CTime; cmdParms[9].Value = model.CUser; cmdParms[10].Value = model.UserId; cmdParms[11].Value = model.Mobile; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_SendMessageTemplate model) { return(this.dal.Add(model)); }
public bool Update(Model_SendMessageTemplate model) { return(this.dal.Update(model)); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(tId)) { #region 添加 //验证该类型是否已添加数据 if (bll.GetRecordCount("SType='" + ddlSType.SelectedValue + "'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该类型数据已添加。', { time: 2000, icon: 4})</script>"); return; } model.SendSMSTemplateId = Guid.NewGuid().ToString(); model.SType = ddlSType.SelectedValue.Trim(); model.UserId = txtUserId.Text.Trim(); model.UserName = txtUserName.Text.Trim(); model.PassWord = txtPassword.Text.Trim(); model.Content = txtContent.Text.Trim(); model.IsStart = rbtisLast1.Checked ? 1 : 0; model.MsgUrl = this.txtUrl.Text.TrimEnd(); model.Method = this.ddlMethod.SelectedValue; model.CUser = loginUser.SysUser_ID; model.CTime = DateTime.Now; model.Mobile = txtMobile.Text.Trim(); bool boolAddRes = bll.Add(model); if (boolAddRes) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>"); return; } #endregion } else { #region 修改 //验证该类型是否已添加数据 if (bll.GetRecordCount("SendSMSTemplateId!='" + tId + "' and SType='" + ddlSType.SelectedIndex + "'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该类型数据已添加。', { time: 2000, icon: 4})</script>"); return; } model = bll.GetModel(tId); model.SType = ddlSType.SelectedValue.Trim(); model.UserId = txtUserId.Text.Trim(); model.UserName = txtUserName.Text.Trim(); model.PassWord = txtPassword.Text.Trim(); model.Content = txtContent.Text.Trim(); model.CUser = loginUser.SysUser_ID; model.CTime = DateTime.Now; model.IsStart = rbtisLast1.Checked ? 1 : 0; model.MsgUrl = this.txtUrl.Text.TrimEnd(); model.Method = this.ddlMethod.SelectedValue; model.Mobile = txtMobile.Text.Trim(); bool boolUpdateRes = bll.Update(model); if (boolUpdateRes) { ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>"); } #endregion } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2});</script>"); } }