public virtual void ShouldBeComparedByInternalState() { var name1 = new FullName("Test", "MegaTest"); var name2 = new FullName("Test", "MegaTest"); var name2AsObject = (object)name2; var name3 = new FullName("Test2", "OmegaTest"); var name4 = new ExFullName("Test2", "OmegaTest", "khsadf"); Assert.IsTrue(name1 == name2); Assert.IsTrue(name1.GetHashCode() == name2.GetHashCode()); Assert.IsTrue(name1.Equals(name2AsObject)); Assert.IsTrue(name2 != name3); Assert.IsTrue(name1 != name3); Assert.IsTrue(name1.GetHashCode() != name3.GetHashCode()); Assert.IsFalse(name1.Equals(null)); Assert.IsTrue(null != name3); Assert.IsTrue(name4 != name3); Assert.IsTrue(name4.GetHashCode() != name3.GetHashCode()); var name5 = new FullNameMirror("Test", "MegaTest"); var name6 = new FullNameAbsoluteMirror("Test", "MegaTest"); Assert.IsTrue(name5.Equals(name1)); Assert.IsTrue(name6.Equals(name1)); }
public void AppendFullName(FullName fullName) { Append(AddUri(fullName.Uri)); var sb = StringBuilder; sb.Append("::"); sb.Append(fullName.Name); }
public Employee(EmployeeId id, FullName name, Address homeAddress, decimal salary) { Id = id; Name = name; HomeAddress = homeAddress; Salary = salary; }
public void ToStringReturnsGivenNameFollowedBySurname( string givenName, string surname, string expected) { var name = new FullName(givenName, surname); name.ToString().Should().Be(expected); }
public RegisterEmployeeCommand( EmployeeId id, FullName name, decimal initialSalary ) : base(id) { Name = name; InitialSalary = initialSalary; }
public EmployeeRegisteredEvent( EmployeeId employeeId, FullName name, decimal initialSalary ) : base(employeeId) { Name = name; InitialSalary = initialSalary; }
public PersonNameChanged(TenantId tenantId, string userName, FullName name) { this.TenantId = tenantId.Id; this.UserName = userName; this.Name = name; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public UserRegistered(TenantId tenantId, string userName, FullName name, EmailAddress emailAddress) { this.TenantId = tenantId.Id; this.UserName = userName; this.Name = name; this.EmailAddress = emailAddress; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public TenantAdministratorRegistered( TenantId tenantId, string name, FullName administorName, EmailAddress emailAddress, string userName, string temporaryPassword) { this.TenantId = tenantId.Id; this.Name = name; this.AdministorName = administorName; this.TemporaryPassword = temporaryPassword; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public void CreateEmployee(EmployeeId id, FullName name, decimal initialSalary) { using (var session = _store.OpenSession()) { var employee = new Employee(id, name, Address.NotInformed, initialSalary ); session.Store(employee); session.SaveChanges(); } }
public FullName FormatRealNameInputFromStringArray(string[] nameStrings, FullName name) { switch (nameStrings.Length) { case 1: name.FirstName = nameStrings[0]; break; case 2: name.FirstName = nameStrings[0]; name.LastName = nameStrings[1]; break; case 3: name.FirstName = nameStrings[0]; name.MiddleName = nameStrings[1]; name.LastName = nameStrings[2]; break; } return name; }
public void AppendTypeIndicator(FullName fullName) { Append('('); AppendFullName(fullName); StringBuilder.Append(") "); }
internal static ExpressionSyntax Literal(FullName value) { return CS.NewObjExpr(FullNameName, CS.Literal(value.Uri), CS.Literal(value.Name)); }
public void CreateEmployee(EmployeeId id, FullName name, decimal initialSalary) { _data.Add(id, new Employee(id, name, Address.NotInformed, initialSalary)); }
private bool ClassValue(ClassTypeMd declaredClsMd, out object result, out TextSpan textSpan) { var hasAliasUriList = false; if (Token('<')) { List<AliasUri> auList = null; while (true) { Token aliasToken; if (Name(out aliasToken)) { var alias = aliasToken.Value; if (auList == null) { auList = new List<AliasUri>(); } else { foreach (var item in auList) { if (item.Alias == alias) { ErrorAndThrow(new DiagMsg(DiagnosticCode.DuplicateUriAlias, alias), aliasToken.TextSpan); } } } TokenExpected('='); auList.Add(new AliasUri(alias, StringExpected().Value)); if (!Token(',')) { break; } } else { break; } } TokenExpected('>'); if (auList != null) { _aliasUriListStack.Push(auList); hasAliasUriList = true; } } var hasTypeIndicator = false; ClassTypeMd clsMd = null; var fullName = default(FullName); if (Token('(')) { hasTypeIndicator = true; var aliasToken = NameExpected(); TokenExpected((int)TokenKind.ColonColon, ":: expected."); var nameToken = NameExpected(); TokenExpected(')'); fullName = new FullName(GetUri(aliasToken), nameToken.Value); textSpan = nameToken.TextSpan; if (declaredClsMd != null) { clsMd = ProgramMd.TryGetGlobalType<ClassTypeMd>(fullName); if (clsMd == null) { ErrorAndThrow(new DiagMsg(DiagnosticCode.InvalidClassReference, fullName.ToString()), textSpan); } if (!clsMd.IsEqualToOrDeriveFrom(declaredClsMd)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.ClassNotEqualToOrDeriveFromTheDeclared, fullName.ToString(), declaredClsMd.FullName.ToString()), textSpan); } } } else { textSpan = default(TextSpan); } Token openBraceToken; if (Token('{', out openBraceToken)) { if (!hasTypeIndicator) { textSpan = openBraceToken.TextSpan; } } else { if (hasAliasUriList || hasTypeIndicator) { ErrorAndThrow("{ expected."); } result = null; return false; } if (declaredClsMd != null) { if (!hasTypeIndicator) { clsMd = declaredClsMd; fullName = declaredClsMd.FullName; } if (clsMd.IsAbstract) { ErrorAndThrow(new DiagMsg(DiagnosticCode.ClassIsAbstract, fullName.ToString()), textSpan); } var obj = clsMd.CreateInstance(); if (!clsMd.InvokeOnLoad(true, obj, _context, textSpan)) { Throw(); } var propMdMap = clsMd._propertyMap; HashSet<string> propNameSet = null; Dictionary<string, object> unknownPropMap = null; while (true) { Token propNameToken; if (Name(out propNameToken)) { var propName = propNameToken.Value; if (propNameSet == null) { propNameSet = new HashSet<string>(); } else if (propNameSet.Contains(propName)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.DuplicatePropertyName, propName), propNameToken.TextSpan); } propNameSet.Add(propName); TokenExpected('='); PropertyMd propMd; if (propMdMap.TryGetValue(propName, out propMd)) { propMd.SetValue(obj, LocalValueExpected(propMd.Type)); } else { if (unknownPropMap == null) { unknownPropMap = new Dictionary<string, object>(); } unknownPropMap.Add(propName, LocalValueExpected(null)); } if (!Token(',')) { break; } } else { break; } } var closeBraceToken = TokenExpected('}'); if (propMdMap.Count > 0) { var needThrow = false; foreach (var propMd in propMdMap.Values) { if (!propMd.Type.IsNullable && (propNameSet == null || !propNameSet.Contains(propMd.Name))) { Error(new DiagMsg(DiagnosticCode.PropertyMissing, propMd.Name), closeBraceToken.TextSpan); needThrow = true; } } if (needThrow) { Throw(); } } if (unknownPropMap != null) { clsMd.SetUnknownProperties(obj, unknownPropMap); } if (!clsMd.InvokeOnLoad(false, obj, _context, textSpan)) { Throw(); } result = obj; } else { Dictionary<string, object> propMap = null; while (true) { Token propNameToken; if (Name(out propNameToken)) { var propName = propNameToken.Value; if (propMap == null) { propMap = new Dictionary<string, object>(); } else if (propMap.ContainsKey(propName)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.DuplicatePropertyName, propName), propNameToken.TextSpan); } TokenExpected('='); propMap.Add(propName, LocalValueExpected(null)); if (!Token(',')) { break; } } else { break; } } TokenExpected('}'); result = new UntypedObject(fullName, propMap); } if (hasAliasUriList) { _aliasUriListStack.Pop(); } return true; }
/// <summary>Serves as a hash function for a particular type.</summary> /// <returns>A hash code for the current Object.</returns> public override int GetHashCode() { return(null != FullName?FullName.GetHashCode() : 0); }
public void TestResponsiblePartyHasAName() { FullName testName = new FullName("first", "last"); Assert.AreEqual(testName.First, TestRelative.Name.First); Assert.AreEqual(testName.Last, TestRelative.Name.Last); }
public override string ToString() { return($"{FullName.TrimEnd(' ')} from {City.TrimEnd(' ')}, desired price range {MinPrice} - {MaxPrice}"); }
/// <summary> /// Returns the hash code for the directory /// </summary> /// <returns>The hash code for the directory</returns> public override int GetHashCode() => FullName.GetHashCode();
private User(FullName fullName, DateTime dob) { FullName = fullName; DOB = dob; }
protected string GetUser() { var userName = FullName.Get(); return(userName.Remove("Hello ", "!")); }
public void CreateFullName() { var fullName = new FullName("Armen", "Hovsepian"); Assert.AreEqual("Armen Hovsepian", fullName.ToString()); }
public Detained(FullName fullName, Birthday birthday) : base(fullName, birthday) { }
protected virtual void refresh(IShellFolder2 parentShellFolder, PIDL relPIDL, PIDL fullPIDL) { if (parentShellFolder != null && fullPIDL != null && relPIDL != null) { Attributes = loadAttributes(parentShellFolder, fullPIDL, relPIDL); string parseName = loadName(parentShellFolder, relPIDL, ShellAPI.SHGNO.FORPARSING); FullName = ""; //Console.WriteLine("relPIDL.size = {0}", relPIDL.Size); //Console.WriteLine("PIDL.size = {0}", _pidl.Size); if (relPIDL.Size == 0) { FullName = IOTools.IID_Desktop; } else //0.12: Fixed Fullname of User/Shared directory under desktop is now it's GUID instead of it's file path. //0.13: Fixed All subdirectory under User/Shared directory uses GUID now. { if (DirectoryInfoEx.CurrentUserDirectory != null) { if (parseName == DirectoryInfoEx.CurrentUserDirectory.FullName && loadName(parentShellFolder, ShellAPI.SHGNO.FORPARSING) == Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) { FullName = IOTools.IID_UserFiles; } //else if ( // (parseName.StartsWith(DirectoryInfoEx.CurrentUserDirectory.FullName) && // _parent != null && _parent.FullName.StartsWith(IOTools.IID_UserFiles)) // || // (OriginalPath != null && OriginalPath.StartsWith(IOTools.IID_UserFiles)) // ) //{ // FullName = parseName.Replace(DirectoryInfoEx.CurrentUserDirectory.FullName, IOTools.IID_UserFiles); //} } if (DirectoryInfoEx.SharedDirectory != null) { if (parseName == DirectoryInfoEx.SharedDirectory.FullName && loadName(parentShellFolder, ShellAPI.SHGNO.FORPARSING) == Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) { FullName = IOTools.IID_Public; } //else if ( // (parseName.StartsWith(DirectoryInfoEx.SharedDirectory.FullName) && // _parent != null && _parent.FullName.StartsWith(IOTools.IID_Public)) // || // (OriginalPath != null && OriginalPath.StartsWith(IOTools.IID_Public)) // ) // FullName = parseName.Replace(DirectoryInfoEx.SharedDirectory.FullName, IOTools.IID_Public); } //if (_parent != null && _parent.FullName.StartsWith(IOTools.IID_Library) // && !parseName.StartsWith(IOTools.IID_Library)) // FullName = PathEx.Combine(_parent.FullName, PathEx.GetFileName(parseName)); if (FullName == "") { FullName = parseName; } } //if (DirectoryInfoEx.CurrentUserDirectory != null && parseName == DirectoryInfoEx.CurrentUserDirectory.FullName && //loadName(parentShellFolder, ShellAPI.SHGNO.FORPARSING) == Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) // FullName = IOTools.IID_UserFiles; //else //if (DirectoryInfoEx.SharedDirectory != null && parseName == DirectoryInfoEx.SharedDirectory.FullName && // loadName(parentShellFolder, ShellAPI.SHGNO.FORPARSING) == Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) // FullName = IOTools.IID_Public; //else if (OriginalPath == null) { OriginalPath = FullName; } if (parseName.StartsWith("::")) //Guid { parseName = loadName(parentShellFolder, relPIDL, ShellAPI.SHGNO.NORMAL); } _name = FullName.EndsWith("\\") ? FullName : PathEx.GetFileName(FullName); Label = loadName(parentShellFolder, relPIDL, ShellAPI.SHGNO.NORMAL); } else { if (OriginalPath != null) { string origPath = Helper.RemoveSlash(OriginalPath); _name = Path.GetFileName(origPath); Label = _name; FullName = origPath; } } }
public int CompareTo(object obj) { TypeDef type_def = (TypeDef)obj; return(FullName.CompareTo(type_def.FullName)); }
public UntypedEnumValue(FullName enumFullName, string memberName) { EnumFullName = enumFullName; MemberName = memberName; }
public static User Create(FullName fullName, DateTime dob) { return(new User(fullName, dob)); }
void GenerateDeclaration(StreamWriter sw, string indent, CodeGenerationOptions opt) { StringBuilder sb = new StringBuilder(); foreach (ISymbol isym in Interfaces) { InterfaceGen igen = (isym is GenericSymbol ? (isym as GenericSymbol).Gen : isym) as InterfaceGen; if (igen.IsConstSugar) { continue; } if (sb.Length > 0) { sb.Append(", "); } sb.Append(opt.GetOutputName(isym.FullName)); } sw.WriteLine("{0}// Metadata.xml XPath interface reference: path=\"{1}\"", indent, MetadataXPathReference); if (this.IsDeprecated) { sw.WriteLine("{0}[ObsoleteAttribute (@\"{1}\")]", indent, DeprecatedComment); } sw.WriteLine("{0}[Register (\"{1}\", \"\", \"{2}\"{3})]", indent, RawJniName, Namespace + "." + FullName.Substring(Namespace.Length + 1).Replace('.', '/') + "Invoker", this.AdditionalAttributeString()); if (this.TypeParameters != null && this.TypeParameters.Any()) { sw.WriteLine("{0}{1}", indent, TypeParameters.ToGeneratedAttributeString()); } sw.WriteLine("{0}{1} partial interface {2} : {3} {{", indent, Visibility, Name, Interfaces.Count == 0 || sb.Length == 0 ? "IJavaObject" : sb.ToString()); sw.WriteLine(); GenProperties(sw, indent + "\t", opt); GenMethods(sw, indent + "\t", opt); sw.WriteLine(indent + "}"); sw.WriteLine(); }
/// <summary> /// ProcessFile does all the processing. Wanted to keep main clean. This performs the required tasks /// </summary> /// <param name="pathToFIle">Path of the JSON file we're processing</param> private static void ProcessFile(String pathToFIle) { // List of clients to iterate through from the JSON file var clientList = new List <Client>(); try { // Using Newtonsoft to deserialize the JSON string json = File.ReadAllText(pathToFIle); clientList = JsonConvert.DeserializeObject <List <Client> >(json); } catch (Exception e) { Exit(e.ToString()); } int overFifty = 0; var eyeColor = new Hashtable(); var favoriteFruit = new Hashtable(); int winningNumEyecolor = 0; Decimal runningBalance = 0; var registeredAndActive = DateTime.MinValue; var nameOfMostRecentRegistered = new FullName(); // Only iterate through the client list once to save processing time foreach (Client cl in clientList) { // Objective: What is the count of individuals over the age of 50? if (cl.Age > 50) { overFifty++; } // Objective: What is the full name of the individual with the id of 5aabbca3e58dc67745d720b1 in the format of lastname, firstname? if (cl.Id.Equals("5aabbca3e58dc67745d720b1")) { Console.WriteLine("The client with ID 5aabbca3e58dc67745d720b1 is {0}, {1}", cl.Name.Last, cl.Name.First); } // Objective: What is the most common eye color? // Used a hashtable for speed if (!eyeColor.ContainsKey(cl.EyeColor)) { eyeColor[cl.EyeColor] = 1; if (winningNumEyecolor == 0) { winningNumEyecolor++; } } else { int old = (int)eyeColor[cl.EyeColor]; eyeColor[cl.EyeColor] = old + 1; if ((int)eyeColor[cl.EyeColor] > winningNumEyecolor) { winningNumEyecolor = (int)eyeColor[cl.EyeColor]; } } // Objective: What are the counts of each favorite fruit? // Again using a hashtable for speed if (!favoriteFruit.ContainsKey(cl.FavoriteFruit)) { favoriteFruit[cl.FavoriteFruit] = 1; } else { int old = (int)favoriteFruit[cl.FavoriteFruit]; favoriteFruit[cl.FavoriteFruit] = old + 1; } // Obnjective: What is the total balance of all individuals combined? var trimmedBalance = cl.Balance.Trim(new Char[] { ' ', ',', '$' }); // Trim the string for processing and then tally up the total balance runningBalance += Decimal.Parse(trimmedBalance, NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol); // Objective: Who is last individual that registered who is still active ? if (cl.IsActive && cl.Registered > registeredAndActive) { nameOfMostRecentRegistered = cl.Name; } } // Write the results to the console line and wait for input so the user has time to read the results Console.WriteLine("The number of clients over fifty is {0}", overFifty.ToString()); Console.WriteLine("The total balance is ${0}", String.Format("{0:n}", runningBalance)); Console.WriteLine("The person who is active and registered most recently is {0} {1}", nameOfMostRecentRegistered.First, nameOfMostRecentRegistered.Last); WriteMostCommonEyeColor(winningNumEyecolor, eyeColor); WriteCountsOfFavoriteFruits(favoriteFruit); Exit("\nThis completes the interview code challenge output. It was fun!"); }
private string GetName() { return(FullName.Split('<')[0]); }
public async void CreateEmployeeWithInvalidDataThrowsException(FullName fullName, string iban, string username, string password, Role role, Address address, ContactDetails contactDetails) { await Assert.ThrowsAsync <InvalidDataException>(() => _employeeService.CreateEmployeeAsync(fullName, iban, username, password, role, address, contactDetails)); }
public Client(long clientID, string firstName, string secondName, string lastName, string clientAddress, string clientPhoneNumber, int clientNumberOfRequests, double clientTotalSum, ClientType clientType) { this.clientID = clientID; clientFullName = new FullName(firstName, secondName, lastName); this.clientAddress = clientAddress; this.clientPhoneNumber = clientPhoneNumber; this.clientNumberOfRequests = clientNumberOfRequests; this.clientTotalSum = clientTotalSum; this.clientType = clientType; }
static void Main(string[] args) { var firstName = new Name("masanobu"); var lastName = new Name("naruse"); var name = new FullName(firstName, lastName); }
public void TestGetSEVISEVBatchTypeExchangeVisitorDependent() { var personId = 100; var participantId = 200; var firstName = "first"; var lastName = "last"; var passport = "passport"; var preferred = "preferred"; var suffix = "Jr."; var fullName = new FullName(firstName, lastName, passport, preferred, suffix); var birthCity = "birth city"; var birthCountryCode = "CN"; var birthDate = DateTime.UtcNow; var citizenshipCountryCode = "FR"; var email = "*****@*****.**"; var gender = Gender.SEVIS_MALE_GENDER_CODE_VALUE; var permanentResidenceCountryCode = "MX"; var phone = "123-456-7890"; var mailAddress = new AddressDTO { AddressId = 1, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var usAddress = new AddressDTO { AddressId = 2, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var printForm = true; var birthCountryReasonCode = USBornReasonType.Item01.ToString(); var relationship = DependentCodeType.Item01.ToString(); var isTravelingWithParticipant = true; var isDeleted = false; var dependent = new AddedDependent( fullName: fullName, birthCity: birthCity, birthCountryCode: birthCountryCode, birthCountryReasonCode: birthCountryReasonCode, birthDate: birthDate, citizenshipCountryCode: citizenshipCountryCode, emailAddress: email, gender: gender, permanentResidenceCountryCode: permanentResidenceCountryCode, phoneNumber: phone, relationship: relationship, mailAddress: mailAddress, usAddress: usAddress, printForm: printForm, participantId: participantId, personId: personId, isTravelingWithParticipant: isTravelingWithParticipant, isDeleted: isDeleted ); var modifiedParticipantDependent = new ModifiedParticipantDependent(dependent: dependent); var instance = modifiedParticipantDependent.GetSEVISEVBatchTypeExchangeVisitorDependent(); Assert.IsNotNull(instance.Item); Assert.IsInstanceOfType(instance.Item, typeof(SEVISEVBatchTypeExchangeVisitorDependentAdd)); Assert.IsNotNull(instance.UserDefinedA); Assert.IsNotNull(instance.UserDefinedB); var key = new ParticipantSevisKey(instance.UserDefinedA, instance.UserDefinedB); Assert.AreEqual(participantId, key.ParticipantId); Assert.AreEqual(personId, key.PersonId); }
public override int GetHashCode() { return(FullName != null?FullName.GetHashCode() : 0); }
public RegisterEmployeeCommand(Guid id, FullName name, decimal initialSalary) { Id = id; Name = name; InitialSalary = initialSalary; }
public Employee(EmployeeId id, FullName name, object notInformed, decimal initialSalary) { throw new NotImplementedException(); }
public IHttpActionResult EmployeeRegister(Individual model) { try { if (model.fullName == null) { return(Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), "224-Full name is required"), new JsonMediaTypeFormatter())); } else { if (string.IsNullOrEmpty(model.fullName.Ar_SA) && string.IsNullOrEmpty(model.fullName.En_US)) { return(Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), "224-Full name is required"), new JsonMediaTypeFormatter())); } } // Validate Model if (!ModelState.IsValid) { var modelErrors = new List <string>(); foreach (var modelState in ModelState.Values) { foreach (var modelError in modelState.Errors) { modelErrors.Add(modelError.ErrorMessage == "" ? modelError.Exception.Message : modelError.ErrorMessage); } } return(Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), modelErrors[0].ToString()), new JsonMediaTypeFormatter())); } var userDocumentEmail = _bucket.Query <object>(@"SELECT * From " + _bucket.Name + " where email= '" + model.Email + "' and isActive=true").ToList(); if (userDocumentEmail.Count > 0) { return(Content(HttpStatusCode.Conflict, MessageResponse.Message(HttpStatusCode.Conflict.ToString(), "105-The e-mail already exists"), new JsonMediaTypeFormatter())); } if (model.LoginDetails != null) { if (string.IsNullOrEmpty(model.LoginDetails.Password)) { return(Content(HttpStatusCode.BadRequest, MessageResponse.Message(HttpStatusCode.BadRequest.ToString(), "158-Password is required"), new JsonMediaTypeFormatter())); } } var userDocumentPhone = _bucket.Query <object>(@"SELECT * From " + _bucket.Name + " where " + _bucket.Name + ".mobNum.num= '" + model.MobNum.NumM + "'").ToList(); if (userDocumentPhone.Count > 0) { return(Content(HttpStatusCode.Conflict, MessageResponse.Message(HttpStatusCode.Conflict.ToString(), "Mobile number already exists"), new JsonMediaTypeFormatter())); } Address address = new Address(); address.City = model.Address.City; address.State = model.Address.State; address.Area = model.Address.Area; address.Street = model.Address.Street; address.BldgNum = model.Address.BldgNum; address.FlatNum = model.Address.FlatNum; MobNum mobNum = new MobNum(); mobNum.CountryCodeM = model.MobNum.CountryCodeM; mobNum.NumM = model.MobNum.NumM; mobNum.AreaM = model.MobNum.AreaM; TelNum telNum = new TelNum(); if (model.TelNum != null) { telNum.CountryCodeT = model.TelNum.CountryCodeT; telNum.NumT = model.TelNum.NumT; telNum.AreaT = model.TelNum.AreaT; } List <AuditInfo> lstauditInfo = new List <AuditInfo>(); AuditInfo auditInfo = new AuditInfo(); auditInfo.Version = "1"; auditInfo.Status = "true"; auditInfo.LastChangeDate = DataConversion.ConvertYMDHMS(DateTime.Now.ToString()); auditInfo.LastChangeBy = model.Email; lstauditInfo.Add(auditInfo); List <Roles> lstRoles = new List <Roles>(); if (model.Roles != null) { foreach (var role in model.Roles) { Roles roles = new Roles(); roles.RoleID = role.RoleID; roles.Name = role.Name; roles.Link = role.Link; lstRoles.Add(roles); } } #region MyRegion List <Fines> lstFines = new List <Fines>(); List <Documents> lstDocuments = new List <Documents>(); List <Vehicles> lstVehicles = new List <Vehicles>(); List <Incidents> lstIncident = new List <Incidents>(); List <ScoreCards> lstScoreCard = new List <ScoreCards>(); List <DriverStatus> lstdriverStatus = new List <DriverStatus>(); #endregion FullName fullName = new FullName(); fullName.En_US = model.fullName.En_US; fullName.Ar_SA = model.fullName.Ar_SA; Status status = new Status(); if (model.Status != null) { status.StatusID = model.Status.StatusID; status.DateTime = model.Status.DateTime; } //DataConversion.ConvertYMDHMS(DateTime.Now.AddDays(Convert.ToInt16(ConfigurationManager.AppSettings.Get("ValidToProfilePhotoDays"))).ToString()) ProfilePhoto profilePhoto = new ProfilePhoto(); if (model.ProfilePhoto != null) { profilePhoto.DocFormat = model.ProfilePhoto.DocFormat; profilePhoto.Photo = model.ProfilePhoto.Photo; profilePhoto.ValidFrom = DataConversion.ConvertYMDHMS(DateTime.Now.ToString()); profilePhoto.ValidTo = DataConversion.ConvertYMDHMS(DateTime.Now.AddDays(Convert.ToInt16(ConfigurationManager.AppSettings.Get("ValidToProfilePhotoDays"))).ToString()); } string docId = string.Empty; if (string.IsNullOrEmpty(model.KeyID)) { docId = "individual_" + Guid.NewGuid(); } else { docId = "individual_" + model.KeyID; } var employeeDoc = new Document <Individual>() { Id = docId, Content = new Individual { KeyID = docId, fullName = fullName, DOB = DataConversion.ConvertDateYMD(model.DOB), Nationality = model.Nationality, Gender = model.Gender, Fines = lstFines, Language = model.Language, MaritalStatus = model.MaritalStatus, MobNum = mobNum, AuditInfo = lstauditInfo, Vehicles = lstVehicles, Roles = lstRoles, TelNum = telNum, DocType = ("Individual").ToLower(), Documents = lstDocuments, Email = model.Email, ProfilePhoto = profilePhoto, Notes = model.Notes, ScoreCards = lstScoreCard, Address = address, Religion = model.Religion, Status = status, Incidents = lstIncident, DriverStatus = lstdriverStatus, }, }; var result = _bucket.Insert(employeeDoc); if (!result.Success) { return(Content(HttpStatusCode.InternalServerError, MessageResponse.Message(HttpStatusCode.InternalServerError.ToString(), result.Message), new JsonMediaTypeFormatter())); } return(Content(HttpStatusCode.OK, MessageResponse.Message(HttpStatusCode.OK.ToString(), MessageDescriptions.Add, result.Document.Id), new JsonMediaTypeFormatter())); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, MessageResponse.Message(HttpStatusCode.InternalServerError.ToString(), ex.StackTrace), new JsonMediaTypeFormatter())); } }
public Person(FullName fullName, Birthday birthday) : this(fullName) { this.Birthday = birthday; }
public bool Search(string search) => search.IsEmpty() || FullName.Search(search) || Phone.Search(search) || Address.Search(search) || PassportNumberSeries.Search(search) || PassportInfoWhom.Search(search) || PassportInfoWhen.Search(search) || Department.Name.Search(search) || Position.Name.Search(search);
public Person(FullName fullName) { this.FullName = fullName; }
public Detained(FullName fullName) : base(fullName) { }
public UntypedObject(FullName classFullName, Dictionary<string, object> properties) { ClassFullName = classFullName; Properties = properties; }
private bool LocalValue(LocalTypeMd typeMd, out object result, out TextSpan textSpan) { Token token; if (Null(out token)) { if (typeMd != null && !typeMd.IsNullable) { ErrorAndThrow(new DiagMsg(DiagnosticCode.NullNotAllowed), token.TextSpan); } result = null; textSpan = token.TextSpan; return true; } if (AtomValue(out token)) { if (typeMd != null) { var nonNullableTypeMd = typeMd.NonNullableType; var typeKind = nonNullableTypeMd.Kind; if (!typeKind.IsAtom()) { if (typeKind == TypeKind.Enum) { typeKind = nonNullableTypeMd.TryGetGlobalType<EnumTypeMd>().UnderlyingType.Kind; } else { ErrorAndThrow(new DiagMsg(DiagnosticCode.SpecificValueExpected, typeKind.ToString()), token.TextSpan); } } result = AtomExtensions.TryParse(typeKind, token.Value); if (result == null) { ErrorAndThrow(new DiagMsg(DiagnosticCode.InvalidAtomValue, typeKind.ToString(), token.Value), token.TextSpan); } } else { result = token.Value; } textSpan = token.TextSpan; return true; } if (PeekToken('(', '{', '<')) {//class value if (typeMd != null) { var nonNullableTypeMd = typeMd.NonNullableType; var typeKind = nonNullableTypeMd.Kind; if (typeKind != TypeKind.Class) { ErrorAndThrow(new DiagMsg(DiagnosticCode.SpecificValueExpected, typeKind.ToString())); } return ClassValue(nonNullableTypeMd.TryGetGlobalType<ClassTypeMd>(), out result, out textSpan); } else { return ClassValue(null, out result, out textSpan); } } if (Name(out token)) {//enum value TokenExpected((int)TokenKind.ColonColon, ":: expected."); var nameToken = NameExpected(); var fullName = new FullName(GetUri(token), nameToken.Value); EnumTypeMd enumMd = null; if (typeMd != null) { var nonNullableTypeMd = typeMd.NonNullableType; var typeKind = nonNullableTypeMd.Kind; if (typeKind != TypeKind.Enum) { ErrorAndThrow(new DiagMsg(DiagnosticCode.SpecificValueExpected, typeKind.ToString()), nameToken.TextSpan); } enumMd = ProgramMd.TryGetGlobalType<EnumTypeMd>(fullName); if (enumMd == null) { ErrorAndThrow(new DiagMsg(DiagnosticCode.InvalidEnumReference, fullName.ToString()), nameToken.TextSpan); } var declaredEnumMd = nonNullableTypeMd.TryGetGlobalType<EnumTypeMd>(); if (enumMd != declaredEnumMd) { ErrorAndThrow(new DiagMsg(DiagnosticCode.EnumNotEqualToTheDeclared, fullName.ToString(), declaredEnumMd.FullName.ToString()), nameToken.TextSpan); } } TokenExpected('.'); var memberNameToken = NameExpected(); if (enumMd != null) { if (!enumMd._members.TryGetValue(memberNameToken.Value, out result)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.InvalidEnumMemberName, memberNameToken.Value), memberNameToken.TextSpan); } } else { result = new UntypedEnumValue(fullName, memberNameToken.Value); } textSpan = memberNameToken.TextSpan; return true; } if (Token('[', out token)) { if (typeMd != null) { var nonNullableTypeMd = typeMd.NonNullableType; var typeKind = nonNullableTypeMd.Kind; var isSet = typeKind == TypeKind.Set; if (typeKind != TypeKind.List && !isSet) { ErrorAndThrow(new DiagMsg(DiagnosticCode.SpecificValueExpected, typeKind.ToString()), token.TextSpan); } var collTypeMd = (CollectionTypeMd)nonNullableTypeMd; var collObj = collTypeMd.CreateInstance(); var itemMd = collTypeMd.ItemOrValueType; object itemObj; TextSpan ts; while (true) { if (LocalValue(itemMd, out itemObj, out ts)) { if (isSet) { if (!collTypeMd.InvokeBoolAdd(collObj, itemObj)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.DuplicateSetItem), ts); } } else { collTypeMd.InvokeAdd(collObj, itemObj); } if (!Token(',')) { break; } } else { break; } } TokenExpected(']'); result = collObj; } else { var listObj = new List<object>(); object itemObj; TextSpan ts; while (true) { if (LocalValue(null, out itemObj, out ts)) { listObj.Add(itemObj); if (!Token(',')) { break; } } else { break; } } TokenExpected(']'); result = listObj; } textSpan = token.TextSpan; return true; } if (Token((int)TokenKind.DollarOpenBracket, out token)) { if (typeMd != null) { var nonNullableTypeMd = typeMd.NonNullableType; var typeKind = nonNullableTypeMd.Kind; if (typeKind != TypeKind.Map) { ErrorAndThrow(new DiagMsg(DiagnosticCode.SpecificValueExpected, typeKind.ToString()), token.TextSpan); } var collTypeMd = (CollectionTypeMd)nonNullableTypeMd; var collObj = collTypeMd.CreateInstance(); var keyMd = collTypeMd.MapKeyType; var valueMd = collTypeMd.ItemOrValueType; object keyObj; TextSpan ts; while (true) { if (LocalValue(keyMd, out keyObj, out ts)) { if (collTypeMd.InvokeContainsKey(collObj, keyObj)) { ErrorAndThrow(new DiagMsg(DiagnosticCode.DuplicateMapKey), ts); } TokenExpected('='); collTypeMd.InvokeAdd(collObj, keyObj, LocalValueExpected(valueMd)); if (!Token(',')) { break; } } else { break; } } TokenExpected(']'); result = collObj; } else { var mapObj = new Dictionary<object, object>(); object keyObj; TextSpan ts; while (true) { if (LocalValue(null, out keyObj, out ts)) { TokenExpected('='); mapObj.Add(keyObj, LocalValueExpected(null)); if (!Token(',')) { break; } } else { break; } } TokenExpected(']'); result = mapObj; } textSpan = token.TextSpan; return true; } result = null; textSpan = default(TextSpan); return false; }
public void TestFullNameHasAFirstAndLast() { FullName Name = new FullName("testFirst", "testLast"); Assert.NotNull(Name.First); Assert.NotNull(Name.Last); }
public virtual void ChangeName(FullName name) { this.Name = name; DomainEventPublisher.Instance.Publish(new PersonNameChanged(this.TenantId, this.User.UserName, this.Name)); }
private static AccountManagement.User MapToUser(User dbUser) { var fullName = new FullName(new Name(dbUser.LastName), new GivenNames(dbUser.FirstName, dbUser.MiddleName)); var user = new AccountManagement.User(new UserId(dbUser.UserId), fullName); return user; }
public override string ToString() { string[] info = FullName.Split(' '); return($"{info[0]} {info[1][0]}. {info[2][0]}."); }
public void FillFullName() { FullName.Clear(); FullName.SendKeys("Tsvetomir Pavlov"); }
public bool Equals(GenericSerializationInfo other) { return(FullName.Equals(other.FullName)); }
public virtual void ChangePersonalName(FullName personalName) { Person.ChangeName(personalName); }
public override int GetHashCode() { return(FullName == null?Name.GetHashCode() : FullName.GetHashCode()); }
public Client(long clientID, FullName clientFullName, string clientAddress, string clientPhoneNumber, int clientNumberOfRequests, double clientTotalSum, ClientType clientType) { this.clientID = clientID; this.clientFullName = clientFullName; this.clientAddress = clientAddress; this.clientPhoneNumber = clientPhoneNumber; this.clientNumberOfRequests = clientNumberOfRequests; this.clientTotalSum = clientTotalSum; this.clientType = clientType; }
/// <summary> /// Gets the full name based on the current culture. /// </summary> /// <param name="fullName">The full name object.</param> /// <returns> /// The full name. /// </returns> public string ToFullName(FullName fullName) { return(this.ToFullName(fullName.LastName, fullName.FirstName, fullName.MiddleName)); }
public int CompareTo(object obj) { return(FullName.ToLower().CompareTo(((User)obj).FullName.ToLower())); }
public void TestConstructor() { var personId = 100; var participantId = 200; var firstName = "first"; var lastName = "last"; var passport = "passport"; var preferred = "preferred"; var suffix = "Jr."; var fullName = new FullName(firstName, lastName, passport, preferred, suffix); var birthCity = "birth city"; var birthCountryCode = "CN"; var birthDate = DateTime.UtcNow; var citizenshipCountryCode = "FR"; var email = "*****@*****.**"; var gender = Gender.SEVIS_MALE_GENDER_CODE_VALUE; var permanentResidenceCountryCode = "MX"; var phone = "123-456-7890"; var mailAddress = new AddressDTO { AddressId = 1, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var usAddress = new AddressDTO { AddressId = 2, Country = LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME }; var printForm = true; var birthCountryReasonCode = USBornReasonType.Item01.ToString(); var relationship = DependentCodeType.Item01.ToString(); var isTravelingWithParticipant = true; var isDeleted = false; var dependent = new AddedDependent( fullName: fullName, birthCity: birthCity, birthCountryCode: birthCountryCode, birthCountryReasonCode: birthCountryReasonCode, birthDate: birthDate, citizenshipCountryCode: citizenshipCountryCode, emailAddress: email, gender: gender, permanentResidenceCountryCode: permanentResidenceCountryCode, phoneNumber: phone, relationship: relationship, mailAddress: mailAddress, usAddress: usAddress, printForm: printForm, participantId: participantId, personId: personId, isTravelingWithParticipant: isTravelingWithParticipant, isDeleted: isDeleted ); var modifiedParticipantDependent = new ModifiedParticipantDependent(dependent); Assert.IsTrue(Object.ReferenceEquals(dependent, modifiedParticipantDependent.Dependent)); }
public Person(TenantId tenantId, FullName name, ContactInformation contactInformation) { this.TenantId = tenantId; this.Name = name; this.ContactInformation = contactInformation; }
public RuntimeProperties(ServiceConfigParameters ConfigParameters) { _ServiceConfigParameters = ConfigParameters; //personal _Staff_ID = new StaffID(); _Full_Name = new FullName(); _Country = new Country(); _ContractType = new ContractType(); _ContractTypeForReports = new ContractTypeForReports(); _Position = new Position(); _DateOfTREnd = new DateOfTREnd(); _DateOfTRStart = new DateOfTRStart(); _DateOfEntrance = new DateOfEntrance(); _CalendarName = new CalendarName(); _TemplateFilter = new TemplateFilter(); _ArePropReadyPersonal = new ArePropReady(); _BusinessUnitInfo = new BusinessUnitInfo(); _PMSA = new PMSA(); _PMSAItem = new PMSAItem(); _Gender = new Gender(); _ActivityCodeInfo = new ActivityCodeInfo(); _OfficialLS = new OfficialLS(); _PhoneDirOnly = new PhoneDirOnly(); //update _SelectedDate = new SelectedDate(); _SelectedDateStatus = new SelectedDateStatus(); _SelectedDateTransactionStatus = new SelectedDateTransactionStatus(); _SelectedDateType = new SelectedDateType(); _SelectedDateisOptional = new SelectedDateisOptional(); _PercentPerDay = new PercentPerDay(); _SelectedJob = new SelectedJob(); _MaxHoursDaily = new MaxHoursDaily(); _ArePropReadyTRUpdate = new ArePropReady(); _TRInputListClient = new TRInputListClient(); _LastOpenDay = new LastOpenDay(); //submit _SumOfHours = new SumOfHours(); _TRInputList = new TRInputList(); _WorkingHoursWeekly = new WorkingHoursWeekly(); _MinHoursDaily = new MinHoursDaily(); _FirstSubmitableDay = new FirstSubmitableDay(); _SelectedActivityCode = new SelectedActivityCode(); _Description = new Description(); _Location = new Location(); _BusinessUnit = new BusinessUnit(); _ReasonCode = new ReasonCode(); _ArePropReadyTRSubmit = new ArePropReady(); _PeriodEnd = new PeriodEnd(); //reports _PeriodStarting = new PeriodStarting(); _ArePropReadyReports = new ArePropReady(); _ReportIntervalFrom = new ReportIntervalFrom(); _ReportIntervalTo = new ReportIntervalTo(); _UserIDList = new UserIDList(); _SelectedReportTemplate = new SelectedReportTemplate(); _SelectedReportType = new SelectedReportType(); //külön queryk-ben/Getparameters-ben kap értéket _LastSubmittedDay = new LastSubmittedDay(); _JobCh = new JobCH(); _InsertedHour = new InstertedHour(); _ValidationConstraint = new ValidationConstraint(); _JobFilter = new JobFilter(); _ActivityCodeFilter = new ActivityCodeFilter(); _UserGroup = new UserGroup(); _ReasonCodeFilter = new ReasonCodeFilter(); }