/// <summary> /// Mo form KhachAo de edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridKhachAo_DoubleClick(object sender, EventArgs e) { gridKhachAo.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection; if (gridKhachAo.SelectedItems.Count > 0) { GridEXRow row = ((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow(); DanhBaKhachQuen objKhachQuen = (DanhBaKhachQuen)((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow().DataRow; if (objKhachQuen == null) { return; } frmKhachQuen frm = new frmKhachQuen(objKhachQuen, false);//,G_lstKhachQuen_Type,G_lstKhachQuen_Rank); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachQuen = frm.GetKhachQuen(); frm.Dispose(); //Insert DataBase if (!objKhachQuen.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách quen"); return; } else { //Load lai grid LoadListKhachQuen(); } } else { return; } } }
private void ThemKhachQuen() { DanhBaKhachQuen objKhachQuen = new DanhBaKhachQuen(); frmKhachQuen frm = new frmKhachQuen(objKhachQuen, true, G_lstKhachQuen_Type, G_lstKhachQuen_Rank);// them moi if (frm.ShowDialog(this) == DialogResult.OK) { objKhachQuen = frm.GetKhachQuen(); //Insert DataBase if (!objKhachQuen.Insert()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách quen"); } else { //Load lai grid LoadListKhachQuen(); } } }
private void SuaKhachQuen() { try { if (gridViewKhachQuen.SelectedRowsCount > 0) { DanhBaKhachQuen objKhachQuen = (DanhBaKhachQuen)gridViewKhachQuen.GetFocusedRow(); frmKhachQuen frm = new frmKhachQuen(objKhachQuen, false, G_lstKhachQuen_Type, G_lstKhachQuen_Rank); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachQuen = frm.GetKhachQuen(); if (StringTools.TrimSpace(objKhachQuen.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachQuen.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachQuen.Phones).Length < 8) { return; } if (!objKhachQuen.Update()) { new MessageBoxBA().Show("Lỗi khi sửa khách quen"); } else { LoadListKhachQuen(); } } } } catch (Exception ex) { LogError.WriteLogError("SuaKhachQuen: ", ex); } }
private void SuaKhachQuen() { gridKhachAo.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection; if (gridKhachAo.SelectedItems != null && gridKhachAo.SelectedItems.Count > 0 && gridKhachAo.SelectedItems[0].RowType == RowType.Record) { GridEXRow row = ((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow(); DanhBaKhachQuen objKhachQuen = (DanhBaKhachQuen)((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow().DataRow; frmKhachQuen frm = new frmKhachQuen(objKhachQuen, false);//,G_lstKhachQuen_Type,G_lstKhachQuen_Rank); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachQuen = frm.GetKhachQuen(); if (StringTools.TrimSpace(objKhachQuen.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachQuen.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachQuen.Phones).Length < 8) { return; } //Insert DataBase if (!objKhachQuen.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách quen"); return; } else { //Load lai grid LoadListKhachQuen(); } } } }
private void ThemKhachQuen() { try { DanhBaKhachQuen objKhachQuen = new DanhBaKhachQuen(); frmKhachQuen frm = new frmKhachQuen(objKhachQuen, true, G_lstKhachQuen_Type, G_lstKhachQuen_Rank); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachQuen = frm.GetKhachQuen(); if (!objKhachQuen.Insert()) { new MessageBoxBA().Show("Lỗi thêm mới khách quen"); } else { LoadListKhachQuen(); } } } catch (Exception ex) { LogError.WriteLogError("ThemKhachQuen: ", ex); } }