Esempio n. 1
0
 private void LoadInfo(KellRole.Action d)
 {
     textBox1.Text = d.Name;
     textBox3.Text = d.FormName;
     textBox4.Text = d.ControlName;
     textBox2.Text = d.Remark;
 }
Esempio n. 2
0
 private void btn_Perm_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Permission per = new Permission();
         per.ID       = data[comboBox1.SelectedIndex].ID;
         per.Name     = textBox1.Text.Trim();
         per.IsExcept = checkBox1.Checked;
         Module mod = comboBox9.SelectedItem as Module;
         if (mod != null)
         {
             per.TheModule = mod;
             KellRole.Action act = comboBox10.SelectedItem as KellRole.Action;
             per.TheAction = act;
             per.Remark    = textBox2.Text;
             PermissionLogic pl = PermissionLogic.GetInstance();
             if (pl.ExistsNameOther(per.Name, per.ID))
             {
                 if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                 {
                     if (pl.UpdatePermission(per))
                     {
                         data[comboBox1.SelectedIndex].Name      = per.Name;
                         data[comboBox1.SelectedIndex].TheModule = per.TheModule;
                         data[comboBox1.SelectedIndex].TheAction = per.TheAction;
                         data[comboBox1.SelectedIndex].Remark    = per.Remark;
                         RefreshInfo();
                         MessageBox.Show("修改成功!");
                     }
                 }
                 else
                 {
                     textBox1.Focus();
                     textBox1.SelectAll();
                 }
             }
             else
             {
                 if (pl.UpdatePermission(per))
                 {
                     data[comboBox1.SelectedIndex].Name      = per.Name;
                     data[comboBox1.SelectedIndex].TheModule = per.TheModule;
                     data[comboBox1.SelectedIndex].TheAction = per.TheAction;
                     data[comboBox1.SelectedIndex].Remark    = per.Remark;
                     RefreshInfo();
                     MessageBox.Show("修改成功!");
                 }
             }
         }
         else
         {
             MessageBox.Show("请选定模块!");
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的项目!");
     }
 }
Esempio n. 3
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         KellRole.Action d = comboBox1.SelectedItem as KellRole.Action;
         if (d != null)
         {
             LoadInfo(d);
         }
     }
 }
Esempio n. 4
0
        private void button9_Click(object sender, EventArgs e)
        {
            Module mod = comboBox9.SelectedItem as Module;

            KellRole.Action act = comboBox10.SelectedItem as KellRole.Action;
            if (mod != null)
            {
                Permission per = new Permission();
                per.Name      = textBox1.Text.Trim();
                per.IsExcept  = checkBox1.Checked;
                per.TheModule = mod;
                per.TheAction = act;
                per.Remark    = textBox2.Text;
                PermissionLogic pl = PermissionLogic.GetInstance();
                if (pl.ExistsName(per.Name))
                {
                    if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                    {
                        int id = pl.AddPermission(per);
                        if (id > 0)
                        {
                            per.ID = id;
                            data.Add(per);
                            RefreshInfo();
                            MessageBox.Show("添加成功!");
                        }
                    }
                    else
                    {
                        textBox1.Focus();
                        textBox1.SelectAll();
                    }
                }
                else
                {
                    int id = pl.AddPermission(per);
                    if (id > 0)
                    {
                        per.ID = id;
                        data.Add(per);
                        RefreshInfo();
                        MessageBox.Show("添加成功!");
                    }
                }
            }
            else
            {
                MessageBox.Show("请选定模块!");
            }
        }
Esempio n. 5
0
 private void btn_Actn_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         KellRole.Action action = new KellRole.Action();
         action.ID          = data[comboBox1.SelectedIndex].ID;
         action.Name        = textBox1.Text.Trim();
         action.FormName    = textBox3.Text.Trim();
         action.ControlName = textBox4.Text.Trim();
         action.Remark      = textBox2.Text;
         ActionLogic al = ActionLogic.GetInstance();
         if (al.ExistsNameOther(action.Name, action.ID))
         {
             if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
             {
                 if (al.UpdateAction(action))
                 {
                     data[comboBox1.SelectedIndex].Name        = action.Name;
                     data[comboBox1.SelectedIndex].FormName    = action.FormName;
                     data[comboBox1.SelectedIndex].ControlName = action.ControlName;
                     data[comboBox1.SelectedIndex].Remark      = action.Remark;
                     RefreshInfo();
                     MessageBox.Show("修改成功!");
                 }
             }
             else
             {
                 textBox1.Focus();
                 textBox1.SelectAll();
             }
         }
         else
         {
             if (al.UpdateAction(action))
             {
                 data[comboBox1.SelectedIndex].Name        = action.Name;
                 data[comboBox1.SelectedIndex].FormName    = action.FormName;
                 data[comboBox1.SelectedIndex].ControlName = action.ControlName;
                 data[comboBox1.SelectedIndex].Remark      = action.Remark;
                 RefreshInfo();
                 MessageBox.Show("修改成功!");
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的项目!");
     }
 }
Esempio n. 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该项目?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             KellRole.Action action = data[comboBox1.SelectedIndex];
             if (ActionLogic.GetInstance().DeleteAction(action))
             {
                 data.RemoveAt(comboBox1.SelectedIndex);
                 RefreshInfo();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的项目!");
     }
 }
Esempio n. 7
0
        private void button19_Click(object sender, EventArgs e)
        {
            KellRole.Action action = new KellRole.Action();
            action.Name        = textBox1.Text.Trim();
            action.FormName    = textBox3.Text.Trim();
            action.ControlName = textBox4.Text.Trim();
            action.Remark      = textBox2.Text;
            ActionLogic al = ActionLogic.GetInstance();

            if (al.ExistsName(action.Name))
            {
                if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                {
                    int id = al.AddAction(action);
                    if (id > 0)
                    {
                        action.ID = id;
                        data.Add(action);
                        RefreshInfo();
                        MessageBox.Show("添加成功!");
                    }
                }
                else
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
            else
            {
                int id = al.AddAction(action);
                if (id > 0)
                {
                    action.ID = id;
                    data.Add(action);
                    RefreshInfo();
                    MessageBox.Show("添加成功!");
                }
            }
        }