private void DingYue() { string queryString = WebUtils.GetQueryString("_mailaddr"); if (string.IsNullOrEmpty(queryString)) { base.Response.Write("{\"msg\":\"" + base.GetCaption("DingYue_EmailNotEmpty") + "\"}"); } else if (!ValidateUtils.IsEmail(queryString)) { base.Response.Write("{\"msg\":\"" + base.GetCaption("DingYue_EmailIncorrect") + "\"}"); } else { int num = SinGooCMS.BLL.DingYue.Add(queryString); if (num == -1) { base.Response.Write("{\"msg\":\"" + base.GetCaption("DingYue_EmailExists") + "\"}"); } else if (num > 0) { base.Response.Write("{\"msg\":\"" + base.GetCaption("DingYue_Success") + "\"}"); } } }
protected void btnok_Click(object sender, System.EventArgs e) { if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { DingYueInfo dingYueInfo = new DingYueInfo(); if (base.IsEdit) { dingYueInfo = SinGooCMS.BLL.DingYue.GetDataById(base.OpID); } dingYueInfo.UserName = WebUtils.GetString(this.TextBox1.Text); dingYueInfo.Email = WebUtils.GetString(this.TextBox2.Text); dingYueInfo.IsTuiDing = !this.istuiding.Checked; if (string.IsNullOrEmpty(dingYueInfo.UserName)) { base.ShowMsg("请输入用户名称"); } if (!ValidateUtils.IsEmail(dingYueInfo.Email)) { base.ShowMsg("请输入有效的邮箱地址"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { dingYueInfo.Lang = base.cultureLang; dingYueInfo.AutoTimeStamp = System.DateTime.Now; if (SinGooCMS.BLL.DingYue.Add(dingYueInfo) > 0) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加订阅邮箱[" + dingYueInfo.Email + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Thao tác thất bại"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (SinGooCMS.BLL.DingYue.Update(dingYueInfo)) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改订阅邮箱[" + dingYueInfo.Email + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Thao tác thất bại"); } } } } }
protected void btnok_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp("Reply")) { base.ShowMsg("Không có thẩm quyền"); } else { string text = base.Server.HtmlEncode(this.txtReply.Text); if (string.IsNullOrEmpty(text)) { base.ShowMsg("请输入回复内容"); } else { FeedbackInfo dataById = SinGooCMS.BLL.Feedback.GetDataById(base.OpID); dataById.Replier = base.LoginAccount.AccountName; dataById.ReplyContent = text; dataById.ReplyDate = System.DateTime.Now; if (SinGooCMS.BLL.Feedback.Update(dataById)) { string @string = WebUtils.GetString(this.txtMail.Text); string strMailBody = string.Concat(new string[] { "来自管理员的回复:<br/><div style='border-bottom:1px solid #ccc'>", text, "</div><br/>", PageBase.config.SiteName, "(", PageBase.config.SiteDomain, ")" }); string empty = string.Empty; if (this.chkReply2Mail.Checked && ValidateUtils.IsEmail(@string)) { MsgService.SendMail(@string, "来自管理员的回复", strMailBody, out empty); } if (!string.IsNullOrEmpty(empty) && "success" != empty) { base.ShowMsg(empty); PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + this.feedback.Title + "] thành công,但发送邮件失败"); } else { PageBase.log.AddEvent(base.LoginAccount.AccountName, "回复留言[" + dataById.Title + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } } else { base.ShowMsg("回复留言失败"); } } } }
private void InitForModify() { this.feedback = SinGooCMS.BLL.Feedback.GetDataById(base.OpID); if (this.feedback != null) { UserInfo userByName = SinGooCMS.BLL.User.GetUserByName((this.feedback == null) ? string.Empty : this.feedback.UserName); if (!string.IsNullOrEmpty(this.feedback.Email) && ValidateUtils.IsEmail(this.feedback.Email)) { this.txtMail.Text = this.feedback.Email; } else if (this.feedback != null && userByName != null && !string.IsNullOrEmpty(userByName.Email) && ValidateUtils.IsEmail(userByName.Email)) { this.txtMail.Text = userByName.Email; } this.txtReply.Text = this.feedback.ReplyContent; } }
private static int SendMail(string strTitle, string strBody) { string str = string.Empty; int num = 0; System.Collections.Generic.IList <DingYueInfo> list = SinGooCMS.BLL.DingYue.GetList(0, " IsTuiDing=0 ", "AutoID asc"); if (list != null && list.Count > 0) { string empty = string.Empty; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); for (int i = 0; i < list.Count; i++) { if (ValidateUtils.IsEmail(list[i].Email)) { stringBuilder.Append(list[i].Email + ","); } if ((i + 1) % 5 == 0 || i >= list.Count - 1) { string empty2 = string.Empty; string strReciveMail = stringBuilder.ToString().Trim().TrimEnd(new char[] { ',' }); MsgService.SendMail(strReciveMail, strTitle, strBody, out empty2); if (empty2 != "success") { str = str + empty2 + ";"; } else { num += stringBuilder.ToString().Trim().TrimEnd(new char[] { ',' }).Split(new char[] { ',' }).Length; } stringBuilder.Clear(); } } } return(num); }
protected void btnSend_Click(object sender, System.EventArgs e) { string @string = WebUtils.GetString(this.txtReciver.Text); if (ValidateUtils.IsEmail(@string)) { string empty = string.Empty; if (MsgService.SendMail(@string, PageBase.config.SiteName + "Các tin nhắn thử nghiệm", "Đây là một tin nhắn kiểm tra, nếu bạn nhận được thông báo này,Dịch vụ chuyển phát nhanh hiệu quả!", out empty)) { base.ShowMsg("Thư được gửi thử nghiệm thành công"); } else { base.ShowMsg(empty); } } else { base.ShowMsg("E-mail người nhận không phải là một địa chỉ e-mail hợp lệ"); } }
protected void btnok_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { BaseConfigInfo baseConfigInfo = ConfigProvider.GetCacheBaseConfig(); if (baseConfigInfo == null) { baseConfigInfo = new BaseConfigInfo(); } baseConfigInfo.ServMailAccount = WebUtils.GetString(this.TextBox1.Text); baseConfigInfo.ServMailUserName = WebUtils.GetString(this.TextBox2.Text); string @string = WebUtils.GetString(this.TextBox3.Text); if (!string.IsNullOrEmpty(@string)) { baseConfigInfo.ServMailUserPwd = @string; } baseConfigInfo.ServMailSMTP = WebUtils.GetString(this.TextBox4.Text); baseConfigInfo.ServMailPort = WebUtils.GetString(this.TextBox5.Text); baseConfigInfo.ServMailIsSSL = this.CheckBox6.Checked; if (!string.IsNullOrEmpty(baseConfigInfo.ServMailAccount) && !ValidateUtils.IsEmail(baseConfigInfo.ServMailAccount)) { base.ShowMsg("Định dạng địa chỉ hệ thống-mail là không chính xác, xin vui lòng để trống nếu không cần thiết"); } else if (ConfigProvider.Update(baseConfigInfo)) { CacheUtils.Del("JsonLeeCMS_CacheForGetBaseConfig"); CacheUtils.Del("JsonLeeCMS_CacheForVER"); PageBase.log.AddEvent(base.LoginAccount.AccountName, "Cấu hình mail cập nhật thành công"); base.ShowMsg("Cập nhật thành công"); } else { base.ShowMsg("Cập nhật thất bại"); } } }
protected void SendSystemMsg2Mger(MessageSet setting, Dictionary <string, string> msgParams) { if (setting.IsSendMsg) { Message.SendSysMsg(setting.MessageTitle, this.ReplaceTemplate(setting.MessageTemplate, msgParams)); } if (setting.IsSendMail && !string.IsNullOrEmpty(ConfigProvider.Configs.ManagerMail)) { string[] array = ConfigProvider.Configs.ManagerMail.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (ValidateUtils.IsEmail(text)) { MsgService.SendMail(text, setting.MailTitle, this.ReplaceTemplate(setting.MailTemplate, msgParams)); } } } if (setting.IsSendSMS && !string.IsNullOrEmpty(ConfigProvider.Configs.ManagerMobile)) { string[] array = ConfigProvider.Configs.ManagerMobile.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (ValidateUtils.IsMobilePhone(text)) { MsgService.SendSMS(text, this.ReplaceTemplate(setting.SMSTemplate, msgParams)); } } } }
private void SendEmailOnFH(OrdersInfo order, UserInfo user) { bool @bool = WebUtils.GetBool(base.GetConfigValue("IsSendMailOnGoodsSend")); string configValue = base.GetConfigValue("MailTmpOnGoodsSend"); if (@bool && !string.IsNullOrEmpty(configValue) && !string.IsNullOrEmpty(user.Email) && ValidateUtils.IsEmail(user.Email) && user != null) { MsgService.SendMail(user.Email, "您的订单已经发货", configValue.Replace("${username}", user.UserName).Replace("${orderno}", order.OrderNo).Replace("${sitename}", PageBase.config.SiteName).Replace("${send_date}", System.DateTime.Now.ToString())); } }
protected void Page_Load(object sender, System.EventArgs e) { if (base.IsPost) { RegType regType = (RegType)System.Enum.Parse(typeof(RegType), WebUtils.GetFormString("_regtype", "Normal")); string strGroupName = WebUtils.GetFormString("_usergroupname", "个人会员"); System.Collections.Generic.IEnumerable <UserGroupInfo> source = from p in UserGroup.GetCacheUserGroupList() where p.GroupName.Equals(strGroupName) select p; System.Collections.Generic.IEnumerable <UserLevelInfo> source2 = (from p in UserLevel.GetCacheUserLevelList() orderby p.Integral select p).Take(1); TaoBaoAreaInfo iPAreaFromTaoBao = IPUtils.GetIPAreaFromTaoBao(IPUtils.GetIP()); UserInfo userInfo = new UserInfo { UserName = WebUtils.GetFormString("_regname"), Password = WebUtils.GetFormString("_regpwd"), GroupID = ((source.Count <UserGroupInfo>() > 0) ? source.First <UserGroupInfo>().AutoID : 0), LevelID = ((source2.Count <UserLevelInfo>() > 0) ? source2.First <UserLevelInfo>().AutoID : 0), Email = ((regType == RegType.ByEmail) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regemail")), Mobile = ((regType == RegType.ByMobile) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regmobile")), Country = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country), Province = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.region), City = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.city), County = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country), Status = 99, AutoTimeStamp = System.DateTime.Now }; string[] array = PageBase.config.SysUserName.Split(new char[] { ',' }); string strA = string.Empty; switch (regType) { case RegType.ByMobile: { SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Mobile); if (lastCheckCode != null) { strA = lastCheckCode.ValidateCode; } goto IL_27A; } case RegType.ByEmail: { SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Email); if (lastCheckCode != null) { strA = lastCheckCode.ValidateCode; } goto IL_27A; } } strA = base.ValidateCode; IL_27A: if (PageBase.config.VerifycodeForReg && string.Compare(strA, WebUtils.GetFormString("_regyzm"), true) != 0) { base.WriteJsonTip(base.GetCaption("ValidateCodeIncorrect")); } else if (userInfo.GroupID.Equals(0) || userInfo.LevelID.Equals(0)) { base.WriteJsonTip(base.GetCaption("Reg_MemberInfoNotComplete")); } else if (!SinGooCMS.BLL.User.IsValidUserName(userInfo.UserName) && !ValidateUtils.IsEmail(userInfo.UserName) && !ValidateUtils.IsMobilePhone(userInfo.UserName)) { base.WriteJsonTip(base.GetCaption("Reg_InvalidUserName")); } else if (array.Length > 0 && array.Contains(userInfo.UserName)) { base.WriteJsonTip(base.GetCaption("Reg_SystemRetainsUserName").Replace("${username}", userInfo.UserName)); } else if (SinGooCMS.BLL.User.IsExistsByName(userInfo.UserName)) { base.WriteJsonTip(base.GetCaption("Reg_UserNameAlreadyExists")); } else if (userInfo.Password.Length < 6) { base.WriteJsonTip(base.GetCaption("Reg_UserPwdLenNeed")); } else if (userInfo.Password != WebUtils.GetFormString("_regpwdagain")) { base.WriteJsonTip(base.GetCaption("Reg_2PwdInputNoMatch")); } else if (!string.IsNullOrEmpty(userInfo.Email) && !ValidateUtils.IsEmail(userInfo.Email)) { base.WriteJsonTip(base.GetCaption("Reg_EmailTypeError")); } else if (!string.IsNullOrEmpty(userInfo.Email) && SinGooCMS.BLL.User.IsExistsByEmail(userInfo.Email)) { base.WriteJsonTip(base.GetCaption("Reg_EmailAddressAlreadyExists")); } else if (!string.IsNullOrEmpty(userInfo.Mobile) && !ValidateUtils.IsMobilePhone(userInfo.Mobile)) { base.WriteJsonTip(base.GetCaption("Reg_MobileTypeError")); } else if (!string.IsNullOrEmpty(userInfo.Mobile) && SinGooCMS.BLL.User.IsExistsByMobile(userInfo.Mobile)) { base.WriteJsonTip(base.GetCaption("Reg_MobileAlreadyExists")); } else { int autoID = 0; System.Collections.Generic.IList <UserFieldInfo> fieldListByModelID = UserField.GetFieldListByModelID(userInfo.GroupID, true); System.Collections.Generic.Dictionary <string, UserFieldInfo> dictionary = new System.Collections.Generic.Dictionary <string, UserFieldInfo>(); foreach (UserFieldInfo current in fieldListByModelID) { current.Value = WebUtils.GetFormString(current.FieldName); dictionary.Add(current.FieldName, current); } UserStatus userStatus = SinGooCMS.BLL.User.Reg(userInfo, dictionary, ref autoID); if (userStatus.Equals(UserStatus.Success)) { new MsgService(userInfo).SendRegMsg(); new MsgService().SendRegMsg2Mger(); if (PageBase.config.RegGiveIntegral > 0) { userInfo.AutoID = autoID; AccountDetail.AddIntegral(userInfo, 1, (double)PageBase.config.RegGiveIntegral, "注册赠送积分"); } UserInfo userInfo2 = new UserInfo(); LoginStatus loginStatus = SinGooCMS.BLL.User.UserLogin(userInfo.UserName, userInfo.Password, ref userInfo2); string text = base.Server.UrlDecode(WebUtils.GetFormString("_regreturnurl")); if (!string.IsNullOrEmpty(text)) { base.WriteJsonTip(true, base.GetCaption("Reg_Success"), text); } else { base.WriteJsonTip(true, base.GetCaption("Reg_Success"), "/user/regsuccess.html?info=" + base.Server.UrlEncode(base.GetCaption("Reg_SuccessWillJumpMemberCenter"))); } } else { base.WriteJsonTip(base.GetCaption("Reg_FailWithMsg").Replace("${msg}", base.GetCaption("UserStatus_" + userStatus.ToString()))); } } } else { System.Collections.Generic.IEnumerable <UserGroupInfo> source3 = from p in UserGroup.GetCacheUserGroupList() where p.GroupName.Equals("个人会员") select p; base.Put("usermodel", UserField.GetFieldListByModelID((source3.Count <UserGroupInfo>() > 0) ? source3.First <UserGroupInfo>().AutoID : 0, true)); base.Put("returnurl", WebUtils.GetQueryString("returnurl")); base.UsingClient("user/注册.html"); } }
protected void btnok_Click(object sender, System.EventArgs e) { base.ShowMsg("Ờ"); if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { UserInfo userInfo = new UserInfo(); if (base.IsEdit) { userInfo = SinGooCMS.BLL.User.GetDataById(base.OpID); } userInfo.UserName = WebUtils.GetString(this.TextBox1.Text); userInfo.GroupID = this.intGroupID; userInfo.LevelID = WebUtils.GetInt(this.DropDownList3.SelectedValue); userInfo.Email = WebUtils.GetString(this.TextBox5.Text); userInfo.Mobile = WebUtils.GetString(this.TextBox6.Text); userInfo.Amount = WebUtils.GetDecimal(this.TextBox10.Text); userInfo.Integral = WebUtils.GetInt(this.TextBox11.Text); userInfo.CertType = this.DropDownList12.SelectedItem.Text; userInfo.CertNo = WebUtils.GetString(this.TextBox13.Text); userInfo.Status = (this.isaudit.Checked ? 99 : 0); userInfo.FileSpace = WebUtils.GetInt(this.FileSpace.Text) * 1024 * 1024; System.Collections.Generic.Dictionary <string, UserFieldInfo> fieldDicWithValues = this.GetFieldDicWithValues(); string[] array = PageBase.config.SysUserName.Split(new char[] { ',' }); if (userInfo.GroupID.Equals(0) || userInfo.LevelID.Equals(0)) { base.ShowMsg("会员信息不完整,会员组及会员等级信息不可缺少"); } else if (!SinGooCMS.BLL.User.IsValidUserName(userInfo.UserName) && !ValidateUtils.IsEmail(userInfo.UserName) && !ValidateUtils.IsMobilePhone(userInfo.UserName)) { base.ShowMsg("无效的会员名称"); } else if (array.Length > 0 && array.Contains(userInfo.UserName)) { base.ShowMsg(userInfo.UserName + " 是系统保留会员名称,请选择其它会员名称"); } else if (!base.IsEdit && this.TextBox4.Text.Length < 6) { base.ShowMsg("密码长度不少于6位"); } else if (base.IsEdit && !string.IsNullOrEmpty(this.TextBox4.Text) && this.TextBox4.Text.Length < 6) { base.ShowMsg("密码长度不少于6位"); } else if (!string.IsNullOrEmpty(userInfo.Email) && !ValidateUtils.IsEmail(userInfo.Email)) { base.ShowMsg("邮箱格式不正确"); } else if (!string.IsNullOrEmpty(userInfo.Email) && SinGooCMS.BLL.User.IsExistsByEmail(userInfo.Email, userInfo.AutoID)) { base.ShowMsg("邮箱已经存在"); } else if (!string.IsNullOrEmpty(userInfo.Mobile) && !ValidateUtils.IsMobilePhone(userInfo.Mobile)) { base.ShowMsg("手机号码格式不正确"); } else if (!string.IsNullOrEmpty(userInfo.Mobile) && SinGooCMS.BLL.User.IsExistsByMobile(userInfo.Mobile, userInfo.AutoID)) { base.ShowMsg("手机号码已经存在"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { userInfo.Password = SinGooCMS.BLL.User.GetEncodePwd(this.TextBox4.Text); UserStatus userStatus = SinGooCMS.BLL.User.Reg(userInfo, fieldDicWithValues); switch (userStatus) { case UserStatus.Error: base.ShowMsg("添加会员失败"); goto IL_54B; case UserStatus.WaitingForAudit: case UserStatus.MobileNoValidate: break; case UserStatus.UserNameNoValidate: base.ShowMsg("用户名非法"); goto IL_54B; case UserStatus.EmailNoValidate: base.ShowMsg("邮箱地址非法"); goto IL_54B; case UserStatus.ExistsUserName: base.ShowMsg("用户名已存在"); goto IL_54B; case UserStatus.ExistsEmail: base.ShowMsg("邮箱地址已存在"); goto IL_54B; case UserStatus.ExistsMobile: base.ShowMsg("手机号码已存在"); goto IL_54B; default: if (userStatus == UserStatus.Success) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加会员[" + userInfo.UserName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "UserList.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&GroupID=", userInfo.GroupID, "&action=View" })); goto IL_54B; } break; } base.ShowMsg("Lỗi Unknown"); IL_54B :; } if (base.Action.Equals(ActionType.Modify.ToString())) { if (!this.TextBox4.Text.IsNullOrEmpty()) { userInfo.Password = SinGooCMS.BLL.User.GetEncodePwd(this.TextBox4.Text); } UserStatus userStatus = SinGooCMS.BLL.User.Update(userInfo, fieldDicWithValues); switch (userStatus) { case UserStatus.Error: base.ShowMsg("更新会员失败"); goto IL_6DC; case UserStatus.WaitingForAudit: case UserStatus.MobileNoValidate: break; case UserStatus.UserNameNoValidate: base.ShowMsg("用户名非法"); goto IL_6DC; case UserStatus.EmailNoValidate: base.ShowMsg("邮箱地址非法"); goto IL_6DC; case UserStatus.ExistsUserName: base.ShowMsg("用户名已存在"); goto IL_6DC; case UserStatus.ExistsEmail: base.ShowMsg("邮箱地址已存在"); goto IL_6DC; case UserStatus.ExistsMobile: base.ShowMsg("手机号码已存在"); goto IL_6DC; default: if (userStatus == UserStatus.Success) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "更新会员[" + userInfo.UserName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "UserList.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&GroupID=", userInfo.GroupID, "&action=View" })); goto IL_6DC; } break; } base.ShowMsg("Lỗi Unknown"); IL_6DC :; } } } }