Beispiel #1
0
        private bool ValidateBeforeSave(BO.j02Person c, j02RecordViewModel v)
        {
            if (v.IsUserProfile)
            {
                if (!string.IsNullOrEmpty(v.ResetPassword))
                {
                    var lu  = new BO.LoggingUser();
                    var res = lu.ValidatePassword(v.ResetPassword);
                    if (res.Flag == BO.ResultEnum.Failed)
                    {
                        Factory.CurrentUser.AddMessage(res.Message);
                        return(false);
                    }
                }

                if (string.IsNullOrEmpty(v.UserProfile.j03Login) || v.UserProfile.j04ID == 0)
                {
                    Factory.CurrentUser.AddMessage("Uživatel musí mít vyplněný uživatelský účet."); return(false);
                }
                if ((c.j03ID == 0 && string.IsNullOrEmpty(v.ResetPassword)))
                {
                    Factory.CurrentUser.AddMessage("Pro nového uživatele musíte definovat výchozí heslo."); return(false);
                }
                if (c.p28ID == 0 || Factory.p21LicenseBL.HasClientValidLicense(c.p28ID) == false)
                {
                    Factory.CurrentUser.AddMessage("Osoba s uživatelským účtem musí mít vazbu na subjekt (firmu) s platnou licencí užívat tento software.");
                    return(false);
                }
                if (Factory.j03UserBL.GetList(new BO.myQuery("j03User")).Where(p => p.pid != c.j03ID && p.j03Login.ToUpper() == v.UserProfile.j03Login.ToUpper()).Count() > 0)
                {
                    Factory.CurrentUser.AddMessage("Uživatel s tímto loginem již existuje.");
                    return(false);
                }
            }



            return(true);
        }
Beispiel #2
0
 private void RefreshState(j02RecordViewModel v)
 {
     v.Toolbar = new MyToolbarViewModel(v.Rec);
 }