public override string ToString() { return($"=======MAILITEM=======\n" + $"Entry ID: {EntryID}\n" + $"Folder Entry ID: {FolderEntryID}\n" + $"Folder Name: {FolderPath}\n" + $"Subject: {Subject}\n" + $"Received Date: {ReceivedDate.ToString("dd/MM/yyyy hh:mm:ss")}\n" + $"From: {From}\n" + $"To: {To}\n" + $"CC: {CC}\n" + $"======================\n"); }
private void metroButton1_Click(object sender, EventArgs e) { //variables; string ProductName; int ProductQuantity; string SupplierName; int ReceivedStatus; decimal OrderCost; string ReceivedDate; string Received; SqlConnection sqlcon = new SqlConnection(Globals_Class.ConnectionString); sqlcon.Open(); string cmd = "Select ProductName, ProductQuantity, SupplierName, ReceivedStatus, OrderCost, ReceivedDate FROM ReceiveSupplierOrder"; SqlCommand sqlcom = new SqlCommand(cmd, sqlcon); SqlDataReader reader; reader = sqlcom.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { ProductName = (reader["ProductName"].ToString()); ProductQuantity = Convert.ToInt32((reader["ProductQuantity"])); SupplierName = (reader["SupplierName"].ToString()); ReceivedStatus = Convert.ToInt32((reader["ReceivedStatus"])); OrderCost = Convert.ToDecimal((reader["OrderCost"])); ReceivedDate = (reader["ReceivedDate"].ToString()); if (ReceivedStatus == 1) { Received = "Yes"; } else { Received = "No"; } Details += "\n" + "Product Name:" + " " + ProductName + "\n" + "Quantity Ordered:" + " " + ProductQuantity.ToString() + "\n" + "Supplier Name:" + " " + SupplierName + "\n" + "Received Status:" + " " + Received + "\n" + "Order Cost:" + " " + OrderCost.ToString() + "\n" + "Received Date:" + " " + ReceivedDate.ToString() + "\n"; } } reader.Close(); sqlcon.Close(); documentWriter(); }