public static void GenerateInventoryItemList(int empId) { string filename = "InventoryStatusReport_" + DateTime.Now.ToString("ddMMMMyyyy_HH_mm_ss") + ".pdf"; SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext(); List <ItemVM> InventoryItemList = ItemBL.GetLowStockItems(); string filePath = HttpContext.Current.Server.MapPath("~/Report_Templates/"); string HTML = string.Empty; HTML = string.Concat(HTML, File.ReadAllText(filePath + "InventoryItem_Header.txt", System.Text.Encoding.UTF8)); HTML = HTML.Replace("[date]", DateTime.Now.ToString("dd MMMM yyyy")); int sr_no = 1; foreach (ItemVM item in InventoryItemList) { HTML = string.Concat(HTML, File.ReadAllText(filePath + "InventoryItem_Body.txt", System.Text.Encoding.UTF8)); HTML = HTML.Replace("[#]", sr_no.ToString()); HTML = HTML.Replace("[itemcode]", item.ItemCode); HTML = HTML.Replace("[item_desc]", item.Desc); HTML = HTML.Replace("[location]", item.Location); HTML = HTML.Replace("[uom]", item.UOM); HTML = HTML.Replace("[item_balance]", item.Balance.ToString()); HTML = HTML.Replace("[item_restock_lvl]", item.ReorderLevel.ToString()); HTML = HTML.Replace("[item_restock_qty]", item.ReorderQty.ToString()); HTML = HTML.Replace("[item_supp1]", item.SuppCode1); HTML = HTML.Replace("[item_supp2]", item.SuppCode2); HTML = HTML.Replace("[item_supp3]", item.SuppCode3); sr_no += 1; } HTML = string.Concat(HTML, File.ReadAllText(filePath + "InventoryItem_Footer.txt", System.Text.Encoding.UTF8)); PDFGenerator_A3Landscape(filename, HTML); EmailBL.SendInvListEmail(empId, filename); }
public static void GenerateLowStockItemList(int empId) { string filename = "StationeryItemsWithLowStockQuantities_" + DateTime.Now.ToString("ddMMMMyyyy_HH_mm_ss") + ".pdf"; SA46Team08ADProjectContext entities = new SA46Team08ADProjectContext(); List <ItemVM> LowStockItemList = ItemBL.GetLowStockItems(); string filePath = HttpContext.Current.Server.MapPath("~/Report_Templates/"); string HTML = string.Empty; HTML = string.Concat(HTML, File.ReadAllText(filePath + "LowStockItemList_Header.txt", System.Text.Encoding.UTF8)); HTML = HTML.Replace("[date]", DateTime.Now.ToString("dd MMMM yyyy")); int sr_no = 1; foreach (ItemVM item in LowStockItemList) { HTML = string.Concat(HTML, File.ReadAllText(filePath + "LowStockItemList_Body.txt", System.Text.Encoding.UTF8)); HTML = HTML.Replace("[#]", sr_no.ToString()); HTML = HTML.Replace("[itemcode]", item.ItemCode); HTML = HTML.Replace("[item_desc]", item.Desc); HTML = HTML.Replace("[uom]", item.UOM); HTML = HTML.Replace("[item_balance]", item.Balance.ToString()); HTML = HTML.Replace("[item_restock_lvl]", item.ReorderLevel.ToString()); HTML = HTML.Replace("[item_restock_qty]", item.ReccReorderQty.ToString()); HTML = HTML.Replace("[item_supp1]", item.SuppCode1); HTML = HTML.Replace("[item_p1]", item.Price1.ToString("C")); //string.Format("{0:C}", Math.Round(item.Price1,3)) HTML = HTML.Replace("[item_supp2]", item.SuppCode2); HTML = HTML.Replace("[item_p2]", item.Price2.ToString("C")); HTML = HTML.Replace("[item_supp3]", item.SuppCode3); HTML = HTML.Replace("[item_p3]", item.Price3.ToString("C")); sr_no += 1; } HTML = string.Concat(HTML, File.ReadAllText(filePath + "LowStockItemList_Footer.txt", System.Text.Encoding.UTF8)); PDFGenerator_A3Landscape(filename, HTML); EmailBL.SendLowStockEmail(empId, filename); }