示例#1
0
    protected void Add_blackList_Click(object sender, EventArgs e)
    {
        //验证用户填写黑名单店铺
        if (txtStoreID.Text == "")
        {
            //提示用户填写
            ScriptHelper.SetAlert(out msg, GetTran("001393", "必须提供店铺编号!"));
            this.txtStoreID.Focus();
            return;
        }
        //判断当前编号是否存在
        if (BlackListBLL.CheckStoreID(txtStoreID.Text))
        {
            ScriptHelper.SetAlert(out msg, GetTran("001391", "提供店铺编号在该系统中不存在!"));
            return;
        }
        //判断是否已经存在该黑名单IP 3代表IP类型
        if (BlackListBLL.HasBlackList(txtStoreID.Text.Trim(), 4, 0))
        {
            //提示已经存在,无需填写
            ScriptHelper.SetAlert(out msg, GetTran("001390", "指定的店铺编号已经存在,无法增加!"));
            this.txtStoreID.Text = "";
            return;
        }
        BlacklistModel blackListModel = new BlacklistModel();

        //店铺类型类型
        blackListModel.UserType  = 4;
        blackListModel.UserID    = txtStoreID.Text;
        blackListModel.OperateBH = Session["Company"].ToString();

        blackListModel.OperateIP = Request.UserHostAddress.ToString();
        blackListModel.GroupID   = 0;
        blackListModel.BlackDate = DateTime.Now;
        switch (BlackListBLL.AddBlackList(blackListModel))
        {
        case 1:
            ScriptHelper.SetAlert(out msg, GetTran("000891", "添加成功!"));
            break;

        case -1:
            ScriptHelper.SetAlert(out msg, GetTran("001087", "执行发生错误!"));
            break;

        default:
            ScriptHelper.SetAlert(out msg, GetTran("001089", "数据异常"));
            break;
        }
        this.txtStoreID.Text = "";
        PageSet();
        Translations();
    }
    /// <summary>
    /// 加入黑名单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Add_blackList_Click(object sender, EventArgs e)
    {
        string storeId = txtStoreID.Text.Trim();

        //验证用户填写黑名单店铺管辖
        if (storeId == "")
        {
            //提示用户填写
            ScriptHelper.SetAlert(out msg, GetTran("001417", "必须提供管辖店铺编号!"));
            this.txtStoreID.Focus();
            return;
        }
        //验证黑名单店铺管辖合法性
        if (BlackListBLL.CheckStoreID(storeId))
        {
            //提示无效
            ScriptHelper.SetAlert(out msg, GetTran("001415", "必须提供有效的管辖店铺编号!"));
            this.txtStoreID.Text = "";
            this.txtStoreID.Focus();
            return;
        }
        //判断是否已经存在该黑名单店铺管辖 3代表店铺管辖类型
        if (BlackGroupBLL.HasBlackGroup(storeId, 4))
        {
            //提示已经存在,无需填写
            ScriptHelper.SetAlert(out msg, GetTran("001412", "指定的管辖店铺已经存在,无法增加!"));
            this.txtStoreID.Text = "";
            return;
        }
        BlackGroupModel blackGroup = new BlackGroupModel();

        //店铺管辖类型
        blackGroup.IntGroupType  = 4;
        blackGroup.IntGroupValue = storeId;
        string operateIP  = Request.UserHostAddress.ToString();
        string operateNum = Session["Company"].ToString();

        switch (BlackGroupBLL.AddBlackGroup(blackGroup, operateIP, operateNum))
        {
        case 1:
            ScriptHelper.SetAlert(out msg, GetTran("000891", "添加成功!"));
            break;

        default:
            ScriptHelper.SetAlert(out msg, GetTran("001087", "执行发生错误"));
            break;
        }
        this.txtStoreID.Text = "";
        PageSet();
        Translations();
    }