internal static Party EditParty(PartyModel partyModel, Dictionary <string, string> partyCustomAttributeValues) { PartyTypeManager partyTypeManager = new PartyTypeManager(); PartyManager partyManager = new PartyManager(); var party = new Party(); try { var newAddPartyCustomAttrValues = new Dictionary <PartyCustomAttribute, string>(); party = partyManager.Find(partyModel.Id); //Update some fields party.Description = partyModel.Description; party.StartDate = partyModel.StartDate.HasValue ? partyModel.StartDate.Value : DateTime.MinValue; party.EndDate = partyModel.EndDate.HasValue ? partyModel.EndDate.Value : DateTime.MaxValue; party = partyManager.Update(party); foreach (var partyCustomAttributeValueString in partyCustomAttributeValues) { PartyCustomAttribute partyCustomAttribute = partyTypeManager.PartyCustomAttributeRepository.Get(int.Parse(partyCustomAttributeValueString.Key)); string value = string.IsNullOrEmpty(partyCustomAttributeValueString.Value) ? "" : partyCustomAttributeValueString.Value; newAddPartyCustomAttrValues.Add(partyCustomAttribute, value); } partyManager.AddPartyCustomAttributeValues(party, partyCustomAttributeValues.ToDictionary(cc => long.Parse(cc.Key), cc => cc.Value)); } finally { partyTypeManager?.Dispose(); partyManager?.Dispose(); } return(party); }
public async Task <PartyResponse> AddPartyRL(PartyRequest partyRequest, string adminId) { try { var newParty = new PartyModel() { PartyName = partyRequest.PartyName, RegisteredBy = partyRequest.RegisterBy, CreatedDate = DateTime.Now, MofifiedDate = DateTime.Now }; authenticationContext.Parties.Add(newParty); await this.authenticationContext.SaveChangesAsync(); if (newParty != null) { var partyResponse = new PartyResponse() { Id = newParty.Id, PartyName = newParty.PartyName, RegisteredBy = newParty.RegisteredBy }; return(partyResponse); } else { return(null); } } catch (Exception exception) { throw new Exception(exception.Message); } }
public ActionResult PartyEdit(int id, PartyModel model) { var service = new PartyService(); service.UpdateParty(model); return(RedirectToAction("GetAllParties", "Admin", null)); }
public ActionResult PartyDelete(int id, PartyModel collection) { var service = new PartyService(); service.DeleteParty(id); return(RedirectToAction("GetAllParties", "Admin", null)); }
public ActionResult List() { var model = new List <PartyModel>(); try { var parties = m_internetDc.Parties.ToList(); var partyImages = new List <string>(); int i = 0; foreach (var item in parties) { var partyModel = new PartyModel(); partyImages.Add(string.Format("data:image/jpg;base64,{0}", Convert.ToBase64String(item.Image.ToArray()))); i++; if (!string.IsNullOrEmpty(item.Manager)) { var citizen = m_internetDc.Citizens.First(x => x.IdentityNo == item.Manager); partyModel.Manager = citizen; } partyModel.Party = item; model.Add(partyModel); } ViewData["PartyImages"] = partyImages; } catch (Exception) { } return(View(model)); }
public ActionResult PartyCreate(PartyModel model) { var service = new PartyService(); var result = service.CreateParty(model); return(RedirectToAction("GetAllParties", "Admin", null)); }
public ActionResult SavePartyDetails(PartyModel objPartyModel) { ResponseDetail objResponse = new ResponseDetail(); objPartyModel.LoginUser = Session["LoginUser"] as User; objResponse = objRegistrationManager.SavePartyDetails(objPartyModel); return(Json(objResponse, JsonRequestBehavior.AllowGet)); }
public PartyModel getPartyById(int id) { Mapper.CreateMap <PartyMaster, PartyModel>(); PartyMaster objComp = Dbcontext.PartyMasters.SingleOrDefault(m => m.PID == id); PartyModel objCItem = Mapper.Map <PartyModel>(objComp); return(objCItem); }
public ActionResult Edit(PartyModel model) { PartyServices objPservice = new PartyServices(); model.CompID = Convert.ToInt32(Session["CompID"].ToString()); objPservice.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public async Task JoinParty(string partyName, string playerObj) { var player = CompressionHelper.Decompress <PlayerModel>(playerObj); var ladder = await _ladderService.GetLadderForPlayer(player.Character.League, player.Character.Name); if (ladder == null) { ladder = await _ladderService.GetLadderForLeague(player.Character.League); } player.LadderInfo = ladder; // set initial id of player player.ConnectionID = Context.ConnectionId; //update ConnectionId:Partyname index await AddToIndex(partyName); // look for party var party = await _cache.GetAsync <PartyModel>($"party:{partyName}"); if (party == null) { party = new PartyModel() { Name = partyName, Players = new List <PlayerModel> { player } }; await _cache.SetAsync <PartyModel>($"party:{partyName}", party); await Clients.Caller.SendAsync("EnteredParty", CompressionHelper.Compress(party), CompressionHelper.Compress(player)); } else { var oldPlayer = party.Players.FirstOrDefault(x => x.Character.Name == player.Character.Name || x.ConnectionID == player.ConnectionID); if (oldPlayer == null) { party.Players.Insert(0, player); } else { var index = party.Players.IndexOf(oldPlayer); party.Players[index] = player; } await _cache.SetAsync <PartyModel>($"party:{partyName}", party); await Clients.Caller.SendAsync("EnteredParty", CompressionHelper.Compress(party), CompressionHelper.Compress(player)); } await Groups.AddToGroupAsync(Context.ConnectionId, partyName); await Clients.OthersInGroup(partyName).SendAsync("PlayerJoined", CompressionHelper.Compress(player)); await Clients.Group(partyName).SendAsync("PlayerUpdated", CompressionHelper.Compress(player)); }
public int Update(PartyModel model) { Mapper.CreateMap <PartyModel, PartyMaster>(); PartyMaster objVehicle = DbContext.PartyMasters.SingleOrDefault(m => m.PID == model.PID); objVehicle = Mapper.Map(model, objVehicle); DbContext.SaveChanges(); return(DbContext.SaveChanges()); }
public ActionResult Edit(bool relationTabAsDefault = false) { PartyManager partyManager = null; PartyTypeManager partyTypeManager = null; UserManager userManager = null; try { partyManager = new PartyManager(); partyTypeManager = new PartyTypeManager(); userManager = new UserManager(); var user = userManager.FindByNameAsync(HttpContext.User?.Identity?.Name).Result; if (user == null) { return(RedirectToAction("Index", "Home", new { area = "" })); } ViewBag.Title = PresentationModel.GetGenericViewTitle("Edit Party"); var model = new PartyModel(); model.PartyTypeList = partyTypeManager.PartyTypeRepository.Get().ToList(); Party party = partyManager.GetPartyByUser(user.Id); if (party == null) { return(RedirectToAction("UserRegistration", "PartyService", new { area = "bam" })); } model.Description = party.Description; model.Id = party.Id; model.PartyType = party.PartyType; //Set dates to null to not showing the minimum and maximum dates in UI if (party.StartDate == DateTime.MinValue) { model.StartDate = null; } else { model.StartDate = party.StartDate; } if (party.EndDate.Date == DateTime.MaxValue.Date) { model.EndDate = null; } else { model.EndDate = party.EndDate; } model.Name = party.Name; ViewBag.RelationTabAsDefault = false; ViewBag.Title = "Edit party"; return(View(model)); } finally { partyManager?.Dispose(); partyTypeManager?.Dispose(); userManager?.Dispose(); } }
public bool SaveData(PartyModel party) { bool status = true; PartyRepository repo = new PartyRepository(); status = repo.SaveEdit(ParserAddParty(party)); return(status); }
public async Task UpdatePartyAsync(PartyModel model) { using (var context = new StudentElectionContext()) { var party = context.Parties.SingleOrDefault(p => p.Id == model.Id); _mapper.Map(model, party); await context.SaveChangesAsync(); } }
public ActionResult getParty(int SID) { List <PartyModel> lstVhcl = new List <PartyModel>(); PartyModel objModel = new PartyModel(); ConsignmentService objEmp = new ConsignmentService(); objModel = objEmp.getPartyById(SID); return(PartialView("_Contact", objModel)); //return Json(objModel, JsonRequestBehavior.AllowGet); }
public async Task DeletePartyAsync(PartyModel model) { using (var context = new StudentElectionContext()) { var party = context.Parties.SingleOrDefault(p => p.Id == model.Id); context.Parties.Remove(party); await context.SaveChangesAsync(); } }
public JsonResult AddParty([FromBody] PartyModel party) { var result = _partyservice.AddParty(party); if (!result) { return(new JsonResult("Party could not be added")); } return(new JsonResult("Party Added")); }
private async void tbkParty_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (AreCandidatesFinalized) { return; } var tbk = sender as TextBlock; var parentWindow = Window.GetWindow(this); var window = parentWindow as MaintenanceWindow; G.WaitLang(window); Cursor = Cursors.Wait; window.Opacity = 0.5; var form = new PartyForm(); _party = this.DataContext as PartyModel; form.Party = _party; var helper = new WindowInteropHelper(window); SetWindowLong(new HandleRef(form, form.Handle), -8, helper.Handle.ToInt32()); G.EndWait(window); Cursor = Cursors.Arrow; form.ShowDialog(); G.WaitLang(window); var party = await form.GetNewDataAsync(); if (!form.IsDeleted && party != null) { DataContext = party; foreach (CandidateControl control in stkCandidate.Children) { var candidate = control.DataContext as CandidateModel; candidate.Party = party; control.DataContext = candidate; } } else { await window.LoadCandidatesAsync(); } window.Opacity = 1; G.EndWait(window); }
public PartyModel GetParty(int id) { PartyModel party = new PartyModel(); PartyRepository repo = new PartyRepository(); if (party != null) { party = ParserParty(repo.GetParty(id)); } return(party); }
public async Task DeletePartyAsync(PartyModel model) { await Task.CompletedTask; using (var tableAdapter = new PartyTableAdapter()) { tableAdapter.Delete( model.Id ); } }
/// <summary> /// Service Method To Get Parties /// </summary> /// <param name="party"></param> /// <returns></returns> public static async Task <List <PartyModel> > GetParty(PartyModel party) { List <PartyModel> Parties = new List <PartyModel>(); using (SqlConnection dbConn = new SqlConnection(selectConnection(party.Location))) { var isExistingParty = "SELECT * from Party"; SqlDataReader reader; try { dbConn.Open(); SqlCommand cmd = new SqlCommand(isExistingParty, dbConn); reader = await cmd.ExecuteReaderAsync(); if (reader.HasRows) { while (reader.Read()) { PartyModel partyItem = new PartyModel(); partyItem.ID = reader.GetInt32(0); partyItem.Name = reader.GetString(1); Parties.Add(partyItem); } } } catch (Exception ex) { reader = null; ActionLogService.LogAction(new ActionLogModel() { UserID = party.UserID, ActionPerformed = "Party Exists Error : " + ex.Message, MethodName = "PartyExists", IsError = true }, party.Location); } finally { dbConn.Close(); ActionLogService.LogAction(new ActionLogModel() { UserID = party.UserID, ActionPerformed = "Check If Party Exists", MethodName = "PartyExists", IsError = false }, party.Location); } return(Parties); } }
public async Task <IActionResult> Add(ConcertViewModel model) { if (ModelState.IsValid) { ConcertModel concert = await _context.Concerts.FirstOrDefaultAsync(u => u.Name == model.Name); if (concert == null) { ConcertModel c = new ConcertModel(model); if (model.Type == nameof(ClassicalConcertModel)) { ClassicalConcertModel classicConcert = new ClassicalConcertModel(c); classicConcert.VocalType = model.VocalType; classicConcert.ClassicalConcertName = model.ClassicalConcertName; classicConcert.Composer = model.Composer; _context.ClassicalConcerts.Add(classicConcert); } else if (model.Type == nameof(OpenAirModel)) { OpenAirModel openAir = new OpenAirModel(c); openAir.DriveWay = model.DriveWay; openAir.Headliner = model.Headliner; _context.OpenAirs.Add(openAir); } else if (model.Type == nameof(PartyModel)) { PartyModel party = new PartyModel(c); party.AgeQualification = model.AgeQualification.Value; _context.Parties.Add(party); } else { ModelState.AddModelError("", "Некорректные данные"); } await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Concerts")); } else { ModelState.AddModelError("", "Некорректные данные"); } } else { ModelState.AddModelError("", "Некорректные данные"); } return(View(model)); }
public async Task <int> DeletePartyAsync(PartyModel model) { var party = new Party { PartyId = model.PartyId }; using (var dataService = DataServiceFactory.CreateDataService()) { return(await dataService.DeletePartyAsync(party)); } }
public void Execute() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); CommodityVO[] commodity = { new CommodityVO(CommodityType.Reputation, null, -model.FleePartyPenalty), new CommodityVO(CommodityType.Reputation, model.Party.Faction, -model.FleeFactionPenalty) }; AmbitionApp.SendMessage(commodity); }
private void validateAttribute(PartyModel partyModel) { if (partyModel.StartDate > partyModel.EndDate) { partyModel.Errors.Add(new IO.Transform.Validation.Exceptions.Error(IO.Transform.Validation.Exceptions.ErrorType.Other, "Start date is greater than end date!")); } if (partyModel.PartyType.Id == 0) { partyModel.Errors.Add(new IO.Transform.Validation.Exceptions.Error(IO.Transform.Validation.Exceptions.ErrorType.Other, "Please select party type!")); } }
public PartyItemControl() { InitializeComponent(); tbkParty.DataContextChanged += (s, ev) => { _party = this.DataContext as PartyModel; tbkParty.Width = double.NaN; }; }
public IResult Execute(PartyModel repo, IRegisteredCommand comm) { if (comm.BaseCommandText == CommandText) { return(new Result()); } else { return(_NextCommand.Execute(repo, comm)); } }
public string AddNewParty(GameObject party, bool automatic_start = false) { PartyController pc = party.GetComponent <PartyController> (); PartyModel pm = party.GetComponent <PartyModel> (); DebugLogger.DebugSystemMessage("Inserting " + pm._AdventureTitle + " Party to Dungeon"); pc.RegisterToEvent(HandlePacketTimerUp); string newPacketKey = AddPartyToDungeon(party); return(newPacketKey); }
public ActionResult UpdateParty(PartyModel partyModel) { try { _partyService.UpdateParty(partyModel); return(Ok(new { Success = true, data = "Success" })); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, new { Success = false, data = "Internal Server Error", Message = ex.Message })); } }
public IResult Execute(PartyModel repo, IRegisteredCommand comm) { if (comm.BaseCommandText == CommandText) { string printString = repo.PrettyPrint(); return(new Result(printString)); } else { return(_NextCommand.Execute(repo, comm)); } }