public bool Update(AppInfo appInfo) { if (appInfo == null) return false; _efRepository.Update(appInfo); return true; }
public JsApiTicket GetJsApiTicket(AppInfo appInfo) { var result = _efRepository.Get(item => item.AppId == appInfo.Id && !item.Expired) .OrderByDescending(item => item.SysDateTime) .Take(1); return result.FirstOrDefault(); }
public int Add(AppInfo appInfo) { if (appInfo == null) return 0; appInfo.CreateDate = DateTime.Now; _efRepository.Add(appInfo); return appInfo.Id; }
private bool DoAdd() { try { string strErr = ""; if (this.txtwxName.Text.Trim().Length == 0) { strErr += "公众帐号名称不能为空!"; } if (this.txtwxId.Text.Trim().Length == 0) { strErr += "公众号原始id不能为空!"; } if (this.txtweixinCode.Text.Trim().Length == 0) { strErr += "微信号不能为空!"; } if (this.txtwxToken.Text.Trim().Length == 0) { strErr += "TOKEN值不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return false; } var manager = GetAdminInfo(); int uId = manager.Id; string wxName = this.txtwxName.Text; string wxId = this.txtwxId.Text; string weixinCode = this.txtweixinCode.Text; string wxPwd = ""; string headerpic = this.txtImgUrl.Text; string apiurl = ""; string wxToken = this.txtwxToken.Text; string wxProvince = ""; string wxCity = ""; string AppId = this.txtAppId.Text; string AppSecret = this.txtAppSecret.Text; string EncodingAESKey = txtEncodingAESKey.Text; DateTime createDate = DateTime.Now; DateTime endDate = DateTime.Now.AddYears(1); var model = new AppInfo { UId = uId, WxName = wxName, WxId = wxId, YixinId = "", WxCode = weixinCode, WxPwd = wxPwd, Headerpic = headerpic, Apiurl = apiurl, WxToken = wxToken, WxProvince = wxProvince, WxCity = wxCity, AppId = AppId, AppSecret = AppSecret, AccessToken = "", OpenIdStr = "", CreateDate = createDate, EndDate = endDate, WenziMaxNum = -1, TuwenMaxNum = -1, YuyinMaxNum = -1, WenziDefineNum = 0, TuwenDefineNum = 0, YuyinDefineNum = 0, RequestTtNum = 0, RequestUsedNum = 0, SmsTtNum = 0, SmsUsedNum = 0, IsDelete = false, ExtStr = EncodingAESKey, WxType = MyCommFun.Obj2Int(rblweixintype.SelectedItem.Value), Remark = "", Seq = 99 }; //-1为无限制 //暂存入extStr字段里 if (IsChaoGuoWxNum()) { return false; } int wId = _appInfoService.Add(model); this.Id = wId; if (wId > 0) { Object obj = ConfigurationManager.AppSettings["industry_defaultAdd"]; if (obj != null && obj.ToString() == "true") { //根据登录者所在行业为微帐号添加相应默认模块 var mModel = GetAdminInfo(); //取得管理员信息 var idBll = new IndustryDefaultModuleService(new IndustryDefaultModuleRepository()); idBll.addMouduleByRoleid(mModel.RoleId, wId, new ArticleCategoryRepository(siteConfig.sysdatabaseprefix)); } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.Id + ",微信号为:" + model.WxCode); //记录日志 return true; } return false; } catch (Exception exception) { JscriptMsg("保存过程中发生错误!", "", "Error"); return false; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(AppInfo model) { return _repository.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(AppInfo model) { return _repository.Add(model); }
public bool Update(AppInfo appInfo) { return _appInfoRepository.Update(appInfo); }
public int Add(AppInfo appInfo) { return _appInfoRepository.Add(appInfo); }
private bool DoAdd() { string strErr = ""; if (this.txtwxName.Text.Trim().Length == 0) { strErr += "公众帐号名称不能为空!"; } if (this.txtwxId.Text.Trim().Length == 0) { strErr += "公众号原始id不能为空!"; } if (this.txtweixinCode.Text.Trim().Length == 0) { strErr += "微信号不能为空!"; } if (this.txtwxToken.Text.Trim().Length == 0) { strErr += "TOKEN值不能为空!"; } if (this.txtEndData.Text.Trim().Length == 0) { strErr += "到期时间不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return false; } var manager = GetAdminInfo(); int uId = manager.Id; string wxName = this.txtwxName.Text; string wxId = this.txtwxId.Text; string weixinCode = this.txtweixinCode.Text; string wxPwd = ""; string headerpic = this.txtImgUrl.Text; string apiurl = ""; string wxToken = this.txtwxToken.Text; string wxProvince = ""; string wxCity = ""; string AppId = this.txtAppId.Text; string AppSecret = this.txtAppSecret.Text; DateTime createDate = DateTime.Now; DateTime endDate = MyCommFun.Obj2DateTime(txtEndData.Text); var model = new AppInfo { UId = this.uid, WxName = wxName, WxId = wxId, YixinId = "", WxCode = weixinCode, WxPwd = wxPwd, Headerpic = headerpic, Apiurl = apiurl, WxToken = wxToken, WxProvince = wxProvince, WxCity = wxCity, AppId = AppId, AppSecret = AppSecret, AccessToken = "", OpenIdStr = "", CreateDate = createDate, EndDate = endDate, WenziMaxNum = -1, TuwenMaxNum = -1, YuyinMaxNum = -1, WenziDefineNum = 0, TuwenDefineNum = 0, YuyinDefineNum = 0, RequestTtNum = 0, RequestUsedNum = 0, SmsTtNum = 0, SmsUsedNum = 0, IsDelete = false, WStatus = true, Remark = "", Seq = 99 }; //-1为无限制 if (IsChaoGuoWxNum()) { return false; } int wId = bll.Add(model); if (wId > 0) { Object obj = ConfigurationManager.AppSettings["industry_defaultAdd"]; if (obj != null && obj.ToString() == "true") { //为微账户添加行业默认模块 var mBll = new ManagerInfoService(); var idBll = new IndustryDefaultModuleService(new IndustryDefaultModuleRepository()); var user = mBll.GetModel(uid); int roleid = user.RoleId; idBll.addMouduleByRoleid(roleid, wId, new ArticleCategoryRepository(siteConfig.sysdatabaseprefix)); } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.Id + ",微信号为:" + model.WxCode); //记录日志 return true; } return false; }