Beispiel #1
0
    protected void btn_importLOA_Click(object sender, EventArgs e)
    {
        DataTable     dtLOA;
        ImportYEBData iObj = new ImportYEBData();

        if (Session["yrmo"] != null)
        {
            usryrmo = Session["yrmo"].ToString();
        }

        if (Session["pilotind"] != null)
        {
            pilotind = Session["pilotind"].ToString();
        }
        status = "EBALOA";

        if (pilotind != "" && status != "")
        {
            try
            {
                //Delete any previously imported data for the specified YRMO and criteria
                ImportYEBData.Rollback("LOA" + pilotind, usryrmo);
                //retrieve the datatable for the criteria specified based on status
                dtLOA = ImportYEBData.getYEBEmployeesbyStatus(pilotind, status.Substring(3, 3)).Tables[0];
                if (dtLOA.Rows.Count > 0)
                {
                    ImportYEBData.PrintLOAProgressBar();
                    _counter = iObj.insertYEB_ACT_LOA_Data(dtLOA, usryrmo, pilotind, src, status);
                    ImportYEBData.ClearProgressBar(_counter);
                    if (_counter > 0)
                    {
                        MultiView1.SetActiveView(view_result);
                        lbl_result.Text = "Import completed successfully -- " + _counter + " records imported";
                    }
                }
            }
            catch (Exception ex)
            {
                //resultDiv.Visible = false;
                //ImportYEBData iObj = new ImportYEBData();
                ImportYEBData.Rollback("LOA" + pilotind, usryrmo);
                lbl_error.Text = "Error - " + ex.Message;
            }
        }
    }