public string CheckFullName(string fullname)
 {
     if (fullname == null || fullname == "")
     {
         return("");
     }
     else
     {
         return(Firstname.Trim() + " " + Lastname.Trim() + "\r\n");
     }
 }
Exemple #2
0
 public string GetStudentInfo()
 {
     if (Firstname == null || Firstname.Trim().Length == 0)
     {
         return($"Помилка            ");
     }
     else if (Lastname == null || Lastname.Trim().Length == 0)
     {
         return($"Помилка            ");
     }
     else if (Date == null || Date.Trim().Length == 0)
     {
         return($"Помилка            ");
     }
     else
     {
         return("\n Firstname: " + Firstname + "   Lastname: " + Lastname + "   Date: " + Date + Studentaddress);
     }
 }
        private void SearchExecute()
        {
            FoundOperators = new ObservableCollection <FoundOperator>();
            var request = new OperatorCriterias();

            if (!string.IsNullOrEmpty(Username.Trim()))
            {
                request.username = Username.Trim();
            }
            else
            {
                request.username = "";
            }
            if (!string.IsNullOrEmpty(Firstname.Trim()))
            {
                request.name = Firstname.Trim();
            }
            else
            {
                request.name = "";
            }
            if (!string.IsNullOrEmpty(Lastname.Trim()))
            {
                request.surname = Lastname.Trim();
            }
            else
            {
                request.surname = "";
            }
            if (!string.IsNullOrEmpty(EMail.Trim()))
            {
                request.email = EMail.Trim();
            }
            else
            {
                request.email = "";
            }

            try
            {
                var result = WsdlRepository.SearchForOperators(request, StationRepository.GetUid(ChangeTracker.CurrentUser));
                FoundOperators = new ObservableCollection <FoundOperator>(ConvertUsers(result));
            }
            catch (System.ServiceModel.FaultException <HubServiceException> exception)
            {
                switch (exception.Detail.code)
                {
                case 178:
                    ShowError(TranslationProvider.Translate(MultistringTags.OPERATOR_NOT_FOUND).ToString());
                    return;

                default:     // 113, 114, 172
                    ShowError(exception.Detail.message);
                    return;
                }
            }
            if (FoundOperators.Count < 1)
            {
                ShowError(TranslationProvider.Translate(MultistringTags.OPERATOR_NOT_FOUND).ToString());
            }
        }
Exemple #4
0
        public Name(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            name = TrimAfterChar(name, '/');

            var splitted = name.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);

            if (splitted.Length == 1)
            {
                splitted    = name.Split('.');
                splitted[0] = splitted[0] + ".";
            }

            switch (splitted.Length)
            {
            case 1:
                Firstname = "NC";
                Lastname  = name.ToUpper().Trim();
                break;

            case 2:
                if (IsAllUpper(splitted[0]) && IsAllUpper(splitted[1]))
                {
                    Firstname = splitted[0].Trim();
                    Lastname  = splitted[1].Trim();
                }
                else if (!IsAllUpper(splitted[0]) && IsAllUpper(splitted[1]))
                {
                    Firstname = splitted[0].Trim();
                    Lastname  = splitted[1].Trim();
                }
                else if (IsAllUpper(splitted[0]) && !IsAllUpper(splitted[1]))
                {
                    Firstname = splitted[1].Trim();
                    Lastname  = splitted[0].Trim();
                }
                else
                {
                    Firstname = splitted[0].Trim();
                    Lastname  = splitted[1].Trim();
                }
                break;

            default:

                if (AllWordAreLower(name))
                {
                    var isFirst = true;
                    foreach (var s in splitted)
                    {
                        if (isFirst)
                        {
                            Firstname = s;
                            isFirst   = false;
                        }
                        else
                        {
                            Lastname += s + " ";
                        }
                    }
                }
                else
                {
                    foreach (var s in splitted)
                    {
                        if (s == "M.")
                        {
                            continue;
                        }

                        if (!IsAllUpper(s))
                        {
                            Firstname += s + " ";
                        }
                        else
                        {
                            Lastname += s + " ";
                        }
                    }
                }

                if (string.IsNullOrWhiteSpace(Firstname))
                {
                    Firstname = "NC";
                }
                if (string.IsNullOrWhiteSpace(Lastname))
                {
                    throw new Exception("Le nom n'est pas renseigné pour " + name);
                }

                Firstname = Firstname.Trim();
                Lastname  = Lastname.Trim();
                break;
            }
        }
Exemple #5
0
        /// <summary>Parse accepts an XmlNode and parses values</summary>
        public void Parse(XmlNode xNode)
        {
            XmlNode xResultNode = null;
            string  strTmp      = null;

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USER_ID);
                strTmp      = xResultNode.InnerText;
                UserID      = (long)Convert.ToInt32(strTmp);
            }
            catch
            {
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USER_ROLE_ID);
                UserRoleID  = (long)Convert.ToInt32(xResultNode.InnerText);
            }
            catch
            {
                UserRoleID = 0;
            }

            try
            {
                xResultNode      = xNode.SelectSingleNode(TAG_BEGIN_DATE_CREATED);
                BeginDateCreated = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode    = xNode.SelectSingleNode(TAG_END_DATE_CREATED);
                EndDateCreated = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode       = xNode.SelectSingleNode(TAG_BEGIN_DATE_MODIFIED);
                BeginDateModified = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode     = xNode.SelectSingleNode(TAG_END_DATE_MODIFIED);
                EndDateModified = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_FIRSTNAME);
                Firstname   = xResultNode.InnerText;
                if (Firstname.Trim().Length == 0)
                {
                    Firstname = null;
                }
            }
            catch
            {
                Firstname = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_MIDDLENAME);
                Middlename  = xResultNode.InnerText;
                if (Middlename.Trim().Length == 0)
                {
                    Middlename = null;
                }
            }
            catch
            {
                Middlename = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_LASTNAME);
                Lastname    = xResultNode.InnerText;
                if (Lastname.Trim().Length == 0)
                {
                    Lastname = null;
                }
            }
            catch
            {
                Lastname = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USERNAME);
                Username    = xResultNode.InnerText;
                if (Username.Trim().Length == 0)
                {
                    Username = null;
                }
            }
            catch
            {
                Username = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_PASSWD);
                Passwd      = xResultNode.InnerText;
                if (Passwd.Trim().Length == 0)
                {
                    Passwd = null;
                }
            }
            catch
            {
                Passwd = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_PICTURE_URL);
                PictureUrl  = xResultNode.InnerText;
                if (PictureUrl.Trim().Length == 0)
                {
                    PictureUrl = null;
                }
            }
            catch
            {
                PictureUrl = null;
            }
            // Cannot reliably convert a byte[] to a string.

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_IS_DISABLED);
                IsDisabled  = Convert.ToBoolean(xResultNode.InnerText);
            }
            catch
            {
                IsDisabled = false;
            }

            try
            {
                xResultNode        = xNode.SelectSingleNode(TAG_BEGIN_LAST_LOGIN_DATE);
                BeginLastLoginDate = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode      = xNode.SelectSingleNode(TAG_END_LAST_LOGIN_DATE);
                EndLastLoginDate = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }
        }