Ejemplo n.º 1
0
 private void Save_Edit(object sender, RoutedEventArgs e)
 {
     ComboBoxItem status = (ComboBoxItem)this.status.SelectedItem;
     UserBean bean = new UserBean();
     QueryUser query = new QueryUser();
     query.Account = UserManagerBean.AddUser.queryAccount.Text;
     query.UserName = UserManagerBean.AddUser.queryName.Text;
     bean.Id = int.Parse(this.userId.Content.ToString());
     bean.UserName = this.userName.Text;
     bean.Phone = this.userPhone.Text;
     bean.Status = int.Parse(status.Tag.ToString());
     bean.Type = this.userType.SelectedIndex;
     Users user = new Users();
     int state = user.saveUserEdit(bean);
     if (state == BaseRequest.SUCCESS)
     {
         JXMessageBox.Show(Window.GetWindow(this), "编辑用信息保存成功!", MsgImage.Success);
         this.Close();
         UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, user.getUsersList(query), BaseRequest.PAGE_SIZE);
     }
     else if (state == BaseRequest.SYSTEM_EXCEPTION)
     {
         JXMessageBox.Show(Window.GetWindow(this), "系统异常,请联系管理员!", MsgImage.Error);
     }
     else
     {
         JXMessageBox.Show(Window.GetWindow(this), "未知错误", MsgImage.Error);
     }
 }
Ejemplo n.º 2
0
        private void Submit_AddUser(object sender, RoutedEventArgs e)
        {
            if (ValidateUtil.CheckFolderName(this.account.Text) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请填写帐号!", MsgImage.Error);
                return;
            }
            if (ValidateUtil.CheckFolderName(this.userName.Text) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请填写用户姓名!", MsgImage.Error);
                return;
            }
            if (ValidateUtil.CheckPasswordStrength(this.password.Password) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请输入6位以上的密码长度!", MsgImage.Error);
                return;
            }

            if (!this.password.Password.Equals(this.password2.Password))
            {
                JXMessageBox.Show(Window.GetWindow(this), "输入密码不一致,请重新输入!", MsgImage.Error);
                return;
            }
            Users u = new Users();
            UserBean bean = new UserBean();
            QueryUser query = new QueryUser();
            query.Account = UserManagerBean.AddUser.queryAccount.Text;
            query.UserName = UserManagerBean.AddUser.queryName.Text;
            bean.Account = this.account.Text;
            bean.UserName = this.userName.Text;
            bean.Password = this.password.Password;
            bean.Status = 0;
            bean.CreateId = Session.UserId;
            bean.CreateTime = Convert.ToDateTime(DateTime.Now);
            bean.Phone = this.phone.Text;
            ComboBoxItem type = (ComboBoxItem)this.userType.SelectedItem;
            bean.Type = int.Parse(type.Tag.ToString());
            int state = u.registUser(bean);
            Window targe = Window.GetWindow(this);
            if (state == BaseRequest.HAS)
            {
                JXMessageBox.Show(Window.GetWindow(this), "该账号已被使用!", MsgImage.Error);
            }
            else if (state==BaseRequest.SUCCESS)
            {
                JXMessageBox.Show(Window.GetWindow(this), "新增用户成功!", MsgImage.Error);
                UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, u.getUsersList(query), BaseRequest.PAGE_SIZE);
                this.Close();
            }
            else
            {
                JXMessageBox.Show(Window.GetWindow(this), "系统异常,请联系管理员!", MsgImage.Error);
            }
        }
Ejemplo n.º 3
0
 //用户分页列表
 public DataSet getUsersList(QueryUser query)
 {
     try
     {
         //int count = (BaseRequest.PAGE_CURRENT - 1) * BaseRequest.PAGE_SIZE;
         string sql = "SELECT u.ID,u.ACCOUNT,u.USER_NAME,u.TYPE,u.STATUS,us.USER_NAME as NAME,u.LOGIN_TIME,"
                    + "u.PHONE FROM users AS u LEFT JOIN users AS us ON u.CREATE_ID=us.ID  where u.ACCOUNT like '%"
                    + @query.Account + "%' and u.USER_NAME like '%" + query.UserName + "%' ORDER BY u.CREATE_TIME DESC";
      
         //string sqlAppend = SqlApend.returnSqlStr(sql,SqlApend.SqlMap);
         DataSet set = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sql);
         return set;
     }
     catch (Exception e)
     {
         e.GetBaseException();
     }
     return null;
 }
Ejemplo n.º 4
0
 private void QueryUser(object sender, RoutedEventArgs e)
 {
     QueryUser query = new QueryUser();
     query.Account = this.queryAccount.Text;
     query.UserName = this.queryName.Text;
     Users user = new Users();
     DataSet set=user.getUsersList(query);
     this.page.ShowPages(this.userData,set, BaseRequest.PAGE_SIZE);
     
 }
Ejemplo n.º 5
0
        private void DazzleTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DazzleTabItem item = ((sender as DazzleTabControl).SelectedItem as DazzleTabItem);
            if (item != null)
            {
                //MessageBox.Show(item.ToString());
                if (item.Name.Equals("User_Manager"))
                {
                    Users u = new Users();
                    QueryUser query = new QueryUser();
                    query.Account = UserManagerBean.AddUser.queryAccount.Text;
                    query.UserName = UserManagerBean.AddUser.queryName.Text;

                    DataSet set = u.getUsersList(query);
                    UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, set, BaseRequest.PAGE_SIZE);
                    AddGrid(UserManagerBean.AddUser);
                }
            }
        }
Ejemplo n.º 6
0
        //private void _UserManager(object sender, System.Windows.Input.MouseButtonEventArgs e)
        //{
        //    //UserManagerBean.AddUser
        //    Users u = new Users();
        //    QueryUser query = new QueryUser();
        //    query.Account = UserManagerBean.AddUser.queryAccount.Text;
        //    query.UserName = UserManagerBean.AddUser.queryName.Text;

        //    DataSet set = u.getUsersList(query);
        //    UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, set, BaseRequest.PAGE_SIZE);
        //    AddGrid(UserManagerBean.AddUser);
        //}

        private void User_Manager_KeyDown(object sender, KeyEventArgs e)
        {
            //UserManagerBean.AddUser
            Users u = new Users();
            QueryUser query = new QueryUser();
            query.Account = UserManagerBean.AddUser.queryAccount.Text;
            query.UserName = UserManagerBean.AddUser.queryName.Text;

            DataSet set = u.getUsersList(query);
            UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, set, BaseRequest.PAGE_SIZE);
            AddGrid(UserManagerBean.AddUser);
        }
Ejemplo n.º 7
0
        //设备管理功能选择
        private void Choice(object sender, RoutedEventArgs e)
        {
            TreeViewItem assets = ((sender as TreeView).SelectedItem as TreeViewItem);
            //MessageBox.Show(assets.Uid.ToString());
            string assetsName = assets.Uid.ToString();
            if (assetsName == null || "".Equals(assetsName))
            {
                roomGrid.Children.Clear();
            }
            if (roomGrid.Children != null) roomGrid.Children.Clear();

            // ==================================================================================

            if (assetsName.Equals("Elist"))
            {
                EquipmentList equipment = RoomManagerBean.EquipmentList;
                RoomClass rc = new RoomClass();
                EquipmentBean bean = new EquipmentBean();
                
                DataSet equipmentSet = rc.queryEquipmentList(bean);
                DataSet typeSet = rc.queryType();
                ComboBox box = RoomManagerBean.EquipmentList.type;
                if (box.HasItems) box.Items.Clear();
                ComboBoxItem boxItem = new ComboBoxItem();
                boxItem.Content = "请选择...";
                boxItem.Tag = "";
                boxItem.IsSelected = true;
                box.Items.Add(boxItem);
                //RoomManagerBean.DeviceClass.selectType.SelectedValuePath = "";
                if (typeSet.Tables.Count > 0)
                {
                    DataRowCollection drc = typeSet.Tables[0].Rows;

                    for (int i = 0; i < drc.Count; i++)
                    {
                        DataRow dr = drc[i];
                        int typeId = (int)dr["ID"];
                        string typeName = dr["TYPE_NAME"].ToString();

                        ComboBoxItem boxItems = new ComboBoxItem();
                        boxItems.Content = typeName;
                        boxItems.Tag = typeId;
                        box.Items.Add(boxItems);
                        //MessageBox.Show("typeId=" + typeId + " typeName=" + boxItems.Tag);
                    }
                    //MessageBox.Show("===" + equipmentSet.Tables.Count);
                    RoomManagerBean.EquipmentList.page.ShowPages(RoomManagerBean.EquipmentList.equipment, equipmentSet, BaseRequest.PAGE_SIZE);
                    roomGrid.Children.Add(equipment);
                    equipment.SetValue(Grid.RowProperty, 0);
                    equipment.SetValue(Grid.ColumnProperty, 0);
                }
            }
                else if (assetsName.Equals("Report"))
                {
                    Statement statement = RoomManagerBean.Statement;
                    roomGrid.Children.Add(statement);
                    statement.SetValue(Grid.RowProperty, 0);
                    statement.SetValue(Grid.ColumnProperty, 0);
                }
                else if (assetsName.Equals("Inventory"))
                {
                    RoomClass rc = new RoomClass();
                    DataSet stockSet = rc.queryInventory();
                    RoomManagerBean.DeviceList.page.ShowPages(RoomManagerBean.DeviceList.stock, stockSet, BaseRequest.PAGE_SIZE);
                    DeviceList deviceList = RoomManagerBean.DeviceList;
                    roomGrid.Children.Add(deviceList);
                    deviceList.SetValue(Grid.RowProperty, 0);
                    deviceList.SetValue(Grid.ColumnProperty, 0);
                }
                else if (assetsName.Equals("Category"))
                {
                    DeviceClass deviceClass = RoomManagerBean.DeviceClass;
                    RoomClass room = new RoomClass();
                    QueryUser query = new QueryUser();

                    //query.Account = UserManagerBean.AddUser.queryAccount.Text;
                    //query.UserName = UserManagerBean.AddUser.queryName.Text;
                     DataSet set = room.queryType();
                    
                     RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, set, BaseRequest.PAGE_SIZE);
                   
                    roomGrid.Children.Add(deviceClass);
                    deviceClass.SetValue(Grid.RowProperty, 0);
                    deviceClass.SetValue(Grid.ColumnProperty, 0);
                }
            else if (assetsName.Equals("HistoryEquipment"))
            {
                HistoryEquipment he = RoomManagerBean.HistoryEquipment;
                RoomClass rc = new RoomClass();
                DataSet set = rc.queryHistoryEquipment();
                he.page.ShowPages(he.historyEquipment, set, BaseRequest.PAGE_SIZE);
                roomGrid.Children.Add(he);
                he.SetValue(Grid.RowProperty, 0);
                he.SetValue(Grid.ColumnProperty, 0);
            }
            
            }