private void btnUpdate_Click(object sender, EventArgs e) { if (Code > -1) { NCCPTien nc = cbbSupplier.SelectedItem as NCCPTien; PhuongTien exited = PhuongTien.Single(Code); PhuongTien newVehicle = controls_Load(); if (txtName.Text != exited.TenPT) { if (PhuongTien.FindByTen_NCC(txtName.Text, nc.ID).Count > 0) { MessageBox.Show("This vehicle had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); btnAdd.Enabled = false; return; } } int affected = PhuongTien.Update(newVehicle); if (affected > 0) { MessageBox.Show("Updating is sucessful!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnUpdate_Click(object sender, EventArgs e) { NCCPTien exited = NCCPTien.Single(Code); NCCPTien newAdd = controls_Load(); if (exited.TenNCC != newAdd.TenNCC) { if (NCCPTien.FindByTenNCC(newAdd.TenNCC) != null) { MessageBox.Show("This supplier had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); btnAdd.Enabled = false; return; } } int affected = NCCPTien.Update(newAdd); if (affected > 0) { MessageBox.Show("Updating is successfull!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tvSupplier_Load(NCCPTien supplier) { tvSupplier.Nodes.Clear(); tvSupplier.Nodes.Add("Code: " + supplier.ID); tvSupplier.Nodes.Add("Company Name: " + supplier.TenNCC); tvSupplier.Nodes.Add("Phone Numbers: " + supplier.DienThoai); tvSupplier.Nodes.Add("Address: " + supplier.DiaChi); }
private void controls_LoadUp() { NCCPTien nc = NCCPTien.Single(Code); txtName.Text = nc.TenNCC; txtAddress.Text = nc.DiaChi; txtPhone.Text = nc.DienThoai; }
private void itemAdd_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { Supplierform frm = new Supplierform(); frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { lvSuppliers_Load(NCCPTien.All()); } }
private void btnNewSupplier_Click(object sender, EventArgs e) { Supplierform frm = new Supplierform(); frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { cbbSupplier_Load(NCCPTien.All()); } }
private NCCPTien controls_Load() { NCCPTien result = new NCCPTien(); result.ID = Code; result.TenNCC = txtName.Text; result.DiaChi = txtAddress.Text; result.DienThoai = txtPhone.Text; return(result); }
private void btnView_Click(object sender, EventArgs e) { Supplierform frm = new Supplierform(); NCCPTien nc = cbbSupplier.SelectedItem as NCCPTien; frm.Code = NCCPTien.Single(nc.ID).ID; frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { cbbSupplier_Load(); } }
private void Suppliersfrm_Load(object sender, EventArgs e) { if (Powers == PowersLog.Administrator || Powers == PowersLog.Designer) { grbManager.Visible = true; } else { grbManager.Visible = false; } cbbFields_Load(); lvSuppliers_Load(NCCPTien.All()); }
private void itemUpdate_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (lvSuppliers.SelectedItems.Count > 0) { Supplierform frm = new Supplierform(); frm.Code = MyConvert.ToInt32(lvSuppliers.SelectedItems[0].SubItems[0].Text); frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { lvSuppliers_Load(NCCPTien.All()); } } }
private PhuongTien controls_Load() { PhuongTien result = new PhuongTien(); result.ID = Code; result.TenPT = txtName.Text; result.TienNghi = txtFacitities.Text; result.SoChoToiDa = MyConvert.ToInt32(txtMxNbr.Text); result.SoChoToiThieu = MyConvert.ToInt32(txtMinNbr.Text); NCCPTien nc = (NCCPTien)cbbSupplier.SelectedItem; result.NhaCungCap = nc.ID; return(result); }
private void Tourfrm_Load(object sender, EventArgs e) { tvtours_Load(Tour.All()); listDes = new List <DiemDen>(); listScenic = new List <DiemDL>(); cbbLocal_Load(DiaDiemDL.All()); cbbSupplier_Load(NCCPTien.All()); cbbStatus.SelectedIndex = 0; if (_ID != 0) { btnUpdateTour.Enabled = true; Controls_LoadUp(); } }
private void cbbSupplier_SelectedIndexChanged(object sender, EventArgs e) { if (cbbSupplier.SelectedIndex > 0) { NCCPTien ncc = cbbSupplier.SelectedItem as NCCPTien; cbbPhuongTien_Load(PhuongTien.FindByMaNCC(ncc.ID)); } else { cbbPhuongTien_Load(PhuongTien.All()); } cbbVehical.Text = ""; tvVehical.Nodes.Clear(); btnAddDes.Enabled = false; }
private void lvVehicles_SelectedIndexChanged(object sender, EventArgs e) { if (lvVehicles.SelectedItems.Count > 0) { lvTours_Load(Tour.FindByVehicleCode(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text))); trvDestination_Load(DiemDen.FindByMaPT(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text))); tvSupplier_Load(NCCPTien.FindByVehicleCode(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text))); } else { lvTours.Items.Clear(); trvDestination.Nodes.Clear(); tvSupplier.Nodes.Clear(); } }
private void btnAdd_Click(object sender, EventArgs e) { NCCPTien nc = NCCPTien.FindByTenNCC(txtName.Text); if (nc != null) { MessageBox.Show("This supplier had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); btnAdd.Enabled = false; return; } int affected = NCCPTien.Add(controls_Load()); if (affected > 0) { MessageBox.Show("Adding is successful!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show("Adding had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cbbFields_Load() { object[] bjs = NCCPTien.ColumnNames(); cbbFields.Items.AddRange(bjs); }
private void btnAll_Click(object sender, EventArgs e) { lvSuppliers_Load(NCCPTien.All()); }
private void txtSearchKey_EditValueChanged(object sender, EventArgs e) { lvSuppliers_Load(NCCPTien.SearchKeyWords(txtSearchKey.Text)); }
private void cbbFields_SelectedIndexChanged(object sender, EventArgs e) { lvSuppliers_Load(NCCPTien.SearchFields(cbbFields.SelectedItem.ToString(), txtValueField.Text)); }
private void cbbSupplier_Load() { cbbSupplier.DataSource = NCCPTien.All(); cbbSupplier.DisplayMember = "TenNCC"; cbbSupplier.ValueMember = "ID"; }