public static void Build(NetworkStream stream, string jsonList) { List <string> initKeys = ConvertStringToList <string> .Convert(jsonList.Normalize()); BuilderKey.Build(initKeys); ResponseServer.SendResponse(stream, "Build Keys Succesfully"); }
public void ConvertJsonArrStringToListTest1() { string jsonString = @"[""Ford"",""BMW"",""Fiat""]"; List <string> actualResult = ConvertStringToList <string> .Convert(jsonString); List <string> expectedResult = new List <string>() { "Ford", "BMW", "Fiat" }; CollectionAssert.AreEqual(expectedResult, actualResult); }
public void ConvertJsonArrStringToListTest2() { string user1 = @"{ ""id"": 0, ""uuid"": ""5AAB1A5B-48C4-4698-9830-1A401F286D00"", ""username"": ""naruto"", ""password"": ""sasuke"" }"; string user2 = @"{ ""id"": 1, ""uuid"": ""5AAB1A5B-48C4-4698-9830-1A401F286D01"", ""username"": ""goku"", ""password"": ""kakaroto"" }"; string user3 = @"{ ""id"": 2, ""uuid"": ""5AAB1A5B-48C4-4698-9830-1A401F286D02"", ""username"": ""seiya"", ""password"": ""sahori"" }"; string jsonString = $"[{user1},{ user2},{user3}]"; List <ModelUser> actualResult = ConvertStringToList <ModelUser> .Convert(jsonString); ModelUser userOne = new ModelUser(); userOne.id = 0; userOne.uuid = "5AAB1A5B-48C4-4698-9830-1A401F286D00"; userOne.username = "******"; userOne.password = "******"; ModelUser userTwo = new ModelUser(); userTwo.id = 1; userTwo.uuid = "5AAB1A5B-48C4-4698-9830-1A401F286D01"; userTwo.username = "******"; userTwo.password = "******"; ModelUser userThree = new ModelUser(); userThree.id = 2; userThree.uuid = "5AAB1A5B-48C4-4698-9830-1A401F286D02"; userThree.username = "******"; userThree.password = "******"; List <ModelUser> expectedResult = new List <ModelUser>() { userOne, userTwo, userThree }; CollectionAssert.AreEqual(expectedResult, actualResult); }
private Posting Template_fn(string name, Posting posting) { // retrieving record from PostingTemplate table by Template Name (Unique) var postingTemplate = db.PostingTemplates.Where(p => p.templateName == name).SingleOrDefault(); var positionToAdd = db.Positions.Where(p => p.ID == postingTemplate.PositionID).SingleOrDefault(); // Assigned record of postingTemplate to Posting Object // to be able to use the record from postingTemplate table in View/Create posting = new Posting { pstNumPosition = postingTemplate.pstNumPosition, pstFTE = postingTemplate.pstFTE, pstSalary = postingTemplate.pstSalary, pstCompensationType = postingTemplate.pstCompensationType, pstJobDescription = postingTemplate.pstJobDescription, pstOpenDate = postingTemplate.pstOpenDate, pstEndDate = postingTemplate.pstEndDate, pstJobStartDate = postingTemplate.pstJobStartDate, pstJobEndDate = postingTemplate.pstJobEndDate, PositionID = postingTemplate.PositionID, Position = positionToAdd }; // Populatedropdownlist for PositionID PopulateDropdownList(posting); // Passing values to View/Create and Convert IDs string to List ( to be able to use Contains function) var tempLocationIDs = ConvertStringToList.ConvertToInt(postingTemplate.LocationIDs); var tempSkillIDs = ConvertStringToList.ConvertToInt(postingTemplate.SkillIDs); var tempRequirementIDs = ConvertStringToList.ConvertToInt(postingTemplate.RequirementIDs); var tempDayIDs = ConvertStringToList.ConvertToInt(postingTemplate.dayIDs); ViewBag.Qualifications = new MultiSelectList(db.Qualification.OrderBy(q => q.QlfDescription), "ID", "QlfDescription", tempRequirementIDs.ToArray()); ViewBag.Locations = new MultiSelectList(db.Locations, "ID", "Address", tempLocationIDs.ToArray()); ViewBag.Skills = new MultiSelectList(db.Skills.OrderBy(s => s.SkillDescription), "ID", "SkillDescription", tempSkillIDs.ToArray()); ViewBag.Day = new MultiSelectList(db.Days, "ID", "dayName", tempDayIDs.ToArray()); ViewBag.Flag = true; PopulateDropdownList(posting); //PopulateListBoxByID(id, posting); return(posting); }
public static SensitiveInformation GetModel(EntitySensitiveInformation entitySI) { SensitiveInformation modelSI = new SensitiveInformation(); modelSI.id = entitySI.id; modelSI.uuid = entitySI.uuid.ToString(); modelSI.type = ConvertStringToEnum <EnumSIType> .Convert(entitySI.type); modelSI.informationName = entitySI.informationName; modelSI.containerName = entitySI.containerName; modelSI.notes = entitySI.notes; modelSI.username = entitySI.username; modelSI.password = entitySI.password; modelSI.cardName = entitySI.cardName; modelSI.cardEntity = entitySI.cardEntity; modelSI.cardNumber = entitySI.cardNumber; modelSI.cardExpirationDate = entitySI.cardExpirationDate; modelSI.cardSecurityNumber = entitySI.cardSecurityNumber; modelSI.contactName = entitySI.contactName; modelSI.contactLastname = entitySI.contactLastname; modelSI.businessName = entitySI.businessName; modelSI.postalCode = entitySI.postalCode; modelSI.country = entitySI.country; modelSI.state = entitySI.state; modelSI.birthday = entitySI.birthday; modelSI.favorite = entitySI.favorite; modelSI.contentKey = entitySI.contentKey; modelSI.tagsList = ConvertStringToList <string> .Convert(entitySI.tagsList); modelSI.addressesList = ConvertStringToList <string> .Convert(entitySI.addressesList); modelSI.phoneNumbersList = ConvertStringToList <string> .Convert(entitySI.phoneNumbersList); modelSI.emailsList = ConvertStringToList <string> .Convert(entitySI.emailsList); modelSI.urlsList = ConvertStringToList <string> .Convert(entitySI.urlsList); return(modelSI); }
public List <string> GetResponse() { ClientSocket.SendRequest("GetNormalValidKeys"); return(ConvertStringToList <string> .Convert(ResponseClient.responseData)); }