public void urunGuncVeriCek(int no, Ambiance_TextBox tbUAdi, Ambiance_TextBox tbUBarkod, Ambiance_ComboBox cbKategori, Ambiance_TextBox Tb_Stok, Ambiance_ComboBox CbBirim, Ambiance_TextBox TbFiyat, iTalk_Button_2 btnDuzenle, DataGridView dgUrun) { try { SqlConnection b = new SqlConnection(); b.ConnectionString = bag_cumlem; b.Open(); string sql = "Select * from urunler where urun_id='" + no + "'"; SqlCommand k = new SqlCommand(sql, b); SqlDataReader dr = k.ExecuteReader(); while (dr.Read()) { tbUAdi.Text = dr["urun_adi"].ToString(); tbUBarkod.Text = dr["urun_barkod"].ToString(); cbKategori.Text = dr["urun_kategori"].ToString(); Tb_Stok.Text = dr["stok"].ToString(); CbBirim.Text = dr["birim"].ToString(); TbFiyat.Text = dr["fiyat"].ToString(); btnDuzenle.Visible = true; } } catch { MessageBox.Show("Kullanıcı Getirilirken bir hata oluştu tekrar deneyiniz"); } }
public void birimListele(Ambiance_ComboBox cbBirim) { string sql = "Select * from urun_birim"; SqlConnection b = new SqlConnection(); b.ConnectionString = bag_cumlem; b.Open(); SqlDataAdapter da = new SqlDataAdapter(sql, b); DataTable t = new DataTable(); da.Fill(t); cbBirim.DataSource = t; cbBirim.DisplayMember = t.Columns[1].ColumnName; cbBirim.ValueMember = t.Columns[0].ColumnName; }
public void kategorilist(Ambiance_ComboBox cbUrunler) { string sql = "Select * from urunkategori"; SqlConnection b = new SqlConnection(); b.ConnectionString = bag_cumlem; b.Open(); SqlDataAdapter da = new SqlDataAdapter(sql, b); DataTable t = new DataTable(); da.Fill(t); cbUrunler.DataSource = t; cbUrunler.DisplayMember = t.Columns[1].ColumnName; cbUrunler.ValueMember = t.Columns[0].ColumnName; }
public void AddTab(SchoolClass classTab, int index) // This method adds a tab to the main page based on the info of a SchoolClass { TabPage tab = new System.Windows.Forms.TabPage // Create a new tab with className { Text = classTab.className, Name = classTab.classID, Size = new System.Drawing.Size(256, 214), TabIndex = index }; allTabs.Add(tab); // Store all tabs in a list classTabs.Controls.Add(tab); // Add tab to display Ambiance_HeaderLabel teacherLabel = new Ambiance_HeaderLabel { AutoSize = true, Location = new System.Drawing.Point(16, 7), Name = "teacherLabel", // Font = new Font("Segoe UI", 12.0f, FontStyle.Bold), Size = new System.Drawing.Size(43, 90), Text = ("Teacher : " + Database.currentClasses[index].teacher.firstName + " " + Database.currentClasses[index].teacher.lastName) }; Ambiance_Label classIDLabel = new Ambiance_Label { AutoSize = true, Location = new System.Drawing.Point(16, 27), Name = "classIDLabel", // Font = new Font("Segoe UI", 12.0f, FontStyle.Regular), Size = new System.Drawing.Size(43, 13), Text = ("Class ID : " + Database.currentClasses[index].classID) }; tab.Controls.Add(teacherLabel); tab.Controls.Add(classIDLabel); if (Database.isTeacher) // If user is a teacher, add these elements to tabs { Ambiance_ComboBox studentBox = new Ambiance_ComboBox { Location = new System.Drawing.Point(700, 10), Name = "studentBox", Size = new System.Drawing.Size(204, 26) }; Ambiance_HeaderLabel studentLabel = new Ambiance_HeaderLabel { AutoSize = true, Location = new System.Drawing.Point(565, 13), Name = "studentLabel", // Font = new Font("Segoe UI", 12.0f, FontStyle.Regular), Size = new System.Drawing.Size(129, 20), Text = ("Current Student :") }; Ambiance_HeaderLabel selectStudentLabel = new Ambiance_HeaderLabel { AutoSize = true, Location = new System.Drawing.Point(72, 180), Name = "selectStudentLabel", Font = new Font("Segoe UI", 32.0f, FontStyle.Bold), Size = new System.Drawing.Size(773, 59), Text = ("Select a student to view their grades.") }; foreach (User userInClass in classTab.students) { studentBox.Items.Add(userInClass.firstName + " " + userInClass.lastName); } studentBox.SelectedIndexChanged += new EventHandler(DynamicComboBox_OnChange); tab.Controls.Add(studentLabel); tab.Controls.Add(studentBox); tab.Controls.Add(selectStudentLabel); } else // If the user is a student, add these elements { ShowInfo(tab, classTab, Database.currentUser); } }