public Form2() { InitializeComponent(); panelMainDashboard.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainPaySomething.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainSendMail.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainSettings.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainTransfer.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainDashboard.Visible = true; panelMainPaySomething.Visible = false; panelMainSendMail.Visible = false; panelMainTransfer.Visible = false; panelMainSettings.Visible = false; pictureFailed.Visible = false; pictureValid.Visible = false; lastMenupanel = panelMainDashboard; UIDashboardAccountFrame.generateDashboard(ibanList, panelMainDashboard, exchangeTbl); labelLastName.Text = DataManagement.getLastName(); using (var context = new MitBankDBEntities2()) { var result2 = context.getLastLogin(DataManagement.getIdUsername()); foreach (var item in result2) { labelLastLogin.Text = item.ToString(); } } }
public Form2() { InitializeComponent(); panelMainDashboard.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainPaySomething.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainSendMail.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainSettings.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainTransfer.BackColor = System.Drawing.Color.FromArgb(100, 100, 40); panelMainDashboard.Visible = true; panelMainPaySomething.Visible = false; panelMainSendMail.Visible = false; panelMainTransfer.Visible = false; panelMainSettings.Visible = false; pictureFailed.Visible = false; pictureValid.Visible = false; lastMenupanel = panelMainDashboard; UIDashboardAccountFrame.generateDashboard(ibanList, panelMainDashboard, exchangeTbl); labelLastName.Text = DataManagement.getLastName(); using (var context = new MitBankDBEntities()) { var result2 = context.getLastLogin(DataManagement.getIdUsername()); foreach (var item in result2) { labelLastLogin.Text = item.ToString(); } } labelChangeEmail.Visible = false; textBoxChangeEmail.Visible = false; using (var context = new MitBankDBEntities()) { var result = context.selectOnIndividuals(DataManagement.getIdUsername()).ToArray(); foreach (var items in result) { labelLastNameSettings.Text = items.LastName; labelFirstNameSettings.Text = items.FirstName; labelEmailSettings.Text = items.Email; labelBirthdateSettings.Text = items.Birthday.ToShortDateString(); int idInd = items.ID; } } }
private void buttonGenerateHistoryTranz_Click(object sender, EventArgs e) { char delim = ';'; DataTable tb = new DataTable(); DataColumn ordId = new DataColumn("IdTranzaction"); ordId.DataType = typeof(int); tb.Columns.Add(ordId); DataColumn usAccount = new DataColumn("UserId"); usAccount.DataType = typeof(string); usAccount.MaxLength = 100; tb.Columns.Add(usAccount); DataColumn fAccount = new DataColumn("From Account"); fAccount.DataType = typeof(string); fAccount.MaxLength = 100; tb.Columns.Add(fAccount); DataColumn tAccount = new DataColumn("To Account"); tAccount.DataType = typeof(string); tAccount.MaxLength = 100; tb.Columns.Add(tAccount); DataColumn typeTranz = new DataColumn("Type Transaction"); typeTranz.DataType = typeof(string); typeTranz.MaxLength = 100; tb.Columns.Add(typeTranz); DataColumn val = new DataColumn("Value"); val.DataType = typeof(float); tb.Columns.Add(val); DataColumn dateTrans = new DataColumn("Date"); dateTrans.DataType = typeof(DateTime); tb.Columns.Add(dateTrans); DataColumn tipTranz = new DataColumn("Type Trnsaction"); tipTranz.DataType = typeof(string); tb.Columns.Add(tipTranz); using (var context = new MitBankDBEntities()) { var result = context.HistoryTransactionProc(DataManagement.getIdUsername()).ToArray(); foreach (var items in result) { if (items.TypeTransaction.Value == 4) { tb.Rows.Add(items.ID, items.UserAccountID, items.fromAccount, items.toWichAccount, items.TypeTransaction , items.Value, items.DateTransaction, "transfer"); } else { if (items.TypeTransaction.Value == 3) { tb.Rows.Add(items.ID, items.UserAccountID, items.fromAccount, items.toWichAccount, items.TypeTransaction , items.Value, items.DateTransaction, "pay bill"); } } } StringBuilder sb = new StringBuilder(); foreach (DataRow row in tb.Rows) { string[] fields = row.ItemArray.Select(field => field.ToString()). ToArray(); sb.AppendLine(string.Join(",", fields)); } if (comboBoxTakeFormat.SelectedItem == "Excel Format") { WriteToExcel(tb, "C:\\Users\\" + Environment.UserName + "\\Desktop\\History Transaction " + DataManagement.getLastName() + ".xlsx"); MessageBox.Show("It`s saved. Please see file on desktop!"); } else if (comboBoxTakeFormat.SelectedItem == "CSV Format") { File.WriteAllText("C:\\Users\\" + Environment.UserName + "\\Desktop\\History Transaction " + DataManagement.getLastName() + ".csv", sb.ToString()); MessageBox.Show("It`s saved. Please see file on desktop!"); } } //order.Rows.Add("O9876", 10, 2001); }
private void button1_Click(object sender, EventArgs e) { PdfDocument document = new PdfDocument(); document.Info.Title = "Account request informations"; // Create an empty page PdfPage page = document.AddPage(); // Get an XGraphics object for drawing XGraphics gfx = XGraphics.FromPdfPage(page); // Create a font XFont font = new XFont("Verdana", 11, XFontStyle.Regular); // Draw the text string infoBank = "MITBank Society, Military Technical Academy"; string infoBank2 = "Sucursala Bucuresti, Sector 4"; string text1 = "Extras de cont din " + DateTime.Now.ToString(); string text2 = " Conform dispozitiilor in vigoare, va instiintăm ca, in evidenţele"; string text3 = "noastre contabile, la data de ............., unitatea dvs. figurează"; string text4 = "cu următoarele conturi................................................"; string text5 = "Conturi curente "; gfx.DrawString(infoBank, font, XBrushes.Black, new XRect(10, 0, page.Width, page.Height), XStringFormats.TopLeft); gfx.DrawString(infoBank2, font, XBrushes.Black, new XRect(10, 12, page.Width, page.Height), XStringFormats.TopLeft); gfx.DrawString(text1, font, XBrushes.Black, new XRect(10, 32, page.Width, page.Height), XStringFormats.TopCenter); gfx.DrawString(text2, font, XBrushes.Black, new XRect(10, 60, page.Width, page.Height), XStringFormats.TopLeft); gfx.DrawString(text3, font, XBrushes.Black, new XRect(10, 72, page.Width, page.Height), XStringFormats.TopLeft); gfx.DrawString(text4, font, XBrushes.Black, new XRect(10, 84, page.Width, page.Height), XStringFormats.TopLeft); gfx.DrawString(text5, font, XBrushes.Black, new XRect(10, 100, page.Width, page.Height), XStringFormats.TopCenter); List <string> lc = new List <string>(); lc = DataManagement.getAllInfoAccunts(); string text11 = "ID" + " " + "IBAN" + " " + "Bank Packet" + " " + "VALABILITY" + " " + "SOLD" + " " + "CURRENCY"; gfx.DrawString(text11, font, XBrushes.Black, new XRect(30, 130, page.Width, page.Height), XStringFormats.TopLeft); int x = 160; foreach (string c in lc) { string text0 = c.ToString(); gfx.DrawString(text0, font, XBrushes.Black, new XRect(30, x, page.Width, page.Height), XStringFormats.TopLeft); x += 20; } string text12 = "Pentru mai multe informatii, contactati-ne la 0722222222, director adjunct SSSSSSS SSS"; gfx.DrawString(text12, font, XBrushes.Black, new XRect(30, 300, page.Width, page.Height), XStringFormats.TopLeft); // Save the document... string filename = "Account request " + DataManagement.getLastName(); document.Save(filename); // ...and start a viewer. Process.Start(filename); }