public void updateHead(T_PaymentIndecreaseHead item)
 {
     Manager.updateHead(item);
 }
    protected void add_Click(object sender, EventArgs e)
    {
        //表头
        T_PaymentIndecreaseHead head = new T_PaymentIndecreaseHead();

        head.AgentDate   = DateTime.Parse(agent_date.Text);
        head.BillNo      = bill_no.Text;
        head.Customer    = customer.Text;
        head.Agenter     = agent_name.Text;
        head.CheckStatus = 0;
        head.CurrencyID  = ddl_currency.SelectedValue;
        decimal        amount_all = 0;
        PaymentAdapter raa        = new PaymentAdapter();

        DataSet ds = raa.getSupplierInfoByName(head.Customer);

        if (ds.Tables[0].Rows.Count > 0)
        {
            head.CustomerID = Int32.Parse(ds.Tables[0].Rows[0]["FNumber"].ToString());
            head.ItemID     = Int32.Parse(ds.Tables[0].Rows[0]["FItemID"].ToString());
        }
        else
        {
            Label1.Text = "供应商姓名请输入关键字后从下拉框选择!";
            return;
        }
        //表体
        DataTable dt = DefineDataTableSchema(hfRptColumns.Value);

        foreach (RepeaterItem item in rptTest.Items)
        {
            DataRow newRow = dt.NewRow();

            string name = ((TextBox)item.FindControl("txt_name")).Text;
            if (string.IsNullOrEmpty(name))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string amount = ((TextBox)item.FindControl("txt_amount")).Text;
            if (string.IsNullOrEmpty(amount))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string apply_date = ((TextBox)item.FindControl("cb_apply_date")).Text;
            if (string.IsNullOrEmpty(apply_date))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string type = ((DropDownList)item.FindControl("ddl_type")).SelectedValue;
            if (string.IsNullOrEmpty(type))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            newRow["g_no"]       = ((TextBox)item.FindControl("txt_g_no")).Text;
            newRow["name"]       = name;
            newRow["amount"]     = amount;
            newRow["apply_date"] = apply_date;
            newRow["type"]       = type;
            if (type == "R")
            {
                amount_all += Decimal.Parse(amount) * -1;
            }
            else
            {
                amount_all += Decimal.Parse(amount);
            }
            newRow["note"]    = ((TextBox)item.FindControl("txt_note")).Text;;
            newRow["bill_no"] = bill_no.Text;
            dt.Rows.Add(newRow);
        }

        head.AmountAll = amount_all;
        try
        {
            PaymentInDecreaseAdapter ida = new PaymentInDecreaseAdapter();
            ida.insertInDecreaseList(dt);
            ida.addInDecreaseHead(head);
            clean();
            Label1.Text = "哟,小伙子,不错,被你录入成功了";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
 public void addInDecreaseHead(T_PaymentIndecreaseHead head)
 {
     Manager.addInDecreaseHead(head);
 }