// public bool Kiemtra(TextBoxX tendaily, ComboBoxEx cmbhuyen, ComboBoxEx cmbxa, TextBoxX diachi, ComboBoxEx cmbDn) { if (tendaily.Text == "") { MessageBox.Show("Chưa nhập tên chủ đại lý !", "Chú ý", MessageBoxButtons.OK); tendaily.Focus(); return(false); } else { if (tendaily.Text.Length > 50) { MessageBox.Show("Nhập tên chủ đại lý không quá 255 ký tự !", "Chú ý", MessageBoxButtons.OK); tendaily.Focus(); return(false); } } if (cmbhuyen.SelectedIndex < 0) { cmbhuyen.Focus(); MessageBox.Show("Chưa chọn Huyện !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (cmbxa.SelectedIndex < 0) { cmbxa.Focus(); MessageBox.Show("Chưa chọn Xã !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (diachi.Text == "") { MessageBox.Show("Chưa nhập địa chỉ !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } else { if (diachi.Text.Length > 50) { MessageBox.Show("Nhập địa chỉ không quá 50 ký tự ", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } } if (cmbDn.SelectedIndex < 0) { cmbxa.Focus(); MessageBox.Show("Chưa chọn Doanh Nghiệp !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
public bool KT(ComboBoxEx cmb, TextBoxX text, string ThongBao) { if (cmb.SelectedIndex >= 0) { if (cmb.SelectedItem.ToString() != "None") { if (text.Text == "" || text == null) { MessageBox.Show("Chưa nhập " + ThongBao); text.Focus(); return(false); } else { return(true); } } } else { MessageBox.Show("Chưa chọn " + ThongBao); cmb.Focus(); return(false); } return(true); }
public bool KT(ComboBoxEx cmb, ComboBoxEx com1, string ThongBao) { if (cmb.SelectedIndex >= 0) { if (cmb.SelectedItem.ToString() != "None") { if (com1.SelectedIndex < 0) { MessageBox.Show("Chưa chọn " + ThongBao); com1.Focus(); return(false); } else { return(true); } } } else { MessageBox.Show("Chưa chọn Điều kiện " + ThongBao); cmb.Focus(); return(false); } return(true); }
void EndEdit() { if (!List.ContainsKey(m_TextBox.Text)) { FolderInfo info = new FolderInfo(m_TextBox.Text, m_TextBox.Text, true); List.Add(info.Name, info); FolderItemControl itemControl = new FolderItemControl(info); m_ComboBox.Combo.Items.Add(itemControl); m_ComboBox.Combo.SelectedItem = itemControl; } m_ComboBox.Visibility = Visibility.Visible; m_TextBox.Visibility = Visibility.Collapsed; m_ComboBox.Focus(); Raise_EditEnd(); }
private bool KiemTra(LabelX maktx, DateTimePicker ngay, ComboBoxEx hoatdong, TextBoxX ghichu) { if (maktx.Text == "") { MessageBox.Show("Mã KTX không hợp lệ", "ky Luat"); return(false); } if (ngay.Value > DateTime.Now) { MessageBox.Show("Ngày không hợp lệ", "ky Luat"); ngay.Value = DateTime.Now; ngay.Focus(); return(false); } if (hoatdong.SelectedIndex < 0) { MessageBox.Show("Chưa chọn Hoạt động", "ky Luat"); hoatdong.Focus(); return(false); } if (ghichu.Text == "") { MessageBox.Show("Chưa nhập Lý do kỹ luật", "ky Luat"); ghichu.Focus(); return(false); } return(true); }
public bool CheckInput(TextBoxX tendichvu, ComboBoxEx cmb) { if (tendichvu.Text == "") { MessageBox.Show("Chưa nhập tên dịch vụ bưu chính viễn thông !", "Chú ý", MessageBoxButtons.OK); tendichvu.Focus(); return(false); } else { if (tendichvu.Text.Length > 200) { MessageBox.Show("Nhập tên dịch vụ bưu chính viễn thông không quá 50 ký tự ", "Chú ý", MessageBoxButtons.OK); tendichvu.Focus(); return(false); } } if (cmb.SelectedIndex < 0) { cmb.Focus(); MessageBox.Show("Chưa chọn Doanh Nghiệp !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
// public bool Kiemtra(TextBoxX tenBDVHX, ComboBoxEx cmbhuyen, ComboBoxEx cmbxa, TextBoxX diachi, ComboBoxEx cmbDN) { if (tenBDVHX.Text == "") { MessageBox.Show("Chưa nhập tên điểm bưu điện văn hóa xã !", "Chú ý", MessageBoxButtons.OK); tenBDVHX.Focus(); return(false); } else { if (tenBDVHX.Text.Length > 50) { MessageBox.Show("Nhập tên điểm bưu điện văn hóa xã không quá 50 ký tự !", "Chú ý", MessageBoxButtons.OK); tenBDVHX.Focus(); return(false); } } if (cmbhuyen.SelectedIndex < 0) { cmbhuyen.Focus(); MessageBox.Show("Chưa chọn Huyện !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (cmbxa.SelectedIndex < 0) { cmbxa.Focus(); MessageBox.Show("Chưa chọn Xã !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (diachi.Text == "") { MessageBox.Show("Chưa nhập địa chỉ !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } else { if (diachi.Text.Length > 50) { MessageBox.Show("Nhập địa chỉ không quá 50 ký tự !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } } if (cmbDN.SelectedIndex < 0) { cmbDN.Focus(); MessageBox.Show("Chưa chọn Doanh nghiệp !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
/// <summary> /// Kiểm tra combobox có chon chưa /// </summary> /// <param name="cmb"></param> /// <param name="ThongBao"></param> /// <returns></returns> public bool CoChon(ComboBoxEx cmb, string ThongBao) { if (cmb.SelectedIndex >= 0) { return(true); } else { MessageBox.Show("Chưa chọn " + ThongBao); cmb.Focus(); } return(false); }
public bool CheckInput(TextBoxX tendaily, ComboBoxEx cmbxa, TextBoxX diachi, TextBox sohieu) { if (tendaily.Text == "") { MessageBox.Show("Chưa nhập tên đại lý !", "Chú ý", MessageBoxButtons.OK); tendaily.Focus(); return(false); } else { if (tendaily.Text.Length > 50) { MessageBox.Show("Nhập tên đại lý không quá 50 ký tự !", "Chú ý", MessageBoxButtons.OK); tendaily.Focus(); return(false); } } if (cmbxa.SelectedIndex < 0) { cmbxa.Focus(); MessageBox.Show("Chưa chọn Xã !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (diachi.Text == "") { MessageBox.Show("Chưa nhập địa chỉ !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } else { if (diachi.Text.Length > 50) { MessageBox.Show("Nhập địa chỉ không quá 50 ký tự ", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } return(true); } if (sohieu.Text == "") { MessageBox.Show("Chưa nhập số hiệu!", "chú ý", MessageBoxButtons.OK); sohieu.Focus(); return(false); } }
private bool KiemTra(LabelX maktx, DateTimePicker ngay, TextBoxX quyetdinhso, ComboBoxEx kl, ComboBoxEx cap, ComboBoxEx cb, TextBoxX lydo) { if (maktx.Text == "") { MessageBox.Show("Mã KTX không hợp lệ", "ky Luat"); return(false); } if (ngay.Value > DateTime.Now) { MessageBox.Show("Ngày không hợp lệ", "ky Luat"); ngay.Value = DateTime.Now; ngay.Focus(); return(false); } if (quyetdinhso.Text == "") { MessageBox.Show("Chưa nhập số quyết định kỹ luật", "ky Luat"); quyetdinhso.Focus(); return(false); } if (kl.SelectedIndex < 0) { MessageBox.Show("Chưa chọn hình thức kỹ luật", "ky Luat"); kl.Focus(); return(false); } if (cap.SelectedIndex < 0) { MessageBox.Show("Chưa chọn cấp kỹ luật", "ky Luat"); cap.Focus(); return(false); } if (cb.SelectedIndex < 0) { MessageBox.Show("Chưa chọn Bán bộ", "ky Luat"); cb.Focus(); return(false); } if (lydo.Text == "") { MessageBox.Show("Chưa nhập Lý do kỹ luật", "ky Luat"); lydo.Focus(); return(false); } return(true); }
public bool CheckInput(TextBoxX ten, TextBoxX user, TextBoxX pass, TextBoxX repass, ComboBoxEx cmbquyen) { if (ten.Text == "") { MessageBox.Show("Chưa nhập họ tên người đăng nhập !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); ten.Focus(); return(false); } else { if (ten.Text.Length > 50) { MessageBox.Show("Họ tên không thể lớn hơn 50 ký tự !", "Chú ý", MessageBoxButtons.OK); ten.Focus(); return(false); } } if (pass.Text != "") { if (pass.Text != repass.Text) { MessageBox.Show("Mật khẩu không trùng nhau !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); pass.Focus(); return(false); } } else { MessageBox.Show("Chưa nhập mật khẩu !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); pass.Focus(); return(false); } if (cmbquyen.SelectedIndex < 0) { cmbquyen.Focus(); MessageBox.Show("Chưa chọn quyền đăng nhập !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
public bool KiemTra(ComboBoxEx danhgia, TextBoxX tichcuc, TextBoxX tieucuc, TextBoxX ghichu) { if (danhgia.SelectedIndex < 0) { MessageBox.Show("Chưa chọn đánh giá", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error); danhgia.Focus(); return(false); } if (tichcuc.Text == "") { DialogResult re = MessageBox.Show("Bạn chưa nhập \"tích cực\" của sinh viên\nBạn có muốn nhập không?", "Danh gia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (re == DialogResult.Yes) { tichcuc.Focus(); return(false); } } if (tieucuc.Text == "") { DialogResult re = MessageBox.Show("Bạn chưa nhập \"tiêu cực\" của sinh viên\nBạn có muốn nhập không?", "Danh gia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (re == DialogResult.Yes) { tieucuc.Focus(); return(false); } } if (ghichu.Text == "") { DialogResult re = MessageBox.Show("Bạn chưa nhập \"Ghi chú\" của sinh viên\nBạn có muốn nhập không?", "Danh gia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (re == DialogResult.Yes) { ghichu.Focus(); return(false); } } return(true); }
public bool KiemTra(TextBoxX hoten, DateTimePicker ngaysinh, TextBoxX diachi, TextBoxX mssv, TextBoxX cmnd, TextBoxX dienthoai, ComboBoxEx qt, ComboBoxEx dt, ComboBoxEx tg) { if (hoten.Text != "") { if (hoten.Text.Length > 30) { MessageBox.Show("Tên không quá 30 ký tự", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); hoten.Focus(); return(false); } } else { hoten.Focus(); MessageBox.Show("Chưa nhập tên", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if ((DateTime.Now.Year - ngaysinh.Value.Year) < 17) { MessageBox.Show("Tuổi phải lớn hơn 16 (tính theo năm)", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); ngaysinh.Focus(); return(false); } if (diachi.Text != "") { if (diachi.Text.Length > 100) { MessageBox.Show("chiều dài Địa chỉ không quá 100 ký tự", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); diachi.Focus(); return(false); } } else { diachi.Focus(); MessageBox.Show("Chưa nhập địa chỉ", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (mssv.Text != "") { if (mssv.Text.Length > 9) { MessageBox.Show("Mã số Sinh viên không quá 9 ký tự", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); mssv.Focus(); return(false); } } else { mssv.Focus(); MessageBox.Show("Chưa nhập MSSV", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (cmnd.Text != "") { if (cmnd.Text.Length != 9) { MessageBox.Show("Chứng minh nhân phải là 9 số", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); cmnd.Focus(); return(false); } else { char[] arr = cmnd.Text.ToCharArray(); string s = "0123456789"; foreach (char c in arr) { if (!s.Contains(c.ToString())) { MessageBox.Show("Chứng minh nhân dân không được có ký tự", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); cmnd.Focus(); return(false); } } } } else { cmnd.Focus(); MessageBox.Show("Chưa nhập số chứng minh nhân dân", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (dienthoai.Text != "") { if (dienthoai.Text.Length != 10 && dienthoai.Text.Length != 6 && dienthoai.Text.Length != 9) { MessageBox.Show("Số điện thoại không thích hợp", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); dienthoai.Focus(); return(false); } else { char[] arr = cmnd.Text.ToCharArray(); string s = "0123456789"; foreach (char c in arr) { if (!s.Contains(c.ToString())) { MessageBox.Show("Số điện thoại không được có ký tự", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); cmnd.Focus(); return(false); } } } } else { dienthoai.Focus(); MessageBox.Show("Chưa nhập số điện thoại", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); // có the khong có } if (qt.SelectedIndex < 0) { qt.Focus(); MessageBox.Show("Chưa chọn Quốc tịch", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (dt.SelectedIndex < 0) { dt.Focus(); MessageBox.Show("Chưa chọn Dân tộc", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (tg.SelectedIndex < 0) { tg.Focus(); MessageBox.Show("Chưa chọn Tôn giáo", "Sinh vien", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
// public bool Kiemtra(TextBoxX ten, TextBoxX diachi, TextBoxX dienthoai, TextBoxX fax, TextBoxX email, TextBoxX trangweb, ComboBoxEx cmbhuyen, ComboBoxEx cmbxa) { if (ten.Text == "") { MessageBox.Show("Chưa nhập tên doanh nghiệp !", "Chú ý", MessageBoxButtons.OK); ten.Focus(); return(false); } else { if (ten.Text.Length > 255) { MessageBox.Show("Tên Doanh nghiệp đã quá chiều dài quy định !", "Chú ý", MessageBoxButtons.OK); ten.Focus(); return(false); } } if (diachi.Text == "") { MessageBox.Show("Chưa nhập địa chỉ !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } else { if (diachi.Text.Length > 50) { MessageBox.Show("Địa chỉ không quá 50 kí tự !", "Chú ý", MessageBoxButtons.OK); diachi.Focus(); return(false); } } if (dienthoai.Text != "") { if (dienthoai.Text.Length != 10 && dienthoai.Text.Length != 11 && dienthoai.Text.Length != 6 && dienthoai.Text.Length != 9) { MessageBox.Show("Số điện thoại không hợp lệ !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); dienthoai.Focus(); return(false); } else { char[] arr = dienthoai.Text.ToCharArray(); string s = "0123456789"; foreach (char c in arr) { if (!s.Contains(c.ToString())) { MessageBox.Show("Số điện thoại không được có ký tự !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); dienthoai.Focus(); return(false); } } } } else { dienthoai.Focus(); MessageBox.Show("Chưa nhập số điện thoại !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (cmbhuyen.SelectedIndex < 0) { cmbhuyen.Focus(); MessageBox.Show("Chưa chọn Huyện !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (cmbxa.SelectedIndex < 0) { cmbxa.Focus(); MessageBox.Show("Chưa chọn Xã !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }