private void but_search_Click(object sender, EventArgs e) { if (textbox_search.Text != "") { string inputSearch = textbox_search.Text; string root = query + " WHERE "; string or = " OR "; string searchTen; if (funcShare.isNumber(inputSearch)) { string searchID = "id= " + inputSearch; searchTen = "ten LIKE N'%" + inputSearch + "%'"; string searchSdt = "sdt LIKE N'%" + inputSearch + "%'"; root = root + searchID + or + searchTen + or + searchSdt; } else { searchTen = "ten LIKE N'%" + inputSearch + "%'"; string searchPhuong = "phuong LIKE N'%" + inputSearch + "%'"; string searchQuan = "quan LIKE N'%" + inputSearch + "%'"; string searchCity = "city LIKE N'%" + inputSearch + "%'"; root = root + searchTen + or + searchPhuong + or + searchQuan + or + searchCity; } database.pushGridview(root, gridView); } }
private bool kiemTraInput() { bool check = true; resetError(); if (textbox_ten.Text == "") { but_error_ten.Visible = true; check = false; } if (!funcShare.isNumber(textbox_sdt.Text) || textbox_sdt.Text.Length > 11 || textbox_sdt.Text.Length < 6) { but_error_sdt.Visible = true; check = false; } if (textbox_tuoi.Text == "" || !funcShare.isNumber(textbox_tuoi.Text) || Convert.ToInt16(textbox_tuoi.Text) < 1) { but_error_tuoi.Visible = true; check = false; } if (cbGioiTinh.Text != "Nam" && cbGioiTinh.Text != "Nữ") { check = false; // MessageBox.Show("loi gt"); } if (textbox_dc.Text == "") { but_error_dc.Visible = true; check = false; // MessageBox.Show("loi dc"); } if (textbox_luong.Text == "" || !funcShare.isNumber(textbox_luong.Text) || Convert.ToInt64(textbox_luong.Text) < 0) { but_error_luong.Visible = true; check = false; // MessageBox.Show("loi luong"); } return(check); }
private bool checkInput() { e_cost.Visible = false; label_cost.Visible = false; e_sl.Visible = false; label_sl.Visible = false; e_dvi.Visible = false; label_dvi.Visible = false; bool check = true; if (!funcShare.isNumber(textbox_cost.Text)) { e_cost.Visible = true; label_cost.Visible = true; check = false; } if (!funcShare.isNumber(textbox_soluong.Text)) { e_sl.Visible = true; label_sl.Visible = true; check = false; } if (textbox_donvi.Text == "") { e_dvi.Visible = true; label_dvi.Visible = true; check = false; } return(true); }
private bool checkInput2() { resetError(); bool check = true; if (!funcShare.checkPK(textbox_item.Text, "mat_hang")) { label_item.Text = "Mã Mh không tồn tại"; label_item.Visible = true; e_item.Visible = true; check = false; } if (!funcShare.isNumber(textbox_soluong.Text)) { label_sl.Visible = true; e_sl.Visible = true; check = false; } if (!funcShare.isNumber(textbox_cost.Text)) { label_cost.Visible = true; e_cost.Visible = true; check = false; } if (textbox_donvi.Text == "đơn vị") { e_dvi.Visible = true; check = false; } return(check); }
private bool checkInput() { resetError(); bool check = true; if (textbox_ten.Text == "") { e_ten.Visible = true; check = false; } if (!funcShare.checkPK(textbox_loai.Text, "loai_hang")) { label_error_loai.Visible = true; e_loai.Visible = true; check = false; } if (!funcShare.isNumber(textbox_remain.Text)) { label_error_remain.Visible = true; e_remain.Visible = true; check = false; } return(true); }