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; } } }
//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); }