public string GetNamesByBoothId(UserBooth userBooth) { try { return(new BoothOfficerBO().GetNamesByBoothId(this.ConnectionHandler, userBooth)); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public string GetNamesByBoothId(IConnectionHandler connectionHandler, UserBooth userBooth) { var list = this.Select(connectionHandler, x => x.EnterpriseNode.RealEnterpriseNode.FirstName + " " + x.EnterpriseNode.RealEnterpriseNode.LastName, x => x.UserId == userBooth.UserId && x.BoothId == userBooth.BoothId ); var str = ""; foreach (var boothOfficer in list) { if (!string.IsNullOrEmpty(str)) { str += ","; } str += boothOfficer; } return(str); }
public bool BoothOfficerModify(IConnectionHandler connectionHandler, IConnectionHandler enterpriseNodeConnection, List <BoothOfficer> boothOfficers, UserBooth userBooth) { var enterpriseNodeTransactionalFacade = EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(enterpriseNodeConnection); var list = this.Where(connectionHandler, x => x.UserId == userBooth.UserId && x.BoothId == userBooth.BoothId ); foreach (var boothOfficer in boothOfficers) { var officer = this.Get(connectionHandler, boothOfficer.Id, userBooth.BoothId, userBooth.UserId); if (officer != null) { if (!enterpriseNodeTransactionalFacade.Update(boothOfficer.EnterpriseNode, boothOfficer.AttachFile)) { return(false); } } else { boothOfficer.EnterpriseNode.Id = boothOfficer.Id; if (!enterpriseNodeTransactionalFacade.Insert(boothOfficer.EnterpriseNode, boothOfficer.AttachFile)) { return(false); } boothOfficer.BoothId = userBooth.BoothId; boothOfficer.UserId = userBooth.UserId; if (!this.Insert(connectionHandler, boothOfficer)) { throw new Exception(Resources.Congress.ErrorInSaveBoothOfficer); } } } foreach (var boothOfficer in list) { if (boothOfficers.Any(x => x.BoothId == boothOfficer.BoothId && x.UserId == boothOfficer.UserId && x.Id == boothOfficer.Id)) { continue; } if (!this.Delete(connectionHandler, boothOfficer.Id, boothOfficer.BoothId, boothOfficer.UserId)) { throw new Exception(Resources.Congress.ErrorInSaveBoothOfficer); } } return(true); }
public ActionResult CreateBooth(FormCollection collection) { var userBooth = new UserBooth(); try { var messageStack = new List <string>(); this.RadynTryUpdateModel(userBooth); userBooth.UserId = SessionParameters.CongressUser.Id; var transactionDiscountAttaches = Payment.Tools.AppExtentions.FillTransactionDiscount(collection); var config = this.Homa.Configuration; if (transactionDiscountAttaches.Count > config.DisscountCount) { messageStack.Add(Resources.Congress.YouCanNotUseDiscoutOverThanMax + Tag.NewLine + Resources.Congress.DiscountCount + config.DisscountCount); } var postFormData = this.PostForFormGenerator(collection); if (!string.IsNullOrEmpty(postFormData.FillErrors)) { messageStack.Add(postFormData.FillErrors); } var boothOfficers = (List <BoothOfficer>)Session["BoothOfficers"]; if (boothOfficers == null || !boothOfficers.Any()) { messageStack.Add(Resources.Congress.PleaseEnterBoothOfficer); } var booth = CongressComponent.Instance.BaseInfoComponents.BoothFacade.Get(userBooth.BoothId); if (booth != null && booth.MaxBoothOfficerCount != null && boothOfficers != null && boothOfficers.Count > booth.MaxBoothOfficerCount) { messageStack.Add(Resources.Congress.BoothOfficerCountismorethantheallowednumber + " " + Resources.Congress.Maximumallowed + ":" + booth.MaxBoothOfficerCount); } var messageBody = messageStack.Aggregate("", (current, item) => current + Tag.Li(item)); if (messageBody != "") { ShowMessage(messageBody, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error); return(Redirect("~/Congress/UserBoothPanel/CreateBooth")); } var userBoothInsert = CongressComponent.Instance.BaseInfoComponents.UserBoothFacade.UserBoothInsert(this.Homa.Id, userBooth, transactionDiscountAttaches, "/Congress/UserBoothPanel/UpdateStatusAfterTransaction?Id=" + userBooth.BoothId, postFormData, boothOfficers); if (userBoothInsert) { this.ClearFormGeneratorData(postFormData.Id); Session.Remove("BoothOfficers"); if (userBooth.TempId.HasValue) { return(Redirect("~" + Extentions.PrepaymenyUrl(userBooth.TempId.Value))); } ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed); return(Redirect("~/Congress/UserBoothPanel/IndexBooth")); } ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error); return(Redirect("~/Congress/UserBoothPanel/CreateBooth")); } catch (Exception exception) { ShowExceptionMessage(exception); return(Redirect("~/Congress/UserBoothPanel/CreateBooth")); } }