public Dictionary <Referee, bool> GetAllForArticle(Guid congressId, Guid articleId, bool isSpecial = false) { try { var list = new RefereeBO().OrderBy(this.ConnectionHandler, x => x.EnterpriseNode.RealEnterpriseNode.FirstName + " " + x.EnterpriseNode.RealEnterpriseNode.LastName, x => x.CongressId == congressId); var getAllForArticle = new Dictionary <Referee, bool>(); var refereeCartableBo = new RefereeCartableBO(); var addedList = refereeCartableBo.Select(this.ConnectionHandler, x => x.RefereeId, x => x.ArticleId == articleId && x.IsActive, true); var listAllCartable = refereeCartableBo.Select(this.ConnectionHandler, new Expression <Func <RefereeCartable, object> >[] { x => x.RefereeId, x => x.Status }, x => x.Referee.CongressId == congressId, true); foreach (var referee in list) { var res = addedList.Any(x => x == referee.Id); if (!res && referee.IsSpecial != isSpecial) { continue; } referee.AllArticleCount = listAllCartable.Count(x => x.RefereeId == referee.Id); referee.WaitForAnswerArticleCount = listAllCartable.Count(x => x.RefereeId == referee.Id && x.Status == (byte)Enums.FinalState.WaitForAnswer); getAllForArticle.Add(referee, res); } return(getAllForArticle); } 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 List <Referee> SearchRefree(string text, Guid congressId) { var list = new RefereeBO().SearchRefree(ConnectionHandler, text, congressId); var refereeBo = new RefereeBO(); refereeBo.SetArticleCount(ConnectionHandler, list, congressId); return(list); }
public List <Referee> GetAllrefreeWithCartable(Guid homaId) { var bo = new RefereeBO(); var list = bo.OrderBy(this.ConnectionHandler, x => x.EnterpriseNode.RealEnterpriseNode.FirstName + " " + x.EnterpriseNode.RealEnterpriseNode.LastName, x => x.CongressId == homaId); var refereeBo = new RefereeBO(); refereeBo.SetArticleCount(ConnectionHandler, list, homaId); return(list); }
public bool SentArticle(Article article, HttpPostedFileBase orginalFileId, FormStructure formModel) { ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>(); bool result; RefereeBO refereeBo = new RefereeBO(); try { ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted); if (orginalFileId != null) { article.OrginalFileId = FileManagerComponent.Instance.FileTransactionalFacade(FileManagerConnection) .Insert(orginalFileId); } new ArticleBO().SetStatus(article); ArticleBO articleBo = new ArticleBO(); FormGeneratorComponent.Instance.FormDataTransactionalFacade(FormGeneratorConnection).ModifyFormData(formModel); articleBo.Update(ConnectionHandler, article); articleBo.SendArticle(ConnectionHandler, FileManagerConnection, article, keyValuePairs); ConnectionHandler.CommitTransaction(); FileManagerConnection.CommitTransaction(); FormGeneratorConnection.CommitTransaction(); result = true; } 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 { if (result) { refereeBo.InformRefereeAddArticle(ConnectionHandler, article.CongressId, keyValuePairs); } } catch (Exception) { } return(result); }
public override bool Delete(params object[] keys) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted); var obj = new RefereeBO().Get(this.ConnectionHandler, keys); var byFilter = new RefereeCartableBO().Any(this.ConnectionHandler, cartable => cartable.RefereeId == obj.Id); if (byFilter) { throw new Exception(Resources.Congress.ErrorInDeleteRefereeBecauseHisCartablContainArticle); } var refereePivotBo = new RefereePivotBO(); var list = refereePivotBo.Select(this.ConnectionHandler, x => x.PivotId, x => x.RefereeId == obj.Id); foreach (var refereePivot in list) { if (!refereePivotBo.Delete(this.ConnectionHandler, obj.Id, refereePivot)) { throw new Exception(Resources.Congress.ErrorInEditReferee); } } if (!new RefereeBO().Delete(this.ConnectionHandler, keys)) { throw new Exception(Resources.Congress.ErrorInDeleteReferee); } if ( !EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(this.EnterpriseNodeConnection) .Delete(keys)) { return(false); } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); return(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); } }
public bool InsertList(List <Referee> referee) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted); var @select = new RefereeBO().Select(ConnectionHandler, x => x.Id); var refereeBo = new RefereeBO(); foreach (var refe in referee) { if (@select.All(x => x != refe.Id)) { if (!refereeBo.Insert(this.ConnectionHandler, this.EnterpriseNodeConnection, refe)) { throw new Exception(Resources.Congress.ErrorInSaveUser); } @select.Add(refe.Id); } else { if (!refereeBo.Update(this.ConnectionHandler, this.EnterpriseNodeConnection, refe)) { throw new Exception(Resources.Congress.ErrorInSaveUser); } } } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); return(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); } }
public bool CheckOldPassword(Guid refreeId, string password) { try { var referee = new RefereeBO().Get(this.ConnectionHandler, refreeId); return(referee.Password.Equals(StringUtils.HashPassword(password))); } 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 bool SpecialRefereeAssignArticle(Guid congressId, RefereeCartable refereeCartable, Guid answeredrefreeId, string comments, HttpPostedFileBase attachment, List <Guid> refreeIdlist) { ModelView.ModifyResult <RefereeCartable> keyValuePairs; var refereeBo = new RefereeBO(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); keyValuePairs = new RefereeCartableBO().SpecialRefereeAssignArticle(this.ConnectionHandler, this.FileManagerConnection, congressId, refereeCartable, answeredrefreeId, comments, attachment, refreeIdlist); this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (keyValuePairs.SendInform) { refereeBo.InformRefereeAddArticle(this.ConnectionHandler, congressId, keyValuePairs.InformList); } } catch (Exception) { } return(keyValuePairs.Result); }
public bool AssigneArticleToRefreeCartabl(Guid congressId, Guid articleId, Guid flowsender, List <Guid> refereesId) { ModelView.ModifyResult <RefereeCartable> keyValuePairs; var refereeBo = new RefereeBO(); try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); keyValuePairs = new RefereeCartableBO().AssigneArticleToRefreeCartabl(this.ConnectionHandler, this.FileManagerConnection, articleId, flowsender, refereesId); this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } try { if (keyValuePairs.SendInform) { refereeBo.InformRefereeAddArticle(this.ConnectionHandler, congressId, keyValuePairs.InformList); } } catch (Exception) { } return(keyValuePairs.Result); }
public IEnumerable <ArticleFlow> GetArticleFlow(Guid congressId, Guid articelId, Guid?filterId = null, bool?isReferee = null, bool?isuser = null) { try { var predicateBuilder = new PredicateBuilder <ArticleFlow>(); predicateBuilder.And(x => x.ArticleId == articelId); if (filterId.HasValue) { predicateBuilder.And(x => x.ReceiverId == filterId || x.SenderId == filterId); if (isuser.HasValue && isuser == true) { var guids = new RefereeBO().Select(this.ConnectionHandler, x => x.Id, x => x.CongressId == congressId); if (guids.Any()) { predicateBuilder.And(x => (x.SenderId == null || x.SenderId.NotIn(guids)) && (x.ReceiverId == null || x.ReceiverId.Value.NotIn(guids))); } } if (isReferee.HasValue && isReferee.Value) { var users = new UserBO().Select(this.ConnectionHandler, c => c.Id, c => c.CongressId == congressId); if (users.Any()) { predicateBuilder.And(x => (x.SenderId == null || x.SenderId.NotIn(users)) && (x.ReceiverId == null || x.ReceiverId.Value.NotIn(users))); } } } var list = new ArticleFlowBO().OrderByDescending(this.ConnectionHandler, x => x.SaveDate + "" + x.SaveTime, predicateBuilder.GetExpression()); var @select = new RefereeCartableBO().Select(base.ConnectionHandler, new Expression <Func <RefereeCartable, object> >[] { x => x.Status, x => x.RefereeId }, i => i.ArticleId == articelId, new OrderByModel <RefereeCartable>() { Expression = x => x.InsertDate, OrderType = OrderType.DESC }); foreach (var item in list) { if (item.Status != null) { item.LastRefreeView = ((Enums.FinalState)item.Status).GetDescriptionInLocalization(); } else if (item.Sender != null) { var refereeCartable = @select.FirstOrDefault(i => i.RefereeId == item.SenderId); if (refereeCartable != null) { item.LastRefreeView = ((Enums.FinalState)refereeCartable.Status).GetDescriptionInLocalization(); } } item.Remark = item.Remark.Replace("\r\n", "<br />"); } 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); } }