/// <summary>
        /// 为用户设置 PF 的邮费类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_set_pf_rate_Click(object sender, EventArgs e)
        {
            string username = Request.Form["username"];
            string ratetype = Request.Form["pfrate"];

            int flag = new SetPFIPECollectionRateForUserDAO().setRateForUser(username, ratetype, staffname);

            if (flag == 1)
            {
                alert("更新成功!!");
            }
            else if (flag == 2)
            {
                alert("更新失败!!");
            }
            else if (flag == 3)
            {
                alert("设置成功!!!");
            }
            else if (flag == 4)
            {
                alert("设置失败!!!");
            }

            pageNow         = 1;
            rate_count      = new SetPFIPECollectionRateForUserDAO().getUserRateCount();
            rate_page_count = new SetPFIPECollectionRateForUserDAO().getPageCount(rate_count, pageSize);
            initUserHasDiscountDataList(pageNow, pageSize);
        }
        /// <summary>
        /// 分页创建 用户邮费表
        /// </summary>
        /// <param name="pageNow">当前页</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <returns></returns>
        public DataTable createUserRateTable(int pageNow, int pageSize)
        {
            DataTable table = new DataTable();

            DataColumn dc = new DataColumn("name", typeof(string));

            table.Columns.Add(dc);

            dc = new DataColumn("type", typeof(string));
            table.Columns.Add(dc);

            dc = new DataColumn("seter", typeof(string));
            table.Columns.Add(dc);

            dc = new DataColumn("time", typeof(string));
            table.Columns.Add(dc);


            DataTable staffTable = new SetPFIPECollectionRateForUserDAO().getUserRate(pageNow, pageSize);

            for (int i = 0; i < staffTable.Rows.Count; i++)
            {
                DataRow dr = table.NewRow();
                dr["name"]  = staffTable.Rows[i]["username"].ToString();
                dr["type"]  = staffTable.Rows[i]["ratetype"].ToString();
                dr["seter"] = staffTable.Rows[i]["setername"].ToString();
                dr["time"]  = Convert.ToDateTime(staffTable.Rows[i]["settime"].ToString()).ToString("yyyy:MM:dd HH:mm");
                table.Rows.Add(dr);
            }

            return(table);
        }
        protected void check_rate_Click(object sender, EventArgs e)
        {
            initArray();

            string name = Request.Form["username"];

            username = name;
            UserRate emsRate = new SetEMSRateForUserDAO().getUserRate(name);

            if (emsRate == null)
            {
                emsRate          = new UserRate();
                emsRate.Name     = name;
                emsRate.Ratetype = "rate1";
            }
            type.Add(emsRate.Ratetype);

            UserRate postnlRate = new SetPostNLRateForUserDAO().getUserRate(name);

            if (postnlRate == null)
            {
                postnlRate          = new UserRate();
                postnlRate.Name     = name;
                postnlRate.Ratetype = "rate22";
            }
            type.Add(postnlRate.Ratetype);

            UserRate pfgprcRate = new SetPFGPRCRateForUserDAO().getUserRate(name);

            if (pfgprcRate == null)
            {
                pfgprcRate          = new UserRate();
                pfgprcRate.Name     = name;
                pfgprcRate.Ratetype = "rate1";
            }
            type.Add(pfgprcRate.Ratetype);

            UserRate pfgprdRate = new SetPFGPRDRateForUserDAO().getUserRate(name);

            if (pfgprdRate == null)
            {
                pfgprdRate          = new UserRate();
                pfgprdRate.Name     = name;
                pfgprdRate.Ratetype = "rate1";
            }
            type.Add(pfgprdRate.Ratetype);

            UserRate pfipecRate = new SetPFIPECollectionRateForUserDAO().getUserRate(name);

            if (pfipecRate == null)
            {
                pfipecRate          = new UserRate();
                pfipecRate.Name     = name;
                pfipecRate.Ratetype = "rate1";
            }
            type.Add(pfipecRate.Ratetype);

            UserRate pfipedRate = new SetPFIPEDepotRateForUserDAO().getUserRate(name);

            if (pfipedRate == null)
            {
                pfipedRate          = new UserRate();
                pfipedRate.Name     = name;
                pfipedRate.Ratetype = "rate1";
            }
            type.Add(pfipedRate.Ratetype);

            UserRate pfipepRate = new SetPFIPEPolRateForUserDAO().getUserRate(name);

            if (pfipepRate == null)
            {
                pfipepRate          = new UserRate();
                pfipepRate.Name     = name;
                pfipepRate.Ratetype = "rate1";
            }
            type.Add(pfipepRate.Ratetype);

            UserRate pfipetRate = new SetPFIPETrailerRateForUserDAO().getUserRate(name);

            if (pfipetRate == null)
            {
                pfipetRate          = new UserRate();
                pfipetRate.Name     = name;
                pfipetRate.Ratetype = "rate1";
            }
            type.Add(pfipetRate.Ratetype);

            string    sql      = "select " + emsRate.Ratetype + " from tb_rate_ems";
            DataTable emstable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < emstable.Rows.Count; i++)
            {
                emsArray.Add(Math.Round(Convert.ToSingle(emstable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + postnlRate.Ratetype + " from tb_rate_postnl";
            DataTable postnltable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < postnltable.Rows.Count; i++)
            {
                postnlArray.Add(Math.Round(Convert.ToSingle(postnltable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + pfgprcRate.Ratetype + " from tb_rate_pf_gpr_collection";
            DataTable pftable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pftable.Rows.Count; i++)
            {
                pfgprcArray.Add(Math.Round(Convert.ToSingle(pftable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + pfgprdRate.Ratetype + " from tb_rate_pf_gpr_delivery";
            DataTable pfgprdtable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pfgprdtable.Rows.Count; i++)
            {
                pfgprdArray.Add(Math.Round(Convert.ToSingle(pfgprdtable.Rows[i][0].ToString()), 2));
            }


            sql = "select " + pfipecRate.Ratetype + " from tb_rate_pf_ipe_Collection";
            DataTable pfipectable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pfipectable.Rows.Count; i++)
            {
                pfipecArray.Add(Math.Round(Convert.ToSingle(pfipectable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + pfgprdRate.Ratetype + " from tb_rate_pf_ipe_depot";
            DataTable pfipedtable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pfipedtable.Rows.Count; i++)
            {
                pfipedArray.Add(Math.Round(Convert.ToSingle(pfipedtable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + pfgprdRate.Ratetype + " from tb_rate_pf_ipe_pol";
            DataTable pfipeptable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pfipeptable.Rows.Count; i++)
            {
                pfipepArray.Add(Math.Round(Convert.ToSingle(pfipeptable.Rows[i][0].ToString()), 2));
            }

            sql = "select " + pfgprdRate.Ratetype + " from tb_rate_pf_ipe_trailer";
            DataTable pfipettable = new DBOperateCommon().excuteQuery(sql);

            for (int i = 0; i < pfipettable.Rows.Count; i++)
            {
                pfipetArray.Add(Math.Round(Convert.ToSingle(pfipettable.Rows[i][0].ToString()), 2));
            }

            user_rate_info.Visible = true;
        }