public static Tuple <Personnel, User> GetAnyObject(PersonnelVM vm, bool isAddObject)
        {
            Personnel prs  = GetPersonnel(vm, isAddObject);
            User      user = GetUser(vm, prs, isAddObject);

            return(Tuple.Create(prs, user));
        }
        private static Personnel GetPersonnel(PersonnelVM vm, bool isAddObject)
        {
            Personnel obj = new Personnel();

            if (!isAddObject)
            {
                obj.PersonnelId = vm.PersonnelId;
            }
            obj.FirstName    = vm.FirstName;
            obj.LastName     = vm.LastName;
            obj.NationalCode = vm.NationalCode;
            obj.PhoneNo      = vm.PhoneNo;
            obj.Email        = vm.Email;

            return(obj);
        }
        private static User GetUser(PersonnelVM vm, Personnel prs, bool isAddObject)
        {
            User user = new User();

            if (!isAddObject)
            {
                user.UserId = vm.UserId.GetValueOrDefault();
            }
            user.PersonnelId = prs.PersonnelId;
            user.Password    = vm.Password;
            user.UserRole    = vm.UserRole.GetValueOrDefault();
            user.UserActived = true;
            user.Personnel   = prs;

            return(user);
        }
        // public bool? UserActived { get; set; }
        //[Display(Name = "وضعیت")]
        //public string UserActivedName { get; set; }
        #endregion

        public static PersonnelVM GetVM(Personnel obj)
        {
            PersonnelVM vm = new PersonnelVM();

            vm.PersonnelId  = obj.PersonnelId;
            vm.FirstName    = obj.FirstName;
            vm.LastName     = obj.LastName;
            vm.NationalCode = obj.NationalCode;
            vm.PhoneNo      = obj.PhoneNo;
            vm.Email        = obj.Email;
            vm.UserId       = obj.CurrentUser?.UserId;
            vm.Password     = obj.CurrentUser?.Password;
            vm.UserRole     = obj.CurrentUser?.UserRole;
            vm.UserRoleName = obj.CurrentUser != null ? (obj.CurrentUser.UserRole == Domain.Enums.UserRole.Admin ? "مدیر سیستم" : "کاربر سیستم") : null;
            //vm.UserActived = obj.CurrentUser?.UserActived;
            //vm.UserActivedName = (obj.CurrentUser.UserActived ? "فعال" : "غیر فعال");

            return(vm);
        }