private bool DoAdd() { bool result = false; SF.BLL.sf_website bll = new SF.BLL.sf_website(); SF.Model.sf_website model = new SF.Model.sf_website(); ManagerInfo model1 = (ManagerInfo)Session[DTKeys.SESSION_ADMIN_INFO]; //model.businessNum = model1.businessNum; model.sitename = txtsitename.Text.Trim(); //model.appid_name = txtappid_name.Text.Trim(); //model.appid_origin_id = txtappid_origin_id.Text.Trim(); //model.weixin_account = txtweixin_account.Text.Trim(); //model.avatar = txtavatar.Text; //model.interface_url = txtinterface_url.Text.Trim(); //model.token_value = txttoken_value.Text.Trim(); //if (string.IsNullOrEmpty(model.token_value)) //{ // //model.token_value = this.CreateKey(8); //} //model.encodingaeskey = txtencodingaeskey.Text.Trim(); //model.appid = txtappid.Text.Trim().Trim(); //model.appsecret = txtappsecret.Text.Trim(); //model.payment_name = txtpayment_name.Text; ////model.state = cbstate.Checked ? 1 : 0; //model.weixin_pay_account = txtweixin_pay_account.Text.Trim(); //model.account_pay_key = txtaccount_pay_key.Text.Trim(); //model.send_type = int.Parse(rblsend_type.SelectedValue); //model.logo = txtlogo.Text; //model.description = txtdescription.Text; model.create_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.create_user = model1.realname; model.mid = model1.UserId; model.wid = "W" + SFUtils.GetCheckCode(4).ToString() + DateTime.Now.ToString("yyyyMMddHHmmss"); if (bll.Add(model) > 0) { //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加公众服务号:" + model.appid_name); //记录日志 //1.拷贝默认模板 CopyTemplate(model.wid); //2.增加默认会员类别 MemberGradeInfo memberGrade = new MemberGradeInfo(); memberGrade.wid = model.wid; memberGrade.Name = "普通会员"; memberGrade.Description = "普通会员"; memberGrade.IsDefault = true; memberGrade.TranVol = 999999999.00; memberGrade.TranTimes = 999999999; //折扣 memberGrade.Discount = 100; result = MemberHelper.CreateMemberGrade(memberGrade); } return(result); }
private void btnSubmitMemberRanks_Click(object sender, System.EventArgs e) { string text = string.Empty; if (this.txtValue.Text.Trim().Contains(".")) { this.ShowMsg("折扣必须为正整数", false); return; } MemberGradeInfo memberGradeInfo = new MemberGradeInfo(); memberGradeInfo.Name = this.txtRankName.Text.Trim(); memberGradeInfo.Description = this.txtRankDesc.Text.Trim(); int points; if (int.TryParse(this.txtPoint.Text.Trim(), out points)) { memberGradeInfo.Points = points; } else { text += Formatter.FormatErrorMessage("积分设置无效或不能为空,必须大于等于0的整数"); } memberGradeInfo.IsDefault = this.chkIsDefault.SelectedValue; int discount; if (int.TryParse(this.txtValue.Text, out discount)) { memberGradeInfo.Discount = discount; } else { text += Formatter.FormatErrorMessage("等级折扣设置无效或不能为空,等级折扣必须在1-10之间"); } if (!string.IsNullOrEmpty(text)) { this.ShowMsg(text, false); return; } if (!this.ValidationMemberGrade(memberGradeInfo)) { return; } if (MemberHelper.HasSamePointMemberGrade(memberGradeInfo)) { this.ShowMsg("已经存在相同积分的等级,每个会员等级的积分不能相同", false); return; } if (MemberHelper.CreateMemberGrade(memberGradeInfo)) { this.ShowMsg("成功添加了一个会员等级", true); return; } this.ShowMsg("添加会员等级失败", false); }
private void btnSubmitMemberRanks_Click(object sender, EventArgs e) { string str = string.Empty; if (this.txtValue.Text.Trim().Contains(".")) { this.ShowMsg("折扣必须为正整数", false); } else { int num; int num2; MemberGradeInfo memberGrade = new MemberGradeInfo { Name = this.txtRankName.Text.Trim(), Description = this.txtRankDesc.Text.Trim() }; if (int.TryParse(this.txtPoint.Text.Trim(), out num)) { memberGrade.Points = num; } else { str = str + Formatter.FormatErrorMessage("积分设置无效或不能为空,必须大于等于0的整数"); } memberGrade.IsDefault = this.chkIsDefault.SelectedValue; if (int.TryParse(this.txtValue.Text, out num2)) { memberGrade.Discount = num2; } else { str = str + Formatter.FormatErrorMessage("等级折扣设置无效或不能为空,等级折扣必须在1-10之间"); } if (!string.IsNullOrEmpty(str)) { this.ShowMsg(str, false); } else if (this.ValidationMemberGrade(memberGrade)) { if (MemberHelper.HasSamePointMemberGrade(memberGrade)) { this.ShowMsg("已经存在相同积分的等级,每个会员等级的积分不能相同", false); } else if (MemberHelper.CreateMemberGrade(memberGrade)) { this.ShowMsg("成功添加了一个会员等级", true); } else { this.ShowMsg("添加会员等级失败", false); } } } }
private void btnSubmitMemberRanks_Click(object sender, System.EventArgs e) { string text = this.txtRankName.Text; string text2 = this.txt_tradeVol.Text; string text3 = this.txt_tradeTimes.Text; string text4 = this.txtValue.Text; string arg_3B_0 = this.txtRankDesc.Text; if (string.IsNullOrEmpty(text)) { this.ShowMsg("会员等级名称不能为空!", false); return; } if (text.Length > 20) { this.ShowMsg("会员等级名称最长20个字符", false); return; } double value = 0.0; if (!string.IsNullOrEmpty(text2)) { double num = 0.0; if (!this.bDouble(text2, ref num)) { this.ShowMsg("请输入正确的交易额!", false); return; } value = num; } int value2 = 0; if (!string.IsNullOrEmpty(text3)) { int num2 = 0; if (!this.bInt(text3, ref num2)) { this.ShowMsg("请输入正确的交易次数!", false); return; } value2 = num2; } int num3 = 0; if (string.IsNullOrEmpty(text4)) { this.ShowMsg("会员折扣不能为空!", false); return; } if (!this.bInt(text4, ref num3)) { this.ShowMsg("会员折扣必须是不大于100的正整数!", false); return; } if (num3 > 100) { this.ShowMsg("会员折扣必须是不大于100的正整数!", false); return; } MemberGradeInfo memberGradeInfo; if (AddMemberGrade._bAdd) { memberGradeInfo = new MemberGradeInfo(); } else { memberGradeInfo = MemberHelper.GetMemberGrade(AddMemberGrade._gradeid); } memberGradeInfo.Name = text; memberGradeInfo.Description = this.txtRankDesc.Text.Trim(); memberGradeInfo.IsDefault = this.cbIsDefault.Checked; memberGradeInfo.TranVol = new double?(value); memberGradeInfo.TranTimes = new int?(value2); memberGradeInfo.Discount = num3; if (AddMemberGrade._bAdd && MemberHelper.IsExist(text)) { this.ShowMsg("该等级名称已存在,请修改等级名称", false); return; } if (MemberHelper.HasSameMemberGrade(memberGradeInfo)) { this.ShowMsg("已经存在相同交易额或交易次数的等级,每个会员等级的交易额或交易次数不能相同", false); return; } try { if (AddMemberGrade._bAdd) { if (MemberHelper.CreateMemberGrade(memberGradeInfo)) { this.ShowMsgAndReUrl("新增会员等级成功", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("新增会员等级失败", false); } } else if (MemberHelper.UpdateMemberGrade(memberGradeInfo)) { this.ShowMsgAndReUrl("修改会员等级成功", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("修改会员等级失败", false); } } catch (System.Exception ex) { this.ShowMsg("操作失败,原因是:" + ex.Message, false); } }
private void btnSubmitMemberRanks_Click(object sender, EventArgs e) { string text = this.txtRankName.Text; string str2 = this.txt_tradeVol.Text; string str3 = this.txt_tradeTimes.Text; string str4 = this.txtValue.Text; string text1 = this.txtRankDesc.Text; if (string.IsNullOrEmpty(text)) { this.ShowMsg("会员等级名称不能为空!", false); } else if (text.Length > 20) { this.ShowMsg("会员等级名称最长20个字符", false); } else { double num = 0.0; if (!string.IsNullOrEmpty(str2)) { double num2 = 0.0; if (!this.bDouble(str2, ref num2)) { this.ShowMsg("请输入正确的交易额!", false); return; } num = num2; } int num3 = 0; if (!string.IsNullOrEmpty(str3)) { int num4 = 0; if (!this.bInt(str3, ref num4)) { this.ShowMsg("请输入正确的交易次数!", false); return; } num3 = num4; } int i = 0; if (string.IsNullOrEmpty(str4)) { this.ShowMsg("会员折扣不能为空!", false); } else if (!this.bInt(str4, ref i)) { this.ShowMsg("会员折扣必须是不大于100的正整数!", false); } else if (i > 100) { this.ShowMsg("会员折扣必须是不大于100的正整数!", false); } else { MemberGradeInfo memberGrade; if (_bAdd) { memberGrade = new MemberGradeInfo(); } else { memberGrade = MemberHelper.GetMemberGrade(_gradeid); } memberGrade.Name = text; memberGrade.Description = this.txtRankDesc.Text.Trim(); memberGrade.IsDefault = this.cbIsDefault.Checked; memberGrade.IsDaifa = this.cbIsDaifa.Checked; memberGrade.IsPifa = this.cbIsPifa.Checked; memberGrade.TranVol = new double?(num); memberGrade.TranTimes = new int?(num3); memberGrade.Discount = i; if (_bAdd && MemberHelper.IsExist(text)) { this.ShowMsg("该等级名称已存在,请修改等级名称", false); } else if (MemberHelper.HasSameMemberGrade(memberGrade)) { this.ShowMsg("已经存在相同交易额或交易次数的等级,每个会员等级的交易额或交易次数不能相同", false); } else { try { if (_bAdd) { if (MemberHelper.CreateMemberGrade(memberGrade)) { this.ShowMsgAndReUrl("新增会员等级成功", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("新增会员等级失败", false); } } else if (MemberHelper.UpdateMemberGrade(memberGrade)) { this.ShowMsgAndReUrl("修改会员等级成功", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("修改会员等级失败", false); } } catch (Exception exception) { this.ShowMsg("操作失败,原因是:" + exception.Message, false); } } } } }
private void btnSubmitMemberRanks_Click(object sender, EventArgs e) { string text = this.txtRankName.Text; string str2 = this.txt_tradeVol.Text; string str3 = this.txt_tradeTimes.Text; string str4 = this.txtValue.Text; string text1 = this.txtRankDesc.Text; if (string.IsNullOrEmpty(text)) { this.ShowMsg("会员等级名称不能为空!", false); } else if (text.Length > 20) { this.ShowMsg("会员等级名称需小于20个字符", false); } else { double?nullable = null; if (!string.IsNullOrEmpty(str2)) { double num = 0.0; if (!this.bDouble(str2, ref num)) { this.ShowMsg("请输入正确的交易额!", false); return; } nullable = new double?(num); } int?nullable2 = null; if (!string.IsNullOrEmpty(str3)) { int num2 = 0; if (!this.bInt(str3, ref num2)) { this.ShowMsg("请输入正确的交易次数!", false); return; } nullable2 = new int?(num2); } int i = 0; if (string.IsNullOrEmpty(str4)) { this.ShowMsg("会员折扣不能为空!", false); } else if (!this.bInt(str4, ref i)) { this.ShowMsg("会员折扣必须是小于100的正整数!", false); } else if (i > 100) { this.ShowMsg("会员折扣必须是小于100的正整数!", false); } else if (!nullable.HasValue && !nullable2.HasValue) { this.ShowMsg("交易额和交易次数同时为空!", false); } else { MemberGradeInfo memberGrade; if (_bAdd) { memberGrade = new MemberGradeInfo(); } else { memberGrade = MemberHelper.GetMemberGrade(_gradeid); } memberGrade.wid = this.wid; memberGrade.Name = text; memberGrade.Description = this.txtRankDesc.Text.Trim(); memberGrade.IsDefault = Convert.ToBoolean(this.chkIsDefault.SelectedValue); memberGrade.TranVol = nullable; memberGrade.TranTimes = nullable2; memberGrade.Discount = i; if (_bAdd && MemberHelper.IsExist(text, this.wid)) { this.ShowMsg("该等级名称已存在,请修改等级名称", false); } else if (MemberHelper.HasSameMemberGrade(memberGrade)) { this.ShowMsg("已经存在相同交易额或交易次数的等级,每个会员等级的交易额或交易次数不能相同", false); } else { try { if (_bAdd) { if (MemberHelper.CreateMemberGrade(memberGrade)) { this.ShowMsgAndReUrl("成功添加了一个会员等级", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("添加会员等级失败", false); } } else if (MemberHelper.UpdateMemberGrade(memberGrade)) { this.ShowMsgAndReUrl("成功修改了一个会员等级", true, "/Admin/Member/MemberGrades.aspx"); } else { this.ShowMsg("修改会员等级失败", false); } } catch (Exception exception) { this.ShowMsg("操作失败,提示:" + exception.Message, false); } } } } }