protected void UploadButton_Click(object sender, EventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { EmployerVisitDO objEmployerVisitDO = new EmployerVisitDO(); objEmployerVisitDO.CaseID = txtCaseID.Text; objEmployerVisitDO.CompanyID = txtCompanyID.Text; objEmployerVisitDO.CompanyName = txtCompanyName.Text; objEmployerVisitDO.UserID = txtUserID.Text; objEmployerVisitDO.UserName = txtUserName.Text; objEmployerVisitDO.VisitId = txtVisitId.Text; objEmployerVisitDO.FileName = ReportUpload.FileName; EmployerBO objEmployerBO = new EmployerBO(); string sPath = objEmployerBO.SaveVisitDocument(objEmployerVisitDO); string sBasePath = ConfigurationManager.AppSettings["BASEPATH"].ToString(); if (!Directory.Exists(sBasePath + sPath)) { Directory.CreateDirectory(sBasePath + sPath); } if (sPath != "") { ReportUpload.SaveAs(sBasePath + sPath + ReportUpload.FileName); lblmsg.Text = "File saved successfully"; lblmsg.Visible = true; } else { lblmsg.Text = "unable to save file"; lblmsg.Visible = true; } } catch (Exception ex) { lblmsg.Text = ex.ToString(); lblmsg.Visible = true; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void btn_update_Click(object sender, EventArgs e) { ReportObject reportObj = new ReportObject(); reportObj.ReportId = int.Parse(Session["Report_id"].ToString()); DataTable dt = dal.SelectInformationById(reportObj.ReportId); reportObj.ReportTitle = tbxReportTitle.Text; reportObj.UserId = Int32.Parse(Session["user_id"].ToString()); if (ddlReportStatus.SelectedValue == "1") { reportObj.Status = true; } else if (ddlReportStatus.SelectedValue == "0") { reportObj.Status = false; } if (ReportUpload.HasFile) { string extension = Path.GetExtension(ReportUpload.FileName); string reportpath = Guid.NewGuid().ToString() + extension; string uploadFolder = "~/Report_Files/"; ReportUpload.SaveAs(Server.MapPath(uploadFolder + reportpath)); reportObj.ReportPath = reportpath; } else { reportObj.ReportPath = dt.Rows[0]["ReportPath"].ToString(); } try { int result = dal.UpdateInformation(reportObj); if (result == 1) { SuccessPanel.Visible = true; } else { DangerPanel.Visible = true; } } catch { throw; } }
protected void UploadButton_Click(object sender, EventArgs e) {//Logging Start string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { if ((Session["UploadReport_DoctorId"] != null) && (Session["UploadReport_VisitType"] != null) && (Session["UploadReport_EventId"] != null) && (Session["UploadReport_ProcedureGroupId"] != null)) { if ((Session["UploadReport_DoctorId"].ToString() != "") && (Session["UploadReport_VisitType"].ToString() != "") && (Session["UploadReport_ProcedureGroupId"].ToString() != "") && (Session["UploadReport_EventId"].ToString() != "")) { Bill_Sys_Upload_VisitReport _bill_Sys_Report_Upload = new Bill_Sys_Upload_VisitReport(); if (ReportUpload.HasFile) { //check specialty node ArrayList UploadObj = new ArrayList(); UploadObj.Add(((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID.ToString()); UploadObj.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID.ToString()); UploadObj.Add(Session["UploadReport_DoctorId"].ToString()); UploadObj.Add(Session["UploadReport_VisitType"].ToString()); UploadObj.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME.ToString()); UploadObj.Add(ReportUpload.FileName); UploadObj.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); UploadObj.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME.ToString()); UploadObj.Add(Session["UploadReport_EventId"].ToString()); UploadObj.Add(Session["UploadReport_ProcedureGroupId"].ToString()); string Result = _bill_Sys_Report_Upload.Upload_Report_For_Visit(UploadObj); if (Result != "Failed") { if (!(Directory.Exists(Result))) { Directory.CreateDirectory(Result); } ReportUpload.SaveAs(Result + ReportUpload.FileName); Msglbl.Text = "Document Saved Successfully"; } else { Msglbl.Text = "Unable to save the Document"; } } else { Msglbl.Text = "No File Selected"; } } } else { Msglbl.Text = "Doctor or VisitType unknown "; } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void UploadButton_Click(object sender, EventArgs e) { if (ReportUpload.HasFile) { string savePath = null; // Specify the path to save the uploaded file to. if (EmployeeReportsCheck.Checked) { savePath = "C:\\Users\\chinnu\\Desktop\\old\\WebApplication\\WebApplication\\Content\\EmployeeReports\\"; } if (CompanyReportsCheck.Checked) { savePath = "C:\\Users\\chinnu\\Desktop\\old\\WebApplication\\WebApplication\\Content\\CompanyReports\\"; } if (FinanceReportsCheck.Checked) { savePath = "C:\\Users\\chinnu\\Desktop\\old\\WebApplication\\WebApplication\\Content\\FinanceReports\\"; } // Get the name of the file to upload. string fileName = ReportUpload.FileName; // Create the path and file name to check for duplicates. string pathToCheck = savePath + fileName; // Create a temporary file name to use for checking duplicates. string tempfileName = ""; // Check to see if a file already exists with the // same name as the file to upload. if (System.IO.File.Exists(pathToCheck)) { int counter = 2; while (System.IO.File.Exists(pathToCheck)) { // if a file with this name already exists, // prefix the filename with a number. tempfileName = fileName + counter.ToString(); pathToCheck = savePath + tempfileName; counter++; } fileName = tempfileName; // Notify the user that the file name was changed. Message.Text = "A file with the same name already exists.Your file was saved as " + fileName; } else { // Notify the user that the file was saved successfully. //UploadStatusLabel.Text = "Your file was uploaded successfully."; Response.Write("<script>alert('Your file was uploaded successfully.')</script>"); } // Append the name of the file to upload to the path. savePath += fileName; // Call the SaveAs method to save the uploaded // file to the specified directory. ReportUpload.SaveAs(savePath); } else { Response.Write("<script>alert('You did not specify a file to upload')</script>"); } }