private void butLuu_Click(object sender, EventArgs e) { try { string aloai = f_Get_id_loai(); if (txtSohieubl.Text.Trim() == "") { MessageBox.Show(this, lan.Change_language_MessageText("Nhập ký hiệu sổ!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSohieubl.Focus(); return; } if (txtSohieu.Text.Trim() == "") { MessageBox.Show(this, lan.Change_language_MessageText("Nhập tên sổ!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); txtSohieu.Focus(); return; } txtTuso_Validated(null, null); txtDenso_Validated(null, null); txtSoghi_Validated(null, null); decimal ats = 0, ads = 0, asoghi = 0; ats = decimal.Parse(txtTuso.Text.Replace(" ", "")); ads = decimal.Parse(txtDenso.Text.Replace(" ", "")); asoghi = decimal.Parse(txtSoghi.Text.Replace(" ", "")); if (asoghi > ads || asoghi < ats - 1) { MessageBox.Show(this, lan.Change_language_MessageText("Số liệu từ số, đến số, số ghi không hợp lệ!"), m_v.s_AppName, MessageBoxButtons.OK); //\nĐiều kiện: [Từ số] <= [Số ghi -1] <= [Đến số]"), m_v.s_AppName, MessageBoxButtons.OK); txtSoghi.Focus(); return; } if (m_id == "") { m_id = m_v.get_id_v_quyenso.ToString(); } else { if (m_v.dadung_v_quyenso(m_id) == -1) { if (!m_v.is_dba_admin(m_userid)) { MessageBox.Show(this, lan.Change_language_MessageText("Hệ thống không cho sửa nội dung này!") + "\n" + lan.Change_language_MessageText("Liên hệ quản trị hệ thống để được trợ giúp!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } } int tmp_chinhanh = (bQuanly_chinhanh) ? ((cbchinhanh.SelectedIndex < 0) ? 0 : int.Parse(cbchinhanh.SelectedValue.ToString())) : 0; m_v.upd_v_quyenso(decimal.Parse(m_id), txtSohieubl.Text.Trim(), txtSohieu.Text.Trim(), ats, ads, asoghi, aloai, chkKhambenh.Checked?1:0, chkDangsd.Checked?1:0, decimal.Parse(m_userid), txtNgaylinh.Text.Substring(0, 10), chkHide.Checked?1:0); m_v.execute_data("update " + m_v.user + ".v_quyenso set dichvu=" + (chkDichvu.Checked ? "1" : "0") + " where id=" + m_id); m_v.execute_data(" update " + m_v.user + ".v_quyenso set chinhanh=" + tmp_chinhanh + " where id=" + m_id); f_Enable(false); f_Load_DG(); butMoi.Focus(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }