public override bool Delete(params object[] keys) { try { var obj = new HotelBO().Get(this.ConnectionHandler, keys); var list = new HotelUserBO().Any(ConnectionHandler, supporter => supporter.HotelId == obj.Id); if (list) { throw new Exception(Resources.Congress.ErrorInDeleteHotelBecauseThisReserved); } if (!new HotelBO().Delete(this.ConnectionHandler, keys)) { throw new Exception(Resources.Congress.ErrorInDeleteHotel); } 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); } }
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 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) { } }
public bool HotelUserUpdate(Guid congressId, HotelUser hotelUser, FormStructure formModel) { bool result = false; var entitiys = new ModelView.InFormEntitiyList <HotelUser>(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); result = new HotelUserBO().HotelUserUpdate(this.ConnectionHandler, this.FormGeneratorConnection, hotelUser, formModel); entitiys.Add( hotelUser, Resources.Congress.HotelUpdateEmail, Resources.Congress.HotelUpdateSMS ); 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 HotelUserBO().InformHotelReserv(this.ConnectionHandler, congressId, entitiys); } } catch (Exception) { } return(result); }
public IEnumerable <HotelUser> Search(Guid hotelId, byte?status, string registerDate, string searchvalue, FormStructure formStructure) { try { var hotelUserBo = new HotelUserBO(); var list = hotelUserBo.Search(this.ConnectionHandler, hotelId, status, registerDate, searchvalue, formStructure); 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); } }
public Guid UpdateStatusAfterTransaction(Guid congressid, Guid userId, Guid tempId) { ModelView.ModifyResult <HotelUser> afterTransactionModel; try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted); afterTransactionModel = new HotelUserBO().UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, userId, 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) { new HotelUserBO().InformHotelReserv(ConnectionHandler, congressid, afterTransactionModel.InformList); } } catch (Exception) { } return(afterTransactionModel.TransactionId); }
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 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); } }