/// <summary> /// Mo form KhachVIP de edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void grdKhachVIP_DoubleClick(object sender, EventArgs e) { grdKhachVIP.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection; if (grdKhachVIP.SelectedItems.Count > 0) { GridEXRow row = ((GridEXSelectedItem)grdKhachVIP.SelectedItems[0]).GetRow(); KhachVIP objKhachVIP = (KhachVIP)((GridEXSelectedItem)grdKhachVIP.SelectedItems[0]).GetRow().DataRow; frmKhachVIP frm = new frmKhachVIP(objKhachVIP, false); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachVIP = frm.GetKhachVIP(); frm.Dispose(); //Insert DataBase if (!objKhachVIP.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách VIP"); return; } else { //Load lai grid LoadListKhachVIP(); } } else { return; } } }
private void SuaKhachVIP() { grdKhachVIP.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection; if (grdKhachVIP.SelectedItems.Count > 0) { GridEXRow row = ((GridEXSelectedItem)grdKhachVIP.SelectedItems[0]).GetRow(); KhachVIP objKhachVIP = (KhachVIP)((GridEXSelectedItem)grdKhachVIP.SelectedItems[0]).GetRow().DataRow; frmKhachVIP frm = new frmKhachVIP(objKhachVIP, false); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachVIP = frm.GetKhachVIP(); if (StringTools.TrimSpace(objKhachVIP.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachVIP.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachVIP.Phones).Length < 8) { return; } //Insert DataBase if (!objKhachVIP.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách VIP"); return; } else { //Load lai grid LoadListKhachVIP(); } } else { return; } } }