protected void btn_import_Click(object sender, EventArgs e) { string strFilePath1 = ""; lbl_error.Text = ""; lbl_result.Text = ""; string _yr = txtTempPlanYearImp.Text; if (FileUpload1.GotFile && Page.IsValid) { try { bool _pycheck = BenhierDAL.checkRatePY(_yr); if (!_pycheck) { string fn = System.IO.Path.GetFileName(FileUpload1.FilePost.FileName); if (fn.Contains(_yr)) { strFilePath1 = Server.MapPath("~/uploads/") + fn; if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } FileUpload1.FilePost.SaveAs(strFilePath1); int _cnt = IPBAImport.importRatesTemplate(strFilePath1, _yr); lbl_result.Text = "Imported Rates successfully for year - " + _yr; Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskINRC(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "IPBA", "New Rates Import", "Rates", "New Rates", _yr, _cnt); } else { throw (new Exception("File Plan year doesn't match with entered Plan year!")); } } else { throw (new Exception("Rates for the entered Plan Year already defined!")); } } catch (Exception ex) { lbl_error.Text = "Error in importing file. " + ex.Message; } finally { FileUpload1.FilePost.InputStream.Flush(); FileUpload1.FilePost.InputStream.Close(); FileUpload1.FilePost.InputStream.Dispose(); if (File.Exists(strFilePath1)) { File.Delete(strFilePath1); } } } }
protected void ddlYrmoList() { string prevYRMO; for (int i = 0; i < 6; i++) { prevYRMO = IPBAImport.getPrevYRMO(i); ddlYrmo.Items.Add(prevYRMO); } ddlYrmo.Items.Add("New Yrmo"); }
protected bool ImportFile(string strFilePath1, string yrmo) { bool _success = false; try { int _cnt = IPBAImport.importGreenBarDetail(yrmo, strFilePath1); Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1; Audit.auditUserTaskINRC(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "IPBA", "Insured Plans Billings & Adjustments", "HTH_HMO_Billing", "Greenbar Report Import", yrmo, _cnt); _success = true; } catch (Exception ex) { throw ex; } return(_success); }