private void duzenle() { gridToEntity(); Kullanici TempEntity = Entity; KullaniciEkleDuzenle kED = new KullaniciEkleDuzenle(); kED.setState("Düzenle"); kED.setEntity(Entity); DialogResult result = kED.ShowDialog(); if (result.CompareTo(DialogResult.OK) == 0) { Entity = kED.getEntity(); if (!new KullaniciDAO().existingControl(Entity)) { Entity.AdminStajyer = calisanStajyer; try { kDAO.Save(Entity); MessageBox.Show("Düzenlendi"); gridDoldur(); } catch (Exception) { MessageBox.Show("Başarısız"); } } else { MessageBox.Show("Mevcut kullanici"); } } }
private void btnYeni_Click(object sender, EventArgs e) { KullaniciEkleDuzenle kED = new KullaniciEkleDuzenle(); DialogResult result = kED.ShowDialog(); if (result.CompareTo(DialogResult.OK) == 0) { Entity = kED.getEntity(); if (!new KullaniciDAO().existingControl(Entity)) { Entity.Active = true; Entity.InsDate = DateTime.Now; Entity.AdminStajyer = calisanStajyer; try { kDAO.Save(Entity); MessageBox.Show("Eklendi"); gridDoldur(); } catch (Exception) { MessageBox.Show("Başarısız"); } } else { MessageBox.Show("Mevcut kullanici"); } } }
private void ColumnsSettingToolStripMenuItem_Click(object sender, EventArgs e) { IList <ColumnInfoVo> clist = new List <ColumnInfoVo>(); foreach (DataGridViewColumn col in dataGridView1.Columns) { ColumnInfoVo vo = new ColumnInfoVo(); vo.Columnheadertext = col.HeaderText; vo.Columndisplayindex = col.DisplayIndex; vo.Columnname = col.Name; vo.Columnwidth = col.Width; vo.Columnvisible = col.Visible; clist.Add(vo); } FrmColumnsSetting f = new FrmColumnsSetting(clist); DialogResult r = f.ShowDialog(this); if (r.CompareTo(DialogResult.OK) == 0) { string filepath = "temp\\" + this.Name + ".xml"; if (System.IO.File.Exists(filepath)) { File.Delete(filepath); CreateXml(clist, filepath); } else { //创建列显示定义XML文件 CreateXml(clist, filepath); } } }
private void FormPrincipalBingo_FormClosing(object sender, FormClosingEventArgs e) { DialogResult seleccion = MessageBox.Show("Seguro que quieres salir...?", "Confirmar", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (seleccion.CompareTo(DialogResult.OK) != 0) { e.Cancel = true; } }
private void ItemXoa_Click(object sender, EventArgs e) { if (ListShow.SelectedItems.Count > 0) { string id = ListShow.SelectedItems[0].SubItems[1].Text; string tenSanPham = ListShow.SelectedItems[0].SubItems[2].Text; string soLuong = ListShow.SelectedItems[0].SubItems[3].Text; DialogResult dialogResult = MessageBox.Show($"Bạn có muốn xóa mặt hàng này không?\nTên Sản Phẩm: {tenSanPham} số lượng: {soLuong}", null, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult.CompareTo(DialogResult.Yes) == 0) { using (SqlConnection sqlConnection = new SqlConnection(Form1.connect)) { sqlConnection.Open(); string query = "delete from Medicine where ID_Medicine = @value"; SqlCommand sqlCommand = new SqlCommand(query, sqlConnection); sqlCommand.Parameters.AddWithValue("value", id); sqlCommand.ExecuteScalar(); } button1_Click(PictureBoxDanhMucSanPham, null); } } }