private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (IsRightValid())
            {
                try
                {
                    if (cboRoles.SelectedIndex != -1)
                    {
                        _right.RoleId = int.Parse(cboRoles.SelectedValue.ToString());
                    }
                    if (cboMenuItem.SelectedIndex != -1)
                    {
                        _right.MenuItemId = int.Parse(cboMenuItem.SelectedValue.ToString());
                    }
                    _right.Allowed = chkAllowed.Checked;

                    rep.UpdateReportsRight(_right);

                    ReportsRightsListForm f = (ReportsRightsListForm)this.Owner;
                    f.RefreshGrid();
                    this.Close();
                }
                catch (Exception ex)
                {
                    Utils.ShowError(ex);
                }
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsRightValid())
            {
                try
                {
                    spAllowedReportsRolesMenu _right = new spAllowedReportsRolesMenu();
                    if (cboRoles.SelectedIndex != -1)
                    {
                        _right.RoleId = int.Parse(cboRoles.SelectedValue.ToString());
                    }
                    if (cboMenuItem.SelectedIndex != -1)
                    {
                        _right.MenuItemId = int.Parse(cboMenuItem.SelectedValue.ToString());
                    }
                    _right.Allowed = chkAllowed.Checked;


                    if (db.spAllowedReportsRolesMenus.Any(i => i.RoleId == _right.RoleId && i.MenuItemId == _right.MenuItemId))
                    {
                        MessageBox.Show("Right Exist!", "SB Payroll", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    if (!db.spAllowedReportsRolesMenus.Any(i => i.RoleId == _right.RoleId && i.MenuItemId == _right.MenuItemId))
                    {
                        db.spAllowedReportsRolesMenus.AddObject(_right);
                        db.SaveChanges();

                        ReportsRightsListForm f = (ReportsRightsListForm)this.Owner;
                        f.RefreshGrid();
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Utils.ShowError(ex);
                }
            }
        }