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) { } }
public KeyValuePair <bool, Guid> HotelUserInsert(Guid congressId, Guid hotelId, User parentUser, List <DiscountType> discountAttaches, string callBackurl, FormGenerator.DataStructure.FormStructure formModel, int dayCount, List <Guid> userIdlist) { KeyValuePair <bool, Guid> keyValuePair; var entitiys = new ModelView.InFormEntitiyList <HotelUser>(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted); this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); var hotelUserInsertGroup = new HotelUserBO().HotelUserInsert(this.ConnectionHandler, this.PaymentConnection, this.FormGeneratorConnection, hotelId, parentUser, discountAttaches, callBackurl, formModel, dayCount, userIdlist); if (hotelUserInsertGroup.Key && userIdlist.Count > 0) { entitiys.Add( new HotelUser() { HotelId = hotelId, UserId = parentUser.Id }, Resources.Congress.HotelInsertEmail, Resources.Congress.HotelInsertSMS ); } this.ConnectionHandler.CommitTransaction(); this.PaymentConnection.CommitTransaction(); this.FormGeneratorConnection.CommitTransaction(); keyValuePair = new KeyValuePair <bool, Guid>(hotelUserInsertGroup.Key, hotelUserInsertGroup.Value); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.PaymentConnection.RollBack(); this.FormGeneratorConnection.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(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (keyValuePair.Key) { new HotelUserBO().InformHotelReserv(this.ConnectionHandler, congressId, entitiys); } } catch (Exception) { } return(keyValuePair); }
public bool Insert(Referee referee, HttpPostedFileBase fileBase, List <Guid> pivots) { var dictionary = new ModelView.InFormEntitiyList <Referee>(); var result = false; try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted); if (!string.IsNullOrEmpty(referee.Password)) { referee.PasswordWithoutHash = referee.Password; } if (!new RefereeBO().Insert(this.ConnectionHandler, this.EnterpriseNodeConnection, referee, fileBase, pivots)) { throw new Exception(Resources.Congress.ErrorInSaveReferee); } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); if (referee.SendInform) { dictionary.Add(referee, Resources.Congress.RefereeInsertEmail, Resources.Congress.RefereeInsertSMS); } result = true; } catch (KnownException ex) { this.ConnectionHandler.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.EnterpriseNodeConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { //ارسال پیغام به داور if (result) { new RefereeBO().InformRefereeRegister(this.ConnectionHandler, referee.CongressId, dictionary); } } catch { } return(result); }
public bool AdminUpdateArticles(Guid congressId, List <Article> model) { ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>(); bool result; ArticleBO articleBo = new ArticleBO(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); var transactionTransactionalFacade = PaymentComponenets.Instance.TransactionTransactionalFacade(PaymentConnection); var list = articleBo.Where(ConnectionHandler, x => x.Id.In(model.Select(article => article.Id))); foreach (Article obj in list) { articleBo.AdminSetStatus(obj); if (obj.PayStatus.HasValue) { obj.PayStatus = obj.PayStatus; if (obj.PayStatus == (byte)Enums.ArticlepayState.PayConfirm && obj.TransactionId != null) { transactionTransactionalFacade.Done((Guid)obj.TransactionId); } } articleBo.Update(ConnectionHandler, obj); articles.Add(obj, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS); } ConnectionHandler.CommitTransaction(); result = true; } catch (KnownException ex) { ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (result) { articleBo.InformArticle(ConnectionHandler, congressId, articles); } } catch (Exception) { } return(result); }
public bool UpdateStatus(Guid congressId, List <Guid> guids, FinalState status) { ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>(); bool result; ArticleBO articleBo = new ArticleBO(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); if (!guids.Any()) { return(true); } List <Article> list = articleBo.Where(ConnectionHandler, x => x.Id.In(guids)); foreach (Article item in list) { item.FinalState = (byte)status; articleBo.AdminSetStatus(item); articleBo.Update(ConnectionHandler, item); articles.Add(item, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS); } ConnectionHandler.CommitTransaction(); result = true; } catch (KnownException ex) { ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (result) { articleBo.InformArticle(ConnectionHandler, congressId, articles); } } catch (Exception) { } return(result); }
public bool AdminUpdate(Guid adminId, Article obj, List <ArticleAuthors> articleAuthorses, string comment, HttpPostedFileBase flowFile, HttpPostedFileBase orginalFileId, HttpPostedFileBase abstractFileId, FormStructure formModel) { bool result; ArticleBO articleBo = new ArticleBO(); ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); Article oldsatus = articleBo.Get(ConnectionHandler, obj.Id); articleBo.AdminUpdate(ConnectionHandler, FileManagerConnection, FormGeneratorConnection, adminId, obj, articleAuthorses, orginalFileId, abstractFileId, comment, flowFile, formModel); ConnectionHandler.CommitTransaction(); FileManagerConnection.CommitTransaction(); FormGeneratorConnection.CommitTransaction(); result = true; if (oldsatus.Status != obj.Status) { articles.Add(obj, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS); } } catch (KnownException ex) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); FormGeneratorConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); FormGeneratorConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { articleBo.InformArticle(ConnectionHandler, obj.CongressId, articles); } catch (Exception) { } return(result); }
public bool ArticlePaymnet(Article article, List <DiscountType> transactionDiscountAttaches, string callbackurl) { bool Resultpaymnet; ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted); if ( !new ArticleBO().ArticlePaymnet(ConnectionHandler, PaymentConnection, ref article, transactionDiscountAttaches, callbackurl)) { return(false); } ConnectionHandler.CommitTransaction(); PaymentConnection.CommitTransaction(); Resultpaymnet = true; articles.Add(article, Resources.Congress.ArticlePaymentEmail, Resources.Congress.ArticlePaymentSMS); } catch (KnownException ex) { ConnectionHandler.RollBack(); PaymentConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { ConnectionHandler.RollBack(); PaymentConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (Resultpaymnet) { new ArticleBO().InformArticle(ConnectionHandler, article.CongressId, articles); } } catch (Exception) { } return(Resultpaymnet); }
public bool WorkShopUserUpdate(Guid congressId, WorkShopUser WorkShop, FormStructure formModel) { bool result = false; var entitiys = new ModelView.InFormEntitiyList <WorkShopUser>(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); result = new WorkShopUserBO().WorkShopUserUpdate(this.ConnectionHandler, this.FormGeneratorConnection, WorkShop, formModel); entitiys.Add( WorkShop, Resources.Congress.WorkShopInsertEmail, Resources.Congress.WorkShopInsertSMS ); this.ConnectionHandler.CommitTransaction(); this.FormGeneratorConnection.CommitTransaction(); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FormGeneratorConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FormGeneratorConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (result) { new WorkShopUserBO().InformWorkShopReserv(this.ConnectionHandler, congressId, entitiys); } } catch (Exception) { } return(result); }
public bool UserInsert(Article article, List <ArticleAuthors> articleAuthorses, HttpPostedFileBase abstractFileId, HttpPostedFileBase orginalFileId, FormStructure formModel) { bool result = false; ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>(); ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>(); ArticleBO articleBo = new ArticleBO(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); if ( !articleBo.UserInsert(ConnectionHandler, FileManagerConnection, FormGeneratorConnection, article, articleAuthorses, abstractFileId, orginalFileId, formModel)) { return(false); } if (!articleBo.SendArticle(ConnectionHandler, FileManagerConnection, article, keyValuePairs)) { return(false); } ConnectionHandler.CommitTransaction(); FileManagerConnection.CommitTransaction(); FormGeneratorConnection.CommitTransaction(); result = true; articles.Add( article, Resources.Congress.ArticleInsertEmail, Resources.Congress.ArticleInsertSMS ); } catch (KnownException) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); FormGeneratorConnection.RollBack(); throw; } catch (Exception ex) { ConnectionHandler.RollBack(); FileManagerConnection.RollBack(); FormGeneratorConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { articleBo.InformArticle(ConnectionHandler, article.CongressId, articles); new RefereeBO().InformRefereeAddArticle(ConnectionHandler, article.CongressId, keyValuePairs); } catch (Exception) { } return(result); }
public bool UpdateList(Guid congressId, List <HotelUser> list) { bool result; var hotelUserBO = new HotelUserBO(); var entitiys = new ModelView.InFormEntitiyList <HotelUser>(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted); var transactionTransactionalFacade = PaymentComponenets.Instance.TransactionTransactionalFacade(this.PaymentConnection); var userBo = new UserBO(); foreach (var hotelUser1 in list) { var hotelUser = Get(hotelUser1.HotelId, hotelUser1.UserId); if (hotelUser == null) { continue; } hotelUser.Status = hotelUser1.Status; if (hotelUser.Status == (byte)Enums.RezervState.PayConfirm) { if (hotelUser.TransactionId != null) { if (!transactionTransactionalFacade.Done((Guid)hotelUser.TransactionId)) { return(false); } } } if (!hotelUserBO.Update(this.ConnectionHandler, hotelUser)) { throw new Exception(Resources.Congress.ErrorInEditHotelReserv); } var user = userBo.Get(this.ConnectionHandler, hotelUser1.UserId); if (entitiys.All(x => x.obj.UserId != hotelUser.UserId)) { entitiys.Add(hotelUser , Resources.Congress.HotelChangeStatusEmail, Resources.Congress.HotelChangeStatusSMS); } if (!user.ParentId.HasValue || entitiys.Any(x => x.obj.UserId == user.ParentId)) { continue; } entitiys.Add( new HotelUser() { UserId = (Guid)user.ParentId, HotelId = hotelUser1.HotelId, Status = hotelUser1.Status } , Resources.Congress.HotelChangeStatusEmail, Resources.Congress.HotelChangeStatusSMS ); } 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) { hotelUserBO.InformHotelReserv(this.ConnectionHandler, congressId, entitiys); } } catch (Exception) { } return(result); }
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)); }
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); }