我需要在记录导入次数中选择单个记录

时间:2016-04-14 09:44:30

标签: c# asp.net

<asp:Panel ID="panelPriorYearImport" runat="server" Style="height: 200px; width: 450px;
                                                           border: 13px solid skyblue; display: none; background-color: Silver">
  <div style="width: 80%; margin-left: 10%; margin-top: 25px;">
    From which tax year you want to import vehicle information?
    <br />
    <asp:RadioButtonList ID="rbl_prior_yrs" runat="server" RepeatDirection="Horizontal">
      <asp:ListItem Text="2014" Value="2014" Selected="True"></asp:ListItem>
      <asp:ListItem Text="2013" Value="2013"></asp:ListItem>
      <asp:ListItem Text="2012" Value="2012"></asp:ListItem>                    
    </asp:RadioButtonList>
    <br />
    After importing you can edit or remove the vehicles.
    <div style="text-align: center; padding-top: 25px;">
      <asp:Button ID="btnPriorYrVehImport_Cancel" runat="server" CssClass="btnGray" Text="Cancel"
                  OnClick="btnPriorYrVehImport_Click" CausesValidation="false" Style="height: 30px;
                                                                                      width: 100px; margin-right: 20px;" />
      <asp:Button ID="btnPriorYrVehImport" runat="server" CssClass="btnBlue" Text="Import"
                  OnClick="btnPriorYrVehImport_Click" CausesValidation="false" Style="height: 30px;
                                                                                      width: 100px" />
    </div>
  </div>
</asp:Panel>

上面的代码是显示模态窗口。如果单击“导入”按钮,则会导入数据。后端代码是

Vehicle objVehicle = new Vehicle();
objVehicle.BusinessKey = Convert.ToString(Session["BUSINESS_KEY"]);
objVehicle.TaxYear = Convert.ToInt16(rbl_prior_yrs.SelectedItem.Value);
objVehicle.VehicleCategory = "T";

BAL_Vehicles objVehiclesOperation = new BAL_Vehicles();

DataTable ldtTaxableVeh = objVehiclesOperation.GetPriorYearVehicle(objVehicle);

#region TAXABLE VEHICLES FROM PRIOR YEAR FILING
try
{
    if (ldtTaxableVeh == null)
        CreateStructureTaxableVeh(ref ldtTaxableVeh);
    else
    {
        ldtTaxableVeh.Columns["weight_current"].ColumnName = "weight_category";
        ldtTaxableVeh.Columns["tax_amt"].ColumnName = "tax_amount";
        ldtTaxableVeh.Columns.Add(new DataColumn("weight", typeof(string)));

        foreach (DataRow ldr in ldtTaxableVeh.Rows)
            ldr["weight"] = ddlWeight.Items.FindByValue(ldr["weight_category"].ToString()).Text;
    }

    ldtTaxableVeh.PrimaryKey = new DataColumn[] { ldtTaxableVeh.Columns["vin"] };

    Session["TAX_AMOUNT"] = "0";
    if (ldtTaxableVeh.Rows.Count > 0)
    {
        RecalculateAmount(ref ldtTaxableVeh);

        foreach (DataRow ldr in ldtTaxableVeh.Rows)
            Session["TAX_AMOUNT"] = Convert.ToDecimal(Session["TAX_AMOUNT"]) + Convert.ToDecimal(ldr["tax_amount"]);
    }
}
catch { }

导入数据后,我只需要选择一个数据请帮助

0 个答案:

没有答案