Beispiel #1
0
        /// <summary>
        /// 分页获取黑名单组信息
        /// </summary>
        /// <param name="pageInfo"></param>
        /// <param name="tableName"></param>
        /// <param name="columns"></param>
        /// <param name="condition"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static IList <BlackGroupModel> GetBlackGroups(Model.Other.PaginationModel pageInfo, string tableName, string columns, string condition, string key)
        {
            SqlParameter[] ps = new SqlParameter[]
            {
                new SqlParameter("@tableName", tableName),
                new SqlParameter("@key", key),
                new SqlParameter("@comlums", columns),
                new SqlParameter("@condition", condition),
                new SqlParameter("@start", pageInfo.GetPageDate()),
                new SqlParameter("@end", pageInfo.GetEndDate()),
                new SqlParameter("@DataCount", pageInfo.DataCount)
            };
            ps[6].Direction = ParameterDirection.Output;
            ps[6].Size      = 10;
            SqlDataReader           reader = DBHelper.ExecuteReader("GetDataPagePagination", ps, CommandType.StoredProcedure);
            IList <BlackGroupModel> blacks = null;

            if (reader.HasRows)
            {
                blacks = new List <BlackGroupModel>();
                while (reader.Read())
                {
                    BlackGroupModel black = new BlackGroupModel(reader.GetInt32(0));
                    black.IntGroupType  = reader.GetInt32(1);
                    black.IntGroupValue = reader.GetString(2);
                    blacks.Add(black);
                }
                reader.NextResult();
                pageInfo.DataCount = Convert.ToInt32(ps[6].Value.ToString());
            }
            reader.Close();
            return(blacks);
        }
Beispiel #2
0
    /// <summary>
    /// 加入黑名单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Add_blackList_Click(object sender, EventArgs e)
    {
        //验证用户填写黑名单区域管辖
        string country = CountryCity1.Country;
        string p       = CountryCity1.Province;
        string city    = CountryCity1.City;
        string xian    = CountryCity1.Xian;

        if (!this.CountryCity1.CheckFill())
        {
            ScriptHelper.SetAlert(out msg, GetTran("000886", "必须提供有效的区域"));
            CountryCity1.SelectCountry(country, p, city, xian);
            return;
        }
        string area = country + "," + p + "," + city + "," + xian;

        area = area.Replace(" ", "");
        string[] areas = area.Split(',');
        if (areas.Length != 4)
        {
            ScriptHelper.SetAlert(out msg, GetTran("000887", "必须提供有效的区域!"));
            CountryCity1.SelectCountry(country, p, city, xian);
            return;
        }
        //判断是否已经存在该黑名单区域管辖 3代表区域管辖类型
        string cpcode = CommonDataDAL.GetCPCCode(country, p, city, xian);

        if (BlackGroupBLL.HasBlackGroup(cpcode, 3))
        {
            //提示已经存在,无需填写
            ScriptHelper.SetAlert(out msg, GetTran("000890", "指定的黑名单区域已经存在,无法增加!"));
            CountryCity1.SelectCountry(country, p, city, xian);
            return;
        }
        BlackGroupModel blackGroup = new BlackGroupModel();

        //区域管辖类型
        blackGroup.IntGroupType  = 3;
        blackGroup.IntGroupValue = cpcode;
        string operateIP  = Request.UserHostAddress.ToString();
        string operateNum = Session["Company"].ToString();

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

        default:
            ScriptHelper.SetAlert(out msg, GetTran("000893", "执行发生错误"));
            break;
        }
    }
    /// <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();
    }
Beispiel #4
0
    /// <summary>
    /// 加入黑名单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Add_blackList_Click(object sender, EventArgs e)
    {
        //验证用户填写黑名单网络团队
        if (txtNumber.Text == "")
        {
            //提示用户填写
            ScriptHelper.SetAlert(out msg, GetTran("001343", "必须提供网络关系编号!"));
            this.txtNumber.Focus();
            return;
        }
        //验证黑名单网络团队合法性
        if (registermemeberBLL.CheckNumberTwice(txtNumber.Text) == null)
        {
            //提示无效
            ScriptHelper.SetAlert(out msg, GetTran("001347", "必须提供有效的网络关系编号!"));
            this.txtNumber.Text = "";
            this.txtNumber.Focus();
            return;
        }
        //判断是否已经存在该黑名单网络团队 3代表网络团队类型
        if (BlackGroupBLL.HasBlackGroup(txtNumber.Text, (this.radlnetWorkType.SelectedIndex == 0?5:6)))
        {
            //提示已经存在,无需填写
            ScriptHelper.SetAlert(out msg, GetTran("001350", "指定的网络关系已经存在,无法增加!"));
            this.txtNumber.Text = "";
            return;
        }
        BlackGroupModel blackGroup = new BlackGroupModel();

        //网络团队类型
        blackGroup.IntGroupType  = (this.radlnetWorkType.SelectedIndex == 0 ? 5 : 6);
        blackGroup.IntGroupValue = txtNumber.Text;
        string operateIP  = Request.UserHostAddress.ToString();
        string operateNum = Session["Company"].ToString();

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

        default:
            ScriptHelper.SetAlert(out msg, GetTran("001087", "执行发生错误"));
            break;
        }
        this.txtNumber.Text = "";
        PageSet();
        Translations();
    }
Beispiel #5
0
 /// <summary>
 /// 存储当前黑名单组
 /// </summary>
 /// <param name="blackGroup">黑名单组类型</param>
 /// <returns>执行结果</returns>
 public static int AddBlackGroup(BlackGroupModel blackGroup, string operateIP, string operateNum)
 {
     return(BlackGroupDAL.AddBlackGroup(blackGroup, operateIP, operateNum));
 }
Beispiel #6
0
        /// <summary>
        /// 添加黑名单组到数据库
        /// </summary>
        /// <param name="blackGroup">黑名单组</param>
        /// <param name="operateIP">操作人IP</param>
        /// <param name="operateNum">操作人编号</param>
        /// <returns></returns>
        public static int AddBlackGroup(BlackGroupModel blackGroup, string operateIP, string operateNum)
        {
            if (blackGroup.IntGroupType == 3)
            {
                //保存区域黑名单组
                SqlParameter[] paras = new SqlParameter[] {
                    new SqlParameter("@GroupValue", blackGroup.IntGroupValue),
                    new SqlParameter("@operateIP", operateIP),
                    new SqlParameter("@operateNum", operateNum)
                };
                object obj = null;
                //保存店辖黑名单组
                try
                {
                    obj = DBHelper.ExecuteScalar("AddAreaBlackGroup", paras, CommandType.StoredProcedure);
                }
                catch (SqlException)
                {
                    return(-2);
                }
                return(1);
            }
            else if (blackGroup.IntGroupType == 4)
            {
                SqlParameter[] paras = new SqlParameter[] {
                    new SqlParameter("@GroupValue", blackGroup.IntGroupValue),
                    new SqlParameter("@operateIP", operateIP),
                    new SqlParameter("@operateNum", operateNum)
                };
                object obj = null;
                //保存店辖黑名单组
                try
                {
                    obj = DBHelper.ExecuteScalar("AddStoreBlackGroup", paras, CommandType.StoredProcedure);
                }
                catch (SqlException)
                {
                    return(-2);
                }
                //if (obj != null)
                //{
                //    return Convert.ToInt32(obj.ToString());
                //}
                //else
                //{
                //    return -3;
                //}
                return(1);
            }
            else if (blackGroup.IntGroupType == 5 || blackGroup.IntGroupType == 6)
            {
                //保存安置网络黑名单组
                //保存推荐网络黑名单组
                object         obj     = null;
                int            groupid = 0;
                SqlParameter[] paras   = new SqlParameter[] {
                    new SqlParameter("@GroupValue", blackGroup.IntGroupValue),
                    new SqlParameter("@GroupType", blackGroup.IntGroupType)
                };
                SqlConnection conn = new SqlConnection(DBHelper.connString);
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string sql = "insert into blackgroup values(@GroupValue,@GroupType)";
                    DBHelper.ExecuteNonQuery(sql, paras, CommandType.Text);
                    paras = new SqlParameter[] {
                        new SqlParameter("@GroupValue", blackGroup.IntGroupValue),
                        new SqlParameter("@GroupType", blackGroup.IntGroupType)
                    };
                    sql = "select id from BlackGroup where GroupValue=@GroupValue and GroupType=@GroupType";
                    obj = DBHelper.ExecuteScalar(sql, paras, CommandType.Text);
                    if (obj == null)
                    {
                        tran.Rollback();
                        return(-2);
                    }
                    groupid = int.Parse(obj.ToString());
                    AddBlackList(tran, blackGroup.IntGroupValue, blackGroup.IntGroupType, operateIP, operateNum, groupid);

                    ///////限制该会员登录
                    BlacklistModel blackListModel = new BlacklistModel();
                    blackListModel.UserType  = 0;
                    blackListModel.UserID    = blackGroup.IntGroupValue;
                    blackListModel.OperateBH = operateNum;
                    blackListModel.OperateIP = operateIP;
                    blackListModel.GroupID   = groupid;
                    blackListModel.BlackDate = DateTime.Now.ToUniversalTime();
                    AddBlackList(tran, blackListModel, "AddBlackList");
                    tran.Commit();
                }
                catch (SqlException)
                {
                    tran.Rollback();
                    DelBlackGroup(groupid, blackGroup.IntGroupType);
                    return(-2);
                }
                finally
                {
                    conn.Close();
                }
                return(1);
            }
            else
            {
                //数据异常
                return(-3);
            }
        }