public void GetData(string id13, string name, string sname, string status) { if (string.IsNullOrEmpty(id13) && string.IsNullOrEmpty(name) && string.IsNullOrEmpty(sname) && string.IsNullOrEmpty(status) && string.IsNullOrEmpty(txtbook_number.Text) && string.IsNullOrEmpty(txtrank.Text) && mtxtYearin.Text.Equals(" /") && !chkmove_in.Checked && string.IsNullOrEmpty(DataControls.GetSelectedValueComboBoxToString(cmbselectaddress))) { // grdData.DataSource = dcore.GetSearchPerson(id13, name, sname, status, mode_search); } else { switch (mode_search) { case "new": // grdData.DataSource = dcore.GetSearchPerson(id13, name, sname, status, mode_search); grdData.DataSource = dcore.GetSearchListPreAddressmore(txtname.Text, txtlname.Text, "", txtbook_number.Text, txtrank.Text, id13, mtxtYearin.Text, chkmove_in.Checked, DataControls.GetSelectedValueComboBoxToString(cmbselectaddress)); lblcount.Text = string.Format("{0} {1}", grdData.RowCount, "Record"); break; case "edit": // if (!(string.IsNullOrEmpty(id13) && string.IsNullOrEmpty(name) && string.IsNullOrEmpty(sname))) // { // grdData.DataSource = dcore.GetSearchPerson(id13, name, sname, status, mode_search); // } grdData.DataSource = dcore.GetSearchListPreAddressmore(txtname.Text, txtlname.Text, "", txtbook_number.Text, txtrank.Text, id13, mtxtYearin.Text, chkmove_in.Checked, DataControls.GetSelectedValueComboBoxToString(cmbselectaddress)); lblcount.Text = string.Format("{0:0,0} {1}", grdData.RowCount, "Record"); break; } DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle(); columnHeaderStyle.BackColor = Color.Beige; columnHeaderStyle.Font = new Font("Bookman Old Style", 8, FontStyle.Bold); grdData.ColumnHeadersDefaultCellStyle = columnHeaderStyle; grdData.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); grdData.Columns[0].HeaderText = "ชื่อ"; grdData.Columns[1].HeaderText = "สกุล"; grdData.Columns[2].HeaderText = "NAVYID"; grdData.Columns[3].HeaderText = "ผลัด"; grdData.Columns[4].HeaderText = "ทะเบียน"; grdData.Columns[5].HeaderText = "หน่วย"; grdData.Columns[6].HeaderText = "สถานะ"; grdData.Columns[7].HeaderText = "ครั้งที่พิมพ์"; grdData.Columns[8].HeaderText = "ID13"; grdData.Columns[9].HeaderText = "เล่มที่"; grdData.Columns[10].HeaderText = "ลำดับที่"; //if (grdData.Rows.Count == 1 && (mode_search == "new" || mode_search == "out")) //{ // MessageBox.Show("ไม่มีข้อมูล"); // this.Close(); //} } txtname.Focus(); mtxtYearin.SelectAll(); txtname.SelectAll(); txtlname.SelectAll(); txtid13.SelectAll(); txtrank.SelectAll(); txtbook_number.SelectAll(); }
public void GetData() { grdData.DataSource = dcore.GetSearchListPreAddressmore(txtname.Text, txtlname.Text, "", "", "", "", " /", false, ""); DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle(); columnHeaderStyle.BackColor = Color.Beige; columnHeaderStyle.Font = new Font("Bookman Old Style", 8, FontStyle.Bold); grdData.ColumnHeadersDefaultCellStyle = columnHeaderStyle; grdData.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); grdData.Columns[0].HeaderText = "ชื่อ"; grdData.Columns[1].HeaderText = "สกุล"; grdData.Columns[2].HeaderText = "NAVYID"; grdData.Columns[3].HeaderText = "ผลัด"; grdData.Columns[4].HeaderText = "ทะเบียน"; grdData.Columns[5].HeaderText = "หน่วย"; grdData.Columns[6].HeaderText = "สถานะ"; grdData.Columns[7].HeaderText = "ครั้งที่พิมพ์"; txtname.SelectAll(); txtlname.SelectAll(); }