/// <summary> /// This method assumes the current user is the sender. /// </summary> /// <param name="menuPathMainId"></param> /// <param name="productId"></param> /// <param name="productChildId"></param> /// <param name="menuEnum"></param> /// <returns></returns> //public MessageParameter GetPeopleListCount(string menuPathMainId, string productId, string productChildId, MenuENUM menuEnum) //{ // return makePeopleLists(productId, productChildId, menuEnum, menuPathMainId); //} /// <summary> /// This method assumes current user is sender. Note all parameters will not have value. It depends which menu level they are sent from /// </summary> /// <param name="menuPathMainId"></param> /// <param name="productId"></param> /// <param name="productChildId"></param> /// <param name="menuEnum"></param> /// <returns></returns> public MessageParameter GetPeopleListCount(string menuPathMainId, string productId, string productChildId, MenuENUM menuEnum) { countIsSet = false; if (menuEnum == MenuENUM.Unknown) { throw new Exception("MenuENUM.Unknown"); } Person fromPerson = UserBiz.GetPersonFor(UserId); fromPerson.IsNullThrowException("fromPerson"); //initialize the lists initializeHashSets(); MenuPathMain mpm; switch (menuEnum) { case MenuENUM.IndexMenuPath1: mpm = getMpm(menuPathMainId); getPeopeFromMp1Etc(mpm.MenuPath1Id); break; case MenuENUM.IndexMenuPath2: mpm = getMpm(menuPathMainId); getPeopleFromMp2Etc(mpm.MenuPath1Id, mpm.MenuPath2Id); break; case MenuENUM.IndexMenuPath3: mpm = getMpm(menuPathMainId); getPeopleFromMp3Etc(mpm); break; case MenuENUM.IndexMenuProduct: getPeopleFromProductEtc(productId); break; case MenuENUM.IndexMenuProductChild: getPeopleFromProductChildOwners(productChildId); break; case MenuENUM.IndexDefault: default: break; } //Add to total people addupAllListsIntoTotalPeopleAndClean(fromPerson); MessageParameter msgParam = new MessageParameter(); msgParam.FromPerson = fromPerson; msgParam.NumberOfProductPeople = NumberOfProductPeople; msgParam.NumberOfLikeUnlikePeople = NumberOfPeopleInLikeUnlike; msgParam.NumberOfTotalPeople = NumberOfTotalPeople; msgParam.NumberOfChildProductsBelongingToUserFrom = NumberOfChildProductsBelongingToUserFrom; msgParam.NumberOfProductsBelongingToUserFrom = NumberOfProductsBelongingToUserFrom; msgParam.ProductChildPeople = peopleInProductChildren; msgParam.ProductPeople = peopleInProducts; msgParam.LikeUnlikePeople = peopleInLikeUnlike; msgParam.TotalPeople = totalPeopleHashSet; msgParam.ProductsBelongingToUserFrom = productsBelongingToUserFrom; msgParam.ProductChildrenBelongingToUserFrom = childProductsBelongingToUserFrom; msgParam.ChildProductCheckItems = loadChildProductsIntoCheckItems(childProductsBelongingToUserFrom); //msgParam.OwnersChildProductsWithLinks = loadOwnersChildProductsWithLinks(childProductsBelongingToUserFrom); return(msgParam); }
private void WireUpMessageWithPeople(MenuPathMain mpm, string productId, string productChildId, List <Person> toPeople, Message message, Person fromPerson, MenuENUM menuEnum) { throw new NotImplementedException(); //fromPerson.Messages.Add(message); //foreach (Person toPerson in toPeople) //{ // PeopleMessage pm = new PeopleMessage(); // pm.MessageId = message.Id; // pm.PersonId = toPerson.Id; // toPerson.MessagesToPeople.Add(pm); // message.ToPeople.Add(pm); //} //switch (menuEnum) //{ // case MenuENUM.IndexMenuPath1: // MenuPath1 mp1 = mpm.MenuPath1; // mp1.IsNullThrowException("MenuPath1 not found"); // if (mp1.Messages.IsNull()) // mp1.Messages = new List<Message>(); // mp1.Messages.Add(message); // message.MenuPath1Id = mp1.Id; // break; // case MenuENUM.IndexMenuPath2: // MenuPath2 mp2 = mpm.MenuPath2; // mp2.IsNullThrowException("MenuPath2 not found"); // if (mp2.Messages.IsNull()) // mp2.Messages = new List<Message>(); // mp2.Messages.Add(message); // message.MenuPath2Id = mp2.Id; // break; // case MenuENUM.IndexMenuPath3: // MenuPath3 mp3 = mpm.MenuPath3; // mp3.IsNullThrowException("MenuPath3 not found"); // if (mp3.Messages.IsNull()) // mp3.Messages = new List<Message>(); // mp3.Messages.Add(message); // message.MenuPath3Id = mp3.Id; // break; // case MenuENUM.IndexMenuProduct: // Product product = ProductBiz.Find(productId); // product.IsNullThrowException("Product not found"); // if (product.Messages.IsNull()) // product.Messages = new List<Message>(); // product.Messages.Add(message); // message.MenuPath3Id = product.Id; // break; // case MenuENUM.IndexMenuProductChild: // ProductChild productChild = ProductChildBiz.Find(productChildId); // productChild.IsNullThrowException("Product Child not found"); // if (productChild.Messages.IsNull()) // productChild.Messages = new List<Message>(); // productChild.Messages.Add(message); // message.MenuPath3Id = productChild.Id; // break; // case MenuENUM.IndexDefault: // default: // break; //} }
public void CreateMessageAndSave(string subject, string body, string menuPathMainId, string productId, string productChildId, MessageENUM messageEnum = MessageENUM.Unknown, MenuENUM menuEnum = MenuENUM.Unknown) { throw new NotImplementedException(); //UserId.IsNullOrWhiteSpaceThrowException("You are not logged in"); //if (messageEnum == MessageENUM.Unknown) // throw new Exception("messageEnum.Unknown"); //MessageParameter messageParameter = GetPeopleListCount(menuPathMainId, productId, productChildId, menuEnum); //List<ProductChild> pChildSelectedForAdvertisment = getProductChildrenFromCheckItem(messageParameter); ////you need to fix the toPeople //toPeopleHashSet = new HashSet<Person>(); //Message message = new Message(messageParameter.FromPerson, toPeopleHashSet.ToList(), subject, body, messageEnum, pChildSelectedForAdvertisment); //message.SelfErrorCheck(); ////wire it up ////WireUpMessageWithPeople(mpm, productId, productChildId, toPeopleHashSet.ToList(), message, fromPerson, menuEnum); //CreateAndSave(message); }