Esempio n. 1
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_role(CNAME) values('" + textEditName.Text.ToString().Trim() + "')";
            strsql2 = "select cname from cost_role where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该角色已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        RoleQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
Esempio n. 2
0
 public static RoleQuery GetInstance()
 {
     if (stqform == null || stqform.IsDisposed)
     {
         stqform = new RoleQuery();
     }
     return(stqform);
 }
Esempio n. 3
0
 private void RolePermission_Load(object sender, EventArgs e)
 {
     labelControlRole.Text = RoleQuery.GetCname() + "的权限:";
     showDetail();
     this.Height = ParentForm.Height;
     this.Width  = ParentForm.Width;
     this.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
 }
Esempio n. 4
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            RoleQuery Frm = RoleQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Esempio n. 5
0
        private void Role_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            RoleQuery Frm = RoleQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            //Frm.Width = this.Width - 15;
            //Frm.Height = this.Width - 60;
        }
Esempio n. 6
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string cname = RoleQuery.GetCname();

            if (cname != "")
            {
                //SaleTypeUpdate Frm = SaleTypeUpdate.GetInstance();
                RoleUpdate Frm = new RoleUpdate();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Esempio n. 7
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    cid = RoleQuery.GetCid();

            strsql = "select i.cid,p.cid,p.module_name 模块,p.permission 权限,isnull(r.have_right,'false') ' ' from COST_ROLE i cross join COST_MODULE_PERMISSION p left join COST_ROLE_PERMISSION r on i.CID = r.ROLE_ID and p.CID = r.PERMISSION_ID where i.cid = " + cid;
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[1].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;

            conn.Close();
        }
Esempio n. 8
0
        private void simpleButton全选_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    cid = RoleQuery.GetCid();

            strsql = "select i.cid,p.cid,p.module_name 模块,p.permission 权限, cast('true' as bit) ' ' from COST_ROLE i cross join COST_MODULE_PERMISSION p left join COST_ROLE_PERMISSION r on i.CID = r.ROLE_ID and p.CID = r.PERMISSION_ID where i.cid = " + cid;
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[1].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            ischange = true;
            conn.Close();
        }
Esempio n. 9
0
        private void simpleButtonSubmit_Click(object sender, EventArgs e)
        {
            if (ischange == true)
            {
                ConnDB conn = new ConnDB();
                string strsql;
                int    cid = RoleQuery.GetCid();
                string sql = "insert into COST_ROLE_PERMISSION select i.cid,p.cid,'false' from COST_ROLE i cross join COST_MODULE_PERMISSION p left join COST_ROLE_PERMISSION r on i.CID = r.ROLE_ID and p.CID = r.PERMISSION_ID where i.cid = " + cid + " and r.role_id is null";
                conn.EditDatabase(sql);
                bool isok = false;

                //gridView1.FocusInvalidRow();
                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    strsql = "update i set i.have_right = '" + gridView1.GetDataRow(i).ItemArray[4].ToString() + "' from COST_ROLE_PERMISSION i where i.ROLE_ID = " + gridView1.GetDataRow(i).ItemArray[0].ToString() + " and i.PERMISSION_ID = " + gridView1.GetDataRow(i).ItemArray[1].ToString();
                    isok   = conn.EditDatabase(strsql);
                }

                if (isok)
                {
                    MessageBox.Show("提交成功!");
                    showDetail();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
                conn.Close();
                ischange = false;
            }
            else
            {
                MessageBox.Show("没有可更新的数据!");
            }
        }
Esempio n. 10
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     RoleQuery.RefreshEX();
 }
Esempio n. 11
0
 private void barButtonItem反禁用_ItemClick(object sender, ItemClickEventArgs e)
 {
     RoleQuery.cEnable();
     RoleQuery.RefreshEX();
 }