static void dependency_OnChanged(object sender, RecordChangedEventArgs <patient_lab_header> e) { if (e.ChangeType == ChangeType.Insert) { var changedEntity = e.Entity; var name = changedEntity.patient_name; var hn = changedEntity.hospital_number; var dob = changedEntity.date_of_birth; var age = changedEntity.age; var sex = changedEntity.sex; var rm = changedEntity.patient_area; var doctor = changedEntity.requesting_physician; var order = changedEntity.order_group; var order_date = changedEntity.order_date_time; var serv_cat = changedEntity.service_category; var lab_order = changedEntity.lab_orderable_name; var doc_nr = changedEntity.doc_emp_nr; var med_tech = changedEntity.med_tech; var chief_patho = changedEntity.chief_pathologist; Console.WriteLine("Hospital Number: " + hn); Console.WriteLine("Order Group: " + order); CreatePDF.LabResult(name, hn, dob, age, sex, rm, doctor, order, order_date, serv_cat, lab_order, doc_nr, med_tech, chief_patho); } }
protected void GenerateReport() { int LeadId = 0; string ErrorMessage; if (Session["LeadIds"] != null && Convert.ToInt32(Session["LeadIds"]) > 0) { try { LeadId = Convert.ToInt32(Session["LeadIds"]); string filename1 = CreatePDF.CreateAndGetPDF(LeadId, Request.PhysicalApplicationPath + "PDF\\", out ErrorMessage); LeadReportGenerateLog objLeadReportGenerateLog = new LeadReportGenerateLog(); objLeadReportGenerateLog.LeadId = LeadId; objLeadReportGenerateLog.GenerateDate = DateTime.Now; objLeadReportGenerateLog.Generatedby = Convert.ToInt32(Session["UserId"]); LeadReportLogManager.Save(objLeadReportGenerateLog); } catch (Exception ex) { } OpenNewWindow(LeadId); } }
protected void btnGenerateReport_Click(object sender, EventArgs e) { int LeadId = 0; if (hfLeadsId.Value != null && Convert.ToInt32(hfLeadsId.Value) > 0) { try { LeadId = Convert.ToInt32(hfLeadsId.Value); string filename1 = CreatePDF.CreateAndGetPDF(LeadId, Request.PhysicalApplicationPath + "PDF\\", out ErrorMessage); LeadReportGenerateLog objLeadReportGenerateLog = new LeadReportGenerateLog(); objLeadReportGenerateLog.LeadId = Convert.ToInt32(hfLeadsId.Value); objLeadReportGenerateLog.GenerateDate = DateTime.Now; objLeadReportGenerateLog.Generatedby = Convert.ToInt32(Session["UserId"]); LeadReportLogManager.Save(objLeadReportGenerateLog); } catch (Exception ex) { lblError.Text = "Report Not Generated. " + ex.Message; lblError.Visible = true; return; } OpenNewWindow(LeadId); } }
public void WaitForAllChart() { while (operationsListBox.Count != counteOfChartr) { } CreatePDF.GeneratePDF(images, PDfTableDictionary); }
public static PdfPCell SetCell(string text) { PdfPCell pdfP = new PdfPCell() { VerticalAlignment = Element.ALIGN_CENTER, HorizontalAlignment = Element.ALIGN_CENTER }; pdfP.Phrase = (CreatePDF.FontPolish(text)); return(pdfP); }
public static bool SendPdfToEmail(int orderId) { var packageService = new PackageService(); var pdf = new CreatePDF(orderId); pdf.UrlTOPDF(packageService.GetOrderStateStatus(orderId).URL); return(SendMail.Sendmail(orderId)); }
protected void generatePhotoReport() { bool isSuccess = true; string filename1 = null; // 2013-03-12 tortega //Page.Validate(); //if (!Page.IsValid) // return; int LeadId = SessionHelper.getLeadId(); if (LeadId > 0) { try { // 2013-09-26 tortega - Mike Benhart asked to remove this // check all location/description have been entered prior to print //isBlankDescription = LeadsUploadManager.checkForLocationDescriptionBlank(LeadId); //if (isBlankDescription) { // lblError.Text = "Image locations/descriptions are required prior to printing report."; // lblError.Visible = true; // return; //} filename1 = CreatePDF.CreateAndGetPDF(LeadId, Request.PhysicalApplicationPath + "PDF\\", out ErrorMessage); //LeadReportGenerateLog objLeadReportGenerateLog = new LeadReportGenerateLog(); //objLeadReportGenerateLog.LeadId = Convert.ToInt32(ViewState["LeadIds"].ToString()); //objLeadReportGenerateLog.GenerateDate = DateTime.Now; //objLeadReportGenerateLog.Generatedby = Convert.ToInt32(Session["UserId"]); //LeadReportLogManager.Save(objLeadReportGenerateLog); // 2013-03-21 tortega - moved out of try/catch - causes exception //OpenNewWindow(LeadId); } catch (Exception ex) { lblError.Text = "Report Not Generated."; lblError.Visible = true; Core.EmailHelper.emailError(ex); isSuccess = false; } // show report when success if (isSuccess) { OpenNewWindow(LeadId); } } }
private void GeneratePDF() { string[] missingInfo = dataConnection.ReturnMissingClientInfo(CusFNameTxt.Text, CusLnameTxt.Text); // fill the client info class ClientInfo client = new ClientInfo { ClientFName = CusFNameTxt.Text, ClientLName = CusLnameTxt.Text, Address = CusAddressTxt.Text, CO = c_oBoxTxt.Text, Company = missingInfo[0], PostalCode = missingInfo[1], BoxNum = missingInfo[2], Vehicle = VehicleDropDown.SelectedItem.ToString() }; // fill the labour info class LabourInfo labour = new LabourInfo { QtyAmount = hoursWorkedTxt.Text, Rate = rateTxt.Text, Labour = LabourTxt.Text, Tax = gstTxt.Text }; // get a list of the parts used string partsUsed = string.Empty; foreach (var item in PartsAddedList.Items) { partsUsed += item + ", "; } // fills in the part info class PartInfo part = new PartInfo { AmountOfParts = partsAdded.ToString(), PartsUsed = partsUsed, PartTotal = totalCosttxt.Content.ToString() }; // invoiceNum += CheckInvoiceNum(); if (invoiceNum == 0) { invoiceNum++; } // creates a new invoice CreatePDF invoice = new CreatePDF(); invoice.CreateInvoice(client, labour, part, int.Parse(taxRateTxt.Text), invoiceNum); // SetInvoiceNum(invoiceNum += 1); }
protected void grvOrderHistory_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "SendPDF") { GridViewRow row = (((ImageButton)e.CommandSource).NamingContainer) as GridViewRow; Label orderID = (Label)row.FindControl("lblOrderID"); int orderid = Convert.ToInt32(orderID.Text); CreatePDF pdf = new CreatePDF(orderid); pdf.UrlTOPDF(OrderHistoryHelper.GetPdfURL(orderid)); SendMail.Sendmail(orderid); } }
public static bool PrintOrderStatusReportPdf(int orderId) { try { string PDF_File_Path = GetFilePath() + "\\" + orderId.ToString() + ".pdf"; if (!File.Exists(PDF_File_Path)) { var packageService = new PackageService(); var pdf = new CreatePDF(orderId); pdf.UrlTOPDF(packageService.GetOrderStateStatus(orderId).URL); } return(true); } catch (Exception ex) { return(false); } }
public ActionResult AssessmentReport() { Guid InstanceId = Guid.Parse(Session["InstanceId"].ToString()); ViewBag.Status = true; if (InstanceId == Guid.Empty) { ViewBag.Message = String.Format("Hello {0},\n Kindly Select Instance", Session["UserName"].ToString()); ViewBag.PDFfileName = ""; //return RedirectToAction("Home", "Home"); } else { //Boolean A= _Base.Proceess_WordAddImage(); //Guid InstanceID = Guid.Parse(Session["InstanceId"].ToString()); var fileName = (from u in db.FileUploadMasters where u.InstanceID == InstanceId && u.isActive == true && u.File_Type == _Base.SAPReportFileName// "SAPReadinessCheck" select u.C_FileName).FirstOrDefault(); CreatePDF P = new CreatePDF(); string Folder_Path = Server.MapPath(ConfigurationManager.AppSettings["Upload_filePath"].ToString()); string TempPath = Server.MapPath(ConfigurationManager.AppSettings["Upload_filePath_Temp"].ToString()); string PathPdf = TempPath + "\\Pdf\\" + fileName + ".pdf"; string PathDoc = Folder_Path + fileName + ".docx"; //if (File.Exists(PathPdf)) //{ // ViewBag.Status = true; //} //else //{ Boolean Result = P.convertDOCtoPDF(PathDoc, PathPdf); ViewBag.Status = Result; // } //P.convertDOCtoPDF(PathDoc, PathPdf); ViewBag.PDFfileName = ConfigurationManager.AppSettings["Upload_filePath_Temp"].ToString() + "/Pdf/" + fileName + ".pdf"; } return(View()); }
protected void PDFbtn_Click(object sender, EventArgs e) { StringWriter sw2 = new StringWriter(); HtmlTextWriter hw2 = new HtmlTextWriter(sw2); CreatePDF.RenderControl(hw2); byte[] bytes = PDFUtility.RenderPDF(sw2.ToString(), Server.MapPath("~/fonts/Roboto-Regular.ttf")); FileStream fs = new FileStream(@"\TempFiles\asdfas.pdf", FileMode.Create); fs.Write(bytes, 0, bytes.Length); fs.Close(); }
public static bool DownloadOrderStatusReport(int orderId) { try { string PDF_File_Path = GetFilePath() + "\\" + orderId.ToString() + ".pdf"; string encrypted_PDF_File_Path = GetFilePath() + "\\E" + orderId.ToString() + ".pdf"; if (!File.Exists(PDF_File_Path)) { var packageService = new PackageService(); var pdf = new CreatePDF(orderId); pdf.UrlTOPDF(packageService.GetOrderStateStatus(orderId).URL); } if (!File.Exists(encrypted_PDF_File_Path)) { FileStream stream = File.OpenRead(PDF_File_Path); int length = Convert.ToInt32(stream.Length); byte[] data = new byte[length]; stream.Read(data, 0, length); stream.Close(); using (MemoryStream input = new MemoryStream(data)) { using (MemoryStream output = new MemoryStream()) { eknowID.Model.Candidate candidate = UserHelper.GetCandidateByOrderId(orderId); string password = candidate.Email; PdfReader reader = new PdfReader(input); PdfEncryptor.Encrypt(reader, output, true, password, password, PdfWriter.ALLOW_SCREENREADERS); data = output.ToArray(); } } File.WriteAllBytes(encrypted_PDF_File_Path, data); } return(true); } catch (Exception ex) { return(false); } }
public static void PosaljiNaredbu(string grad, int idNaloga, int idAplikacije) { try { using (PostavkeDataContext db = new PostavkeDataContext()) { // todo obrisi temp if (db.EMAIL_LISTAs.Any(i => i.IDGrada == Sistem.IDGrada(grad) && i.Naredba)) { _Prekrsaj prekrsaj = Prekrsaj.DetaljiPrekrsajaNalog(grad, idNaloga, idAplikacije); if (prekrsaj == null) { Sustav.SpremiGresku(grad, new Exception("idn: " + idNaloga + ", grad: " + grad), idAplikacije, "POSALJI NAREDBU NA EMAIL"); return; } if (prekrsaj.Nalog == null) { Sustav.SpremiGresku(grad, new Exception("idn: " + idNaloga + ", grad: " + grad), idAplikacije, "POSALJI NAREDBU NA EMAIL"); return; } GRADOVI g = db.GRADOVIs.First(i => i.IDGrada == Sistem.IDGrada(grad)); CreatePDF._tipJls = g.Tip; CreatePDF._naziv = g.NazivGrada; CreatePDF._grb = g.Grb; CreatePDF._odlukaLisice = g.OdlukaLisice; string putanja = CreatePDF.Naredba(grad, new List <_Prekrsaj>() { prekrsaj }); //Prekrsaj(grad, prekrsaj, hub, idAplikacije); if (putanja == "") { Sustav.SpremiGresku(grad, new Exception("putanja"), idAplikacije, "POSALJI NAREDBU NA EMAIL"); } foreach (var email in db.EMAIL_LISTAs.Where(i => i.IDGrada == Sistem.IDGrada(grad) && i.Naredba)) { //bool hub = email.Prilog && prekrsaj.Dokument == "OBAVIJEST"; //todo string poruka = Pripremi.PopulateBodyNaredba(email.ImePrezime, idNaloga, prekrsaj.Nalog.Lisice); string tip = "podizanje"; if (prekrsaj.Nalog.Lisice) { tip = "blokiranje"; } Posalji.Email(grad, poruka, "Naredba za " + tip + " br. " + idNaloga, new List <string> { email.Email }, putanja, true, idAplikacije); } } } } catch (Exception ex) { Sustav.SpremiGresku(grad, ex, idAplikacije, "POSALJI NAREDBU NA EMAIL"); } }
public static void AddTableOfContent(Document document, Dictionary <object, System.Drawing.Image> images, PdfWriter writer) { Dictionary <object, System.Drawing.Image> imagesbyMonth = images; bool cos1 = true; CreateChapter chapter = new CreateChapter(CreatePDF.FontPolish("Spis Treści"), 0, 3f); chapter.chapter.NumberDepth = 0; string name = null; int page = 3; int numberChapert = 1; int numberSection = 1; int numberSubSection = 1; foreach (var image in images) { string[] chwilowy = image.Value.Tag.ToString().Split(','); string nameParking = null; for (int i = 2; i < chwilowy.Length; i++) { nameParking += $"{chwilowy[i]},"; } if (image.Key is SumOfParked) { chapter.AddToTableOfContents(AddHypperLink($"{numberChapert++}. {chwilowy[1]}", page++, writer)); } if (image.Key is SumOfParkedByMonth) { cos1 = false; chapter.AddToTableOfContents(AddHypperLink($"{numberChapert}. Ilosc wzbudzeń w podziale na poszczególne miesiące.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($"{numberChapert}.{numberSection}. Porównanie ilości wzbudzeń na Parkingu {nameParking} w danych miesiącach.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}.{numberSubSection++}. Wartość liczbowa.", page++, writer)); } if (image.Key is SumOfParkedByMonthPercent) { if (cos1 == true) { chapter.AddToTableOfContents(AddHypperLink($"{numberChapert} Ilosc wzbudzeń w podziale na poszczególne miesiące.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($"{numberChapert}.{numberSection}. Porównanie ilości wzbudzeń na Parkingu {nameParking} w danych miesiącach.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}.{numberSubSection++}. Wartość Procentowa.", page++, writer)); } else { chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection++}.{numberSubSection++}. Wartość Procentowa.", page++, writer)); } } if (image.Key is SumOfVehiclesInMonthOnCarPark) { numberSubSection = 1; chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}. Ilość wzbudzeń na Parkingu {chwilowy[2]} w danych miesiacach", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}.{numberSubSection++}. " + chwilowy[1], page++, writer)); } if (image.Key is SumOfParkedInEachMonthPercent) { chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection++}.{numberSubSection++}. " + chwilowy[1], page++, writer)); } if (image.Key is LineChart) { numberSection = 1; numberSubSection = 1; chapter.AddToTableOfContents(AddHypperLink($"{++numberChapert}. Zestawienie godzinowe ilość wzbudzeń w całym okresie raportu - wartości procentowe.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection++}. Porównanie ilości wzbudzeń na parkingach {nameParking}", page++, writer)); } if (image.Key is LineSumByHour) { chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection++}. {chwilowy[1]}", page++, writer)); } if (image.Key is LineSumByHourEachMonth) { if (name == null) { numberSection = 1; numberSubSection = 1; chapter.AddToTableOfContents(AddHypperLink($"{++numberChapert}. Zestawienie godzinowe ilości wzbudzeń w podziale na poszczególne miesiące.", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}. {chwilowy[1]}", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}.{numberSubSection++}. { Enum.GetName(typeof(EnumMonth), int.Parse(chwilowy[2])) }", page++, writer)); name = chwilowy[1]; } else if (name == chwilowy[1]) { chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{numberSection}.{numberSubSection++}. { Enum.GetName(typeof(EnumMonth), int.Parse(chwilowy[2])) }", page++, writer)); name = chwilowy[1]; } else if (name != chwilowy[1]) { numberSubSection = 1; chapter.AddToTableOfContents(AddHypperLink($" {chwilowy[1]}", page, writer)); chapter.AddToTableOfContents(AddHypperLink($" {numberChapert}.{++numberSection}.{numberSubSection++}. { Enum.GetName(typeof(EnumMonth), int.Parse(chwilowy[2])) }", page++, writer)); name = chwilowy[1]; } } } document.Add(chapter.GetChapter()); }
static void Main(string[] args) { log.Info("Starting the application..."); Console.WriteLine("Starting the application..."); try { #region Main ConstructRequest con = new ConstructRequest(); //Get the List of Pending Order Ids List <int> pendingOrderId = OrderStatusHelper.GetPendingOrders(); OrderState pendingOrder; //For Each Record in order Id Check for the Response foreach (int orderId in pendingOrderId) { try { pendingOrder = new OrderState(); //Get Last Order Status of the orderID pendingOrder = OrderStatusHelper.GetOrderState(orderId); if (pendingOrder.TazWorksStatus != 10 && pendingOrder.TazWorksStatus != 4) { // Send the Xml Reponse and Receive the Status Enquiry and Save it to DataBase OrderState newOrderState = con.XMLStatusEnquiry(orderId); if (newOrderState.TazWorksStatus == (int)TazWorksStatus.READY || newOrderState.TazWorksStatus == (int)TazWorksStatus.COMPLETED) { //Create the Pdf If Status is Complete CreatePDF pdf = new CreatePDF(orderId); pdf.UrlTOPDF(newOrderState.URL); //Send Mail To the User if (SendMail.Sendmail(newOrderState.OrderId, true)) { // Mail Sent Console.WriteLine("Mail Sent..."); } else { // Mail Not Sent Console.Write("Not Sent..."); } } } } catch (Exception Ex) { log.Error(Ex.Message); Console.WriteLine(Ex.Message); } } #endregion log.Info("Stop the application..."); Console.WriteLine("Stop the application..."); } catch (Exception ex) { log.Error(ex.Message); Console.WriteLine(ex.Message); } }
private static int ListaArquivos() { System.Threading.Thread.Sleep(2000); Config config = new Config(); config.GetConfig(); Console.Clear(); Console.WriteLine("\t\t\tMinas Ferramentas Ltda."); Console.WriteLine(); Console.WriteLine("\t Impressao e Envio de emails de Coletas em PDF"); Console.WriteLine(); Console.WriteLine("\t Belo Horizonte, {0}", DateTime.Now.ToString("dd 'de' MMMM 'de' yyyy HH:mm:ss")); Console.WriteLine(); DirectoryInfo directory = new DirectoryInfo(config.SourcePath); if (!directory.Exists) { Console.WriteLine("Não encontrado o diretorio especificado!"); return(0); } FileInfo[] files = directory.GetFiles("*.txt"); Console.WriteLine(); Console.WriteLine(@"Arquivos.: {0}", files.Count()); Console.WriteLine(); if (files.Count() == 0) { try { files = directory.GetFiles("*.pdf"); if (files.Count() > 0) { foreach (FileInfo fileinfo in files) { System.Threading.Thread.Sleep(5000); File.Move(config.SourcePath + fileinfo, config.TargetPath + fileinfo); Console.WriteLine(@"Movido o Arquivo {0} para a pasta Impressos.", fileinfo); } } } catch (Exception e) { Console.WriteLine(e.Message); System.Threading.Thread.Sleep(10000); } return(1); } foreach (FileInfo fileinfo in files) { decimal FileLenth = fileinfo.Length / 1024; string DadosDoArquivo = fileinfo.Name + "\t" + FileLenth.ToString("##,##0.00") + " kb" + "\t" + fileinfo.LastWriteTime; if (FileLenth > 0) { Console.WriteLine(@"Txt {0}", DadosDoArquivo); CreatePDF gPdf = new CreatePDF() { ItemsPerPage = 28 }; gPdf.GerarPDF(fileinfo.Name); } else { fileinfo.Delete(); } } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("\t\t\t\tAguarde...."); return(1); }
private void SchedularCallback(object e) { WriteErrorLog("eKnowId Order Status enquiry service started processing all the orders..."); var exceptions = new ConcurrentQueue <Exception>(); try { ConstructRequest con = new ConstructRequest(); ////Get the List of Pending Order Ids List <int> pendingOrderId = OrderStatusHelper.GetPendingOrders(); OrderState pendingOrder; if (pendingOrderId.Any()) { WriteErrorLog("eKnowId Order Status enquiry service found " + pendingOrderId.Count() + " pending Orders"); //For Each Record in order Id Check for the Response foreach (int orderId in pendingOrderId) { try { pendingOrder = new OrderState(); //Get Last Order Status of the orderID pendingOrder = OrderStatusHelper.GetOrderState(orderId); WriteErrorLog("eKnowId Order Status enquiry service received Last Order Status of the orderID: " + orderId + " as " + pendingOrder.TazWorksStatus); if (pendingOrder.TazWorksStatus != 10 && pendingOrder.TazWorksStatus != 4) { // Send the Xml Reponse and Receive the Status Enquiry and Save it to DataBase OrderState newOrderState = con.XMLStatusEnquiry(orderId); WriteErrorLog("eKnowId Order Status enquiry service Sent Xml Reponse, Received Status Enquiry and Saved it to DataBase for orderID: " + orderId); if (newOrderState.TazWorksStatus == (int)TazWorksStatus.READY || newOrderState.TazWorksStatus == (int)TazWorksStatus.COMPLETED) { //Create the Pdf If Status is Complete CreatePDF pdf = new CreatePDF(orderId); pdf.UrlTOPDF(newOrderState.URL); WriteErrorLog("eKnowId Order Status enquiry service created pdf for orderID: " + orderId); //Send Mail To the User if (SendMail.Sendmail(newOrderState.OrderId, true)) { // Mail Sent WriteErrorLog("Email Sent to user"); } else // Mail Not Sent { WriteErrorLog("Failed to send email"); } } } } catch (Exception Ex) { exceptions.Enqueue(Ex); } } WriteErrorLog("eKnowId Order Status enquiry service processed " + pendingOrderId.Count() + "pending Orders"); if (0 < exceptions.Count) { WriteErrorLog(new AggregateException(exceptions).Flatten().Message); } } this.ScheduleService(); } catch (Exception) { using (System.ServiceProcess.ServiceController serviceController = new System.ServiceProcess.ServiceController("StatusEnquiryService")) { if (serviceController.Status == ServiceControllerStatus.Running) { serviceController.Stop(); } } } }