< Summary

Class:WinSolutions.Sveta.Server.Data.DataModel.Entities.User
Assembly:WinSolutions.Sveta.Server
File(s):/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Data/DataModel/Entities/User.cs
Covered lines:1
Uncovered lines:23
Coverable lines:24
Total lines:109
Line coverage:4.1% (1 of 24)
Covered branches:0
Total branches:6
Branch coverage:0% (0 of 6)

Metrics

MethodLine coverage Branch coverage
get_Login()0%100%
get_FirstName()0%100%
get_MiddleName()0%100%
get_LastName()0%100%
get_Position()0%100%
get_Email()0%100%
get_Phone()0%100%
get_Contragent()100%100%
get_IsContactPerson()0%100%
get_IsBlocked()0%100%
get_UsersDepartments()0%100%
get_UsersRoles()0%100%
get_ExternalKey()0%100%
GetFio()0%0%
GetName()0%100%

File(s)

/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Data/DataModel/Entities/User.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using System.ComponentModel.DataAnnotations.Schema;
 3using System;
 4using CrmVtbc.Integration;
 5using System.Collections.Generic;
 6
 7namespace WinSolutions.Sveta.Server.Data.DataModel.Entities
 8{
 9    [CrmCollection("Contact")]
 10    public class User : ExternalRecord, ITrackableRecord
 11    {
 12        /// <summary>
 13        /// Логин
 14        /// </summary>
 015        public string Login { get; set; }
 16
 17        /// <summary>
 18        /// Имя
 19        /// </summary>
 20        [Required]
 21        [CrmMap("GivenName"), CrmOnlyLoad]
 022        public string FirstName { get; set; }
 23
 24        /// <summary>
 25        /// Отчество
 26        /// </summary>
 27        [CrmMap, CrmOnlyLoad]
 028        public string MiddleName { get; set; }
 29
 30        /// <summary>
 31        /// Фамилия
 32        /// </summary>
 33        [Required]
 34        [CrmMap("Surname"), CrmOnlyLoad]
 035        public string LastName { get; set; }
 36
 37
 38        /// <summary>
 39        /// Должность
 40        /// </summary>
 41        [CrmMap("JobTitle"), CrmOnlyLoad]
 042        public string Position { get; set; }
 43
 44
 45        /// <summary>
 46        /// Электронная почта
 47        /// </summary>
 48        [CrmMap, CrmOnlyLoad]
 049        public string Email { get; set; }
 50
 51        /// <summary>
 52        /// Телефон
 53        /// </summary>
 54        [CrmMap("MobilePhone"), CrmOnlyLoad]
 055        public string Phone { get; set; }
 56
 57
 58        /// <summary>
 59        /// Контрагент
 60        /// </summary>
 134261        public Contragent Contragent { get; set; }
 62
 63
 64        /// <summary>
 65        /// Контактное лицо
 66        /// </summary>
 67        [Required]
 068        public bool IsContactPerson { get; set; } = false;
 69
 70        /// <summary>
 71        /// Признак блокировки
 72        /// </summary>
 73        [Required]
 074        public bool IsBlocked { get; set; } = false;
 75
 76        /// <summary>
 77        /// Подразделения
 78        /// </summary>
 079        public List<UserDepartment> UsersDepartments { get; set; }
 80
 81        /// <summary>
 82        /// Роли
 83        /// </summary>
 084        public List<UserRole> UsersRoles { get; set; }
 85
 86        /// <summary>
 87        /// Внешний ключ для CRM
 88        /// </summary>
 89        // [Required]
 90        [CrmKey("NrbTID"), CrmOnlyLoad]
 91        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 092        public Guid ExternalKey { get; set; }
 93
 94        public string GetFio()
 095        {
 096            string result = "";
 097            if (!string.IsNullOrWhiteSpace(this.FirstName))
 098                result += this.FirstName.Substring(0, 1).ToUpper() + ".";
 099            if (!string.IsNullOrWhiteSpace(this.MiddleName))
 0100                result += this.MiddleName.Substring(0, 1).ToUpper() + ".";
 0101            if (!string.IsNullOrWhiteSpace(this.LastName))
 0102                result += this.LastName;
 0103            return result;
 0104        }
 105
 0106        public string GetName() => this.LastName + " " + this.FirstName;
 107    }
 108}
 109