Exemplo n.º 1
0
        private void tv_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (this.tv.SelectedNode == null)
                {
                    return;
                }
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (tb == null || tb.Rows.Count < 1)
                {
                    LoadOper();
                }

                if (this.tv.SelectedNode.Tag == null ||
                    string.IsNullOrEmpty(this.tv.SelectedNode.Tag.ToString()) ||
                    this.tv.SelectedNode.Text.IndexOf("系统管理员") > -1 ||
                    this.tv.SelectedNode.Text.IndexOf("后台管理员") > -1 ||
                    this.tv.SelectedNode.Text.IndexOf("前台管理员") > -1)
                {
                    this.tsbDelType.Enabled    = false;
                    this.tsbChangeType.Enabled = false;
                }
                else
                {
                    this.tsbDelType.Enabled    = true;
                    this.tsbChangeType.Enabled = true;
                }

                if (null != this.tv.SelectedNode.Tag && !string.IsNullOrEmpty(this.tv.SelectedNode.Tag.ToString()))
                {
                    sa_t_oper_type type = (sa_t_oper_type)this.tv.SelectedNode.Tag;
                    var            rows = tb.Select("oper_type = '" + type.oper_type + "'");
                    if (rows.Length != 0)
                    {
                        DataTable tbs = rows.CopyToDataTable();
                        this.dgvOper.DataSource = tbs;
                    }
                    else
                    {
                        this.dgvOper.DataSource = tb.Clone();
                    }
                }
                else
                {
                    this.dgvOper.DataSource = tb;
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Exemplo n.º 2
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!MyLove.PermissionsBalidation(this.Text, "04"))
                {
                    return;
                }
                if (this.tvType.SelectedNode == null)
                {
                    MsgForm.ShowFrom("请先选择操作员组");
                    return;
                }

                sa_t_oper_type oper_type = this.tvType.SelectedNode.Tag as sa_t_oper_type;

                if (oper_type.oper_type.Equals("1000"))
                {
                    MsgForm.ShowFrom("系统管理员权限不可修改");
                    return;
                }

                List <sa_t_oper_grant> grantlis = new List <sa_t_oper_grant>();
                var list = tn_dic.Where(d => d.Value.Checked).Select(d => d.Key).ToList();

                list.ForEach(t =>
                {
                    string[] strs = t.Split('_');

                    var item = grantlis.SingleOrDefault(g => g.func_id.Equals(strs[0]));

                    if (item == null)
                    {
                        grantlis.Add(new sa_t_oper_grant()
                        {
                            func_id      = strs[0],
                            grant_string = strs[1] + ";",
                            oper_id      = oper_type.oper_type,
                            update_time  = DateTime.Now,
                        });
                    }
                    else
                    {
                        item.grant_string += strs[1] + ";";
                    }
                });

                IBLL.ISys bll = new BLL.SysBLL();
                bll.SaveGrant(grantlis);

                MsgForm.ShowFrom("保存成功");
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Exemplo n.º 3
0
        public void DelOperType(sa_t_oper_type type)
        {
            JsonRequest r = new JsonRequest();

            r.Write("type", type);

            r.request("/oper?t=DelOperType");

            if (!r.ReadSuccess())
            {
                throw new Exception(r.ReadMessage());
            }
        }
Exemplo n.º 4
0
        private void tvType_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (this.tvType.SelectedNode == null)
                {
                    return;
                }

                sa_t_oper_type oper_type = this.tvType.SelectedNode.Tag as sa_t_oper_type;
                if (oper_type.oper_type.Equals("1000"))
                {
                    tsbAllCheck_Click(sender, e);
                }
                else
                {
                    IBLL.ISys bll = new BLL.SysBLL();
                    List <sa_t_oper_grant> list = bll.GetAllGrant(new sa_t_oper_grant()
                    {
                        oper_id = oper_type.oper_type
                    });

                    //清空选项
                    tsbNoCheck_Click(sender, e);

                    list.ForEach((grant) =>
                    {
                        string[] grants = grant.grant_string.Split(';');
                        foreach (string str in grants)
                        {
                            if (string.IsNullOrEmpty(str))
                            {
                                continue;
                            }

                            TreeNode tn = tn_dic[grant.func_id + "_" + str];
                            tn.Checked  = true;
                            if (tn.Parent != null)
                            {
                                UpdateParentNodes(tn.Parent);
                            }
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.txtGrout.Text))
                {
                    this.txtGrout.Focus();
                    return;
                }

                IBLL.IOper bll = new BLL.OperBLL();

                if (oper_type == null)
                {
                    oper_type = new sa_t_oper_type()
                    {
                        type_name   = this.txtGrout.Text,
                        update_time = DateTime.Now
                    };

                    bll.AddOperType(oper_type);
                }
                else
                {
                    oper_type.type_name   = this.txtGrout.Text;
                    oper_type.update_time = DateTime.Now;

                    bll.ChangeOperType(oper_type);
                }

                this.DialogResult = DialogResult.Yes;
                this.Close();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Exemplo n.º 6
0
        public void DelOperType(WebHelper w, Dictionary <string, object> kv)
        {
            sa_t_oper_type type = w.GetObject <sa_t_oper_type>("type");

            bll.DelOperType(type);
        }
 public DialogResult ChangeOperType(sa_t_oper_type oper_type)
 {
     this.oper_type = oper_type;
     return(this.ShowDialog());
 }