public User_Defaults(User User) { queries = new Queries2(); UserId = User.UserID; List <string> strs = queries.User_Defaults(UserId); TimesheetCode = queries.TimesheetCode(strs[0]); TaskType = strs[1]; Project = queries.Project(strs[2]); userDefault4 = strs[3]; userDefault5 = strs[4]; userDefault6 = strs[5]; userDefault7 = strs[6]; userDefault8 = strs[7]; userDefault9 = strs[8]; userDefault10 = strs[9]; userDefault11 = strs[10]; userDefault12 = strs[11]; userDefault13 = strs[12]; userDefault14 = strs[13]; userDefault15 = strs[14]; userDefault16 = strs[15]; userDefault17 = strs[16]; userDefault18 = strs[17]; userDefault19 = strs[18]; userDefault20 = strs[19]; }
public TimesheetEntry(User User) { InitializeComponent(); user = User; myConnection = new Connection(); queries = new Queries2(); functions = new Functions(); user_Defaults = new User_Defaults(user); itemsSourceEntriesApproved = new List <Entry>(); LoadConstantsFromDb(); RefreshDGHoursFromClassList(); BindDataGrid(dgHours); BindDataGrid(dgHoursUnapproved); BindDataGrid(dgHoursApproved); BindDataGrid(dgHoursPrevWeek); RefreshDefaultSelections(user_Defaults); hoursMax = 24; hoursMin = 0.5; hoursIncrement = 0.5; txtHours.Text = hoursMin.ToString(); object[] userID = new object[] { "Time Entry for Employee #: ", user.UserID, " - ", user.UserName }; Title = string.Concat(userID); lblSectionDescription.Content = ""; dtpDate.SelectedDate = new DateTime?(DateTime.Now); weekEnding = functions.WeekEnding(DateTime.Now); RefreshDateList(weekEnding); }
public ProjectInfoScreen() { InitializeComponent(); myConnection = new Connection(); queries = new Queries2(); LoadConstantsFromDb(); }
private void show_report() { ReportViewer2.Reset(); DataTable dt = Queries2.flybuygoa(TextBox1.Text, TextBox2.Text, TextBox3.Text); DataTable dt2 = Queries2.Seapdate(TextBox1.Text); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportDataSource rds2 = new ReportDataSource("DataSet2", dt2); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.LocalReport.DataSources.Add(rds2); ReportViewer2.LocalReport.ReportPath = "reports/flybuygoa.rdlc"; ReportParameter[] rptParam = new ReportParameter[] { new ReportParameter("input", TextBox1.Text), new ReportParameter("venue", TextBox2.Text), new ReportParameter("gvenue", TextBox3.Text), }; ReportViewer2.LocalReport.SetParameters(rptParam); ReportViewer2.LocalReport.Refresh(); }
public UserChangePassword(User User) { user = User; queries = new Queries2(); InitializeComponent(); lblUserId.Content = User.UserID; lblUserName.Content = User.UserName; }
protected void Button1_Click(object sender, EventArgs e) { string contractno = Convert.ToString(searchbyTextBox.Text); DataSet ds1 = Queries2.LoadSearchContract(contractno); GridView1.DataSource = ds1; GridView1.DataBind(); }
public Report2(User User) { InitializeComponent(); user = User; queries = new Queries2(); functions = new Functions(); LoadConstantsFromDB(); }
public TimesheetEntry_Edit(Entry entry, TimesheetEntry tsEntry) { this.entry = entry; this.tsEntry = tsEntry; InitializeComponent(); queries = new Queries2(); myConnection = new Connection(); functions = new Functions(); LoadConstantsFromDb(); LoadSelectedEntry(); }
protected void Page_Load(object sender, EventArgs e) { //Button1_Click(Button1, null); // GoogleConnect.ClientId = "606504304030-n75chncdgcj30pkjrtmu6dnscdljb5ol.apps.googleusercontent.com"; //GoogleConnect.ClientSecret = "4ZCzhAAYyWWYCYoY67IWTPKn"; //GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0]; // GoogleConnect.Authorize("profile", "email"); if (!string.IsNullOrEmpty(Request.QueryString["code"])) { string code = Request.QueryString["code"]; string json = GoogleConnect.Fetch("me", code); Class1.GoogleProfile profile = new JavaScriptSerializer().Deserialize <Class1.GoogleProfile>(json); string uemail = TextBox1.Text = profile.Emails.Find(email => email.Type == "ACCOUNT").Value; // profile.DisplayName; //profile.Id; //lblName.Text = profile.DisplayName; string groupid = ""; string title = "", uname = ""; //lblEmail.Text = profile.Emails.Find(email => email.Type == "account").Value; //lblGender.Text = profile.Gender; //lblType.Text = profile.ObjectType; //ProfileImage.ImageUrl = profile.Image.Url; //pnlProfile.Visible = true; //btnLogin.Enabled = false; int user = Queries2.UserExists(uemail); if (user == 1) { uname = Queries2.getusername(uemail); groupid = Queries.GetGroupID(uname); title = Queries.GetTitle(uname); Session["GroupId"] = groupid; Session["username"] = uname; Session["title"] = title; // string office = Queries.GetOffice(uemail); //Session["office"] = office; //Response.Redirect("index.aspx"); Response.Redirect("~/WebSite5/production/Dashboard.aspx"); } else //if (test=="*****@*****.**") { Response.Redirect("~/WebSite5/production/login.aspx"); } } if (Request.QueryString["error"] == "access_denied") { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Access denied.')", true); } Button1_Click(Button1, null); }
public TimesheetApproval_Submission(FivesBronxTimesheetManagement.Classes.User User, TimesheetEntry tsEntryScreen) { InitializeComponent(); queries = new Queries2(); functions = new Functions(); user = User; this.tsEntryScreen = tsEntryScreen; beforeDate = DateTime.Now; RefreshDGHoursFromClassList(); BindDataGrid(); weekEnding = functions.WeekEnding(DateTime.Now); RefreshDateList(weekEnding); }
protected void Button5_Click(object sender, EventArgs e) { var printr = PrintPdfTextBox2.Text; //PrintPdfDropDownList.SelectedItem.Text; //string msg = Server.MapPath("~/reports/" + printr + ".rpt"); //MessageBox.Show("Error while creating profile " + ex.Message); //string msg = "Details updated for Profile :" + " " + profile; // Page.ClientScript.RegisterStartupScript(GetType(), "popup", "alert('" + msg + "');", true); DataTable datatable = Queries2.loadreport((string)Session["GenContNumbglob"], printr, (string)Session["Pofficeo"]); ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report crystalReport.Load(Server.MapPath("~/reports/" + printr + ".rpt")); // path of report crystalReport.SetDataSource(datatable); System.IO.FileStream fs = null; long FileSize = 0; DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); //string ExportFileName = Server.MapPath("~/Copy of holiday_confirm.rpt") + "Export"; string ExportFileName = Server.MapPath("~/reports/" + printr + ".rpt") + "Export"; crystalReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crystalReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oDest.DiskFileName = ExportFileName; crystalReport.ExportOptions.DestinationOptions = oDest; crystalReport.Export(); Response.Clear(); Response.Buffer = true; Response.AddHeader("Content-Type", "application/pdf"); string fn = printr + ".pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=" + fn + ";"); fs = new System.IO.FileStream(ExportFileName, FileMode.Open); FileSize = fs.Length; byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1]; fs.Read(bBuffer, 0, Convert.ToInt32(FileSize)); fs.Close(); Response.BinaryWrite(bBuffer); Response.Flush(); crystalReport.Close(); crystalReport.Dispose(); // Response.Close(); }
private void DeleteEntry() { if (System.Windows.MessageBox.Show("Are you sure you want to delete this Entry?", "Delete Entry?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { try { Queries2 query = queries; string tTimesheetPrelim = queries.t_Timesheet_Prelim; int? entryId = ((Entry)dgHours.SelectedItems[0]).entry_id; query.DeleteTimeEntry(tTimesheetPrelim, entryId.Value); RefreshDGHoursFromClassList(); } catch { } } }
public TimesheetApproval(User User) { this.user = User; this.InitializeComponent(); this.queries = new Queries2(); this.myConnection = new Connection(); this.myFunctions = new Functions(); this.LoadConstantsFromDb(); Label label = this.lblApproverName; int userID = this.user.UserID; label.Content = string.Concat(userID.ToString(), "-", this.user.UserName); this.beforeDate = DateTime.Now; this.dtpEndDate.SelectedDate = new DateTime?(this.beforeDate); this.RefreshDGHoursFromClassList(); this.BindDataGrid(); this.weekEnding = this.myFunctions.WeekEnding(DateTime.Now); this.RefreshDateList(this.weekEnding); }
protected void Button3_Click(object sender, EventArgs e) { DataTable datatable = Queries2.loadregcard(Profile_IDo); var printr = "Guest Reg Form"; ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report crystalReport.Load(Server.MapPath("~/reports/" + printr + ".rpt")); // path of report crystalReport.SetDataSource(datatable); System.IO.FileStream fs = null; long FileSize = 0; DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); //string ExportFileName = Server.MapPath("~/Copy of holiday_confirm.rpt") + "Export"; string ExportFileName = Server.MapPath("~/reports/" + printr + ".rpt") + "Export"; crystalReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crystalReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oDest.DiskFileName = ExportFileName; crystalReport.ExportOptions.DestinationOptions = oDest; crystalReport.Export(); Response.Clear(); Response.Buffer = true; Response.AddHeader("Content-Type", "application/pdf"); string fn = "Guest Reg Form" + ".pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=" + fn + ";"); fs = new System.IO.FileStream(ExportFileName, FileMode.Open); FileSize = fs.Length; byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1]; fs.Read(bBuffer, 0, Convert.ToInt32(FileSize)); fs.Close(); // Response.Write("<script>$(function() {alert('hi'); });</script>"); Response.BinaryWrite(bBuffer); Response.Flush(); // Response.Clear(); }
protected void Button2_Click(object sender, EventArgs e) { // HttpContext tb = HttpContext.Current; string reportName = "DGR"; string reportPro = "DGR"; string date = "2017-12-27"; string office = "HML"; //var printr = PrintPdfDropDownList.SelectedItem.Text; DataTable datatable = Queries2.loadDGR(reportPro, date, office); ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report crystalReport.Load(Server.MapPath("~/reports/" + reportName + ".rpt")); // path of report crystalReport.SetDataSource(datatable); System.IO.FileStream fs = null; long FileSize = 0; DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); //string ExportFileName = Server.MapPath("~/Copy of holiday_confirm.rpt") + "Export"; string ExportFileName = Server.MapPath("~/reports/" + reportName + ".rpt") + "Export"; crystalReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crystalReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oDest.DiskFileName = ExportFileName; crystalReport.ExportOptions.DestinationOptions = oDest; crystalReport.Export(); Response.Clear(); Response.Buffer = true; Response.AddHeader("Content-Type", "application/pdf"); string fn = reportName + ".pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=" + fn + ";"); fs = new System.IO.FileStream(ExportFileName, FileMode.Open); FileSize = fs.Length; byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1]; fs.Read(bBuffer, 0, Convert.ToInt32(FileSize)); fs.Close(); Response.BinaryWrite(bBuffer); Response.Flush(); }
public AdminTools() { InitializeComponent(); queries = new Queries2(); }
public User_CreateEdit() { InitializeComponent(); queries = new Queries2(); functions = new Functions(); }
//static string officeo, GenContNumbglob,globContClub=""; protected void Page_Load(object sender, EventArgs e) { //string user = (string)Session["username"]; //string office = Queries.GetOffice(user); // string resort="", resort1=""; // Session["officeo"] = ""; //Session["officeo"] = office; string user = (string)Session["username"]; // string office = Queries.GetOffice(user); string resort = "", resort1 = ""; // Session["officeo"] = ""; // Session["officeo"] = office; if (user == null) { Response.Redirect("~/WebSite5/production/login.aspx"); } if (!Page.IsPostBack) { //string contractno = "RGC9/271117/114";//.ToString(Request.QueryString["ContractNo"]); string contractno = Convert.ToString(Request.QueryString["ContractNo"]); Session["GenContNumbglob"] = ""; Session["GenContNumbglob"] = contractno; string ProfileID = Queries2.getProfileIDfromNo(contractno); // string office = Queries2.GetOfficeFromCountry(ProfileID); string office = Queries2.GetOfficeFromCountry(ProfileID); string fracid = Queries2.getcontIDfromNo(contractno); DataSet ds4 = Queries2.LoadAllContractFractionalDetails(fracid); string conttype = ds4.Tables[0].Rows[0]["Contract_Finance_Cont_Type"].ToString(); //ds4.Tables[0].Rows[0][""].ToString(); Session["globContClub"] = ""; if (conttype == "Points") { Session["globContClub"] = ds4.Tables[0].Rows[0]["CT_Points_Club"].ToString(); } else if (conttype == "Trade Into Points") { Session["globContClub"] = ds4.Tables[0].Rows[0]["TP_New_CLub"].ToString(); } else if (conttype == "Fractional") { Session["globContClub"] = ""; resort1 = ds4.Tables[0].Rows[0]["Contract_Fractional_Resort"].ToString(); if (resort1 == "FRACTIONAL MEMBER") { resort = "FM"; } } else if (conttype == "Trade Into Fractional") { Session["globContClub"] = ""; resort1 = ds4.Tables[0].Rows[0]["TF_Resort"].ToString(); if (resort1 == "FRACTIONAL MEMBER") { resort = "FM"; } } string PaymentMethod = ds4.Tables[0].Rows[0]["Contract_Finance_Payment_Method"].ToString(); string affilice = ds4.Tables[0].Rows[0]["Contract_Finance_Affil_ICE"].ToString(); string CrownCurr = ds4.Tables[0].Rows[0]["Contract_Finance_Crown_Curr"].ToString(); string financeCurr = ds4.Tables[0].Rows[0]["Contract_Finance_Currency"].ToString(); string coolonoff = ds4.Tables[0].Rows[0]["Contract_Finance_Cool_OnOff"].ToString(); string PaymentMethod2, affil2; if (PaymentMethod == "Crown Finance") { PaymentMethod2 = "Crown Finance"; } else { PaymentMethod2 = "NCrown Finance"; } if (affilice == "True") { affil2 = "ICE"; } else { affil2 = "NICE"; } if (office == "GER" || office == "GRE" || office == "FRA" || office == "ITA" || office == "IRE") { if (coolonoff == "1") { Session["Pofficeo"] = "GER"; Session["Cooloff"] = "1"; } else { Session["Pofficeo"] = "GER"; Session["Cooloff"] = ""; } } else { Session["Cooloff"] = ""; Session["Pofficeo"] = office; } Session["PConttype"] = conttype;//DropDownList40.SelectedItem.Text; //Session["Pofficeo"] = office; Session["PGlobContClub"] = Session["globContClub"].ToString(); Session["PPaymentMethod"] = PaymentMethod2; Session["PAffil"] = affil2; Session["PCrownCurr"] = CrownCurr; Session["Presort"] = resort; Session["PFinaCurrency"] = financeCurr; if (financeCurr == "INR") { if (PaymentMethod == "PARSHURAM FINANCE") { Session["PPaymentMethod"] = PaymentMethod2 = "Parshuram"; } else { Session["PPaymentMethod"] = PaymentMethod2 = "NP"; } PrintPdfDropDownList.Items.Clear(); //string ContType1 = DropDownList40.SelectedItem.Text; DataSet ds21 = Queries2.LoadPrintFiles3(conttype, (string)Session["Pofficeo"], (string)Session["globContClub"], PaymentMethod2, affil2, financeCurr, resort); PrintPdfDropDownList.DataSource = ds21; PrintPdfDropDownList.DataTextField = "Printpdf_name"; PrintPdfDropDownList.DataValueField = "Printpdf_name"; PrintPdfDropDownList.AppendDataBoundItems = true; PrintPdfDropDownList.Items.Insert(0, new ListItem("", "")); PrintPdfDropDownList.DataBind(); } else { PrintPdfDropDownList.Items.Clear(); //string ContType1 = DropDownList40.SelectedItem.Text; DataSet ds21 = Queries2.LoadPrintFiles2(conttype, Session["Pofficeo"].ToString(), (string)Session["globContClub"], PaymentMethod2, affil2, CrownCurr, resort, Session["Cooloff"].ToString(), Session["PFinaCurrency"].ToString()); PrintPdfDropDownList.DataSource = ds21; PrintPdfDropDownList.DataTextField = "Printpdf_name"; PrintPdfDropDownList.DataValueField = "Printpdf_name"; PrintPdfDropDownList.AppendDataBoundItems = true; PrintPdfDropDownList.Items.Insert(0, new ListItem("", "")); PrintPdfDropDownList.DataBind(); } } }
protected void Button1_Click(object sender, EventArgs e) { string Profile_ID, tourid, stayid, phid, emid, primaryprofileid; string fname, lname, add1, phone1, email1, resort, checkin, checkout, VP_Id; string office = "IVO"; string[] ar = new string[10]; int i = 0, j; string kk; int year = DateTime.Now.Year; SqlDataReader reader = Queries2.getvpval(); while (reader.Read()) { ar[i] = reader.GetString(0); i++; } for (j = 0; j < i; j++) { int cnt = Queries2.checkifVPexist(ar[j]); if (cnt == 0) { Profile_ID = Queries.GetProfileID(office); // int profile = Queries.InsertProfile(Profile_ID, DateTime.Now, "", "", "", "", "", "", "", "", "", "", "", "", "", "", office, "", "", "", "", "", "", "",ar[j]); primaryprofileid = Queries.GetPrimaryProfileID(office); tourid = Queries.GetTourDetailsID(office); stayid = Queries.GetStayDetailsID(office); phid = Queries.GetPhoneID(office); emid = Queries.GetEmailID(office); //int adddetail = Queries2.InsertDetailsVP(tourid, stayid, phid, emid,ar[j]); DataSet ds1 = Queries2.LoadVPDetails(ar[j]); VP_Id = ds1.Tables[0].Rows[0]["VP_Id"].ToString(); fname = ds1.Tables[0].Rows[0]["VP_First_Name"].ToString(); lname = ds1.Tables[0].Rows[0]["VP_Last_Name"].ToString(); add1 = ds1.Tables[0].Rows[0]["VP_Address1"].ToString(); phone1 = ds1.Tables[0].Rows[0]["VP_Phone"].ToString(); email1 = ds1.Tables[0].Rows[0]["VP_Email"].ToString(); resort = ds1.Tables[0].Rows[0]["VP_Resort"].ToString(); checkin = ds1.Tables[0].Rows[0]["VP_Arival_Date"].ToString(); checkout = ds1.Tables[0].Rows[0]["VP_Departure_Date"].ToString(); int primary = Queries.InsertPrimaryProfile(primaryprofileid, "", fname, lname, "", "", "", Profile_ID, "", "", ""); int tourdetails = Queries2.InsertTourDetailsVP(tourid, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", VP_Id, Profile_ID); //int staydetails = Queries.InsertProfileStay(stayid, resort, "", checkin, checkout, Profile_ID, tourid); int staydetails = Queries.InsertProfileStay(stayid, resort, "", checkin, checkout, Profile_ID); int phone = Queries.InsertPhone(phid, Profile_ID, "", phone1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); int email = Queries.InsertEmail(emid, Profile_ID, email1, "", "", "", "", "", "", "", "", "", "", ""); int update = Queries.UpdateProfileValue(office, year); int updatep = Queries.UpdatePrimaryValue(office, year); //int updateadd = Queries.UpdateAddressValue(office, year); int updatestay = Queries.UpdateStayValue(office, year); int updatetour = Queries.UpdateTourValue(office, year); int updatephone = Queries.UpdatePhoneValue(office, year); int updateemail = Queries.UpdateEmailValue(office, year); } else { DataSet ds1 = Queries2.LoadVPDetails(ar[j]); VP_Id = ds1.Tables[0].Rows[0]["VP_Id"].ToString(); fname = ds1.Tables[0].Rows[0]["VP_First_Name"].ToString(); lname = ds1.Tables[0].Rows[0]["VP_Last_Name"].ToString(); add1 = ds1.Tables[0].Rows[0]["VP_Address1"].ToString(); phone1 = ds1.Tables[0].Rows[0]["VP_Phone"].ToString(); email1 = ds1.Tables[0].Rows[0]["VP_Email"].ToString(); resort = ds1.Tables[0].Rows[0]["VP_Resort"].ToString(); checkin = ds1.Tables[0].Rows[0]["VP_Arival_Date"].ToString(); checkout = ds1.Tables[0].Rows[0]["VP_Departure_Date"].ToString(); string profil_id = Queries2.getprofileidVP(VP_Id); tourid = Queries.GetTourDetailsID(office); stayid = Queries.GetStayDetailsID(office); int tourdetails = Queries2.InsertTourDetailsVP(tourid, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", VP_Id, profil_id); //int staydetails = Queries.InsertProfileStay(stayid, resort, "", checkin, checkout, profil_id, tourid); int updatestay = Queries.UpdateStayValue(office, year); int updatetour = Queries.UpdateTourValue(office, year); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { LinkButton lnkView = (LinkButton)e.CommandSource; string dealId = lnkView.CommandArgument; if (office == "IVO") { DataTable datatable = Queries2.loadregcard(dealId); var printr = "Guest Reg Form"; ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report crystalReport.Load(Server.MapPath("~/reports/" + printr + ".rpt")); // path of report crystalReport.SetDataSource(datatable); System.IO.FileStream fs = null; long FileSize = 0; DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); //string ExportFileName = Server.MapPath("~/Copy of holiday_confirm.rpt") + "Export"; string ExportFileName = Server.MapPath("~/reports/" + printr + ".rpt") + "Export"; crystalReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crystalReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oDest.DiskFileName = ExportFileName; crystalReport.ExportOptions.DestinationOptions = oDest; crystalReport.Export(); Response.Clear(); Response.Buffer = true; Response.AddHeader("Content-Type", "application/pdf"); string fn = "Guest Reg Form" + ".pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=" + fn + ";"); fs = new System.IO.FileStream(ExportFileName, FileMode.Open); FileSize = fs.Length; byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1]; fs.Read(bBuffer, 0, Convert.ToInt32(FileSize)); fs.Close(); Response.BinaryWrite(bBuffer); Response.Flush(); } else if (office == "HML") { DataTable datatable = Queries2.loadregcard1(dealId); var printr = "Guest Reg form india"; ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report crystalReport.Load(Server.MapPath("~/reports/" + printr + ".rpt")); // path of report crystalReport.SetDataSource(datatable); System.IO.FileStream fs = null; long FileSize = 0; DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); //string ExportFileName = Server.MapPath("~/Copy of holiday_confirm.rpt") + "Export"; string ExportFileName = Server.MapPath("~/reports/" + printr + ".rpt") + "Export"; crystalReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crystalReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oDest.DiskFileName = ExportFileName; crystalReport.ExportOptions.DestinationOptions = oDest; crystalReport.Export(); Response.Clear(); Response.Buffer = true; Response.AddHeader("Content-Type", "application/pdf"); string fn = "Guest Reg Form" + ".pdf"; Response.AddHeader("Content-Disposition", "attachment;filename=" + fn + ";"); fs = new System.IO.FileStream(ExportFileName, FileMode.Open); FileSize = fs.Length; byte[] bBuffer = new byte[Convert.ToInt32(FileSize) + 1]; fs.Read(bBuffer, 0, Convert.ToInt32(FileSize)); fs.Close(); Response.BinaryWrite(bBuffer); Response.Flush(); } //Response.Close(); }