/// <summary> /// 对期数的各种判断 /// </summary> /// <returns></returns> public string Check(string orderId, string number, int exceptNum) { if (ChangeExceptDAL.SelectMemberAndOrder(orderId, number) == 0) { return(BLL.Translation.Translate("006028", "对不起,您输入的订单号或会员编号有误!")); } //该会员注册期数 int memberRegisExce = changeExceptDAL.GetRegisExce(number); //获取报单期数 int orderExcept = changeExceptDAL.GetOrderExcept(orderId); //获取报单是否是首次报单 int isfirst = ChangeExceptDAL.SelectIsAgain(orderId); //获取当前期 int exceptNow = CommonDataDAL.getMaxqishu(); //判断是否又修改到了当前期 if (exceptNum == exceptNow) { return(BLL.Translation.Translate("005784", "当前期报单不能调整到当前期!")); } //只能修改当前期 if (orderExcept != exceptNow) { return(BLL.Translation.Translate("002069", "只能调整当前期报单期数!")); } if (isfirst == 0) { //首次报单 不能改到推荐 if (exceptNum < ChangeExceptDAL.SelectTJQiShu(number) || exceptNum < ChangeExceptDAL.SelectAZQiShu(number)) { return(BLL.Translation.Translate("005791", "首次报单不可以调整到推荐或安置人注册期数之前!")); } } else { //如果该报单期数小于该会员注册期数 if (memberRegisExce > exceptNum) { return(BLL.Translation.Translate("002070", "报单期数不能小于该会员注册期数!")); } } return(""); }
protected void btn_Save_Click(object sender, EventArgs e) { #region 验证用户输入 if (txtBianhao.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(\"" + GetTran("001607", "请输入收件人编号") + "!!!\");</script>"); return; } if (txtTitle.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001609", "请输入标题") + "!!!');</script>"); Literal1.Text = ""; return; } if (this.content1.Value.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请输入公告内容") + "!!!');</script>"); return; } if (this.content1.Value.Trim().Length > 4000) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"); return; } double from = 0; double to = 0; if (this.ChkBonus.Checked) { if (string.IsNullOrEmpty(this.TxtBonusFrom.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 起始奖金不能为空!');</script>"); return; } if (string.IsNullOrEmpty(this.TxtBonusTo.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 未尾奖金不能为空!');</script>"); return; } try { from = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); to = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); if (from <= 0) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 起始奖金不能为负数!');</script>"); return; } if (from <= 0) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 未尾奖金不能负数!');</script>"); return; } } catch { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } if (from >= to) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } } if (this.drop_LoginRole.SelectedValue.Equals("2") && this.ChkNet.Checked) { if (this.TxtLeader.Text.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请指定团队领导人编号") + "!!!');</script>"); return; } else { if (!MessageSendBLL.CheckNumber(2, this.TxtLeader.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "指定的团队领导人不存在") + "!!!');</script>"); return; } } } #endregion StringBuilder sb = new StringBuilder(); if (Request["Id"] != null) { int id = Convert.ToInt32(Request["Id"]); ChangeLogs cl = new ChangeLogs("MessageSend", "ltrim(rtrim(id))"); cl.AddRecord(id); ChangeLogs clsend = new ChangeLogs("MessageReceive", "ltrim(rtrim(messagesendid))"); clsend.AddRecord(id); BLL.other.Company.MessageReceiveBLL bll = new MessageReceiveBLL(); bll.delGongGao(id); cl.ModifiedIntoLogs(ChangeCategory.company19, Session["Company"].ToString(), ENUM_USERTYPE.objecttype10); clsend.ModifiedIntoLogs(ChangeCategory.company19, Session["Company"].ToString(), ENUM_USERTYPE.objecttype10); this.btn_Save.Text = GetTran("000259", "修改"); sb.Append(GetTran("001621", "公告修改")); } else { sb.Append(GetTran("001620", "公告发布")); } MessageSendModel messagesend = new MessageSendModel(); //messagesend.Content = TextBox1.Text.Trim(); messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.Receive = "*"; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.LanguageCode = this.DropDownList2.SelectedValue; //if (this.ChkLevel.Checked) //{ // messagesend.ConditionLevel = Convert.ToInt16(this.DropLevel.SelectedValue); //} //else //{ // messagesend.ConditionLevel = -1; //} if (this.ChkBonus.Checked) { messagesend.ConditionBonusFrom = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); messagesend.ConditionBonusTo = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } else { messagesend.ConditionBonusFrom = -1; messagesend.ConditionBonusTo = -1; } if (this.ChkNet.Checked) { messagesend.ConditionRelation = Convert.ToChar(this.DropRelation.SelectedValue); messagesend.ConditionLeader = this.TxtLeader.Text.Trim(); } else { messagesend.ConditionLeader = ""; messagesend.ConditionRelation = '0'; } messagesend.Qishu = CommonDataDAL.getMaxqishu(); messagesend.MessageType = 'a'; if (MessageSendBLL.Addsendaffiche(messagesend)) { BLL.other.Company.MessageReceiveBLL bll = new MessageReceiveBLL(); if (this.drop_LoginRole.SelectedValue == "1") { bll.UpdateStore(); } else if (this.drop_LoginRole.SelectedValue == "2") { bll.UpdateMember(); } sb.Append(GetTran("001600", "成功") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } else { sb.Append(GetTran("001618", "失败")); ScriptHelper.SetAlert(Page, sb.ToString()); } txtTitle.Text = ""; TextBox1.Text = ""; content1.Value = ""; }
protected void btn_Save_Click(object sender, EventArgs e) { #region 验证用户输入 if (Request["type"] != "huifu" && txtBianhao.Text.Trim() == "" && this.RadioBianhao.Checked) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(\"" + GetTran("001607", "请输入收件人编号") + "!!!\");</script>"); return; } if (txtTitle.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001609", "请输入标题") + "!!!');</script>"); Literal1.Text = ""; return; } if (this.content1.Value.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请输入邮件内容") + "!!!');</script>"); return; } if (this.content1.Value.Trim().Length > 4000) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"); return; } double from = 0; double to = 0; if (this.RadioRange.Checked && this.ChkBonus.Checked) { try { from = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); to = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } if (from >= to) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } } if (this.drop_LoginRole.SelectedValue.Equals("2") && this.RadioRange.Checked && this.ChkNet.Checked) { if (this.TxtLeader.Text.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请指定团队首领编号") + "!!!');</script>"); return; } else { if (!MessageSendBLL.CheckNumber(2, this.TxtLeader.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "指定的团队首领不存在") + "!!!');</script>"); return; } } } #endregion StringBuilder sb = new StringBuilder(); //if (Request["type"] != null) //{ if (Request["type"] == "huifu") { MessageSendModel messagesend = new MessageSendModel(); //邮件保存 messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.LanguageCode = this.DropDownList2.SelectedValue; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.MessageType = 'm'; messagesend.SetNoCondition(); int hfid; try { hfid = Convert.ToInt32(Request["hfid"]); if (hfid < 0) { return; } } catch (Exception) { return; } messagesend.ReplyFor = hfid; System.Data.SqlClient.SqlDataReader dr = DAL.DBHelper.ExecuteReader("select Sender,ClassID from MessageReceive where ID=@id", new System.Data.SqlClient.SqlParameter("@id", hfid), CommandType.Text); if (dr.Read()) { messagesend.Receive = dr["Sender"].ToString(); messagesend.MessageClassID = Convert.ToInt32(dr["ClassID"]); } else { ScriptHelper.SetAlert(Page, GetTran("001589", "对不起发件人不存在") + "!!!"); return; } if (MessageSendBLL.Addsendaffiche(messagesend)) { string href = "ManageMessage_Recive.aspx" + (Request["ClassID"] == null ? "" : "?ClassID=" + Request["ClassID"]); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001587", "邮件回复成功") + "!!!');location.href='" + href + "';</script>"); } else { ScriptHelper.SetAlert(Page, GetTran("001588", "邮件回复失败") + "!!!"); } } else//信息 { if (Request["Id"] != null) { int id = Convert.ToInt32(Request["Id"]); //还没改 MessageSendBLL.DelMessageSendById(id); sb.Append(GetTran("001590", "邮件修改")); } else { Response.Cache.SetExpires(DateTime.Now); Permissions.CheckManagePermission(EnumCompanyPermission.ManageMessage); sb.Append(GetTran("001592", "邮件发送")); } MessageSendModel messagesend = new MessageSendModel(); //邮件保存 messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.LanguageCode = this.DropDownList2.SelectedValue; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.Qishu = CommonDataDAL.getMaxqishu(); messagesend.MessageType = 'm'; messagesend.SetNoCondition(); if (this.RadioBianhao.Checked) //指定了编号 { if (txtBianhao.Text.Trim().Length > 0) { if (!txtBianhao.Text.Trim().Equals("*")) { //验证编号是否存在 string[] strArray = txtBianhao.Text.Trim().Split(new char[] { ',' }); foreach (string strNO in strArray) { if (strNO != "") { int id = Convert.ToInt32(drop_LoginRole.SelectedValue); //验证编号是否存在 if (!MessageSendBLL.CheckNumber(id, strNO)) { Response.Write("<script>alert('" + strNO + GetTran("001584", "不存在") + "');</script>"); return; } } } } } else { ScriptHelper.SetAlert(Page, GetTran("001594", "请输入收件人") + "!!!"); return; } messagesend.Receive = DisposeString.DisString(txtBianhao.Text.Trim()); } else //指定了Range { messagesend.Receive = "*"; //if (this.ChkLevel.Checked) //{ // messagesend.ConditionLevel = Convert.ToInt16(this.DropLevel.SelectedValue); //} if (this.ChkBonus.Checked) { messagesend.ConditionBonusFrom = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); messagesend.ConditionBonusTo = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } if (this.ChkNet.Checked) { messagesend.ConditionRelation = Convert.ToChar(this.DropRelation.SelectedValue); messagesend.ConditionLeader = this.TxtLeader.Text.Trim(); } } if (MessageSendBLL.Addsendaffiche(messagesend)) { sb.Append(GetTran("001600", "成功") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } else { sb.Append(GetTran("001541", "失败") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } } this.txtTitle.Text = ""; this.TextBox1.Text = ""; this.content1.Value = ""; }