public string FillTempAdditionalData(IConnectionHandler connectionHandler, Guid congressId) { var configuration = new ConfigurationBO().SelectFirstOrDefault(connectionHandler, new Expression <Func <Configuration, object> >[] { x => x.BankId, x => x.PaymentType, x => x.TerminalId, x => x.TerminalUserName, x => x.TerminalPassword, x => x.CertificatePath, x => x.CertificatePassword, x => x.MerchantId, x => x.MerchantPublicKey, x => x.MerchantPrivateKey }, x => x.CongressId == congressId); if (configuration == null) { throw new Exception(Resources.Congress.Congresshasnotdonesetting); } if (string.IsNullOrEmpty(configuration.PaymentType)) { throw new Exception(Resources.Congress.Nopaymenthasbeenselectedfortheconference); } var merchantPublicKey = (configuration.MerchantPublicKey != null ? configuration.MerchantPublicKey : String.Empty); var merchantPrivateKey = (configuration.MerchantPrivateKey != null ? configuration.MerchantPrivateKey : String.Empty); var certificatePath = (configuration.CertificatePath != null ? configuration.CertificatePath : String.Empty); var certificatePassword = (configuration.CertificatePassword != null ? configuration.CertificatePassword : String.Empty); var terminalId = (configuration.TerminalId != null ? configuration.TerminalId : String.Empty); var bankId = (configuration.BankId != null ? (byte)configuration.BankId : (byte?)null); var terminalUserName = (configuration.TerminalUserName != null ? configuration.TerminalUserName : String.Empty); var terminalPassword = (configuration.TerminalPassword != null ? configuration.TerminalPassword : String.Empty); var merchantId = (configuration.MerchantId != null ? configuration.MerchantId : String.Empty); var paymentType = (configuration.PaymentType != null ? configuration.PaymentType : String.Empty); return(Radyn.Payment.Tools.Extentions.FillTempAdditionalData(paymentType, bankId, Constants.PaytypeUrl, terminalId, terminalUserName, terminalPassword, certificatePath, certificatePassword, merchantId, merchantPublicKey, merchantPrivateKey)); }
public ModelView.ModifyResult <RefereeCartable> AssigneArticleToRefreeCartabl(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconection, Guid articleId, Guid flowsender, List <Guid> refereesId, bool specialrefereesender = false) { var keyValuePairs = new ModelView.ModifyResult <RefereeCartable>(); var articleBo = new ArticleBO(); var article = articleBo.Get(connectionHandler, articleId); var config = new ConfigurationBO().ValidConfig(connectionHandler, article.CongressId); article.FinalState = (byte)Enums.FinalState.WaitForAnswer; bool articleSpecialReferee = config.SentArticleSpecialReferee; if (refereesId.Count > 0) { if (config.SentArticleSpecialReferee) { if (specialrefereesender) { articleSpecialReferee = false; article.Status = (byte)Enums.ArticleState.WaitForRefereeOpinion; } else { article.Status = (byte)Enums.ArticleState.SentToSpecialReferee; } } else { article.Status = (byte)Enums.ArticleState.WaitForRefereeOpinion; } } if (!articleBo.Update(connectionHandler, article)) { return(keyValuePairs); } if ( !this.UpdateRefreeCartabl(connectionHandler, filemanagerconection, article, flowsender, refereesId, articleSpecialReferee)) { return(keyValuePairs); } foreach (var guid in refereesId) { keyValuePairs.AddInform( new RefereeCartable() { RefereeId = guid, ArticleId = articleId }, Resources.Congress.RefereeInformArticleEmail, Resources.Congress.RefereeInformArticleSMS); } keyValuePairs.Result = true; keyValuePairs.SendInform = true; return(keyValuePairs); }
public void InformRefereeRegister(IConnectionHandler connectionHandler, Guid congressId, ModelView.InFormEntitiyList <Referee> valuePairs) { if (!valuePairs.Any()) { return; } var config = new ConfigurationBO().Get(connectionHandler, congressId); if (config.RefereeInformType == null) { return; } var homa1 = new HomaBO().Get(connectionHandler, config.CongressId); CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == congressId && x.Type == Enums.MessageInformType.Referee); var @where = this.Where(connectionHandler, x => x.Id.In(valuePairs.Select(i => i.obj.Id))); foreach (var valuePair in valuePairs) { var referee = @where.FirstOrDefault(x => x.Id == valuePair.obj.Id); if (referee == null) { continue; } var name = referee.EnterpriseNode.DescriptionFieldWithGender; var homaRefereePanelUrl = homa1.GetHomaRefereePanelUrl(); var homaCompleteUrl = homa1.GetHomaCompleteUrl(); var email = string.Format(valuePair.EmailBody, homa1.CongressTitle, name, homaCompleteUrl, homaRefereePanelUrl, valuePair.obj.Username, valuePair.obj.PasswordWithoutHash); var sms = string.Format(valuePair.SmsBody, homa1.CongressTitle, name, homaRefereePanelUrl, valuePair.obj.Username, valuePair.obj.PasswordWithoutHash); if (custommessage != null) { if (!string.IsNullOrEmpty(custommessage.EmailText)) { email = custommessage.EmailText.Replace($"[{Enums.RefereeMessageKey.FullName.ToString()}]", name); email = email.Replace($"[{Enums.RefereeMessageKey.Username.ToString()}]", referee.Username); email = email.Replace($"[{Enums.RefereeMessageKey.Email.ToString()}]", referee.EnterpriseNode.Email); email = email.Replace($"[{Enums.RefereeMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle); email = email.Replace($"[{Enums.RefereeMessageKey.Password.ToString()}]", valuePair.obj.PasswordWithoutHash); email = email.Replace($"[{Enums.RefereeMessageKey.CongressAddress.ToString()}]", homaCompleteUrl); } if (!string.IsNullOrEmpty(custommessage.SmsText)) { sms = custommessage.SmsText.Replace($"[{Enums.RefereeMessageKey.FullName.ToString()}]", name); sms = sms.Replace($"[{Enums.RefereeMessageKey.Username.ToString()}]", referee.Username); sms = sms.Replace($"[{Enums.RefereeMessageKey.Email.ToString()}]", referee.EnterpriseNode.Email); sms = sms.Replace($"[{Enums.RefereeMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle); sms = sms.Replace($"[{Enums.RefereeMessageKey.Password.ToString()}]", valuePair.obj.PasswordWithoutHash); sms = sms.Replace($"[{Enums.RefereeMessageKey.CongressAddress.ToString()}]", homaCompleteUrl); } } var inform = new Message.Tools.ModelView.MessageModel() { Email = referee.EnterpriseNode.Email, Mobile = referee.EnterpriseNode.Cellphone, EmailTitle = homa1.DescriptionField, EmailBody = email, SMSBody = sms }; new HomaBO().SendInform((byte)config.RefereeInformType, inform, config, homa1.CongressTitle); MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa1.OwnerId, config.CongressId, new[] { referee.Id.ToString() }, homa1.CongressTitle, inform.SMSBody); } }
public bool AnswerArticle(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconnection, Guid congressId, RefereeCartable refereeCartable, Guid answeredrefreeId, string comments, HttpPostedFileBase attachment) { var articleBo = new ArticleBO(); var articleFlowBo = new ArticleFlowBO(); var config = new ConfigurationBO().ValidConfig(connectionHandler, congressId); var refree = new RefereeBO().Get(connectionHandler, answeredrefreeId); if (!this.ModifyCartabl(connectionHandler, refereeCartable.ArticleId, answeredrefreeId, refereeCartable.Status, refereeCartable.Visited, false)) { return(false); } var article = articleBo.Get(connectionHandler, refereeCartable.ArticleId); article.FinalState = (byte)Enums.FinalState.WaitForAnswer; if (config.SentArticleSpecialReferee) { article.Status = refree.IsSpecial ? (byte)Enums.ArticleState.WaitForScientificTeacher : (byte)Enums.ArticleState.WaitforSpecialRefereeOpinion; } else { article.Status = (byte)Enums.ArticleState.WaitForScientificTeacher; } if (!articleBo.Update(connectionHandler, article)) { throw new Exception(string.Format(Resources.Congress.ErrorInEditArticleCongress, Extention.GetAtricleTitle(article.CongressId))); } var lastSenderId = new ArticleFlowBO().SelectFirstOrDefault(connectionHandler, x => x.SenderId, x => x.ReceiverId == answeredrefreeId && x.ArticleId == article.Id, new OrderByModel <ArticleFlow>() { Expression = x => x.SaveDate + "" + x.SaveTime, OrderType = OrderType.DESC }); var lastrefree = new RefereeBO().Get(connectionHandler, lastSenderId); if (lastrefree != null && lastrefree.IsSpecial) { var lastrefereeCartable = new RefereeCartable(); lastrefereeCartable = this.FirstOrDefaultWithOrderByDescending(connectionHandler, x => x.InsertDate, x => x.ArticleId == article.Id && x.RefereeId == lastrefree.Id); if (lastrefereeCartable != null) { if (!this.ModifyCartabl(connectionHandler, lastrefereeCartable.ArticleId, lastSenderId, (byte)Enums.FinalState.RefereeAnswered, lastrefereeCartable.Visited, false)) { return(false); } } else { if (!this.ModifyCartabl(connectionHandler, article.Id, lastSenderId, (byte)Enums.FinalState.WaitForAnswer, false, true)) { return(false); } } if (!articleFlowBo.AddFlow(connectionHandler, filemanagerconnection, answeredrefreeId, lastSenderId != Guid.Empty ? lastSenderId : (Guid?)null, refereeCartable.ArticleId, refereeCartable.Status, comments, attachment)) { return(false); } } else { var articleFlow = articleFlowBo.FirstOrDefaultWithOrderBy(connectionHandler, x => x.SaveDate + " " + x.SaveTime, x => x.ArticleId == refereeCartable.ArticleId && x.ReceiverId == answeredrefreeId); var senderId = articleFlow != null ? articleFlow.SenderId : (Guid?)null; if (!articleFlowBo.AddFlow(connectionHandler, filemanagerconnection, answeredrefreeId, senderId, refereeCartable.ArticleId, refereeCartable.Status, comments, attachment)) { return(false); } } return(true); }