Exemplo n.º 1
0
 public override bool Delete(params object[] keys)
 {
     try
     {
         var obj  = new BoothCatgoryBO().SimpleGet(this.ConnectionHandler, keys);
         var list = new BoothBO().Any(ConnectionHandler, supporter => supporter.CategoryId == obj.Id);
         if (list)
         {
             throw new Exception(Resources.Congress.ErrorInDeleteBoothcategoryBecauseThereAreBoothWithThisType);
         }
         if (!new BoothCatgoryBO().Delete(this.ConnectionHandler, keys))
         {
             throw new Exception(Resources.Congress.ErrorInDeleteBoothCategory);
         }
         return(true);
     }
     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);
     }
 }
Exemplo n.º 2
0
 public override bool Delete(params object[] keys)
 {
     try
     {
         var obj  = new BoothBO().Get(this.ConnectionHandler, keys);
         var list = new UserBoothBO().Any(ConnectionHandler,
                                          supporter => supporter.BoothId == obj.Id);
         if (list)
         {
             throw new Exception(Resources.Congress.ErrorInDeleteBoothBecauseThisReserved);
         }
         if (!new BoothBO().Delete(this.ConnectionHandler, keys))
         {
             throw new Exception(Resources.Congress.ErrorInDeleteBooth);
         }
         return(true);
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex.InnerException);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Exemplo n.º 3
0
 public List <Booth> GetByCongressId(Guid congressId)
 {
     try
     {
         var list = new BoothBO().OrderBy(this.ConnectionHandler, x => x.Code, x => x.CongressId == congressId);
         new BoothBO().SetCapacity(ConnectionHandler, list, congressId);
         return(list);
     }
     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);
     }
 }
Exemplo n.º 4
0
 public IEnumerable <Booth> GerReservableBooth(Guid congressId)
 {
     try
     {
         var lst = new BoothBO().Where(this.ConnectionHandler, x => x.CongressId == congressId);
         new BoothBO().SetCapacity(ConnectionHandler, lst, congressId);
         return(lst.Where(x => x.FreeCapicity > 0));
     }
     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);
     }
 }
Exemplo n.º 5
0
        public KeyValuePair <bool, Guid> InsertGuest(EnterpriseNode.DataStructure.EnterpriseNode enterpriseNode,
                                                     List <Guid> boothIdlist, HttpPostedFileBase file, List <DiscountType> discountAttaches,
                                                     string callBackurl, FormGenerator.DataStructure.FormStructure postFormData, Guid congressId)
        {
            var keyValuePairs = new ModelView.InFormEntitiyList <UserBooth>();
            var guid          = Guid.Empty;
            var userBoothBo   = new UserBoothBO();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var additionalData = new CongressDiscountTypeBO().FillTempAdditionalData(this.ConnectionHandler, congressId);
                if (
                    !EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(this.EnterpriseNodeConnection)
                    .Insert(enterpriseNode, file))
                {
                    return(new KeyValuePair <bool, Guid>(false, Guid.Empty));
                }
                postFormData.RefId = enterpriseNode.Id.ToString();
                if (
                    !FormGeneratorComponent.Instance.FormDataTransactionalFacade(this.FormGeneratorConnection)
                    .ModifyFormData(postFormData))
                {
                    throw new Exception(Resources.Congress.ErrorInSaveBoothReserv);
                }
                var boothBo = new BoothBO();
                var amount  = boothBo.Sum(ConnectionHandler, x => x.ValidCost, x => x.Id.In(boothIdlist));

                if (amount.ToDecimal() > 0)
                {
                    var firstOrDefault = boothIdlist.FirstOrDefault();
                    var booth          = boothBo.Get(this.ConnectionHandler, firstOrDefault);
                    var temp           = new Temp
                    {
                        PayerId     = enterpriseNode.Id,
                        CallBackUrl = callBackurl + enterpriseNode.Id,
                        PayerTitle  = enterpriseNode.DescriptionField,
                        Description = Resources.Congress.PaymentBoothReserv,
                        Amount      =
                            new CongressDiscountTypeBO().CalulateAmountNew(this.PaymentConnection, amount.ToDecimal(),
                                                                           discountAttaches),
                        CurrencyType   = (byte)booth.CurrencyType.ToEnum <Radyn.Common.Definition.Enums.CurrencyType>(),
                        AdditionalData = additionalData
                    };

                    if (
                        !PaymentComponenets.Instance.TempTransactionalFacade(this.PaymentConnection)
                        .Insert(temp, discountAttaches))
                    {
                        return(new KeyValuePair <bool, Guid>(false, Guid.Empty));
                    }
                    guid = temp.Id;
                }
                foreach (var guid1 in boothIdlist)
                {
                    var userBooth = new UserBooth()
                    {
                        UserId  = enterpriseNode.Id,
                        BoothId = guid1,
                        TempId  = guid != Guid.Empty ? guid : (Guid?)null,
                    };
                    if (!userBoothBo.Insert(this.ConnectionHandler, userBooth))
                    {
                        throw new Exception(Resources.Congress.ErrorInSaveBoothReserv);
                    }
                    keyValuePairs.Add(userBooth,
                                      Resources.Congress.BoothInsertEmail, Resources.Congress.BoothInsertSMS);
                }

                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                this.EnterpriseNodeConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.RollBack();
                this.FormGeneratorConnection.RollBack();
                this.EnterpriseNodeConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.RollBack();
                this.FormGeneratorConnection.RollBack();
                this.EnterpriseNodeConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                userBoothBo.InformUserboothReserv(this.ConnectionHandler, congressId, keyValuePairs);
            }
            catch (Exception)
            {
            }
            return(new KeyValuePair <bool, Guid>(true, guid));
        }