Пример #1
0
    protected void btnYEBExpat_Click(object sender, EventArgs e)
    {
        if (Session["yrmo"] != null)
        {
            usryrmo = Session["yrmo"].ToString();
        }

        if (usryrmo != "")
        {
            try
            {
                _counter = ImportYEBData.updateYEBDetailData(usryrmo, "YEBEXPAT");

                if (_counter >= 0)
                {
                    MultiView1.SetActiveView(view_result);
                    lbl_result.Text = "Update completed successfully -- " + _counter + " records updated in YEBDetail";
                }
            }

            catch (Exception ex)
            {
                lbl_error.Text = "Error - " + ex.Message;
            }
        }
    }
Пример #2
0
    //protected void checkPastImport()
    //{
    //    string _yrmo = Session("yrmo"); //ddlYrmo.SelectedItem.Text;
    //    HRAImportDAL iobj = new HRAImportDAL();

    //    if (iobj.PastImport(source, _yrmo))
    //    {
    //        MultiView1.SetActiveView(view_reimport);
    //        lbl_reimport.Text = "Imported already for year-month (YRMO): " + _yrmo + "<br />Do you want to re-import the file?";
    //    }
    //    else
    //    {
    //        MultiView1.SetActiveView(view_main);
    //        //autoImport();
    //    }
    //}
    Boolean ImportFile(string strFilePath1)
    {
        string         _yrmo       = Session["yrmo"].ToString(); //ddlYrmo.SelectedItem.Text;
        string         logFilePath = Server.MapPath("~/uploads/") + "YEB_Online_" + _yrmo + ".xls";
        bool           importStat  = false;
        ImportYEBData  iObj        = new ImportYEBData();
        HRAExcelImport tObj        = new HRAExcelImport();
        DataTable      dtYEBOL;
        DataSet        ds = new DataSet(); ds.Clear();

        ds      = tObj.getExcelData(strFilePath1, "YEBOLTable");
        dtYEBOL = ds.Tables["YEBOLTable"];
        if (dtYEBOL.Rows.Count > 0)
        {
            ImportYEBData.Rollback(source, _yrmo);
            ImportYEBData.PrintOLProgressBar();
            //http://www.eggheadcafe.com/articles/20051223.asp

            _counter = iObj.insertYEBOLData(dtYEBOL);
            Thread.Sleep(2000);
            ImportYEBData.ClearProgressBar(_counter);
            //Now update the YEbDetailtable with the matches
            //found in the YEBOnline table
            ImportYEBData.updateYEBDetailData(_yrmo, "YEBOL");
        }

        if (File.Exists(logFilePath))
        {
            File.Delete(logFilePath);
        }

        importStat = true;

        Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1;
        Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "YEB", "ImportSourceFile", "YEB_ONLINE", "YEBOL Import", _yrmo, _counter);

        return(importStat);
    }