Exemple #1
0
        private async void DeleteEmp(int?obj)
        {
            try
            {
                dc = new DialogContent()
                {
                    Content = "Bạn muốn xóa tài khoản này ?", Tilte = "Thông Báo"
                };
                var dialogYS = new DialogYesNo()
                {
                    DataContext = dc
                };
                var result = (bool)await DialogHost.Show(dialogYS, DialogHostId);

                if (result)
                {
                    if (obj != null)
                    {
                        if (await employee_Repo.Remove((int)obj))
                        {
                            ListAccount.Remove(ListAccount.SingleOrDefault(t => t.EmpID == (int)obj));
                            dc = new DialogContent()
                            {
                                Content = "Xóa Thành Công", Tilte = "Thông Báo"
                            };
                            dialog = new DialogOk()
                            {
                                DataContext = dc
                            };
                            await DialogHost.Show(dialog, DialogHostId);
                        }
                        else
                        {
                            dc = new DialogContent()
                            {
                                Content = "Xóa Thất Bại", Tilte = "Thông Báo"
                            };
                            dialog = new DialogOk()
                            {
                                DataContext = dc
                            };
                            await DialogHost.Show(dialog, DialogHostId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
 private async void ShowInfoEmp(string obj)
 {
     if (!string.IsNullOrEmpty(obj))
     {
         var emp = ListAccount.SingleOrDefault(t => t.NameLogin.Equals(obj));
         if (emp != null)
         {
             UserName  = emp.UserName;
             NameLogin = emp.NameLogin;
             EmpID     = emp.EmpID.ToString();
             ImgEmp    = emp.Avatar.LoadImage();
             Phone     = emp.Phone;
             IsB       = IsG = false;
             if (emp.Sex == true)
             {
                 IsB = true;
             }
             if (emp.Sex == false)
             {
                 IsG = true;
             }
             if (emp.Role == 0)
             {
                 IsE = true;
             }
             if (emp.Role == -1)
             {
                 IsE = false;
             }
             Address = emp.Address;
             DOB     = emp.DOB.ToString();
         }
         DialogHost.CloseDialogCommand.Execute(null, null);
         await DialogHost.Show(new AccountProfile(), DialogHostId);
     }
 }