Advertisement
viciousojs

Form Main

Jan 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. FORM MAIN
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using System.Data.SqlClient;
  12.  
  13. namespace Modul_9_10
  14. {
  15. public partial class frmMain : Form
  16. {
  17. public frmMain()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. SqlConnection con;
  23. string constr;
  24. SqlDataAdapter da;
  25. SqlCommand cmd;
  26. string query;
  27. DataSet ds;
  28.  
  29. private void Koneksi()
  30. {
  31. constr = "Data Source = localhost; Initial Catalog = Logistic; Integrated Security = true";
  32. con = new SqlConnection(constr);
  33. con.Open();
  34. }
  35.  
  36. private void LoadDataProduct()
  37. {
  38. ds = new DataSet();
  39. query = "SELECT * FROM Product";
  40. cmd = new SqlCommand(query, con);
  41. da = new SqlDataAdapter(cmd);
  42. da.Fill(ds, "Product");
  43. }
  44.  
  45. private void frmMain_Load(object sender, EventArgs e)
  46. {
  47. this.IsMdiContainer = true;
  48. this.WindowState = FormWindowState.Maximized;
  49. stbWaktu.Text = DateTime.Now.ToString();
  50. timWaktu.Interval = 1000;
  51. timWaktu.Enabled = true;
  52. Koneksi();
  53. }
  54.  
  55. private void timWaktu_Tick(object sender, EventArgs e)
  56. {
  57. stbWaktu.Text = DateTime.Now.ToString();
  58. }
  59.  
  60. private void mnuMasterProduct_Click(object sender, EventArgs e)
  61. {
  62. Master.frmProduct mstProduct = new Master.frmProduct();
  63. mstProduct.MdiParent = this;
  64. mstProduct.Show();
  65. }
  66.  
  67. private void mnuMasterVendor_Click(object sender, EventArgs e)
  68. {
  69. Master.frmVendor mstVendor = new Master.frmVendor();
  70. mstVendor.MdiParent = this;
  71. mstVendor.Show();
  72. }
  73.  
  74. private void mnuTransactionPurchasing_Click(object sender, EventArgs e)
  75. {
  76. Transaction.frmPurchasing tscPurchasing = new Transaction.frmPurchasing();
  77. tscPurchasing.MdiParent = this;
  78. tscPurchasing.Show();
  79. }
  80.  
  81. private void mnuTransactionSales_Click(object sender, EventArgs e)
  82. {
  83. Transaction.frmSales tscSales = new Transaction.frmSales();
  84. tscSales.MdiParent = this;
  85. tscSales.Show();
  86. }
  87.  
  88. private void mnuTransactionInventory_Click(object sender, EventArgs e)
  89. {
  90. Transaction.frmInventory tscInventory = new Transaction.frmInventory();
  91. tscInventory.MdiParent = this;
  92. tscInventory.Show();
  93. }
  94.  
  95. private void mnuReportProduct_Click(object sender, EventArgs e)
  96. {
  97. Report.crProduct cr = new Report.crProduct();
  98. Report.frmViewer viewer = new Report.frmViewer();
  99. LoadDataProduct();
  100. cr.SetDataSource(ds);
  101. viewer.crystalReportViewer1.ReportSource = cr;
  102. viewer.WindowState = FormWindowState.Maximized;
  103. viewer.Show();
  104. }
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement