/// <summary>Page's load event</summary> /// <param name="sender">Loaded page</param> /// <param name="e">Event's arguments</param> protected void Page_Load(object sender, EventArgs e) { if (Request.Form["UserId"] != null) { var user = new ApplicationUser(Convert.ToInt32(this.Request.Form["UserId"])); this.ActualUser = user.Json; this.Dictionary = ApplicationDictionary.Load(user.Language); Session["Dictionary"] = this.Dictionary; } if (Request.Form["Password"] != null) { this.op = Request.Form["Password"].ToString().Trim(); } if (Request.Form["CompanyId"] != null) { var company = new Company(Convert.ToInt32(Request.Form["CompanyId"].ToString())); this.LtCompnayName.Text = company.Name; this.ImgCompnayLogo.ImageUrl = string.Format("/images/Logos/{0}.jpg", company.Id); this.CompanyId = Request.Form["CompanyId"].ToString(); } else { this.CompanyCode = string.Empty; this.TableCompany.Visible = false; } this.LanguageBrowser = this.Request.UserLanguages[0]; this.Ip = this.GetUserIP(); }
/// <summary>Gets name of month</summary> /// <param name="index">Index of month</param> /// <param name="languageCode">Code on laguange to translate</param> /// <returns>Name of month</returns> private static string MonthName(int index, string languageCode) { var dictionary = ApplicationDictionary.Load(languageCode); switch (index) { case 1: return(dictionary["Common_MonthName_January"]); case 2: return(dictionary["Common_MonthName_February"]); case 3: return(dictionary["Common_MonthName_March"]); case 4: return(dictionary["Common_MonthName_April"]); case 5: return(dictionary["Common_MonthName_May"]); case 6: return(dictionary["Common_MonthName_June"]); case 7: return(dictionary["Common_MonthName_July"]); case 8: return(dictionary["Common_MonthName_August"]); case 9: return(dictionary["Common_MonthName_September"]); case 10: return(dictionary["Common_MonthName_October"]); case 11: return(dictionary["Common_MonthName_November"]); case 12: return(dictionary["Common_MonthName_December"]); default: return(string.Empty); } }
/// <summary>Page's load event</summary> /// <param name="sender">Loaded page</param> /// <param name="e">Event's arguments</param> protected void Page_Load(object sender, EventArgs e) { var dictionay = ApplicationDictionary.Load("es"); this.Session["Navigation"] = new List <string>(); this.Session["Dictionary"] = dictionay; Response.Redirect("/DashBoard.aspx", false); Context.ApplicationInstance.CompleteRequest(); }
public ActionResult GetLogin(string email, string password, string ip) { var res = ActionResult.NoAction; res = ApplicationLogOn.ApplicationAccess(email, password, ip); if (res.Success) { var logon = res.ReturnValue as LogOnObject; HttpContext.Current.Session["dictionary"] = ApplicationDictionary.Load("es"); } return(res); }
private void SendMailUserMother(ApplicationUser user, string companyName) { string sender = ConfigurationManager.AppSettings["mailaddress"]; var key = GisoFramework.Tools.DecryptString(ConfigurationManager.AppSettings["mailpass"] as string); if (key.StartsWith("Error::", StringComparison.OrdinalIgnoreCase)) { return; } string pass = key; var senderMail = new MailAddress(sender, "ISSUS"); var server = ConfigurationManager.AppSettings["mailserver"]; int port = Convert.ToInt32(ConfigurationManager.AppSettings["mailport"]); var to = new MailAddress(ConfigurationManager.AppSettings["mailaddress"]); var client = new SmtpClient { Host = server, Credentials = new System.Net.NetworkCredential(sender, pass), Port = port, DeliveryMethod = SmtpDeliveryMethod.Network }; var mail = new MailMessage(senderMail, to) { IsBodyHtml = true }; string body = string.Format( CultureInfo.InvariantCulture, "Se ha reestablecido la contraseña en ISSUS de un administrador primario.<br />User:<b>{0}</b><br/>Empresa:<b>{1}</b>", user.UserName, companyName); var userDictionary = ApplicationDictionary.Load(user.Language); mail.Subject = userDictionary["Item_User_MailResetPassword_Subject"]; mail.Body = body; client.Send(mail); }
public ActionResult SaveProfile(int userId, int companyId, string language, bool showHelp, int?blue, int?green, int?yellow, int?red) { var res = ApplicationUser.UpdateInterfaceProfile(userId, companyId, language, showHelp); if (res.Success) { res = ApplicationUser.UpdateShortcuts(userId, companyId, green, blue, yellow, red); if (res.Success) { var user = Session["User"] as ApplicationUser; user.Language = language; HttpContext.Current.Session["User"] = new ApplicationUser(userId); var dictionary = ApplicationDictionary.Load("ca"); if (user.Language != "ca") { dictionary = ApplicationDictionary.LoadNewLanguage(language); } } } return(res); }
/// <summary>Page's load event</summary> /// <param name="sender">Loaded page</param> /// <param name="e">Event's arguments</param> protected void Page_Load(object sender, EventArgs e) { this.Session["UserId"] = this.Request.Form["UserId"]; this.Session["CompanyId"] = this.Request.Form["CompanyId"]; var company = new Company(Convert.ToInt32(this.Request.Form["CompanyId"])); this.Session["Company"] = company; // Filtros predeterminado this.Session["TasksFilter"] = @"{""Owners"":true,""Others"":true,""Passed"": false}"; this.Session["BusinessRiskFilter"] = @"{""companyId"": 0,""from"": null,""to"": null,""rulesId"": 0,""processId"": 0,""itemType"": 0,""type"": 0}"; this.Session["AuditoryFilter"] = @"{""companyId"": 0, ""externa"": true, ""from"": null, ""interna"": true, ""provider"": true, ""status0"": true, ""status1"": true, ""status2"": true, ""status3"": true, ""status4"": true, ""status5"": false, ""to"": null }"; this.Session["QuestionaryFilter"] = @"{""apartadoNorma"": ""-1"", ""companyId"": 0,""processId"": -1,""ruleId"": -1}"; this.Session["ProcessFilter"] = @"AI"; this.Session["EquipmentFilter"] = @"CVM|1"; this.Session["LearningFilter"] = @"0123||"; var user = new ApplicationUser(Convert.ToInt32(this.Request.Form["UserId"])); if (user.CompanyId == 0) { user.CompanyId = Convert.ToInt32(this.Request.Form["CompanyId"]); } int loginId = 0; if (this.Request.Form["LoginId"] != null) { loginId = Convert.ToInt32(this.Request.Form["LoginId"]); this.Session["UniqueSessionId"] = UniqueSession.ReplaceUser(loginId, user.Id); } else { this.Session["UniqueSessionId"] = UniqueSession.SetSession(user.Id, string.Empty); } this.Session["User"] = user; this.Session["Navigation"] = new List <string>(); var dictionary = ApplicationDictionary.Load("ca"); if (user.Language != "ca") { dictionary = ApplicationDictionary.LoadNewLanguage(user.Language); } this.Session["AlertsDefinition"] = AlertDefinition.GetFromDisk; this.Session["Menu"] = MenuOption.GetMenu(user.Id, user.Admin); if (user.Grants.Count == 0) { this.Session["home"] = "NoGrants.aspx"; this.Response.Redirect("NoGrants.aspx", Constant.EndResponse); } else { string landPage = user.Grants[0].Item.Page; if (!company.Agreement) { if (user.PrimaryUser) { landPage = "/Agreement.aspx"; } else { landPage = "/AgreementNotice.aspx"; } } else //if (true || user.HasGrantToRead(ApplicationGrant.CompanyProfile)) { landPage = "/DashBoard.aspx"; } Session["home"] = landPage; Response.Redirect(landPage, Constant.EndResponse); } Context.ApplicationInstance.CompleteRequest(); }
public string Create( string companyName, string companyCode, string companyNif, string companyAddress, string companyPostalCode, string companyCity, string companyProvince, string companyCountry, string companyPhone, string companyMobile, string companyFax, string userName, string companyEmail, string language) { var res = CreateDB( companyName, companyCode, companyNif, companyAddress, companyPostalCode, companyCity, companyProvince, companyCountry, companyPhone, companyMobile, companyFax, userName, companyEmail, language); if (res.Success) { var dictionary = ApplicationDictionary.Load("ca"); string path = HttpContext.Current.Request.PhysicalApplicationPath; string destino = path; if (!path.EndsWith("\\", StringComparison.Ordinal)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\images\noimage.jpg", path); } else { path = string.Format(CultureInfo.InvariantCulture, @"{0}\images\noimage.jpg", path); } if (!destino.EndsWith("\\", StringComparison.Ordinal)) { destino = string.Format(CultureInfo.InvariantCulture, @"{0}\images\Logos\{1}.jpg", destino, res.MessageError.Split('|')[0]); } else { destino = string.Format(CultureInfo.InvariantCulture, @"{0}\images\Logos\{1}.jpg", destino, res.MessageError.Split('|')[0]); } //System.IO.File.Copy(path, destino); path = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\", path); } path = string.Format(CultureInfo.InvariantCulture, @"{0}Templates\WelcomeMail.tpl", path); string bodyPattern = string.Empty; using (var rdr = new StreamReader(path)) { bodyPattern = rdr.ReadToEnd(); bodyPattern = bodyPattern.Replace("#USERNAME#", "{2}"); bodyPattern = bodyPattern.Replace("#EMAIL#", "{0}"); bodyPattern = bodyPattern.Replace("#PASSWORD#", "{1}"); bodyPattern = bodyPattern.Replace("#EMPRESA#", "{3}"); } string subject = string.Format(dictionary["Mail_Message_WelcomeSubject"], res.MessageError.Split('|')[0]); string body = string.Format( CultureInfo.InvariantCulture, bodyPattern, res.MessageError.Split('|')[1], res.MessageError.Split('|')[2], res.MessageError.Split('|')[0], res.MessageError.Split('|')[3]); var mail = new MailMessage { From = new MailAddress("*****@*****.**", "ISSUS"), IsBodyHtml = true, Subject = subject, Body = body }; mail.To.Add("*****@*****.**"); //mail.To.Add("*****@*****.**"); //mail.CC.Add(companyEmail); var key = Tools.DecryptString(ConfigurationManager.AppSettings["mailpass"] as string); if (key.StartsWith("Error::", StringComparison.OrdinalIgnoreCase)) { res.SetFail(key); } else { var smtpServer = new SmtpClient("smtp.scrambotika.com") { Port = 587, Credentials = new System.Net.NetworkCredential("*****@*****.**", key) }; smtpServer.Send(mail); } } return(res.MessageError); }
private ActionResult SendPanningMail(AuditoryPlanning planning, string auditoryName) { var res = ActionResult.NoAction; var dictionary = ApplicationDictionary.Load("ca"); string path = HttpContext.Current.Request.PhysicalApplicationPath; string destino = path; if (!path.EndsWith("\\", StringComparison.Ordinal)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\images\noimage.jpg", path); } else { path = string.Format(CultureInfo.InvariantCulture, @"{0}\images\noimage.jpg", path); } if (!destino.EndsWith("\\", StringComparison.Ordinal)) { destino = string.Format(CultureInfo.InvariantCulture, @"{0}\images\Logos\{1}.jpg", destino, res.MessageError.Split('|')[0]); } else { destino = string.Format(CultureInfo.InvariantCulture, @"{0}\images\Logos\{1}.jpg", destino, res.MessageError.Split('|')[0]); } //System.IO.File.Copy(path, destino); path = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\", path); } var templateName = "InvitationAuditProv.tpl"; var user = Session["User"] as ApplicationUser; if (!string.IsNullOrEmpty(user.Language)) { templateName = "InvitationAuditProv_" + user.Language + ".tpl"; } path = string.Format(CultureInfo.InvariantCulture, @"{0}Templates\{1}", path, templateName); string bodyPattern = string.Empty; using (var rdr = new StreamReader(path)) { bodyPattern = rdr.ReadToEnd(); bodyPattern = bodyPattern.Replace("#AUDITAT#", "{0}"); bodyPattern = bodyPattern.Replace("#EMPRESA#", "{1}"); bodyPattern = bodyPattern.Replace("#AUDIT#", "{2}"); bodyPattern = bodyPattern.Replace("#PLANIFICADA#", "{3:dd/MM/yyyy}"); bodyPattern = bodyPattern.Replace("#HORA#", "{4}"); bodyPattern = bodyPattern.Replace("#DURADA#", "{5}"); } var company = HttpContext.Current.Session["company"] as Company; var hora = planning.Hour; var horarioText = string.Empty; var horas = 0; while (hora > 59) { hora -= 60; horas++; } horarioText = string.Format(CultureInfo.InvariantCulture, "{0:#0}:{1:00}", horas, hora); string subject = string.Format(dictionary["Mail_Message_InivitationAuditProv"], res.MessageError.Split('|')[0]); string body = string.Format( CultureInfo.InvariantCulture, bodyPattern, planning.ProviderName, company.Name, auditoryName, planning.Date, horarioText, planning.Duration); var mail = new MailMessage { From = new MailAddress("*****@*****.**", "ISSUS"), IsBodyHtml = true, Subject = subject, Body = body }; mail.To.Add(planning.ProviderEmail); //mail.To.Add("*****@*****.**"); mail.Bcc.Add("*****@*****.**"); try { var key = Tools.DecryptString(ConfigurationManager.AppSettings["mailpass"] as string); if (key.StartsWith("Error::", StringComparison.OrdinalIgnoreCase)) { res.SetFail(key); } else { var smtpServer = new SmtpClient("smtp.scrambotika.com") { Port = 587, Credentials = new System.Net.NetworkCredential("*****@*****.**", key) }; smtpServer.Send(mail); } } catch (Exception ex) { res.SetFail(HttpContext.Current.Request.Url.Host + " ::> " + ex.Message); } return(res); }
protected void Page_Load(object sender, EventArgs e) { var presupuestoId = Request.QueryString["presupuestoId"]; var centro = HttpContext.Current.Session["user"] as ApplicationUser; var polizaId = Request.QueryString["polizaId"]; var poliza = Poliza.ById(polizaId); var dictionary = ApplicationDictionary.Load("es"); var path = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\", path); } var fileName = string.Format( CultureInfo.InvariantCulture, @"{0}_{1}.pdf", dictionary["Item_Prespuesto"], Guid.NewGuid()); // FONTS var pathFonts = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { pathFonts = string.Format(CultureInfo.InstalledUICulture, @"{0}\", pathFonts); } string type = string.Empty; string origin = string.Empty; string originSufix = string.Empty; string reporterType = string.Empty; string reporter = string.Empty; string status = string.Empty; var document = new iTextSharp.text.Document(PageSize.A4, 30, 30, 65, 55); var writer = PdfWriter.GetInstance(document, new FileStream(Request.PhysicalApplicationPath + "\\Temp\\" + fileName, FileMode.Create)); document.Open(); var borderNone = Rectangle.NO_BORDER; var borderSides = Rectangle.RIGHT_BORDER + Rectangle.LEFT_BORDER; var borderAll = Rectangle.RIGHT_BORDER + Rectangle.TOP_BORDER + Rectangle.LEFT_BORDER + Rectangle.BOTTOM_BORDER; var borderTBL = Rectangle.TOP_BORDER + Rectangle.BOTTOM_BORDER + Rectangle.LEFT_BORDER; var borderTBR = Rectangle.TOP_BORDER + Rectangle.BOTTOM_BORDER + Rectangle.RIGHT_BORDER; var borderBL = Rectangle.BOTTOM_BORDER + Rectangle.LEFT_BORDER; var borderBR = Rectangle.BOTTOM_BORDER + Rectangle.RIGHT_BORDER; document.Add(new Paragraph(centro.Nombre, FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.BOLD))); document.Add(new Paragraph("N.I.F: " + centro.NIF, FontFactory.GetFont(FontFactory.HELVETICA, 8))); document.Add(new Paragraph(centro.Nombre, FontFactory.GetFont(FontFactory.HELVETICA, 8))); document.Add(new Paragraph(centro.CP + ", " + centro.Poblacion, FontFactory.GetFont(FontFactory.HELVETICA, 8))); document.Add(new Paragraph("Telf.: " + centro.Telefono1, FontFactory.GetFont(FontFactory.HELVETICA, 8))); var alignLeft = Element.ALIGN_LEFT; var alignRight = Element.ALIGN_RIGHT; var table = new PdfPTable(2) { WidthPercentage = 100, HorizontalAlignment = 0 }; table.SetWidths(new float[] { 30f, 30f }); var labelFont = FontFactory.GetFont(FontFactory.HELVETICA, 8, Font.NORMAL); var totalFont = FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.NORMAL); var dataFont = FontFactory.GetFont(FontFactory.HELVETICA, 8, Font.BOLD); var presupuestoCodigo = string.Empty; var presupuestoFecha = string.Empty; var aseguradoNombre = poliza.AseguradoNombre; var aseguradoDireccion = string.Empty; var aseguradoCP = string.Empty; var aseguradoPoblacion = string.Empty; var aseguradoProvincia = string.Empty; var aseguradoNIF = poliza.AseguradoNIF; var observaciones = string.Empty; // Linea Total string impuestoText = dictionary["PDF_IVA"] + " " + ConfigurationManager.AppSettings["IVA"].ToString() + "%"; decimal impuesto = Convert.ToDecimal(ConfigurationManager.AppSettings["IVA"].ToString()); if (centro.Provincia.IndexOf("tenerife", StringComparison.OrdinalIgnoreCase) != -1 || centro.Provincia.IndexOf("canaria", StringComparison.OrdinalIgnoreCase) != -1 || centro.Provincia.IndexOf("las palmas", StringComparison.OrdinalIgnoreCase) != -1) { impuestoText = dictionary["PDF_IGIC"] + " " + ConfigurationManager.AppSettings["IGIC"].ToString() + "%"; impuesto = Convert.ToDecimal(ConfigurationManager.AppSettings["IGIC"].ToString()); } if (centro.Provincia.IndexOf("melilla", StringComparison.OrdinalIgnoreCase) != -1) { impuestoText = dictionary["PDF_Melilla"] + " " + ConfigurationManager.AppSettings["Melilla"].ToString() + "%"; impuesto = Convert.ToDecimal(ConfigurationManager.AppSettings["Melilla"].ToString()); } if (centro.Provincia.IndexOf("ceuta", StringComparison.OrdinalIgnoreCase) != -1) { impuestoText = dictionary["PDF_Ceuta"] + " " + ConfigurationManager.AppSettings["Ceuta"].ToString() + "%"; impuesto = Convert.ToDecimal(ConfigurationManager.AppSettings["Ceuta"].ToString()); } var tableObservaciones = new PdfPTable(2) { WidthPercentage = 100, HorizontalAlignment = 1, SpacingBefore = 20f, SpacingAfter = 30f }; var tableCostsAspad = new PdfPTable(6) { WidthPercentage = 100, HorizontalAlignment = 1, SpacingBefore = 20f, SpacingAfter = 10f }; var tableCostsPropios = new PdfPTable(6) { WidthPercentage = 100, HorizontalAlignment = 1, SpacingBefore = 10f, SpacingAfter = 20f }; tableObservaciones.SetWidths(new float[] { 1f, 3f }); tableCostsAspad.SetWidths(new float[] { 25f, 23f, 10f, 10f, 10f, 15f }); tableCostsPropios.SetWidths(new float[] { 25f, 23f, 10f, 10f, 10f, 15f }); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Especialidad"])); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Concepto"])); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Cantidad"])); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Base"])); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Dto"])); tableCostsAspad.AddCell(ToolsPdf.HeaderCell(dictionary["PDF_Importe"])); /* CREATE PROCEDURE ASPADLAND_GetPresupuestoPendienteByPresupuestoId * @PresupuestoId uniqueidentifier, * @CentroId nvarchar(50) */ bool propios = false; bool hasObservaciones = false; decimal totalBaseCost = 0; decimal totalBaseCostASPAD = 0; using (var cmd = new SqlCommand("ASPADLAND_Salesforce_GetPresupuestoPendienteByPresupuestoId")) { cmd.CommandType = CommandType.StoredProcedure; using (var cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["cns"].ConnectionString)) { cmd.Connection = cnn; cmd.Parameters.Add(DataParameter.Input("@PresupuestoId", presupuestoId)); cmd.Parameters.Add(DataParameter.Input("@CentroId", centro.Id)); try { cmd.Connection.Open(); using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { observaciones = rdr.GetString(9); presupuestoCodigo = rdr.GetString(1); presupuestoFecha = string.Format(CultureInfo.InvariantCulture, @"{0:dd/MM/yyyy}", rdr.GetDateTime(7)); string amountText = string.Empty; string totalRowText = string.Empty; string actoObservaciones = rdr.GetString(10); var especialidad = rdr.GetString(4); decimal finalAmount = 0M; if (!rdr.IsDBNull(5)) { finalAmount = rdr.GetDecimal(5); if (especialidad.Equals("propio", StringComparison.OrdinalIgnoreCase)) { finalAmount = finalAmount / (1 + impuesto / 100); } amountText = string.Format( CultureInfo.InvariantCulture, @"{0:#0.00} €", finalAmount).Replace(",", "."); totalRowText = string.Format( CultureInfo.InvariantCulture, @"{0:#0.00} €", finalAmount).Replace(",", "."); } var dto = string.Empty; if (!rdr.IsDBNull(6)) { decimal dtoAmount = rdr.GetDecimal(6); finalAmount = finalAmount / (1 + impuesto / 100); amountText = string.Format( CultureInfo.InvariantCulture, @"{0:#0.00} €", finalAmount).Replace(",", "."); finalAmount = finalAmount * (100 - dtoAmount) / 100; dto = string.Format( CultureInfo.InvariantCulture, @"{0:#0.00} %", dtoAmount).Replace(",", "."); totalRowText = string.Format( CultureInfo.InvariantCulture, @"{0:#0.00} €", finalAmount).Replace(",", "."); } if (especialidad.Equals("propio", StringComparison.OrdinalIgnoreCase)) { totalBaseCost += finalAmount; } else { totalBaseCostASPAD += finalAmount; } if (especialidad.Equals("propio", StringComparison.OrdinalIgnoreCase)) { if (!propios) { tableCostsPropios.AddCell(new PdfPCell(new Phrase(dictionary["PDF_Actospropios"], ToolsPdf.TimesBold)) { Border = ToolsPdf.BorderBottom, Padding = 6f, PaddingTop = 6f, HorizontalAlignment = 0, Colspan = 6 }); } tableCostsPropios.AddCell(ToolsPdf.DataCell(especialidad, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(rdr.GetString(3), labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(1, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(amountText, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(dto, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(totalRowText, labelFont)); propios = true; if (!string.IsNullOrEmpty(actoObservaciones)) { hasObservaciones = true; tableObservaciones.AddCell(new PdfPCell(new Phrase(rdr.GetString(3), labelFont)) { Border = ToolsPdf.BorderNone, Padding = 6f, PaddingTop = 6f, HorizontalAlignment = 0 }); tableObservaciones.AddCell(new PdfPCell(new Phrase(actoObservaciones, labelFont)) { Border = ToolsPdf.BorderNone, Padding = 6f, PaddingTop = 6f, HorizontalAlignment = 0 }); } } else { tableCostsAspad.AddCell(ToolsPdf.DataCell(especialidad, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(rdr.GetString(3), labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(1, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(amountText, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(dto, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(totalRowText, labelFont)); if (!string.IsNullOrEmpty(actoObservaciones)) { hasObservaciones = true; tableObservaciones.AddCell(new PdfPCell(new Phrase(rdr.GetString(3), labelFont)) { Border = ToolsPdf.BorderNone, Padding = 6f, PaddingTop = 6f, HorizontalAlignment = 0 }); tableObservaciones.AddCell(new PdfPCell(new Phrase(actoObservaciones, labelFont)) { Border = ToolsPdf.BorderNone, Padding = 6f, PaddingTop = 6f, HorizontalAlignment = 0 }); } } } } } finally { if (cmd.Connection.State != ConnectionState.Closed) { cmd.Connection.Close(); } } } } var la1 = new Chunk(dictionary["PDF_Albaran"] + ": ", labelFont); var la2 = new Chunk(presupuestoCodigo + Environment.NewLine, FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.BOLD)); var la3 = new Chunk(dictionary["PDF_Fecha"] + ": ", labelFont); var la4 = new Chunk(presupuestoFecha, dataFont); var p1 = new Paragraph { la1, la2, la3, la4 }; document.Add(new Paragraph(Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine)); var lb1 = new Chunk(aseguradoNombre + Environment.NewLine, dataFont); var lb2 = new Chunk(dictionary["PDF_Poliza"] + ": ", labelFont); var lb3 = new Chunk(poliza.Numero + Environment.NewLine, dataFont); var p2 = new Paragraph { lb1, lb2, lb3 }; var cell1 = new PdfPCell { Border = ToolsPdf.BorderNone }; var cell2 = new PdfPCell { Border = ToolsPdf.BorderNone }; cell1.AddElement(p1); cell2.AddElement(p2); table.AddCell(cell1); table.AddCell(cell2); document.Add(table); decimal baseIvaASPAD = totalBaseCostASPAD * impuesto / 100; string baseIvaTextASPAD = string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", baseIvaASPAD).Replace(",", "."); string totalASPAD = string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", totalBaseCostASPAD + baseIvaASPAD).Replace(",", "."); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(dictionary["PDF_Base"] + ":", labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellTotal(string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", totalBaseCostASPAD).Replace(",", "."), totalFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(impuestoText + ":", labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(baseIvaTextASPAD, totalFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(dictionary["PDF_Total"] + ":", labelFont)); tableCostsAspad.AddCell(ToolsPdf.DataCellRight(totalASPAD, totalFont)); document.Add(tableCostsAspad); if (propios) { decimal baseIva = totalBaseCost * impuesto / 100; string baseIvaText = string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", baseIva).Replace(",", "."); string total = string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", totalBaseCost + baseIva).Replace(",", "."); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(dictionary["PDF_Base"], labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellTotal(string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", totalBaseCost).Replace(",", "."), totalFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(impuestoText + ":", labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(baseIvaText, totalFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(dictionary["PDF_Total"] + ":", labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCellRight(total, totalFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(ToolsPdf.DataCell(string.Empty, labelFont)); tableCostsPropios.AddCell(TotalCell(string.Empty)); tableCostsPropios.AddCell(TotalCell(string.Empty)); tableCostsPropios.AddCell(TotalCell(string.Empty)); tableCostsPropios.AddCell(TotalCell(string.Empty)); tableCostsPropios.AddCell(TotalCell(dictionary["PDF_Total"] + ":")); string superTotal = string.Format(CultureInfo.InvariantCulture, @"{0:#0.00} €", totalBaseCost + baseIva + totalBaseCostASPAD + baseIvaASPAD).Replace(",", "."); tableCostsPropios.AddCell(TotalCell(superTotal)); document.Add(tableCostsPropios); } if (!string.IsNullOrEmpty(observaciones)) { document.Add(new Paragraph("Observaciones", ToolsPdf.TimesBold)); document.Add(new Paragraph(observaciones, labelFont)); } if (hasObservaciones) { document.Add(tableObservaciones); } document.Add(new Phrase(dictionary["Item_Presupuesto_Print_Caducity"], ToolsPdf.TimesLittle)); document.Close(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", "inline;filename=Incidencia.pdf"); Response.ContentType = "application/pdf"; Response.WriteFile(Request.PhysicalApplicationPath + "\\Temp\\" + fileName); Response.Flush(); Response.Clear(); }