Beispiel #1
0
        private void del_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                MessageAlert.Alert("请先选择要操作的部门");
                return;
            }

            department d = new department();

            if (c.Children.Count > 0)
            {
                MessageAlert.Alert("该部门存在子部门\n不能删除!");
                return;
            }
            if (MessageAlert.Alter("是否删除!"))
            {
                d = Department.SelectById(c.id.ToString());
                d.delDepartment = true;
                if (Department.Update(d))
                {
                    MessageAlert.Alert("删除成功!");
                }
            }
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
Beispiel #2
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                c = new PropertyNodeItem();
                if (MessageAlert.Alter("是否添加顶级部门!"))
                {
                    c.id = 0;
                }
                else
                {
                    MessageAlert.Alert("请选则上级部门");
                    return;
                }
            }


            winDepartment wd = new winDepartment(c.id, c.id, true);

            wd.ShowDialog();
            this.tvProperties.ItemsSource = null;
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
Beispiel #3
0
        private void delbuttonclick(object sender, RoutedEventArgs e)
        {
            if (this.dataGrid1.SelectedIndex < 0)
            {
                return;
            }


            UserModel um = this.dataGrid1.SelectedItem as UserModel;

            if (um == null || um.guid == null)
            {
                return;
            }
            List <QDDL.Model.UserToRoleModel.usertorole> ut = new List <UserToRoleModel.usertorole>();

            ut = UserToRole.selectbyroleid(um.roleID, um.guid);
            if (ut.Count > 0)
            {
                if (!MessageAlert.Alter("是否删除该人员信息"))
                {
                    return;
                }
                if (UserToRole.delete(ut.FirstOrDefault()))
                {
                    userediter.BindUserModel(dataGrid1);
                    MessageAlert.Alert("删除成功!");
                }
            }
        }
        private void bt_del_Click(object sender, RoutedEventArgs e)
        {
            if (this.lv_havefunctio.SelectedIndex < 0)
            {
                return;
            }
            if (lv_havefunctio.Items.Count > 0)
            {
                string tempstr = this.lv_havefunctio.SelectedItem as string;
                if ((cb_role.SelectedItem as role) != null && (cb_role.SelectedItem as role).roleName == "管理员")
                {
                    if (MessageAlert.Alter("是否删除管理员的该功能"))
                    {
                        tempstring.RemoveAt(tempstring.FindIndex(p => p == tempstr));
                    }
                }
                else
                {
                    tempstring.RemoveAt(tempstring.FindIndex(p => p == tempstr));
                }

                lv_havefunctio.ItemsSource = null;
                lv_havefunctio.ItemsSource = tempstring;
            }
        }
 private void Mainwindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (reallyCloseWindow)
     {
         if (MessageAlert.Alter("是否退出系统!"))
         {
             TurnLight(false);
             this.taskbarNotifier.Close();
             rct1.ClosePort();
             rct2.ClosePort();
             if (ruc.IsOpen())
             {
                 ruc.Close();
             }
             Environment.Exit(0);
         }
     }
     else
     {
         TurnLight(false);
         this.taskbarNotifier.Close();
         rct1.ClosePort();
         rct2.ClosePort();
         if (ruc.IsOpen())
         {
             ruc.Close();
         }
     }
 }
 private void logout_Click(object sender, RoutedEventArgs e)
 {
     if (MessageAlert.Alter("是否退出系统!"))
     {
         this.reallyCloseWindow = true;
         // this.taskbarNotifier.Close();
         Environment.Exit(0);
     }
 }
        private void delButtonClick(object sender, RoutedEventArgs e)
        {
            int i_index = dataGrid1.SelectedIndex;

            if (i_index >= 0)
            {
                _wrench = dataGrid1.SelectedItem as wrench;
                if (MessageAlert.Alter("是否删除该条记录"))
                {
                    if (SqlietDelWrench(_wrench))
                    {
                        getwrenchlist(Gettoolmodel(Wrench.selectPage(pagesize, pageno)));
                        getstatus();
                        clear();
                    }
                }
            }
        }
Beispiel #8
0
        private void bt_submit_Click(object sender, RoutedEventArgs e)
        {
            if (borrowwrenchlist == null || borrowwrenchlist.Count <= 0)
            {
                MessageAlert.Alert("没有数据");
                return;
            }

            if (Update())
            {
                MessageAlert.Alert("提交成功!");
                Clear();
            }
            else
            {
                if (MessageAlert.Alter("是否清空数据!"))
                {
                    Clear();
                }
            }
        }
Beispiel #9
0
        private void button_submit_Click(object sender, RoutedEventArgs e)
        {
            if (IsEmpty())
            {
                return;
            }

            try
            {
                if (isadd)
                {
                    users u = new users();
                    u            = GetUser(u);
                    u.department = Department.SelectByGuid(u.department).id.ToString();
                    u.duties     = UserDuty.SelectByGuid(u.duties).id.ToString();
                    role r = this.cbox_role.SelectedItem as role;
                    if (IsExit(u) != null)
                    {
                        if (MessageAlert.Alter("信息已经存在!\n是否跟新"))
                        {
                            u = GetUser(IsExit(u));
                            if (IsUpdataRepeat(u))
                            {
                                return;
                            }
                            UpdateUser(u);
                            if (IsUserToRoleExit(u) == null)
                            {
                                SaveUserToRole(new QDDL.Model.UserToRoleModel.usertorole()
                                {
                                    role = r.id.ToString(), user = u.id.ToString()
                                });
                            }
                            else
                            {
                                UpDateUsertoRol(new QDDL.Model.UserToRoleModel.usertorole()
                                {
                                    role = r.guid, user = u.guid
                                });
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        u.guid = Guid.NewGuid().ToString();
                        if (IsRepeat(u, 0))
                        {
                            return;
                        }
                        string id = SaveUser(u);
                        if (id != "-1")
                        {
                            SaveUserToRole(new QDDL.Model.UserToRoleModel.usertorole()
                            {
                                role = r.id.ToString(), user = id
                            });
                        }
                    }
                }
                else
                {
                    users u = new users();
                    u = _user;
                    u = GetUser(u);
                    role r = this.cbox_role.SelectedItem as role;
                    if (IsUpdataRepeat(u))
                    {
                        return;
                    }
                    UpdateUser(u);
                    UpDateUsertoRol(new QDDL.Model.UserToRoleModel.usertorole()
                    {
                        role = r.guid, user = u.guid
                    });
                }
                MessageAlert.Alert("操作成功!");
                SetEmpty();
                userediter.BindUserModel(this.dataGrid1);
            }
            catch
            {
                MessageAlert.Alert("添加失败!出现异常请联系管理员");
            }
        }