示例#1
0
        private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int SelectedRow = gridItemDetail.FocusedRowHandle;

            if (SelectedRow >= 0)
            {
                DataRow drow   = gridItemDetail.GetDataRow(SelectedRow);
                string  _value = drow["ID"].ToString();
                if (Class.App.ConfirmDeletion() == DialogResult.No)
                {
                    return;
                }

                Class.DanhMuc_Quyen dm = new Class.DanhMuc_Quyen();
                dm.ID = _value;
                if (dm.Delete())
                {
                    Class.App.DeleteSuccessfully();
                    GetAllList_OBJECT();
                }
                else
                {
                    Class.App.DeleteNotSuccessfully();
                }
            }
        }
        private void call_info(string Form_name, string code)
        {
            Class.DanhMuc_Quyen dm = new Class.DanhMuc_Quyen();
            DataTable           dt = dm.GetObjectByCode(code);

            txtID.Text          = dt.Rows[0]["ID"].ToString();
            txtObject_ID.Text   = dt.Rows[0]["Object_ID"].ToString();
            txtObject_Name.Text = dt.Rows[0]["Object_Name"].ToString();
            txtDescription.Text = dt.Rows[0]["Description"].ToString();
            checkActive.Checked = (bool)dt.Rows[0]["Active"];
        }
        private void btnUpdateNew_Click(object sender, EventArgs e)
        {
            if (txtID.Text.Length < 1 || txtObject_Name.Text.Length < 1)
            {
                Class.App.InputNotAccess();
                return;
            }
            Class.DanhMuc_Quyen dm = new Class.DanhMuc_Quyen();
            dm.ID          = txtID.Text;
            dm.Object_ID   = txtObject_ID.Text;
            dm.Object_Name = txtObject_Name.Text;
            dm.Description = txtDescription.Text;
            dm.Active      = checkActive.Checked;
            if (txtID.Enabled == true)
            {
                if (dm.Insert())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }
            else
            {
                if (dm.Update())
                {
                    Class.App.SaveSuccessfully();
                }
                else
                {
                    Class.App.SaveNotSuccessfully();
                }
            }

            if (_reCallFunction == "frmPhanQuyen_DanhMuc")
            {
                (this.Owner as frmPhanQuyen_DanhMuc).GetAllList_OBJECT();
            }

            txtID.Enabled = true;
            txtID.Text    = call_Code_New();
        }
示例#4
0
 public void GetAllList_OBJECT()
 {
     Class.DanhMuc_Quyen dm = new Class.DanhMuc_Quyen();
     gridItem.DataSource = dm.GetAllList_OBJECT();
     gridItemDetail.ExpandAllGroups();
 }