| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 | 
							- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.ComponentModel;
 
- using System.ComponentModel.DataAnnotations;
 
- using MECF.Framework.Common.Account.Extends;
 
- using MECF.Framework.UI.Client.ClientBase;
 
- using OpenSEMI.ClientBase;
 
- namespace MECF.Framework.UI.Client.CenterViews.Configs.Accounts
 
- {
 
-     public class AccountItem : ValidatorBase, INotifyPropertyChanged
 
-     {
 
-         /// <summary>
 
-         /// Account Constructor
 
-         /// </summary>
 
-         public AccountItem(string strID)
 
-         {
 
-             m_Account = new AccountEx(strID, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, new List<string>(), string.Empty);
 
-         }
 
-         /// <summary>
 
-         /// Account Constructor
 
-         /// </summary>
 
-         public AccountItem(AccountEx Acc)
 
-         {
 
-             m_Account = Acc;
 
-         }
 
-         private AccountEx m_Account;
 
-         public AccountEx Account
 
-         {
 
-             get { return m_Account; }
 
-             set { m_Account = value; }
 
-         }
 
-         /// <summary>
 
-         /// Account ID
 
-         /// </summary>
 
-         public string AccountID
 
-         {
 
-             get { return m_Account.UserID; }
 
-             set { m_Account.UserID = value; }
 
-         }
 
-         /// <summary>
 
-         /// Account name
 
-         /// </summary>
 
-         public string AccountName
 
-         {
 
-             get { return Account.LoginName; }
 
-             set
 
-             {
 
-                 Account.LoginName = value;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Account Password
 
-         /// </summary>
 
-         public string Password
 
-         {
 
-             get { return Account.Password; }
 
-             set
 
-             {
 
-                 Account.Password = value;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Account New Password
 
-         /// </summary>
 
-         private string m_strNewPassword;
 
-         public string NewPassword
 
-         {
 
-             get { return m_strNewPassword; }
 
-             set
 
-             {
 
-                 if (value != m_strNewPassword)
 
-                 {
 
-                     m_strNewPassword = value;
 
-                 }
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Account Confirm New Password
 
-         /// </summary>
 
-         private string m_strConfirmPassword;
 
-         public string ConfirmPassword
 
-         {
 
-             get { return m_strConfirmPassword; }
 
-             set
 
-             {
 
-                 if (value != m_strConfirmPassword)
 
-                 {
 
-                     m_strConfirmPassword = value;
 
-                 }
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Account first name
 
-         /// </summary>
 
-         public string FirstName
 
-         {
 
-             get { return Account.FirstName; }
 
-             set
 
-             {
 
-                 Account.FirstName = value;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Account last name
 
-         /// </summary>
 
-         public string LastName
 
-         {
 
-             get { return Account.LastName; }
 
-             set
 
-             {
 
-                 Account.LastName = value;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Email address
 
-         /// </summary>
 
-         public string Email
 
-         {
 
-             get { return Account.Email; }
 
-             set
 
-             {
 
-                 Account.Email = value;
 
-             }
 
-         }
 
-         public string Description
 
-         {
 
-             get { return Account.Description; }
 
-             set
 
-             {
 
-                 Account.Description = value;
 
-             }
 
-         }
 
-         private string _DisplayAccountName;
 
-         //[Required(ErrorMessage = "AccountName Required")]
 
-         public string DisplayAccountName
 
-         {
 
-             get
 
-             {
 
-                 return _DisplayAccountName;
 
-             }
 
-             set
 
-             {
 
-                 _DisplayAccountName = value;
 
-                 this.OnPropertyChanged("DisplayAccountName");
 
-             }
 
-         }
 
-         //[Required(ErrorMessage = "FirstName Required")]
 
-         private string _DisplayFirstName = string.Empty;
 
-         public string DisplayFirstName
 
-         {
 
-             get { return _DisplayFirstName; }
 
-             set
 
-             {
 
-                 _DisplayFirstName = value;
 
-             }
 
-         }
 
-         //[Required(ErrorMessage = "LastName Required")]
 
-         private string _DisplayLastName = string.Empty;
 
-         public string DisplayLastName
 
-         {
 
-             get { return _DisplayLastName; }
 
-             set
 
-             {
 
-                 _DisplayLastName = value;
 
-             }
 
-         }
 
-         private string _DisplayEmail = string.Empty;
 
-         //[Required(ErrorMessage = "Email Required")]
 
-         //[RegularExpression(@"^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$", ErrorMessage = "Email Format Error")]
 
-         public string DisplayEmail
 
-         {
 
-             get { return _DisplayEmail; }
 
-             set
 
-             {
 
-                 _DisplayEmail = value;
 
-             }
 
-         }
 
-         private string _DisplayDescription = string.Empty;
 
-         public string DisplayDescription
 
-         {
 
-             get { return _DisplayDescription; }
 
-             set
 
-             {
 
-                 _DisplayDescription = value;
 
-             }
 
-         }
 
-         private bool _IsSelected = false;
 
-         public bool IsSelected
 
-         {
 
-             get
 
-             {
 
-                 return _IsSelected;
 
-             }
 
-             set
 
-             {
 
-                 _IsSelected = value;
 
-                 this.OnPropertyChanged("IsSelected");
 
-             }
 
-         }
 
-         private bool _AccountTextSaved = true;
 
-         public bool AccountTextSaved
 
-         {
 
-             get { return _AccountTextSaved; }
 
-             set
 
-             {
 
-                 if (_AccountTextSaved != value)
 
-                 {
 
-                     _AccountTextSaved = value;
 
-                     this.OnPropertyChanged("AccountTextSaved");
 
-                 }
 
-             }
 
-         }
 
-         private bool _FirstNameTextSaved = true;
 
-         public bool FirstNameTextSaved
 
-         {
 
-             get { return _FirstNameTextSaved; }
 
-             set
 
-             {
 
-                 if (_FirstNameTextSaved != value)
 
-                 {
 
-                     _FirstNameTextSaved = value;
 
-                     this.OnPropertyChanged("FirstNameTextSaved");
 
-                 }
 
-             }
 
-         }
 
-         private bool _LastNameTextSaved = true;
 
-         public bool LastNameTextSaved
 
-         {
 
-             get { return _LastNameTextSaved; }
 
-             set
 
-             {
 
-                 if (_LastNameTextSaved != value)
 
-                 {
 
-                     _LastNameTextSaved = value;
 
-                     this.OnPropertyChanged("LastNameTextSaved");
 
-                 }
 
-             }
 
-         }
 
-         private bool _EmailTextSaved = true;
 
-         public bool EmailTextSaved
 
-         {
 
-             get { return _EmailTextSaved; }
 
-             set
 
-             {
 
-                 if (_EmailTextSaved != value)
 
-                 {
 
-                     _EmailTextSaved = value;
 
-                     this.OnPropertyChanged("EmailTextSaved");
 
-                 }
 
-             }
 
-         }
 
-         private bool _DescriptionTextSaved = true;
 
-         public bool DescriptionTextSaved
 
-         {
 
-             get { return _DescriptionTextSaved; }
 
-             set
 
-             {
 
-                 if (_DescriptionTextSaved != value)
 
-                 {
 
-                     _DescriptionTextSaved = value;
 
-                     this.OnPropertyChanged("DescriptionTextSaved");
 
-                 }
 
-             }
 
-         }
 
-         private bool _IsEnableChangeAccountName = true;
 
-         public bool IsEnableChangeAccountName
 
-         {
 
-             get
 
-             {
 
-                 return _IsEnableChangeAccountName;
 
-             }
 
-             set
 
-             {
 
-                 if (_IsEnableChangeAccountName != value)
 
-                 {
 
-                     _IsEnableChangeAccountName = value;
 
-                     this.OnPropertyChanged("IsEnableChangeAccountName");
 
-                 }
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// Store all roles
 
-         /// </summary>
 
-         private ObservableCollection<RoleStatusItem> m_RoleColleciton = new ObservableCollection<RoleStatusItem>();
 
-         public ObservableCollection<RoleStatusItem> RoleColleciton
 
-         {
 
-             get { return m_RoleColleciton; }
 
-         }
 
-         /// <summary>
 
-         /// Update password
 
-         /// </summary>
 
-         public bool UpdatePassword()
 
-         {
 
-             if (NewPassword == null || NewPassword == string.Empty
 
-                     || ConfirmPassword == null || ConfirmPassword == string.Empty
 
-                     || NewPassword != ConfirmPassword)
 
-             {
 
-                 return false;
 
-             }
 
-             Password = NewPassword;
 
-             NewPassword = null;
 
-             ConfirmPassword = null;
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// Try update password
 
-         /// </summary>
 
-         public bool TryUpdatePassword()
 
-         {
 
-             if (NewPassword == null || NewPassword == string.Empty
 
-                     || ConfirmPassword == null || ConfirmPassword == string.Empty
 
-                     || NewPassword != ConfirmPassword)
 
-             {
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// Init role list
 
-         /// </summary>
 
-         /// <param name="listRole"></param>
 
-         public void InitRoleList(List<Role> listRole)
 
-         {
 
-             m_RoleColleciton.Clear();
 
-             foreach (Role role in listRole)
 
-             {
 
-                 RoleStatusItem RoleStatus = new RoleStatusItem()
 
-                 {
 
-                     RoleID = role.RoleID,
 
-                     RoleName = role.RoleName,
 
-                     RoleStatus = this.Account.RoleIDs.Contains(role.RoleID) ? true : false
 
-                 };
 
-                 m_RoleColleciton.Add(RoleStatus);
 
-             }
 
-         }
 
-         public bool IsAccountChanged()
 
-         {
 
-             if (this.DisplayAccountName != Account.LoginName)
 
-                 return true;
 
-             if (this.DisplayFirstName != Account.FirstName)
 
-                 return true;
 
-             if (this.DisplayLastName != Account.LastName)
 
-                 return true;
 
-             if (this.DisplayEmail != Account.Email)
 
-                 return true;
 
-             if (this.DisplayDescription != Account.Description)
 
-                 return true;
 
-             foreach (RoleStatusItem item in m_RoleColleciton)
 
-             {
 
-                 if (item.DisplayRoleStatus != item.RoleStatus)
 
-                     return true;
 
-             }
 
-           
 
-             return false;
 
-         }
 
-         #region INotifyPropertyChanged Members
 
-         public event PropertyChangedEventHandler PropertyChanged;
 
-         protected virtual void OnPropertyChanged(string propertyName)
 
-         {
 
-             PropertyChangedEventHandler handler = this.PropertyChanged;
 
-             if (handler != null)
 
-                 handler(this, new PropertyChangedEventArgs(propertyName));
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |