private void InsertData() { data = new DTO.LoaiTien(); data.Ten = tbTen.Text; data.Gia = ConvertUtil.ConvertToInt(tbGiaTri.Text); data.GhiChu = tbGhiChu.Text; data.IsActived = rbSuDung.Checked; if (LoaiTienBus.Insert(data)) { if (MessageBox.Show(string.Format(Constant.MESSAGE_INSERT_SUCCESS, "Mệnh giá tiền " + data.Ten) + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_CONTINUE, Constant.CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.Dispose(); } } else { if (MessageBox.Show(string.Format(Constant.MESSAGE_INSERT_ERROR_DUPLICATED, tbGiaTri.Text) + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { this.Dispose(); } } }
public UcInfo(DTO.LoaiTien data) { InitializeComponent(); this.data = data; isUpdate = true; lbSelect.Text = Constant.DEFAULT_TITLE_EDIT; Init(); tbTen.Text = data.Ten; tbGiaTri.Text = data.Gia.ToString(); tbGhiChu.Text = data.GhiChu; if (data.IsActived) { rbSuDung.Checked = true; } else { rbTamNgung.Checked = true; } if (data.Id == 2) { tbGiaTri.Enabled = false; } }
public UcInfo() { InitializeComponent(); data = new DTO.LoaiTien(); isUpdate = false; Init(); RefreshData(); }
public static bool Delete(LoaiTien data) { try { if (data != null) { dbContext.LoaiTiens.DeleteOnSubmit(data); dbContext.SubmitChanges(); return true; } } catch { //return false; } CreateSQlConnection(); return false; }
public static bool Update(LoaiTien data) { return LoaiTienDao.Update(data); }
public static bool Insert(LoaiTien data) { return LoaiTienDao.Insert(data); }
public static bool Delete(LoaiTien data) { return LoaiTienDao.Delete(data); }
partial void DeleteLoaiTien(LoaiTien instance);
partial void UpdateLoaiTien(LoaiTien instance);
partial void InsertLoaiTien(LoaiTien instance);
public static bool Update(LoaiTien data) { try { if (data != null) { dbContext.SubmitChanges(); return true; } return false; } catch { return false; } }
public static bool Insert(LoaiTien data) { try { dbContext.LoaiTiens.InsertOnSubmit(data); dbContext.SubmitChanges(); return true; } catch { return false; } }