Ejemplo n.º 1
0
        void LoadData()
        {
            try
            {
                GroupUserController  _GroupUserController = new GroupUserController();
                List <GroupUserInfo> _lst = _GroupUserController.GroupUser_GetAll();

                cbo_Group_User.SelectedValuePath = "Id";
                cbo_Group_User.DisplayMemberPath = "Name";
                cbo_Group_User.ItemsSource       = _lst;
                cbo_Group_User.SelectedIndex     = 0;

                if (c_type == Convert.ToInt16(Form_Type.Insert))
                {
                    txtFullName.Focus();
                }
                else if (c_type == Convert.ToInt16(Form_Type.Update))
                {
                    this.Title = "Cập nhật thông tin người dùng [" + c_User_Info.User_Name + "]";

                    txtFullName.Text             = c_User_Info.FullName;
                    txtUserName.Text             = c_User_Info.User_Name;
                    txtPass.Text                 = c_User_Info.Pass;
                    txtPhone.Text                = c_User_Info.Phone;
                    cbo_Group_User.SelectedValue = c_User_Info.Group_Id;

                    txtUserName.IsEnabled = false;
                    txtPass.IsEnabled     = false;
                    txtFullName.Focus();
                }
                else if (c_type == Convert.ToInt16(Form_Type.View))
                {
                    this.Title = "Thông tin người dùng [" + c_User_Info.User_Name + "]";

                    txtFullName.Text             = c_User_Info.FullName;
                    txtUserName.Text             = c_User_Info.User_Name;
                    txtPass.Text                 = c_User_Info.Pass;
                    txtPhone.Text                = c_User_Info.Phone;
                    cbo_Group_User.SelectedValue = c_User_Info.Group_Id;

                    txtFullName.IsEnabled           = false;
                    txtUserName.IsEnabled           = false;
                    txtPhone.IsEnabled              = false;
                    txtPass.IsEnabled               = false;
                    cbo_Group_User.IsHitTestVisible = false;
                    cbo_Group_User.Focusable        = false;
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }