protected void Btn_UpAll_Click(object sender, EventArgs e)
    {
        ExpressCarriageService      ecDal = new ExpressCarriageService();
        IList <ExpressCarriageInfo> list  = new List <ExpressCarriageInfo>();
        string nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);

        foreach (RepeaterItem item in Rpt_ExpressCarriage.Items)
        {
            TextBox             tb   = (TextBox)item.FindControl("Tb_Carri");
            Label               lb   = (Label)item.FindControl("Lbl_Id");
            Label               lbc  = (Label)item.FindControl("Lbl_Carri");
            ExpressCarriageInfo info = new ExpressCarriageInfo();
            info.ID       = new Guid(lb.Text);
            info.Carriage = decimal.Parse(lbc.Text);
            try
            {
                info.Carriage = decimal.Parse(tb.Text);
            }
            catch (Exception ex)
            {
            }
            list.Add(info);
        }

        foreach (ExpressCarriageInfo info in list)
        {
            ecDal.UpdateExpressCarriageInfo(info.ID, info.Carriage);
        }

        IList <ExpressCarriageInfo> ecList = ecDal.GetAllExpressCarriageInfo(nick);

        Rpt_ExpressCarriage.DataSource = ecList;
        Rpt_ExpressCarriage.DataBind();
    }
    private void Bind()
    {
        int TotalCount = 0; //总记录数
        int TotalPage  = 1; //总页数

        int page = 1;

        try
        {
            page = int.Parse(Request.QueryString["Page"]);
            if (ViewState["page"] != null)
            {
                page = int.Parse(ViewState["page"].ToString());
                ViewState["page"] = null;
            }
        }
        catch { }

        string nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
        IList <ExpressCarriageInfo> ecList = ecDal.GetAllExpressCarriageInfo(nick);

        TotalCount      = ecList.Count;
        pds.DataSource  = ecList;
        pds.AllowPaging = true;
        pds.PageSize    = 15;

        if (TotalCount == 0)
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalCount % pds.PageSize == 0)
            {
                TotalPage = TotalCount / pds.PageSize;
            }
            else
            {
                TotalPage = TotalCount / pds.PageSize + 1;
            }
        }

        pds.CurrentPageIndex = page - 1;
        lblCurrentPage.Text  = "共" + TotalCount.ToString() + "条记录 当前页:" + page + "/" + TotalPage;

        lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
        if (!pds.IsFirstPage)
        {
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page - 1);
        }

        if (!pds.IsLastPage)
        {
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page + 1);
        }
        lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + TotalPage;

        Rpt_ExpressCarriage.DataSource = pds;
        Rpt_ExpressCarriage.DataBind();
    }
    protected void Btn_Ok_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(ddl_City.SelectedValue))
        {
            Page.RegisterStartupScript("error", "<script>alert('请选择城市');</script>");
            return;
        }

        ExpressCarriageService ecDal = new ExpressCarriageService();
        ExpressCarriageInfo    info  = new ExpressCarriageInfo();

        info.CityId     = new Guid(ddl_City.SelectedValue);
        info.ExpressId  = new Guid(ddl_Express.SelectedValue);
        info.ProvinceId = new Guid(ddl_Pr.SelectedValue);
        info.Goods      = int.Parse(Rbl_Huo.SelectedValue);

        info.Nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
        try
        {
            info.Carriage = decimal.Parse(TB_Carriage.Text);
        }
        catch (Exception ex)
        {
        }

        ExpressCarriageInfo hadinfo = ecDal.GetExpressCarriageInfo(info.Nick, info.CityId, info.ExpressId, info.ProvinceId);

        if (hadinfo == null)
        {
            info.ID = Guid.NewGuid();
            ecDal.AddExpressCarriage(info);
        }
        else
        {
            ecDal.UpdateExpressCarriageInfo(hadinfo.ID, info.Carriage);
        }

        IList <ExpressCarriageInfo> ecList = ecDal.GetAllExpressCarriageInfo(info.Nick);

        Rpt_ExpressCarriage.DataSource = ecList;
        Rpt_ExpressCarriage.DataBind();
    }