Пример #1
0
        public void butLuu_Click(object sender, EventArgs e)
        {
            try
            {
                string aid_cha = "";
                if (txtStt.Text.Trim() == "")
                {
                    MessageBox.Show(this,
                                    lan.Change_language_MessageText("Nhập số thứ tự!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtStt.Focus();
                    return;
                }
                if (txtTen.Text.Trim() == "")
                {
                    MessageBox.Show(this,
                                    lan.Change_language_MessageText("Nhập tên báo cáo!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtTen.Focus();
                    return;
                }
                if (txtSQL.Text.Trim() == "")
                {
                    MessageBox.Show(this,
                                    lan.Change_language_MessageText("Nhập câu truy vấn SQL!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtSQL.Focus();
                    return;
                }
                try
                {
                    aid_cha = cbCha.SelectedValue.ToString();
                }
                catch
                {
                    aid_cha = "0";
                }
                if (aid_cha.Trim() == "" || aid_cha == "-1")
                {
                    MessageBox.Show(this,
                                    lan.Change_language_MessageText("Chọn mục chứa báo cáo!"), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cbCha.Focus();
                    SendKeys.Send("{F4}");
                    return;
                }

                if (m_id == "")
                {
                    m_id = m_v.get_id_v_treebaocao.ToString();
                }
                else
                {
                    try
                    {
                        if (m_v.dadung_v_treebaocao(m_id) == -1)
                        {
                            MessageBox.Show(this,
                                            lan.Change_language_MessageText("Thông tin này chỉ xem, không cho phép cập nhật!") + "\n" +
                                            lan.Change_language_MessageText("Liên hệ vơi quản trị hệ thống để được trợ giúp."), m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }
                    }
                    catch
                    {
                    }
                }
                m_v.upd_v_treebaocao(decimal.Parse(m_id), decimal.Parse(aid_cha), decimal.Parse(txtStt.Text.Trim()), txtTen.Text, txtSQL.Text, txtTenreport.Text, chkReadonly.Checked?1:0);
                f_Enable(false);
                f_Load_CB_Cha();
                butMoi.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }