Esempio n. 1
0
        public void UpdateStatusAfterTransactionGuest(Guid congressId, Guid id)
        {
            var userBoothBo = new UserBoothBO();
            var list        = new ModelView.InFormEntitiyList <UserBooth>();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var guestbooths             = userBoothBo.Where(this.ConnectionHandler, guestbooth => guestbooth.UserId == id);
                var tempTransactionalFacade = PaymentComponenets.Instance.TempTransactionalFacade(this.PaymentConnection);
                var firstOrDefault          = guestbooths.FirstOrDefault(x => x.TempId != null);
                if (firstOrDefault == null || firstOrDefault.TempId == null)
                {
                    return;
                }
                var tr = tempTransactionalFacade.RemoveTempAndReturnTransaction((Guid)firstOrDefault.TempId);
                if (tr == null)
                {
                    return;
                }
                foreach (var guestbooth in guestbooths)
                {
                    guestbooth.TransactionId = tr.Id;
                    guestbooth.TempId        = null;
                    if (tr.PreDone)
                    {
                        guestbooth.Status = (byte)Enums.RezervState.Pay;
                        list.Add(guestbooth, Resources.Congress.BoothPaymentEmail, Resources.Congress.BoothPaymentSMS);
                    }
                    if (!userBoothBo.Update(this.ConnectionHandler, guestbooth))
                    {
                        throw new Exception(Resources.Congress.ErrorInEditBoothReserv);
                    }
                }
                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.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();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                userBoothBo.InformUserboothReserv(this.ConnectionHandler, congressId, list);
            }
            catch (Exception)
            {
            }
        }
Esempio 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);
     }
 }
Esempio n. 3
0
        public bool UserBoothUpdate(Guid congressId, UserBooth userBooth, List <DiscountType> discountAttaches, string callBackurl,
                                    FormStructure formModel, List <BoothOfficer> boothOfficers)
        {
            ModelView.ModifyResult <UserBooth> modifyResult;
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                modifyResult = new UserBoothBO().UserBoothUpdate(this.ConnectionHandler, this.PaymentConnection,
                                                                 this.FormGeneratorConnection, this.EnterpriseNodeConnection, userBooth, discountAttaches,
                                                                 callBackurl, formModel, boothOfficers);

                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                this.EnterpriseNodeConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                this.PaymentConnection.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
            {
                if (modifyResult.SendInform)
                {
                    new UserBoothBO().InformUserboothReserv(ConnectionHandler, congressId, modifyResult.InformList);
                }
            }
            catch (Exception)
            {
            }
            return(modifyResult.Result);
        }
Esempio n. 4
0
        public void DailyEvaulation()
        {
            var  workShopUserBo = new WorkShopUserBO();
            var  hotelUserBo    = new HotelUserBO();
            var  userBoothBo    = new UserBoothBO();
            var  keyValuePairs  = new Dictionary <Guid, ModelView.ModifyResult <UserBooth> >();
            var  workShopUsers  = new Dictionary <Guid, ModelView.ModifyResult <WorkShopUser> >();
            var  hotelUsers     = new Dictionary <Guid, ModelView.ModifyResult <HotelUser> >();
            bool result         = false;

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                if (!new HomaBO().DailyEvaulation(this.ConnectionHandler, keyValuePairs, workShopUsers, hotelUsers))
                {
                    throw new Exception(Resources.Congress.ErrorInWorkDailyScheduler);
                }
                this.ConnectionHandler.CommitTransaction();
                result = true;
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    foreach (var modifyResult in hotelUsers)
                    {
                        hotelUserBo.InformHotelReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                    foreach (var modifyResult in workShopUsers)
                    {
                        workShopUserBo.InformWorkShopReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                    foreach (var modifyResult in keyValuePairs)
                    {
                        userBoothBo.InformUserboothReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 5
0
        public Guid UpdateStatusAfterTransaction(Guid congressId, Guid user, Guid boothId)
        {
            var userBoothBo = new UserBoothBO();

            ModelView.ModifyResult <UserBooth> afterTransactionModel;
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var userBooth = userBoothBo.Get(this.ConnectionHandler, user, boothId);
                if (userBooth.TempId == null)
                {
                    return(Guid.Empty);
                }
                afterTransactionModel = userBoothBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                                                 (Guid)userBooth.TempId);
                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.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();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (afterTransactionModel.SendInform)
                {
                    userBoothBo.InformUserboothReserv(ConnectionHandler, congressId, afterTransactionModel.InformList);
                }
            }
            catch (Exception)
            {
            }
            return(afterTransactionModel == null ? Guid.Empty : afterTransactionModel.TransactionId);
        }
Esempio n. 6
0
        public ModelView.UserCardModel GetBoothOfficerCard(Guid Id, Guid boothId, Guid userId)
        {
            try
            {
                var userBo         = new UserBO();
                var boothOfficerBo = new BoothOfficerBO();
                var user           = userBo.Get(this.ConnectionHandler, userId);


                var homa          = new HomaBO().Get(this.ConnectionHandler, user.CongressId);
                var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId,
                                                                     homa.Configuration.CardLanguageId);
                var list      = new ModelView.UserCardModel();
                var userBooth = new UserBoothBO().Get(this.ConnectionHandler, userId, boothId);
                if (userBooth.Status == (byte)Enums.RezervState.PayConfirm ||
                    userBooth.Status == (byte)Enums.RezervState.Finalconfirm)
                {
                    var boothOfficers = boothOfficerBo.Get(this.ConnectionHandler, Id, boothId, userId);
                    if (boothOfficers == null)
                    {
                        return(list);
                    }
                    list =
                        boothOfficerBo.GetCardList(this.ConnectionHandler, user, configcontent, homa,
                                                   new List <BoothOfficer>()
                    {
                        boothOfficers
                    }).FirstOrDefault();
                }
                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);
            }
        }
Esempio n. 7
0
        public IEnumerable <UserBooth> Search(Guid id, byte?status, string registerDate, string searchvalue,
                                              FormStructure formStructure)
        {
            try
            {
                var userBoothBo = new UserBoothBO();
                var outlist     = userBoothBo.Search(this.ConnectionHandler, searchvalue, id, status, registerDate, formStructure);

                return(outlist);
            }
            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);
            }
        }
Esempio n. 8
0
        public IEnumerable <ModelView.UserCardModel> GetCardList(Guid boothId, Guid userId)
        {
            try
            {
                var userBo         = new UserBO();
                var boothOfficerBo = new BoothOfficerBO();
                var user           = userBo.Get(this.ConnectionHandler, userId);

                var homa = new HomaBO().Get(this.ConnectionHandler, user.CongressId);

                var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId,
                                                                     homa.Configuration.CardLanguageId);
                var list      = new List <ModelView.UserCardModel>();
                var userBooth = new UserBoothBO().Get(this.ConnectionHandler, userId, boothId);
                if (userBooth.Status == (byte)Enums.RezervState.PayConfirm ||
                    userBooth.Status == (byte)Enums.RezervState.Finalconfirm)
                {
                    var boothOfficers = boothOfficerBo.Where(this.ConnectionHandler, x =>

                                                             x.BoothId == boothId &&
                                                             x.UserId == userId
                                                             );
                    list = boothOfficerBo.GetCardList(this.ConnectionHandler, user, configcontent, homa,
                                                      boothOfficers);
                }
                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);
            }
        }
Esempio n. 9
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));
        }
Esempio n. 10
0
        public bool UpdateList(Guid congressId, List <UserBooth> list)
        {
            var  userBoothBo   = new UserBoothBO();
            var  keyValuePairs = new ModelView.InFormEntitiyList <UserBooth>();
            bool result;

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                foreach (var rezerUserModel in list)
                {
                    var transactionTransactionalFacade =
                        PaymentComponenets.Instance.TransactionTransactionalFacade(this.PaymentConnection);
                    var obj = userBoothBo.Get(this.ConnectionHandler, rezerUserModel.UserId, rezerUserModel.BoothId);
                    if (obj == null)
                    {
                        continue;
                    }
                    obj.Status = rezerUserModel.Status;
                    if (obj.Status == (byte)Enums.RezervState.PayConfirm)
                    {
                        if (obj.TransactionId != null)
                        {
                            if (!transactionTransactionalFacade.Done((Guid)obj.TransactionId))
                            {
                                throw new Exception("خطایی در ثبت تراکنش وجود دارد");
                            }
                        }
                    }

                    if (!userBoothBo.Update(this.ConnectionHandler, obj))
                    {
                        throw new Exception("خطایی در ویرایش رزرو غرفه کاربر وجود دارد");
                    }
                    keyValuePairs.Add(obj, Resources.Congress.BoothChangeStatusEmail, Resources.Congress.BoothChangeStatusSMS);
                }



                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
                result = true;
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.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();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    userBoothBo.InformUserboothReserv(this.ConnectionHandler, congressId, keyValuePairs);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 11
0
 public Guid UpdateStatusAfterTransactionGroupTemp(Guid userId, Guid id)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.ReservationConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         var tempTransactionalFacade = PaymentComponenets.Instance.TempTransactionalFacade(this.PaymentConnection);
         var tr = tempTransactionalFacade.RemoveTempAndReturnTransaction(id);
         if (tr == null)
         {
             return(Guid.Empty);
         }
         var byFilter = tempTransactionalFacade.Where(x => x.ParentId == id);
         if (byFilter.Any())
         {
             var userBo         = new UserBO();
             var userBoothBo    = new UserBoothBO();
             var articleBo      = new ArticleBO();
             var hotelUserBo    = new HotelUserBO();
             var workShopUserBo = new WorkShopUserBO();
             foreach (var temp in byFilter)
             {
                 workShopUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                             userId, temp.Id);
                 hotelUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, userId,
                                                          temp.Id);
                 articleBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                        this.FileManagerConnection, temp.Id, new ModelView.InFormEntitiyList <RefereeCartable>());
                 userBoothBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, temp.Id);
                 userBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                     this.ReservationConnection, userId, temp.Id);
                 tempTransactionalFacade.RemoveTempAndReturnTransaction(temp.Id);
             }
         }
         this.ConnectionHandler.CommitTransaction();
         this.PaymentConnection.CommitTransaction();
         this.FileManagerConnection.CommitTransaction();
         this.ReservationConnection.CommitTransaction();
         return(tr.Id);
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.RollBack();
         this.FileManagerConnection.RollBack();
         this.ReservationConnection.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.FileManagerConnection.RollBack();
         this.ReservationConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }