예제 #1
0
        public ActionResult Index(Guid?userId)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }
            var navigation = new MyNavigation();

            navigation.Navigations.Add(new NavElement
            {
                Depth      = 1,
                Name       = "Адресная книга",
                Action     = "Index",
                Controller = "AddressBook",
                IsUrl      = false
            });
            var userInfo = (UserInfo)Session["userInfo"];

            ViewBag.userInfo = userInfo;
            ViewBag.UserId   = userId == null ? Guid.Empty : (Guid)userId;
            ViewBag.nav      = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            return(View());
        }
예제 #2
0
        //The user press the sign in button
        private async Task SignIn()
        {
            ProfileInfo user = JsonUtil.GetJsonUser();

            //Check if user has an account
            if (user == null)
            {
                SetErrorMessage(2);
                OnPropertyChanged(nameof(ErrorLabelMessage));
            }
            //If the user didn't enter anything in username or password
            else if (String.IsNullOrWhiteSpace(username) || String.IsNullOrWhiteSpace(password))
            {
                //Empty username or password entry
                SetErrorMessage(0);
                OnPropertyChanged(nameof(ErrorLabelMessage));
            }
            else if (!user.username.Equals(username) || !user.password.Equals(Security.Hash(password)))
            {
                //Invalid username or password
                SetErrorMessage(1);
                OnPropertyChanged(nameof(ErrorLabelMessage));
            }
            else
            {
                SystemCache systemCache = JsonUtil.GetJsonSystemCache();
                systemCache.isLoggedIn = SystemCache.LOGGED_IN;
                string json = JsonUtil.Stringify(systemCache);
                JsonUtil.SaveJsonToFile(json, JsonUtil.SYSTEM_CACHE_FILE);

                await MyNavigation.PushModalAsync(new MainPage());
            }
        }
예제 #3
0
        //The user press the forgot password button
        private async Task ForgetPassword()
        {
            ProfileInfo user = JsonUtil.GetJsonUser();

            if (user != null)
            {
                await MyNavigation.PushModalAsync(new ForgetPassword());
            }
        }
예제 #4
0
        public ActionResult Index()
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }
            var model      = new AdminModel();
            var navigation = new MyNavigation();

            navigation.Navigations.Add(new NavElement
            {
                Depth      = 1,
                Name       = "Администрирование",
                Action     = "Index",
                Controller = "Administration",
                IsUrl      = true
            });
            navigation.Navigations.Add(new NavElement
            {
                Depth      = 2,
                Name       = "Учетные записи",
                Action     = "",
                Controller = "",
                IsUrl      = false
            });


            var userInfo = (UserInfo)Session["userInfo"];

            ViewBag.userInfo = userInfo;

            ViewBag.nav = navigation.Navigations.OrderBy(x => x.Depth).ToList();

            AdminInfoResponse response = _cryptxService.GetGroupUsers("", AdminSort.LoginASC, token);

            if (response.Exception == null)
            {
                model.GroupUserInfos = response.GroupUserInfos;
                return(View(model));
            }
            throw response.Exception;
        }
        //The user presses the verify
        private async Task ResetPassword()
        {
            //Hash the security answers
            String hashPassword1 = Security.Hash(securityAnswer1);
            String hashPassword2 = Security.Hash(securityAnswer2);

            //Get the security answers from the user profile
            //Compare it to the hash and if it matches, and allow the user to verify
            if (!user.securityAnswer1.Equals(hashPassword1) || !user.securityAnswer2.Equals(hashPassword2))
            {
                //Display the passwords do not match error
                currErrorMessage = wrongPasswordError;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(currErrorMessage));
            }
            else
            {
                //send the user to the reset password page
                await MyNavigation.PushModalAsync(new ResetPassword());
            }
        }
예제 #6
0
 private async Task ShowInfoAsync()
 {
     await MyNavigation.PushPopupAsync(new InSightInfoPopupPage()).ConfigureAwait(false);
 }
예제 #7
0
        public ActionResult Index(Name?name, SignText?signText, EncText?encText, Guid?userId)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }

            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Шаблоны настроек",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Шаблоны настроек",
                    Action     = "Index",
                    Controller = "Settings",
                    IsUrl      = false
                });
            }

            ViewBag.nav = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            var userInfo = (UserInfo)Session["userInfo"];

            ViewBag.userInfo = userInfo;

            UserProfilesResponse response = _cryptxService.GetUserProfiles(userId == null ? Guid.Empty : (Guid)userId,
                                                                           token);


            if (response.Exception != null)
            {
                throw response.Exception;
            }

            switch (name)
            {
            case Name.ASC:
                signText                 = null;
                encText                  = null;
                ViewBag.name             = name;
                ViewBag.signText         = null;
                ViewBag.encText          = null;
                response.UserProfileList = response.UserProfileList.OrderBy(x => x.Name).ToList();
                break;

            case Name.DESC:
                signText = null;
                encText  = null;

                ViewBag.name             = name;
                ViewBag.signText         = null;
                ViewBag.encText          = null;
                response.UserProfileList = response.UserProfileList.OrderByDescending(x => x.Name).ToList();
                break;
            }

            switch (signText)
            {
            case SignText.ASC:
                name                     = null;
                encText                  = null;
                ViewBag.name             = null;
                ViewBag.signText         = signText;
                ViewBag.encText          = null;
                response.UserProfileList = response.UserProfileList.OrderBy(x => x.SignText).ToList();
                break;

            case SignText.DESC:
                name    = null;
                encText = null;

                ViewBag.name             = null;
                ViewBag.signText         = signText;
                ViewBag.encText          = null;
                response.UserProfileList = response.UserProfileList.OrderByDescending(x => x.SignText).ToList();
                break;
            }

            switch (encText)
            {
            case EncText.ASC:
                name                     = null;
                signText                 = null;
                ViewBag.name             = null;
                ViewBag.signText         = null;
                ViewBag.encText          = encText;
                response.UserProfileList = response.UserProfileList.OrderBy(x => x.EncryptionText).ToList();
                break;

            case EncText.DESC:
                name     = null;
                signText = null;

                ViewBag.name             = null;
                ViewBag.signText         = null;
                ViewBag.encText          = encText;
                response.UserProfileList =
                    response.UserProfileList.OrderByDescending(x => x.EncryptionText).ToList();
                break;
            }
            ViewBag.UserId = userId == null ? Guid.Empty : (Guid)userId;
            return(View(response.UserProfileList));
        }
예제 #8
0
        public ActionResult Edit(Guid?Id, Guid?userId)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }

            ViewBag.canDelete = false;
            ProfileResponse response;

            var settings = new Settings();

            if (Id == null || Id == Guid.Empty)
            {
                ViewBag.Title = "Шаблоны настроек";
                response      = _cryptxService.GetBlankProfile();
                if (response.Exception == null)
                {
                    settings = response.Settings;
                }
                else
                {
                    throw response.Exception;
                }
            }
            else
            {
                UserProfilesResponse responses =
                    _cryptxService.GetUserProfiles(userId == null ? Guid.Empty : (Guid)userId, token);
                if (responses.UserProfileList.Count == 1)
                {
                    ViewBag.canDelete = false;
                }
                else
                {
                    ViewBag.canDelete = true;
                }
                response = _cryptxService.GetProfile((Guid)Id, (userId == null ? Guid.Empty : (Guid)userId), token);
                if (response.Exception == null)
                {
                    settings = response.Settings;
                }
                else
                {
                    throw response.Exception;
                }
            }


            if (response.Exception == null)
            {
                Settings model      = settings;
                var      navigation = new MyNavigation();

                if (userId != null && userId != Guid.Empty)
                {
                    navigation.Navigations.Add(new NavElement
                    {
                        Depth      = 1,
                        Name       = "Администрирование",
                        Action     = "Index",
                        Controller = "Administration",
                        IsUrl      = true
                    });
                    UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                    navigation.Navigations.Add(new NavElement
                    {
                        Depth = 3,
                        Name  = responseUser.User.Name,
                        IsUrl = false
                    });
                    navigation.Navigations.Add(new NavElement
                    {
                        Depth = 4,
                        Name  =
                            "Шаблон: " +
                            (string.IsNullOrEmpty(model._MainSettings.Name) ? "Новый" : model._MainSettings.Name),
                        IsUrl = false
                    });
                }
                else
                {
                    navigation.Navigations.Add(new NavElement
                    {
                        Depth      = 1,
                        Name       = "Шаблоны настроек",
                        Action     = "Index",
                        Controller = "Settings",
                        IsUrl      = true
                    });
                    navigation.Navigations.Add(new NavElement
                    {
                        Depth      = 2,
                        Name       = model._MainSettings.Name,
                        Action     = "Edit",
                        Controller = "Settings",
                        IsUrl      = false
                    });
                }

                ViewBag.nav = navigation.Navigations.OrderBy(x => x.Depth).ToList();
                var userInfo = (UserInfo)Session["userInfo"];
                ViewBag.userInfo = userInfo;
                ViewBag.UserId   = userId == null ? Guid.Empty : (Guid)userId;

                return(View(model));
            }
            throw response.Exception;
        }
예제 #9
0
        public ActionResult Index(Guid?userId)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }

            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Шаблоны настроек",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Шаблоны настроек",
                    Action     = "Index",
                    Controller = "Settings",
                    IsUrl      = false
                });
            }

            ViewBag.nav = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            var userInfo = (UserInfo)Session["userInfo"];

            ViewBag.userInfo = userInfo;
            var response = new UserProfilesResponse();

            response = _cryptxService.GetUserProfiles(userId == null ? Guid.Empty : (Guid)userId, token);
            if (response.Exception != null)
            {
                throw response.Exception;
            }
            response.UserProfileList = response.UserProfileList.OrderBy(x => x.Name).ToList();
            ViewBag.name             = Name.ASC;
            ViewBag.UserId           = userId == null ? Guid.Empty : (Guid)userId;
            return(View(response.UserProfileList));
        }
예제 #10
0
        public ActionResult Edit(Settings settings, Guid?userId, bool attached, bool zip = false)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                return(RedirectToAction("LogOff", "Account"));
            }
            ProfileResponse response = _cryptxService.GetProfile(settings.Id,
                                                                 (userId == null ? Guid.Empty : (Guid)userId), token);

            if (response.Exception == null)
            {
                Settings model      = response.Settings;
                var      navigation = new MyNavigation();
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Шаблоны настроек",
                    Action     = "Index",
                    Controller = "Settings",
                    IsUrl      = true
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 2,
                    Name       = model._MainSettings.Name,
                    Action     = "Edit",
                    Controller = "Settings",
                    IsUrl      = false
                });
                settings._EncryptionSettings.RecipientCertificates1 =
                    (settings._EncryptionSettings.RecipientCertificates1[0].Split(',')).Distinct().ToList();
                List <string> certs = settings._EncryptionSettings.RecipientCertificates1;
                settings._EncryptionSettings.RecipientCertificates1 =
                    settings._EncryptionSettings.RecipientCertificates1.Where(
                        x => (!string.IsNullOrEmpty(x.ToString(CultureInfo.InvariantCulture)))).ToList();
                ViewBag.nav = navigation.Navigations.OrderBy(x => x.Depth).ToList();
                var userInfo = (UserInfo)Session["userInfo"];
                ViewBag.userInfo = userInfo;
                //if (zip)
                //{
                //    settings._SignatureSettings.ZipType = ZipTypeEnum.ZipAfter;
                //    settings._EncryptionSettings.ZipType = ZipTypeEnum.ZipAfter;
                //}
                var defaultSettings = new Settings();
                var defaultResponse = new ProfileResponse();

                if (settings.Id == Guid.Empty)
                {
                    defaultResponse = _cryptxService.GetBlankProfile();
                }
                else
                {
                    defaultResponse = _cryptxService.GetProfile(settings.Id,
                                                                (userId == null ? Guid.Empty : (Guid)userId), token);
                }

                if (defaultResponse.Exception == null)
                {
                    defaultSettings = defaultResponse.Settings;
                }
                else
                {
                    throw defaultResponse.Exception;
                }

                //Глупое место необходимо как-то автоматизировать
                defaultSettings.Id = settings.Id;
                defaultSettings._MainSettings.Name        = settings._MainSettings.Name;
                defaultSettings._MainSettings.Email       = settings._MainSettings.Email;
                defaultSettings._MainSettings.Description = settings._MainSettings.Description;
                defaultSettings._MainSettings.IsDefault   = settings._MainSettings.IsDefault;

                defaultSettings._SignatureSettings.Detached           = !attached;
                defaultSettings._SignatureSettings._EncodingType      = settings._SignatureSettings._EncodingType;
                defaultSettings._SignatureSettings.SignerCertificate1 = settings._SignatureSettings.SignerCertificate1;
                defaultSettings._SignatureSettings.ZipType            = settings._SignatureSettings.ZipType;

                defaultSettings._EncryptionSettings._EncodingType          = settings._EncryptionSettings._EncodingType;
                defaultSettings._EncryptionSettings.RecipientCertificates1 =
                    settings._EncryptionSettings.RecipientCertificates1;
                defaultSettings._EncryptionSettings.ZipType = settings._EncryptionSettings.ZipType;

                //defaultSettings._DecryptionSettings.DecryptCertificate = settings._DecryptionSettings.DecryptCertificate;
                //defaultSettings._DecryptionSettings.KeysetPassword = settings._DecryptionSettings.KeysetPassword;

                ViewBag.Title = defaultSettings._MainSettings.Name;

                if (settings.Id == Guid.Empty)
                {
                    _cryptxService.SaveNewProfile(defaultSettings, token, (userId == null ? Guid.Empty : (Guid)userId));
                }
                else
                {
                    _cryptxService.SaveProfile(defaultSettings, token, (userId == null ? Guid.Empty : (Guid)userId));
                }
                var certBytes = new List <byte[]>();
                foreach (string thumbprint in certs)
                {
                    if (!string.IsNullOrEmpty(thumbprint))
                    {
                        if (Session[thumbprint] != null)
                        {
                            certBytes.Add((byte[])Session[thumbprint]);
                        }
                    }
                }
                _cryptxService.AddCertificates(certBytes, false, (userId == null ? Guid.Empty : (Guid)userId), token);
                if (userId != null && userId != Guid.Empty)
                {
                    return(RedirectToAction("Index", new { userId = (Guid)userId }));
                }
                return(RedirectToAction("Index"));
            }
            throw response.Exception;
        }
예제 #11
0
 private async Task ClosePage()
 {
     await MyNavigation.PopPopupAsync().ConfigureAwait(false);
 }
예제 #12
0
        public ActionResult EditContact(Guid contactId, Guid?userId)
        {
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                ViewBag.login = true;
                return(View());
            }
            Contact contact = _cryptxService.GetContact(contactId, (userId == null ? Guid.Empty : (Guid)userId), token);

            var model = new ContactCertificatesModel();

            model.ID     = contact.ID;
            model.Name   = contact.Name;
            model.Email  = contact.Email;
            model.Sort   = CertificateSort.FriendlyNameASC;
            model.Filter = CertificateFilter.All;
            //model.Certificates = contact.Certificates;
            foreach (ContactCertificateRelationship contactCertificateRelationship in contact.Certificates)
            {
                var certificate = new ContactCertificate();
                certificate.ContactId    = contact.ID;
                certificate.Id           = contactCertificateRelationship.CertificateID;
                certificate.FriendlyName = contactCertificateRelationship.FriendlyName;
                certificate.Thumbprint   = contactCertificateRelationship.CertificateInfo.Thumbprint;
                certificate.SubjectName  = contactCertificateRelationship.CertificateInfo.SubjectName;
                certificate.IsTest       = contactCertificateRelationship.CertificateInfo.IsTest;

                if (DateTime.Now < contactCertificateRelationship.CertificateInfo.NotBefore)
                {
                    certificate.TimeMessage = "Недействителен до " +
                                              contactCertificateRelationship.CertificateInfo.NotBefore.Date
                                              .ToShortDateString().Replace("/", ".");
                }
                if (DateTime.Now > contactCertificateRelationship.CertificateInfo.NotBefore &&
                    DateTime.Now < contactCertificateRelationship.CertificateInfo.NotAfter)
                {
                    certificate.TimeMessage = "Действителен до " +
                                              contactCertificateRelationship.CertificateInfo.NotAfter.Date
                                              .ToShortDateString().Replace("/", ".");
                }
                else
                {
                    certificate.TimeMessage = "Недействителен с " +
                                              contactCertificateRelationship.CertificateInfo.NotAfter.Date
                                              .ToShortDateString().Replace("/", ".");
                    certificate.TimeMessageStyle = "color: red";
                }
                if (contactCertificateRelationship.CertificateInfo != null &&
                    !string.IsNullOrEmpty(contactCertificateRelationship.CertificateInfo.Organization))
                {
                    certificate.Organization = contactCertificateRelationship.CertificateInfo.Organization;
                }
                if (contactCertificateRelationship.CertificateInfo != null &&
                    !string.IsNullOrEmpty(contactCertificateRelationship.CertificateInfo.INN))
                {
                    certificate.INN = "ИНН " + contactCertificateRelationship.CertificateInfo.INN;
                }

                model.Certificates.Add(certificate);
            }

            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Контакт: " + contact.Name,
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Адресная книга",
                    Action     = "Index",
                    Controller = "AddressBook",
                    IsUrl      = true
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 2,
                    Name       = model.Name,
                    Action     = "",
                    Controller = "",
                    IsUrl      = false
                });
            }
            navigation.Navigations = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            ViewBag.nav            = Helper.HtmlNavElement(navigation, Request.RequestContext);
            ViewBag.UserId         = userId == null ? Guid.Empty : (Guid)userId;
            return(View(model));
        }
예제 #13
0
        public ActionResult ContactList(Contacts contacts, Guid?userId)
        {
            string status = "";
            Guid   token  = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                status = "logoff";
                return(View(new AddressBookModel {
                    Status = status
                }));
            }

            ElFinder.CryptxService.UserAddressBookResponse response = _cryptxService.GetAddressBook(contacts.SearchString, contacts.Sort,
                                                                                                    contacts.Filter, (userId == null ? Guid.Empty : (Guid)userId), token, 0);
            var model = new AddressBookModel(response);

            model.Status   = status;
            ViewBag.UserId = userId == null ? Guid.Empty : (Guid)userId;
            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Список контактов",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Адресная книга",
                    Action     = "Index",
                    Controller = "AddressBook",
                    IsUrl      = false
                });
            }
            navigation.Navigations = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            ViewBag.nav            = Helper.HtmlNavElement(navigation, Request.RequestContext);

            return(View(model));
        }
예제 #14
0
        public ActionResult CertificateList(Guid?userId)
        {
            string           status = "";
            Guid             token  = CheckSessionAuthState(CurrentUser, _authService);
            AddressBookModel model;

            if (token == Guid.Empty)
            {
                status       = "logoff";
                model        = new AddressBookModel();
                model.Status = status;
                return(View(model));
                //return RedirectToAction("LogOff", "Account");
            }
            try
            {
                CertificatesResponse response = _cryptxService.GetUserCertificates("", CertificateSort.FriendlyNameASC,
                                                                                   CertificateFilter.Active, (userId == null ? Guid.Empty : (Guid)userId), token, 0);
                model = new AddressBookModel(response);
            }
            catch (Exception exception)
            {
                throw;
            }

            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Список сертификатов",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Адресная книга",
                    Action     = "Index",
                    Controller = "AddressBook",
                    IsUrl      = false
                });
            }
            navigation.Navigations = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            ViewBag.nav            = Helper.HtmlNavElement(navigation, Request.RequestContext);


            ViewBag.UserId = (userId == null ? Guid.Empty : (Guid)userId);
            model.Status   = status;

            return(View(model));
        }
예제 #15
0
        public ActionResult CertificateList(Certificates certificates, string que, string save, string deletingCerts,
                                            string toContactList, Guid?userId)
        {
            var js       = new JavaScriptSerializer();
            var delCerts = (List <string>)js.Deserialize(deletingCerts, typeof(List <string>));

            string           status = "";
            Guid             token  = CheckSessionAuthState(CurrentUser, _authService);
            AddressBookModel model;

            if (token == Guid.Empty)
            {
                status       = "logoff";
                model        = new AddressBookModel();
                model.Status = status;
                return(View(model));
            }

            //удаление сертов
            if (delCerts != null && delCerts.Count > 0 && que == null)
            {
                foreach (string delCert in delCerts)
                {
                    _cryptxService.DeleteRecipientRelation(delCert, (userId == null ? Guid.Empty : (Guid)userId), token);
                }
            }

            try
            {
                CertificatesResponse response = _cryptxService.GetUserCertificates(certificates.SearchString,
                                                                                   certificates.Sort, certificates.Filter, (userId == null ? Guid.Empty : (Guid)userId), token, 0);
                model = new AddressBookModel(response);
            }
            catch (Exception exception)
            {
                model  = new AddressBookModel();
                status = "logoff";
            }
            var navigation = new MyNavigation();

            if (userId != null && userId != Guid.Empty)
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Администрирование",
                    Action     = "Index",
                    Controller = "Administration",
                    IsUrl      = true
                });
                UserInfoResponse responseUser = _authService.GetUserDataByID((Guid)userId);
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 3,
                    Name  = responseUser.User.Name,
                    IsUrl = false
                });
                navigation.Navigations.Add(new NavElement
                {
                    Depth = 4,
                    Name  = "Список сертификатов",
                    IsUrl = false
                });
            }
            else
            {
                navigation.Navigations.Add(new NavElement
                {
                    Depth      = 1,
                    Name       = "Адресная книга",
                    Action     = "Index",
                    Controller = "AddressBook",
                    IsUrl      = false
                });
            }
            navigation.Navigations = navigation.Navigations.OrderBy(x => x.Depth).ToList();
            ViewBag.nav            = Helper.HtmlNavElement(navigation, Request.RequestContext);

            model.Status   = status;
            ViewBag.UserId = (userId == null ? Guid.Empty : (Guid)userId);
            return(View(model));
        }
예제 #16
0
 //The user press the sign up button
 public async Task CreateAccount()
 {
     await MyNavigation.PushModalAsync(new CreateAccount());
 }