예제 #1
0
        private void SaveData()
        {
            if (!IsValid())
            {
                return;
            }
            clsNhom cls = new clsNhom();

            cls.Ten_Nhom    = txtNhom.Text;
            cls.ID_Nhom_Cha = ((cmbNhomCha.EditValue ?? "").ToString() == "") ? SqlInt32.Null : Convert.ToInt32(cmbNhomCha.EditValue);
            cls.TonTai      = true;
            if (m_bCapNhat)
            {
                cls.ID_Nhom = m_iID_Nhom;
                cls.Update();
                BaseMessages.ShowInformationMessage("Cập nhật thành công !!!");
            }
            else
            {
                cls.Insert();
                BaseMessages.ShowInformationMessage("Thêm mới thành công !!!");
            }

            if (m_frmNhom_Ban != null)
            {
                m_frmNhom_Ban.LoadfgBan_Nhom();
            }
            Close();
        }
예제 #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            var fg = fgBan_Nhom;

            if (fg.Row < fg.Rows.Fixed || fg.Row > fg.Rows.Count)
            {
                BaseMessages.ShowInformationMessage("Chưa chọn nhóm.");
                return;
            }
            if (fg.GetDataDisplay(fg.Row, "ID_Nhom") == "")
            {
                fg.Rows.Remove(fg.Row);
            }
            else
            {
                if (fg.Row < fg.Rows.Count - 1 && fg.Rows[fg.Row + 1].Node.Level > fg.Rows[fg.Row].Node.Level)
                {
                    BaseMessages.ShowWarningMessage("Không được xóa nhóm cha");
                    return;
                }
                if (BaseMessages.ShowDeleteQuestionMessage() == DialogResult.Yes)
                {
                    clsNhom cls = new clsNhom();
                    cls.ID_Nhom = fg.GetIntValue(fg.Row, "ID_Nhom");
                    cls.SelectOne();
                    cls.TonTai = false;
                    cls.Update();
                    BaseMessages.ShowInformationMessage("Xóa thành công !!!");
                    LoadfgBan_Nhom();
                }
            }
        }