/// <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(); DanhBaKhachAo objKhachAo = (DanhBaKhachAo)((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow().DataRow; frmKhachAo frm = new frmKhachAo(objKhachAo, false); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachAo = frm.GetKhachAo(); frm.Dispose(); //Insert DataBase if (!objKhachAo.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo"); return; } else { //Load lai grid LoadListKhachAo(); } } else { return; } } }
private void ThemKhachAo() { DanhBaKhachAo objKhachAo = new DanhBaKhachAo(string.Empty, string.Empty, string.Empty); frmKhachAo frm = new frmKhachAo(objKhachAo, true);// them moi if (frm.ShowDialog(this) == DialogResult.OK) { objKhachAo = frm.GetKhachAo(); //Insert DataBase if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8) { return; } if (!objKhachAo.Insert()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo"); return; } else { //Load lai grid LoadListKhachAo(); } } }
private void gridViewDanhMucKhachAo_DoubleClick(object sender, EventArgs e) { try { if (gridViewDanhMucKhachAo.SelectedRowsCount > 0) { DanhBaKhachAo objKhachAo = (DanhBaKhachAo)gridViewDanhMucKhachAo.GetFocusedRow(); frmKhachAo frm = new frmKhachAo(objKhachAo, false); frm.ShowDialog(this); if (frm.IsSuccess) { objKhachAo = frm.GetKhachAo(); frm.Dispose(); if (!objKhachAo.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi khi sửa khách ảo!"); } else { LoadListKhachAo(); } } } } catch (Exception ex) { LogError.WriteLogError("gridViewDanhMucKhachAo_DoubleClick: ", ex); } }
private void SuaKhachAo() { try { if (gridViewDanhMucKhachAo.SelectedRowsCount > 0) { DanhBaKhachAo objKhachAo = (DanhBaKhachAo)gridViewDanhMucKhachAo.GetFocusedRow(); frmKhachAo frm = new frmKhachAo(objKhachAo, false); frm.ShowDialog(this); if (frm.IsSuccess) { objKhachAo = frm.GetKhachAo(); if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8) { return; } if (!objKhachAo.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi khi sửa khách ảo"); } else { LoadListKhachAo(); } } } } catch (Exception ex) { LogError.WriteLogError("SuaKhachAo: ", ex); } }
private void SuaKhachAo() { gridKhachAo.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection; if (gridKhachAo.SelectedItems.Count > 0) { GridEXRow row = ((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow(); DanhBaKhachAo objKhachAo = (DanhBaKhachAo)((GridEXSelectedItem)gridKhachAo.SelectedItems[0]).GetRow().DataRow; frmKhachAo frm = new frmKhachAo(objKhachAo, false); if (frm.ShowDialog(this) == DialogResult.OK) { objKhachAo = frm.GetKhachAo(); if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8) { return; } //Insert DataBase if (!objKhachAo.Update()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo"); return; } else { //Load lai grid LoadListKhachAo(); } } } }
private void ThemKhachAo() { try { DanhBaKhachAo objKhachAo = new DanhBaKhachAo(string.Empty, string.Empty, string.Empty); frmKhachAo frm = new frmKhachAo(objKhachAo, true);// them moi frm.ShowDialog(this); if (frm.IsSuccess) { objKhachAo = frm.GetKhachAo(); if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0) { return; } if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8) { return; } if (!objKhachAo.Insert()) { new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo"); } else { LoadListKhachAo(); } } } catch (Exception ex) { LogError.WriteLogError("ThemKhachAo: ", ex); } }