public void UpdateDoorsxUser(DoorsxUser pDoorsxUser) { string SP = ""; if (pDoorsxUser.TEMP == true) { SP = "[spUpdateTEMPdxu]"; } else { SP = "[spUpdateDoorsxUser]"; } decimal total = Convert.ToDecimal(pDoorsxUser.ItemCost); decimal subto = Convert.ToDecimal(pDoorsxUser.SubTotal); string sql = @"" + SP + " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', '{30}'"; sql = string.Format(sql, pDoorsxUser.Id, pDoorsxUser.Order.Id, pDoorsxUser.DoorStyle.Id, pDoorsxUser.Material.Id, pDoorsxUser.TopRail.Id, pDoorsxUser.BottomRail.Id, pDoorsxUser.Preparation.Id, pDoorsxUser.Join.Id, pDoorsxUser.OutsideEdgeProfile.Id, pDoorsxUser.InsideEdgeProfile.Id, pDoorsxUser.VerticalDivisions.Id, pDoorsxUser.HorizontalDivisions.Id, pDoorsxUser.Width.ToString().Replace(',', '.'), pDoorsxUser.DecimalsWidth.Id, pDoorsxUser.Height.ToString().Replace(',', '.'), pDoorsxUser.DecimalsHeight.Id, (pDoorsxUser.IsOpeningMeasurement == true) ? 1 : 0, pDoorsxUser.Quantity, total.ToString().Replace(',', '.'), subto.ToString().Replace(',', '.'), pDoorsxUser.User.Id, pDoorsxUser.Status.Id, pDoorsxUser.ModificationUser, pDoorsxUser.Picture, pDoorsxUser.ProfilePicture, pDoorsxUser.Panel.Id, pDoorsxUser.PanelMaterial.Id, pDoorsxUser.DoorType.Id, (pDoorsxUser.isOverlay == true) ? 1 : 0, (pDoorsxUser.isDrill == true) ? 1 : 0, (pDoorsxUser.isFingerPull == true) ? 1 : 0); try { _MB.EjecutarSQL(_CN, sql); } catch (Exception err) { throw err; } }
public bool UpdateDoorsxOrder(Order Order) { try { lnDecimals deci = new lnDecimals(); List <Decimals> listDeci = deci.GetAllDecimals(); lnDoorsPrices dp = new lnDoorsPrices(); List <DoorxOrder> listDoorOrders = null; if (Order.TEMP == true) { listDoorOrders = GetAllTEMPdxoXdxu(Order.DoorxUser.Id); } else { listDoorOrders = GetAllDoorxOrderByDoorxUser(Order.DoorxUser.Id); } lnDoorsxUser DU = new lnDoorsxUser(); Order.SubTotal = 0; Order.Quantity = 0; lnOrder _LNOrder = new lnOrder(); lnUser _LNUser = new lnUser(); User u = new User(); u = _LNUser.GetUserById(Order.User.Id); DoorsxUser Dxu = null; if (Order.TEMP == true) { Dxu = DU.GetTEMPdxuById(Order.DoorxUser.Id); } else { Dxu = DU.GetDoorsxUserById(Order.DoorxUser.Id); } foreach (DoorxOrder item in listDoorOrders) { int Rail = 1; if (Order.DoorxUser.TopRail.Id == 3 || Order.DoorxUser.BottomRail.Id == 3 || Order.DoorxUser.DoorStyle.Id == 1009 || Order.DoorxUser.DoorStyle.Id == 1008) { Rail = 2; } int panel = Order.DoorxUser.Panel.Id; if (Order.DoorxUser.DoorStyle.Id == 1002) { panel = 5; } //else if (Order.DoorxUser.DoorStyle.Id == 1003) //{ // Order.DoorxUser.Panel.Id = 2; //} //if (Order.DoorxUser.Panel.Id == 2) //{ // panel = Order.DoorxUser.Panel.Id; //} if (Order.DoorxUser.DoorStyle.Id == 1010) { panel = 2; } //else //{ // if (Order.DoorxUser.Panel.Id == 3) // { // Order.DoorxUser.Panel.Id = 5; // } //} item.User = u; DoorsPrices DoorPrice = dp.GetDoorsPricesById(0, panel, Order.DoorxUser.Material.Id, Rail); decimal deciW = listDeci.Where(x => x.Id == item.DecimalsWidth.Id).FirstOrDefault().Value; decimal deciH = listDeci.Where(x => x.Id == item.DecimalsHeight.Id).FirstOrDefault().Value; decimal Width = item.Width + deciW; decimal Height = item.Height + deciH; decimal result = (((((Width * Height) / 12m) / 12m) - 1.5m) * DoorPrice.AdditionalSFPrice) + DoorPrice.BasePrice; if ((Order.DoorxUser.DoorStyle.Id == 1010)) { result = result / 100m * 80m; } if (result < DoorPrice.BasePrice) { result = (DoorPrice.BasePrice * 2); if (item.User.Descuento > 0) { decimal des = decimal.Parse(item.User.Descuento.ToString()) / 100m; item.TotalDescuento = result * des; result = result - (des * result); } if (item.Descuento > 0) { decimal des = decimal.Parse(item.Descuento.ToString()) / 100m; item.TotalDescuento = result * des; result = result - (des * result); } else { if (Order.Descuento > 0) { decimal des = decimal.Parse(Order.Descuento.ToString()) / 100m; item.Descuento = Order.Descuento; item.TotalDescuento = result * des; result = result - (des * result); } } item.ItemCost = result; item.SubTotal = result * item.Quantity; } else { result = result * 2; if (item.User.Descuento > 0) { decimal des = decimal.Parse(item.User.Descuento.ToString()) / 100m; item.TotalDescuento = result * des; result = result - (des * result); } if (item.Descuento > 0) { decimal des = decimal.Parse(item.Descuento.ToString()) / 100m; item.TotalDescuento = result * des; result = result - (des * result); } else { if (Order.Descuento > 0) { decimal des = decimal.Parse(Order.Descuento.ToString()) / 100m; item.Descuento = Order.Descuento; item.TotalDescuento = result * des; result = result - (des * result); } } item.ItemCost = result; item.SubTotal = result * item.Quantity; } if (Dxu.isDrill == true) { if (Order.DoorxUser.isDrill == false) { item.HingeDirection.Id = 1; } } else { item.HingeDirection.Id = 1; } item.DoorxUser = Order.DoorxUser; item.ModificationDate = DateTime.Now; item.ModificationUser = item.User.Id; item.ProfilePicture = DU.BuscarProfilePicture(Order.DoorxUser.OutsideEdgeProfile.Id, Order.DoorxUser.InsideEdgeProfile.Id, Order.DoorxUser.Panel.Id); item.Picture = DU.BuscarDoorPicture(item); if (Order.TEMP == true) { item.TEMP = true; } int retorno = _AD.UpdateDoorsxOrder(item); Order.SubTotal = Order.SubTotal + item.SubTotal; Order.Tax = 0.0825m * Order.SubTotal; Order.Total = Order.Tax + Order.SubTotal; Order.Quantity = Order.Quantity + item.Quantity; _LNOrder.UpdateOrder(Order); } return(true); } catch (Exception ex) { throw; } }
public int InsertDoorsxOrder(DoorxOrder pDoorsxOrder) { try { lnDecimals deci = new lnDecimals(); List <Decimals> listDeci = deci.GetAllDecimals(); lnDoorsPrices dp = new lnDoorsPrices(); lnDoorsxUser DU = new lnDoorsxUser(); lnOrder _LNOrder = new lnOrder(); Order item = null; DoorsxUser DoorUser = null; if (pDoorsxOrder.TEMP == true) { DoorUser = DU.GetTEMPdxuById(pDoorsxOrder.DoorxUser.Id); DoorUser.TEMP = true; item = _LNOrder.GetTEMPorderById(DoorUser.Order.Id); item.TEMP = true; } else { item = _LNOrder.GetOrderByUser(pDoorsxOrder.User.Id).Where(x => x.Status.Id == 4).FirstOrDefault(); DoorUser = DU.GetAllDoorsxUser().Where(x => x.Order.Id == item.Id).FirstOrDefault(); } pDoorsxOrder.DoorxUser = DoorUser; int Rail = 1; if (DoorUser.TopRail.Id == 3 || DoorUser.BottomRail.Id == 3 || DoorUser.DoorStyle.Id == 1009 || DoorUser.DoorStyle.Id == 1008) { Rail = 2; } int panel = 5; if (DoorUser.Panel.Id == 2) { panel = DoorUser.Panel.Id; } if (DoorUser.DoorStyle.Id == 1010) { panel = 2; } lnUser _LNUser = new lnUser(); User u = new User(); u = _LNUser.GetUserById(pDoorsxOrder.User.Id); DoorsPrices DoorPrice = dp.GetDoorsPricesById(0, panel, DoorUser.Material.Id, Rail); decimal deciW = listDeci.Where(x => x.Id == pDoorsxOrder.DecimalsWidth.Id).FirstOrDefault().Value; decimal deciH = listDeci.Where(x => x.Id == pDoorsxOrder.DecimalsHeight.Id).FirstOrDefault().Value; decimal Width = pDoorsxOrder.Width + deciW; decimal Height = pDoorsxOrder.Height + deciH; decimal a = 1; decimal b = 1; decimal aux = 1; while (!(aux == deciW)) { aux = a / b; if (aux < deciW) { a++; } else if (aux > deciW) { a--; b++; } } string fracc = a.ToString() + "/" + b.ToString(); pDoorsxOrder.User = u; decimal result = (((((Width * Height) / 12m) / 12m) - 1.5m) * DoorPrice.AdditionalSFPrice) + DoorPrice.BasePrice; if ((DoorUser.DoorStyle.Id == 1010)) { result = result / 100m * 80m; } if (result < DoorPrice.BasePrice) { result = DoorPrice.BasePrice * 2; if (pDoorsxOrder.User.Descuento > 0) { decimal des = decimal.Parse(pDoorsxOrder.User.Descuento.ToString()) / 100m; result = result - (des * result); } if (pDoorsxOrder.Descuento > 0) { decimal des = decimal.Parse(pDoorsxOrder.Descuento.ToString()) / 100m; pDoorsxOrder.TotalDescuento = result * des; result = result - (des * result); } pDoorsxOrder.ItemCost = result; pDoorsxOrder.SubTotal = result * pDoorsxOrder.Quantity; } else { result = result * 2; if (pDoorsxOrder.User.Descuento > 0) { decimal des = decimal.Parse(pDoorsxOrder.User.Descuento.ToString()) / 100m; pDoorsxOrder.TotalDescuento = result * des; result = result - (des * result); } if (pDoorsxOrder.Descuento > 0) { decimal des = decimal.Parse(pDoorsxOrder.Descuento.ToString()) / 100m; pDoorsxOrder.TotalDescuento = result * des; result = result - (des * result); } pDoorsxOrder.ItemCost = result; pDoorsxOrder.SubTotal = result * pDoorsxOrder.Quantity; } if (DoorUser.isDrill == false) { pDoorsxOrder.HingeDirection.Id = 3; pDoorsxOrder.HingePositions.Id = 2; } else { pDoorsxOrder.HingeDirection.Id = pDoorsxOrder.HingeDirection.Id; pDoorsxOrder.HingePositions.Id = 2; } pDoorsxOrder.CreationDate = DateTime.Now; pDoorsxOrder.ModificationDate = DateTime.Now; pDoorsxOrder.CreatorUser = pDoorsxOrder.User.Id; pDoorsxOrder.ModificationUser = pDoorsxOrder.User.Id; pDoorsxOrder.ProfilePicture = DU.BuscarProfilePicture(DoorUser.OutsideEdgeProfile.Id, DoorUser.InsideEdgeProfile.Id, DoorUser.Panel.Id); pDoorsxOrder.Picture = DU.BuscarDoorPicture(pDoorsxOrder); int retorno = _AD.InsertDoorsxOrder(pDoorsxOrder); item.SubTotal = item.SubTotal + pDoorsxOrder.SubTotal; item.Tax = 0.0825m * item.SubTotal; item.Total = item.Tax + item.SubTotal; item.Quantity = item.Quantity + pDoorsxOrder.Quantity; _LNOrder.UpdateOrder(item); return(retorno); } catch (Exception ex) { throw; } }
public string DescargarPDF(int IdOrder, string mapPach) { try { string path = mapPach + "/Content/PDF"; foreach (var item in Directory.GetFiles(path, "*.*")) { File.SetAttributes(item, FileAttributes.Normal); File.Delete(item); } BusinessLogic.lnOrder LNOrder = new BusinessLogic.lnOrder(); BusinessLogic.lnUser LNUser = new BusinessLogic.lnUser(); BusinessLogic.lnCompany LNCOmpany = new BusinessLogic.lnCompany(); BusinessLogic.lnDoorsxUser LNDoorUser = new BusinessLogic.lnDoorsxUser(); BusinessLogic.lnDoorxOrder LNDoorOrder = new BusinessLogic.lnDoorxOrder(); BusinessLogic.lnPerson LNPerson = new BusinessLogic.lnPerson(); Order order = LNOrder.GetOrderById(IdOrder); User user = LNUser.GetUserById(order.User.Id); Person person = LNPerson.GetPersonById(user.Person.Id); Company company = LNCOmpany.GetCompanyById(user.Company.Id); DoorsxUser doorsxUser = LNDoorUser.GetAllDoorsxUser().Where(x => x.Order.Id == IdOrder).FirstOrDefault(); List <DoorxOrder> DO = LNDoorOrder.GetAllDoorxOrderByDoorxUser(doorsxUser.Id); var doc1 = new Document(); //use a variable to let my code fit across the page... string ruta = "/Content/PDF" + "/" + IdOrder + ".pdf"; PdfWriter.GetInstance(doc1, new FileStream(path + "/" + IdOrder + ".pdf", FileMode.Create)); doc1.Open(); string rutaImagen = mapPach + company.Logo; Image image = Image.GetInstance(rutaImagen); Chunk c = new Chunk("Order #" + IdOrder + " \n", FontFactory.GetFont("Arial", 18)); PdfPTable table = new PdfPTable(4); //PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns")); //cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //cell.Border = 0; //table.AddCell(cell); table.TotalWidth = 526f; //fix the absolute width of the table table.LockedWidth = true; //relative col widths in proportions - 1/3 and 2/3 float[] widths = new float[] { 1f, 1f, 1f, 1f }; table.SetWidths(widths); table.HorizontalAlignment = 0; //leave a gap before and after the table //table.SpacingBefore = 20f; //table.SpacingAfter = 30f; PdfPCell cell = new PdfPCell(new Phrase("General Configuration", FontFactory.GetFont("Arial", 12))); cell.Colspan = 4; cell.HorizontalAlignment = 1; cell.Border = 0; cell.PaddingBottom = 10f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Wood Species: " + doorsxUser.Material.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Door Style: " + doorsxUser.DoorStyle.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); string overlay = (doorsxUser.isOverlay == true) ? "Overlay Door Type" : "Inset Door Type"; cell = new PdfPCell(new Phrase("Door Place: " + overlay, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Stile Width: " + doorsxUser.TopRail.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Rail Width: " + doorsxUser.BottomRail.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Inside Profile: " + doorsxUser.InsideEdgeProfile.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Outside Profile: " + doorsxUser.OutsideEdgeProfile.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Door Assembly: " + doorsxUser.Join.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Panel Material: " + doorsxUser.PanelMaterial.Description, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); string OpeningMeasurement = (doorsxUser.IsOpeningMeasurement == true) ? "Yes" : "No"; cell = new PdfPCell(new Phrase("Opening Measurement: " + OpeningMeasurement, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Vertical Divisions: " + doorsxUser.VerticalDivisions.Quantity.ToString(), FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase("Horizontal Divisions: " + doorsxUser.HorizontalDivisions.Quantity.ToString(), FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); string Drill = (doorsxUser.isDrill == true) ? "Yes (" + doorsxUser.HingeDirection.Direction + ")" : "No"; cell = new PdfPCell(new Phrase("Drill: " + Drill, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); string FingerPull = (doorsxUser.isFingerPull == true) ? "Yes" : "No"; cell = new PdfPCell(new Phrase("Finger Pull: " + FingerPull, FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase(" ", FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); cell = new PdfPCell(new Phrase(" ", FontFactory.GetFont("Arial", 9))); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; cell.PaddingBottom = 5f; table.AddCell(cell); image.ScaleAbsoluteWidth(150); image.ScaleAbsoluteHeight(42); Paragraph p = new Paragraph(); int descu = 9; if (DO.Sum(x => x.Descuento) > 0) { doorsxUser.DescuentoActivos = true; descu = 10; } PdfPTable TableDoor = new PdfPTable(descu); TableDoor.TotalWidth = 526f; TableDoor.LockedWidth = true; TableDoor.HorizontalAlignment = 0; TableDoor.SpacingBefore = 20f; TableDoor.SpacingAfter = 30f; cell = new PdfPCell(new Phrase("Door List", FontFactory.GetFont("Arial", 12))); cell.Colspan = descu; cell.HorizontalAlignment = 1; cell.Border = 0; cell.PaddingBottom = 10f; TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Door", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Quantity", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Width", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Height", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Panel", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Door Type", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Door Option", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("Item Cost", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); if (doorsxUser.DescuentoActivos) { cell = new PdfPCell(new Phrase("Discount", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); } cell = new PdfPCell(new Phrase("Sub Total", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); foreach (DoorxOrder item in DO) { string rutaImagenDoor = mapPach + item.Picture; Image imagen = Image.GetInstance(rutaImagenDoor); TableDoor.AddCell(imagen); cell = new PdfPCell(new Phrase(item.Quantity.ToString().Replace(',', '.'), FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); string dw = (item.DecimalsWidth.Id == 2) ? "" : item.DecimalsWidth.Description; string wit = item.Width.ToString().Split(',')[0] + " " + dw; cell = new PdfPCell(new Phrase(wit, FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); string dh = (item.DecimalsHeight.Id == 2) ? "" : item.DecimalsHeight.Description; string hei = item.Height.ToString().Split(',')[0] + " " + dh; cell = new PdfPCell(new Phrase(hei, FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase(item.Panel.Description, FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase(item.DoorType.Description, FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase(item.DoorOption.Description, FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); cell = new PdfPCell(new Phrase("$" + item.ItemCost.ToString().Replace(',', '.'), FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); if (doorsxUser.DescuentoActivos) { cell = new PdfPCell(new Phrase(item.Descuento.ToString() + "%", FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); } cell = new PdfPCell(new Phrase("$" + item.SubTotal.ToString().Replace(',', '.'), FontFactory.GetFont("Arial", 10))); TableDoor.AddCell(cell); } Chunk sub = new Chunk("Sub-Total: $" + order.SubTotal.ToString().Replace(',', '.') + " \n", FontFactory.GetFont("Arial", 14)); Chunk tax = new Chunk("Tax: $" + order.Tax.ToString().Replace(',', '.') + " \n", FontFactory.GetFont("Arial", 14)); Chunk total = new Chunk("Total Price: $" + order.Total.ToString().Replace(',', '.') + " \n", FontFactory.GetFont("Arial", 16)); Paragraph footer = new Paragraph(); footer.Add(sub); footer.Add(tax); footer.Add(total); footer.Alignment = 2; PdfPTable TableUser = new PdfPTable(1); TableUser.TotalWidth = 526f; TableUser.LockedWidth = true; TableUser.HorizontalAlignment = 0; TableUser.SpacingBefore = 20f; TableUser.SpacingAfter = 30f; cell = new PdfPCell(new Phrase("Name: " + person.Name + " " + person.Lastname + " \n", FontFactory.GetFont("Arial", 10))); cell.Border = 0; TableUser.AddCell(cell); cell = new PdfPCell(new Phrase("Email: " + user.Email + " \n", FontFactory.GetFont("Arial", 10))); cell.Border = 0; TableUser.AddCell(cell); cell = new PdfPCell(new Phrase("Telephone: " + person.Telephone + " \n", FontFactory.GetFont("Arial", 10))); cell.Border = 0; TableUser.AddCell(cell); PdfPTable TableHeader = new PdfPTable(2); TableHeader.TotalWidth = 526f; TableHeader.LockedWidth = true; TableHeader.HorizontalAlignment = 0; TableHeader.SpacingBefore = 20f; TableHeader.SpacingAfter = 30f; cell = new PdfPCell(image); cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right cell.Border = 0; TableHeader.AddCell(cell); p.Add(c); p.Add(order.CreationDate.ToString("MM/dd/yyyy") + " \n"); p.Alignment = 2; cell = new PdfPCell(new Phrase(p)); cell.HorizontalAlignment = 2; //0=Left, 1=Centre, 2=Right cell.Border = 0; TableHeader.AddCell(cell); // doc1.Add(p); // doc1.Add(image); doc1.Add(TableHeader); doc1.Add(TableUser); doc1.Add(table); doc1.Add(TableDoor); doc1.Add(footer); doc1.Close(); //------------------------------- return(ruta); // return Json(true); } catch (Exception ex) { return(""); // return Json(false); } }
public DoorsxUser GetTEMPdxuById(int Id) { DoorsxUser doorxu = new DoorsxUser(); string sql = @"[spGetTEMPdxu] '{0}' "; sql = string.Format(sql, Id); try { DataSet ds = new DataSet(); ds = _MB.CreaDS(ds, "DoorsxUser", sql, _CN); if (ds.Tables["DoorsxUser"].Rows.Count > 0) { foreach (DataRow item in ds.Tables["DoorsxUser"].Rows) { doorxu = new DoorsxUser() { Id = int.Parse(item["Id"].ToString()), Order = new Order() { Id = int.Parse(item["IdOrder"].ToString()) }, DoorStyle = new DoorStyle() { Id = int.Parse(item["IdDoorStyle"].ToString()), Description = item["DescripDoorStyle"].ToString() }, Material = new Material() { Id = int.Parse(item["IdMaterial"].ToString()), Description = item["DescripMaterial"].ToString() }, TopRail = new TopRail() { Id = int.Parse(item["IdTopRail"].ToString()), Description = item["DescripTopRail"].ToString() }, BottomRail = new BottomRail() { Id = int.Parse(item["IdBottomRail"].ToString()), Description = item["DescripBottomRail"].ToString() }, Preparation = new Preparation() { Id = int.Parse(item["IdPreparation"].ToString()), Description = item["DescripPreparation"].ToString() }, Join = new Join() { Id = int.Parse(item["IdJoin"].ToString()), Description = item["DescripJoin"].ToString() }, OutsideEdgeProfile = new OutsideEdgeProfile() { Id = int.Parse(item["IdOutsideEdgeProfile"].ToString()), Description = item["DescriptOEP"].ToString() }, InsideEdgeProfile = new InsideEdgeProfile() { Id = int.Parse(item["IdInsideEdgeProfile"].ToString()), Description = item["DesccripIEP"].ToString() }, VerticalDivisions = new VerticalDivisions() { Id = int.Parse(item["IdVerticalDivisions"].ToString()), Quantity = int.Parse(item["VerticalDivision"].ToString()) }, HorizontalDivisions = new HorizontalDivisions() { Id = int.Parse(item["IdHorizontalDivisions"].ToString()), Quantity = int.Parse(item["HorizontalDivision"].ToString()) }, Width = decimal.Parse(item["Width"].ToString()), DecimalsWidth = new Decimals() { Id = int.Parse(item["IdDecimalsWidth"].ToString()), Description = item["DescriptDW"].ToString(), Value = decimal.Parse(item["ValueDW"].ToString()) }, Height = decimal.Parse(item["Height"].ToString()), DecimalsHeight = new Decimals() { Id = int.Parse(item["IdDecimalsHeight"].ToString()), Description = item["DescriptDH"].ToString(), Value = decimal.Parse(item["ValueDH"].ToString()) }, IsOpeningMeasurement = bool.Parse(item["IsOpeningMeasurement"].ToString()), Quantity = int.Parse(item["Quantity"].ToString()), ItemCost = decimal.Parse(item["ItemCost"].ToString()), SubTotal = decimal.Parse(item["SubTotal"].ToString()), User = new User() { Id = int.Parse(item["IdUser"].ToString()) }, Status = new Status() { Id = int.Parse(item["IdStatus"].ToString()), Description = item["DescripStatus"].ToString() }, CreationDate = DateTime.Parse(item["CreationDate"].ToString()), ModificationDate = DateTime.Parse(item["ModificationDate"].ToString()), CreatorUser = int.Parse(item["CreatorUser"].ToString()), ModificationUser = int.Parse(item["ModificationUser"].ToString()), Picture = item["Picture"].ToString(), ProfilePicture = item["ProfilePicture"].ToString(), Panel = new Panel() { Id = int.Parse(item["IdPanel"].ToString()), Description = item["DescripPanel"].ToString() }, PanelMaterial = new PanelMaterial() { Id = int.Parse(item["IdPanelMaterial"].ToString()), Description = item["DescripPanelMaterial"].ToString() }, DoorType = new DoorType() { Id = int.Parse(item["IdDoorType"].ToString()), Description = item["DescripDoorType"].ToString() }, isOverlay = bool.Parse(item["isOverlay"].ToString()), isFingerPull = bool.Parse(item["isFingerPull"].ToString()), isDrill = bool.Parse(item["isDrill"].ToString()), }; } } return(doorxu); } catch (Exception err) { throw; } }