/// <summary> /// 设置公司短信配置信息 /// </summary> /// <param name="companyId">公司编号</param> /// <param name="info">配置信息</param> /// <returns></returns> public bool SetComSmsConfig(string companyId, EyouSoft.Model.ComStructure.MSmsConfigInfo info) { if (string.IsNullOrEmpty(companyId)) { return(false); } var setting = GetModel(companyId); if (setting != null && setting.SmsConfig != null && setting.SmsConfig.IsEnabled) { return(true); } if (info == null || !info.IsEnabled) { info = new EyouSoft.BLL.SmsStructure.BSmsAccount().CreateSmsAccount(); } if (info == null) { return(false); } bool dalRetCode = dal.SetComSmsConfig(companyId, info); string cachekey = string.Format(EyouSoft.Cache.Tag.TagName.ComSetting, companyId); EyouSoft.Cache.Facade.EyouSoftCache.Remove(cachekey); return(dalRetCode); }
/// <summary> /// 初始化短信通道 /// </summary> private void InitSendChannel() { var list = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsChannels(); this.ddlSelChannel.DataTextField = "Name"; this.ddlSelChannel.DataValueField = "Index"; this.ddlSelChannel.DataSource = list; this.ddlSelChannel.DataBind(); }
/// <summary> /// btnCreateSms click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCreateSms_Click(object sender, EventArgs e) { string cid = Utils.GetQueryStringValue("cid"); var info = new EyouSoft.BLL.SmsStructure.BSmsAccount().CreateSmsAccount(); if (info != null && new EyouSoft.BLL.ComStructure.BComSetting().SetComSmsConfig(cid, info)) { RegisterAlertAndRedirectScript("短信账号创建成功", null); } else { RegisterAlertAndRedirectScript("短信账号创建失败", null); } }
/// <summary> /// init channels,register channels scripts. /// </summary> void InitChannels() { var items = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsChannels(); var s = "var channels={0};"; if (items == null || items.Count == 0) { s = string.Format(s, "[]"); } else { s = string.Format(s, Newtonsoft.Json.JsonConvert.SerializeObject(items)); } RegisterScript(s); }
/// <summary> /// init prices,register prices scripts. /// </summary> void InitPrices() { var items = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsPrices(CompanyId); string s = "var prices={0};"; if (items == null || items.Count == 0) { s = string.Format(s, "[]"); } else { s = string.Format(s, Newtonsoft.Json.JsonConvert.SerializeObject(items)); } RegisterScript(s); }
/// <summary> /// 初始化充值明细集合 /// </summary> void InitCharges() { PageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1); int recordCount = 0; var searchInfo = new EyouSoft.Model.SmsStructure.MSmsBankChargeSearchInfo(); var items = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsBankCharges(PageSize, PageIndex, out recordCount, searchInfo); if (items != null && items.Count > 0) { this.rptCharges.DataSource = items; this.rptCharges.DataBind(); this.phNotFound.Visible = false; RegisterScript(string.Format("pConfig.pageSize={0};pConfig.pageIndex={1};pConfig.recordCount={2};", PageSize, PageIndex, recordCount)); } else { this.phNotFound.Visible = true; } }
private void PageInit() { #region 初次加载 //获取账户余额,如果少于等于0则显示充值按钮和短信提示信息 decimal accountMoney = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsAccountYuE(CurrentUserCompanyID); if (accountMoney <= 0) { showPay = "style='display:block'"; remainNum.Text = "你的短信剩余条数为0!"; remainNum.Visible = true; PSendBtn.Visible = false; } else { showPay = "style='display:none'"; remainNum.Visible = false; } txtSender.Text = SiteUserInfo.CompanyName; InitSendChannel(); #endregion }
/// <summary> /// 保存 /// </summary> private void Save() { string Msg = string.Empty; if (Utils.GetDecimal(Utils.GetFormValue("txtMoney")) == 0) { Msg += "请输入有效的充值金额!"; } if (!string.IsNullOrEmpty(Msg)) { Msg = UtilsCommons.AjaxReturnJson("0", Msg); } else { var setting = new EyouSoft.BLL.ComStructure.BComSetting().GetModel(CurrentUserCompanyID); if (setting != null && setting.SmsConfig != null && setting.SmsConfig.IsEnabled) { EyouSoft.Model.SmsStructure.MSmsBankChargeInfo model = new EyouSoft.Model.SmsStructure.MSmsBankChargeInfo(); model.AccountId = setting.SmsConfig.Account; model.AppKey = setting.SmsConfig.AppKey; model.AppSecret = setting.SmsConfig.AppSecret; model.ChargeAmount = Utils.GetDecimal(Utils.GetFormValue("txtMoney")); model.ChargeComName = SiteUserInfo.CompanyName; model.ChargeName = SiteUserInfo.Name; model.ChargeTelephone = SiteUserInfo.Telephone; model.IssueTime = DateTime.Now; model.Status = 0; bool Result = new EyouSoft.BLL.SmsStructure.BSmsAccount().SmsBankRecharge(model); Msg = Result ? UtilsCommons.AjaxReturnJson("1", "充值成功,正在审核中...") : UtilsCommons.AjaxReturnJson("0", "充值失败!"); } else { Msg = UtilsCommons.AjaxReturnJson("0", "操作失败,请联系客服!"); } } Response.Clear(); Response.Write(Msg); Response.End(); }
private void PageInit() { var chaXun = new EyouSoft.Model.SmsStructure.MSmsBankChargeSearchInfo(); var setting = new EyouSoft.BLL.ComStructure.BComSetting().GetModel(SiteUserInfo.CompanyId); chaXun.AccountId = setting.SmsConfig.Account; chaXun.AppKey = setting.SmsConfig.AppKey; chaXun.AppSecret = setting.SmsConfig.AppSecret; var list = new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsBankCharges(PageSize, PageIndex, out RecordCount, chaXun); litBalance.Text = EyouSoft.Common.UtilsCommons.GetMoneyString(new EyouSoft.BLL.SmsStructure.BSmsAccount().GetSmsAccountYuE(CurrentUserCompanyID), ProviderToMoney); if (list != null && list.Count > 0) { repList.DataSource = list; repList.DataBind(); } else { repList.EmptyText = "<tr><td colspan=\"4\">暂无相关冲值记录!</td></tr>"; } }