Exemple #1
0
 public ActionResult Delete(Party party)
 {
     PartyManager partyManager = new PartyManager();
     //  party = partyManager.Repo.Reload(party);
     partyManager.Delete(party);
     return RedirectToAction("Index");
 }
Exemple #2
0
        public ActionResult Edit(int id)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Edit Party", this.Session.GetTenant());

            PartyManager partyManager = new PartyManager();
            PartyTypeManager partyTypeManager = new PartyTypeManager();
            var model = new PartyModel();
            model.PartyTypeList = partyTypeManager.Repo.Get().ToList();
            model.Party = partyManager.Repo.Get(id);

            return View(model);
        }
Exemple #3
0
        public ActionResult Create(PartyModel partyModel, Dictionary<string, string> partyCustomAttributeValues)
        {
            PartyTypeManager partyTypeManager = new PartyTypeManager();
            PartyManager partyManager = new PartyManager();
            validateAttribute(partyModel);
            if (partyModel.Errors.Count > 0)
                return View(partyModel);
            //
            var partyType = partyTypeManager.Repo.Get(partyModel.Party.PartyType.Id);
            var partyStatusType = partyTypeManager.GetStatusType(partyType, "Create");

            //Create party
            var party = partyManager.Create(partyType, partyModel.Party.Name, "", "", partyModel.Party.StartDate, partyModel.Party.EndDate, partyStatusType);
            //Add customAttriuteValue to party
            partyManager.AddPartyCustomAttriuteValue(party, ConvertDictionaryToPartyCustomeAttrValuesDictionary(partyCustomAttributeValues));
            return RedirectToAction("Index");
        }
Exemple #4
0
 public ActionResult Edit(PartyModel partyModel, Dictionary<string, string> partyCustomAttributeValues)
 {
     using (IUnitOfWork uow = this.GetUnitOfWork())
     {
         PartyTypeManager partyTypeManager = new PartyTypeManager();
         PartyManager partyManager = new PartyManager();
         validateAttribute(partyModel);
         if (partyModel.Errors.Count > 0)
             return View(partyModel);
         var party = partyManager.Repo.Reload(partyModel.Party);
         //Update some fields
         party.Description = partyModel.Party.Description;
         party.StartDate = partyModel.Party.StartDate;
         party.EndDate = partyModel.Party.EndDate;
         party.Name = partyModel.Party.Name;
         party = partyManager.Update(party);
         foreach (var partyCustomAttributeValueString in partyCustomAttributeValues)
         {
             var partyCustomAttribute = partyTypeManager.RepoPartyCustomAttribute.Get(int.Parse(partyCustomAttributeValueString.Key));
             partyManager.UpdatePartyCustomAttriuteValue(partyCustomAttribute, partyModel.Party, partyCustomAttributeValueString.Value);
         }
     }
     return RedirectToAction("Index");
 }
Exemple #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="Id">PartyType Id</param>
 /// <returns></returns>
 public ActionResult LoadPartyCustomAttr(int id)
 {
     long partyId = 0;
     var partyIdStr = HttpContext.Request.Params["partyId"];
     if (long.TryParse(partyIdStr, out partyId))
     {
         PartyManager pm = new PartyManager();
         ViewBag.customAttrValues = pm.Repo.Get(partyId).CustomAttributeValues.ToList();
     }
     var customAttrList = new List<PartyCustomAttribute>();
     PartyTypeManager partyTypeManager = new PartyTypeManager();
     var partyType = partyTypeManager.Repo.Get(item => item.Id == id);
     if (partyType != null)
         customAttrList = partyType.First().CustomAttributes.ToList();
     return PartialView("_customAttributesView", customAttrList);
 }
Exemple #6
0
 public ActionResult Index()
 {
     PartyManager partyManager = new PartyManager();
     var parties = partyManager.Repo.Get();
     return View(parties.ToList());
 }