public void Export_User_Production_Report() { DateTime Fromdate = Convert.ToDateTime(From_date.ToString()); DateTime Todate = Convert.ToDateTime(To_date.ToString()); Logon_To_Crystal(); rptDoc.SetParameterValue("@Trans", "All"); rptDoc.SetParameterValue("@Order_Id", 0); rptDoc.SetParameterValue("@Client_Id", 0); rptDoc.SetParameterValue("@Subprocess_Id", 0); rptDoc.SetParameterValue("@Order_Progress_Id", 0); rptDoc.SetParameterValue("@Order_Status_Id", 0); rptDoc.SetParameterValue("@From_date", Fromdate); rptDoc.SetParameterValue("@To_date", Todate); rptDoc.SetParameterValue("@User_Id", 0); rptDoc.SetParameterValue("@Log_In_Userid", user_id); ExportOptions CrExportOptions; FileInfo newFile = new FileInfo(@"\\192.168.12.33\oms-reports\User_ProductionRep.xls"); DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); ExcelFormatOptions CrFormatTypeOptions = new ExcelFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = newFile.ToString(); CrExportOptions = rptDoc.ExportOptions; CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.ExcelWorkbook; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; rptDoc.Export(); }
public string PopulateBody() { string body = string.Empty; if (Forms == "Order_Invoice") { Directory_Path = @"\Invoice_Email.htm"; } else if (Forms == "Monthly_Invoice") { Directory_Path = @"\Monthly_Invoice_Email.htm"; } using (StreamReader reader = new StreamReader(Environment.CurrentDirectory + Directory_Path)) { body = reader.ReadToEnd(); } //Hashtable htorder = new Hashtable(); //DataTable dtorder = new DataTable(); //htorder.Add("@Trans", "GET_INVOICE_ORDER_DETAILS_FOR_EMAIL"); //htorder.Add("@Order_ID", Order_Id); //dtorder = dataaccess.ExecuteSP("Sp_Order_Invoice_Entry", htorder); //if (dtorder.Rows.Count > 0) //{ //} if (Forms == "Order_Invoice") { if (Invoice_Status == "True") { body = body.Replace("{Text}", "Please find the attached search report along with invoice copy for your review."); } else if (Invoice_Status == "False") { body = body.Replace("{Text}", "Please find the attached search report."); } } else if (Forms == "Monthly_Invoice") { body = body.Replace("{From_Date}", From_Date.ToString()); body = body.Replace("{To_Date}", To_date.ToString()); } //body = body.Replace("{OrderType}", dtorder.Rows[0]["Order_Type"].ToString()); //body = body.Replace("{OwnerName}", dtorder.Rows[0]["Borrower_Name"].ToString()); //body = body.Replace("{Property_Address}", dtorder.Rows[0]["Address"].ToString()); //body = body.Replace("{County}", dtorder.Rows[0]["County"].ToString()); return(body); }
public void Export_Production_Report() { Get_Day_OfThisMonth(); DateTime Fromdate = Convert.ToDateTime(From_date.ToString()); DateTime Todate = Convert.ToDateTime(To_date.ToString()); Hashtable ht_Status1 = new Hashtable(); System.Data.DataTable dt_Status1 = new System.Data.DataTable(); ht_Status1.Add("@Trans", "Order_Status_Report_All_ClientWise"); ht_Status1.Add("@Fromdate", Fromdate); ht_Status1.Add("@Todate", Todate); ht_Status1.Add("@Log_In_Userid", user_id); dt_Status1 = dataaccess.ExecuteSP("Sp_Order_Status_Report", ht_Status1); Hashtable ht_Status = new Hashtable(); System.Data.DataTable dt_Status = new System.Data.DataTable(); ht_Status.Add("@Trans", "ALL_CLIENT_WISE_PRODUCTION_COUNT"); ht_Status.Add("@Fromdate", Fromdate); ht_Status.Add("@Todate", Todate); ht_Status.Add("@Log_In_Userid", user_id); dt_Status = dataaccess.ExecuteSP("Sp_Order_Status_Report", ht_Status); ds.Tables.Add(dt_Status); // ds.Tables.Add(dt_Status1); ds.Merge(dt_Status1); // ExportDataSetToExcel( ds); Exp(); ds.Clear(); }
public string PopulateBody() { string body = string.Empty; Directory_Path = @"\Monthly_Invoice_Email.htm"; using (StreamReader reader = new StreamReader(Environment.CurrentDirectory + Directory_Path)) { body = reader.ReadToEnd(); } body = body.Replace("{From_Date}", From_Date.ToString()); body = body.Replace("{To_Date}", To_date.ToString()); return(body); }
public void Load_User_Production_Rep() { rptDoc = new Reports.CrystalReport.CrystalReportUser_Prod(); Logon_To_Crystal(); DateTime Fromdate = Convert.ToDateTime(From_date.ToString()); DateTime Todate = Convert.ToDateTime(To_date.ToString()); rptDoc.SetParameterValue("@Trans", "All"); rptDoc.SetParameterValue("@Order_Id", 0); rptDoc.SetParameterValue("@Client_Id", 0); rptDoc.SetParameterValue("@Subprocess_Id", 0); rptDoc.SetParameterValue("@Order_Progress_Id", 0); rptDoc.SetParameterValue("@Order_Status_Id", 0); rptDoc.SetParameterValue("@From_date", Fromdate); rptDoc.SetParameterValue("@To_date", Todate); rptDoc.SetParameterValue("@User_Id", 0); rptDoc.SetParameterValue("@Log_In_Userid", user_id); crViewer.ReportSource = rptDoc; Export_User_Production_Report(); }
public void Send_User_Production_Rport() { using (MailMessage mm = new MailMessage()) { try { mm.From = new MailAddress(From_Email.ToString()); for (int i = 0; i < dtto.Rows.Count; i++) { mm.To.Add(dtto.Rows[i]["To_Email_Id"].ToString()); } txt_Subject.Text = "All Users Production Report - " + "From -" + From_date.ToString() + " To - " + To_date.ToString() + ""; mm.Subject = "All Users Production Report - " + "From -" + From_date.ToString() + " To - " + To_date.ToString() + ""; StringBuilder sb = new StringBuilder(); sb.Append("Subject: " + "Auto Email" + "" + Environment.NewLine); //String str = sb.ToString(); //string Message_Body = str.ToString(); //mm.Body = Message_Body; string Path1 = @"\\192.168.12.33\oms-reports\User_ProductionRep.xls"; MemoryStream ms = new MemoryStream(File.ReadAllBytes(Path1)); mm.Attachments.Add(new System.Net.Mail.Attachment(ms, "User_ProductionRep.xls")); mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); // smtp.Host = "smtp.gmail.com"; smtp.Host = "smtpout.secureserver.net"; // smtp.EnableSsl = true; NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "123new.com"); smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; //smtp.Port = 587; smtp.Port = 80; smtp.Send(mm); //MessageBox.Show("Email Sent"); } catch (Exception error) { MessageBox.Show(error.Message); return; } } }