public TokenController(UserManager <User> userMgr, IPasswordHasher <User> hasher, IConfiguration config, FarmboekContext T) { _userMgr = userMgr; _hasher = hasher; _config = config; communicationRepository = new CommunicationRepository(T); }
public async void Can_update_email_status() { // Arrange var emailCommunication = new EmailCommunication { Status = EmailCommunicationStatus.Pending }; var sut = new CommunicationRepository(); // Act var emailCommunicationId = await sut.CreateEmail(emailCommunication); var retrievedEmailCommunication = await sut.RetrieveEmail(emailCommunicationId); Assert.Equal(EmailCommunicationStatus.Pending, retrievedEmailCommunication.Status); await sut.UpdateEmailStatus(retrievedEmailCommunication.Id, EmailCommunicationStatus.Sent); var updatedEmailCommunication = await sut.RetrieveEmail(emailCommunicationId); // Assert Assert.Equal(EmailCommunicationStatus.Sent, updatedEmailCommunication.Status); }
public DetectorFTDI() { _ftdiRepository = new CommunicationRepository(); _ftdiRepository.DeviceInserted += DeviceInserted; _ftdiRepository.DeviceIdentified += DeviceIdentified; _ftdiRepository.DeviceRemoved += DeviceRemoved; }
public void TestThatConstructorInitializeCommunicationRepository() { var configurationRepositoryMock = MockRepository.GenerateMock <IConfigurationRepository>(); var communicationRepository = new CommunicationRepository(configurationRepositoryMock); Assert.That(communicationRepository, Is.Not.Null); }
public void SetUp() { _ministryPlatformService = new Mock <IMinistryPlatformService>(); _authService = new Mock <IAuthenticationRepository>(); _configWrapper = new Mock <IConfigurationWrapper>(); _authService.Setup(m => m.Authenticate(It.IsAny <string>(), It.IsAny <string>())).Returns(new Dictionary <string, object> { { "token", "ABC" }, { "exp", "123" } }); _fixture = new CommunicationRepository(_ministryPlatformService.Object, _authService.Object, _configWrapper.Object); }
/// <summary> /// Handles the communication so welcome letter will be dispatched to the household member. /// </summary> /// <param name="stakeholder">Stakeholder which data should be dispatched to.</param> /// <param name="householdMember">Household member which should receive the welcome letter.</param> /// <param name="translationInfo">Translation informations used to translate the data to dispatch.</param> protected override void HandleCommunication(IStakeholder stakeholder, IHouseholdMember householdMember, ITranslationInfo translationInfo) { var welcomeLetterStaticText = _systemDataRepository.StaticTextGetByStaticTextType(StaticTextType.WelcomeLetter); welcomeLetterStaticText.Translate(translationInfo.CultureInfo); _staticTextFieldMerge.AddMergeFields(householdMember, translationInfo); _staticTextFieldMerge.Merge(welcomeLetterStaticText, translationInfo); CommunicationRepository.SendMail(stakeholder.MailAddress, welcomeLetterStaticText.SubjectTranslation.Value, welcomeLetterStaticText.BodyTranslation.Value); }
public void addLinkToResult(string url, string title) { lock (theLinkLock) { Program.newsTitlePlusLink.Add(url, title); News news = new News() { Title = title, Url = url }; CommunicationRepository.CreateNews(news); } }
public Datahandling() { RepositoryPerson = new PersonRepository(Entities); RepositoryAddress = new AddressRepository(Entities); RepositoryDocument = new DocumentRepository(Entities); RepositoryAddressPerson = new AddressPersonRepository(Entities); RepositoryCourse = new CourseRepository(Entities); RepositoryContact = new ContactRepository(Entities); RepositoryComment = new CommentRepository(Entities); RepositoryCommunication = new CommunicationRepository(Entities); UserRepository = new UserRepository(Entities); }
public void SetUp() { _ministryPlatformService = new Mock <IMinistryPlatformService>(); _authService = new Mock <IAuthenticationRepository>(); _configWrapper = new Mock <IConfigurationWrapper>(); _authService.Setup(m => m.Authenticate(It.IsAny <string>(), It.IsAny <string>())).Returns(new AuthToken { AccessToken = "ABC", ExpiresIn = 123 }); _fixture = new CommunicationRepository(_ministryPlatformService.Object, _authService.Object, _configWrapper.Object); }
public async void Null_returned_for_non_existent_email_communication() { // Arrange var sut = new CommunicationRepository(); // Act var retrievedEmailCommunication = await sut.RetrieveEmail(Guid.NewGuid().ToString()); // Assert Assert.Null(retrievedEmailCommunication); }
public void TestThatSendMailThrowsArgumentNullExceptionWhenBodyIsInvalid(string invalidValue) { var fixture = new Fixture(); var configurationRepositoryMock = MockRepository.GenerateMock <IConfigurationRepository>(); var communicationRepository = new CommunicationRepository(configurationRepositoryMock); Assert.That(communicationRepository, Is.Not.Null); var exception = Assert.Throws <ArgumentNullException>(() => communicationRepository.SendMail(fixture.Create <string>(), fixture.Create <string>(), invalidValue)); Assert.That(exception, Is.Not.Null); Assert.That(exception.ParamName, Is.Not.Null); Assert.That(exception.ParamName, Is.Not.Empty); Assert.That(exception.ParamName, Is.EqualTo("body")); Assert.That(exception.InnerException, Is.Null); }
public async void Can_create_and_retrieve_email_communication() { // Arrange var emailCommunication = new EmailCommunication { EmailAddress = "*****@*****.**" }; var sut = new CommunicationRepository(); // Act var emailCommunicationId = await sut.CreateEmail(emailCommunication); var retrievedEmailCommunication = await sut.RetrieveEmail(emailCommunicationId); // Assert Assert.Equal(emailCommunication.EmailAddress, retrievedEmailCommunication.EmailAddress); }
public static void RecordNotesforSendDataforCorrection(string physicianNotes, long physicianId, long eventId, long customerId) { try { var repository = new CommunicationRepository(); var orgRoleUser = IoC.Resolve <IOrganizationRoleUserRepository>(); var organizationRoleUser = orgRoleUser.GetOrganizationRoleUser(physicianId); repository.SaveCommunicationDetails(physicianNotes, organizationRoleUser, customerId, eventId); var emailNotificationModelsFactory = IoC.Resolve <IEmailNotificationModelsFactory>(); var notificationModel = emailNotificationModelsFactory.GetRecordSendBackForCorrectionNotificationViewModel(customerId, eventId, physicianId, physicianNotes); var notifier = IoC.Resolve <INotifier>(); notifier.NotifySubscribersViaEmail(NotificationTypeAlias.RecordSendBackForCorrection, EmailTemplateAlias.RecordSendBackForCorrection, notificationModel, 0, organizationRoleUser.OrganizationId, "Record Send Back For Correction"); } catch (Exception ex) { var logger = IoC.Resolve <ILogManager>().GetLogger <Global>(); logger.Error("Evaluation EventId (" + eventId + "), CustomerId (" + customerId + "), PhysicianId (" + physicianId + "). Error occured while executing Recording Physician Remarsk for Send for Correction. Message: " + ex.Message + "\n\t Stack Trace: " + ex.StackTrace); } }
public Form1() { InitializeComponent(); var entities = new PersonEntities(); CommunicationRepository repository = new CommunicationRepository(entities); var c = repository.GetCommunications <Person>(1); var d = repository.GetCommunications <Course>(1); try { var svNr = 07866987; var num = svNr.ToString().Select(x => Convert.ToInt32(x)).ToList(); var s = ConverChar(num[3]); num.Remove(num[3]); var x = 0; //3 var calc = new int[] { 3, 7, 9, 5, 8, 4, 2, 1, 6 }; //11 for (int i = 0; i < calc.Length; i++) { var carNum = ConverChar(num[i]); x += carNum * calc[i]; } var result = x % 11; bool resultBool = s == result; if (resultBool) { Console.WriteLine(); } Console.WriteLine(); } catch (Exception ex) { Console.WriteLine(ex); } }
public CommunicationsController() { unitOfWork = new UnitOfWork(); repos = new CommunicationRepository(unitOfWork); }
protected void Page_Load(object sender, EventArgs e) { // Initial Code just to hide left hand side panel for this page. var masterPage = (TecnicianManualEntry)Page.Master; if (masterPage != null) { masterPage.HideLeftContainer = true; } var accountRepository = IoC.Resolve <ICorporateAccountRepository>(); var account = accountRepository.GetbyEventId(EventId); CaptureHaf = (account == null || account.CaptureHaf); CapturePcpConsent = (account != null && account.CapturePcpConsent); IsHealthPlanEvent = (account != null && account.IsHealthPlan); //var communicationRepository = IoC.Resolve<ICommunicationRepository>(); EventCustomer eventCustomer = null; //var lastCommentAdded = communicationRepository.GetCommentsforPhysician(CustomerId, EventId); if (!IsPostBack) { var setting = IoC.Resolve <ISettings>(); var eventsRepository = IoC.Resolve <IEventRepository>(); var eventData = eventsRepository.GetById(EventId); eventCustomer = IoC.Resolve <IEventCustomerRepository>().Get(EventId, CustomerId); var eventCustomerId = eventCustomer.Id; var purchasedTest = IoC.Resolve <ITestResultService>().TestPurchasedByCustomer(eventCustomerId); var iseawvTestPurchased = IsEawvTestPurchased = purchasedTest != null?purchasedTest.Any(x => x.Id == (long)TestType.eAWV) : false; IsNewResultFlow = eventData.EventDate >= setting.ResultFlowChangeDate; if (IsNewResultFlow) { ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "true"); } else { ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "false"); } var questionnaireType = QuestionnaireType.None; if (account != null && account.IsHealthPlan && eventData != null) { questionnaireType = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>().QuestionnaireTypeByAccountIdandEventDate(account.Id, eventData.EventDate); } var isShowHraQuestioner = questionnaireType == QuestionnaireType.HraQuestionnaire; if (eventData.EventDate < setting.ChecklistChangeDate) { ShowCheckList = (account != null && account.PrintCheckList); } var mediaLocation = IoC.Resolve <IMediaRepository>().GetResultMediaFileLocation(CustomerId, EventId); ClientScript.RegisterClientScriptBlock(Page.GetType(), "js_Location_Url", "function getLocationPrefix() { return '" + mediaLocation.PhysicalPath.Replace("\\", "\\\\") + "'; } function getUrlPrefix() { return '" + mediaLocation.Url + "'; }", true); GetConductedbyData(eventData); FillStates(); var currentSession = IoC.Resolve <ISessionContext>(); ClientScript.RegisterHiddenField("hfTechnicianId", currentSession.UserSession.CurrentOrganizationRole.OrganizationRoleUserId.ToString()); ClientScript.RegisterHiddenField("hfOrganizationId", currentSession.UserSession.CurrentOrganizationRole.OrganizationId.ToString()); string pageHeading = ""; var basicBiometricCutOfDate = setting.BasicBiometricCutOfDate; var hideBasicBiometric = (eventData.EventDate.Date >= basicBiometricCutOfDate); ShowHideFastingStatus = (eventData.EventDate.Date >= setting.FastingStatusDate); BasicBiometric.ShowByCutOffDate = !hideBasicBiometric; TestSection.SetSectionShowHide(hideBasicBiometric); if (currentSession != null && currentSession.UserSession != null && currentSession.UserSession.CurrentOrganizationRole != null) { RoleId = currentSession.UserSession.CurrentOrganizationRole.GetSystemRoleId; } if (Mode == EditResultMode.ResultCorrection) { var result = new CommunicationRepository().GetPhysicianandCommentsforFranchisee(CustomerId, EventId); if (!string.IsNullOrEmpty(result.SecondValue)) { PhysicianCommentsDiv.Visible = true; PhysicianCommentsMessageBox.ShowErrorMessage("<b><u>Physician Comments:</u> </b>" + result.SecondValue); } updateWithCorrectionDivTop.Visible = true; saveDivTop.Visible = false; approveDivtop.Visible = false; updateWithCorrectionsDivbottom.Visible = true; saveDivbottom.Visible = false; approveDivbottom.Visible = false; var physicianService = IoC.Resolve <IPhysicianAssignmentService>(); var physicianIds = physicianService.GetPhysicianIdsAssignedtoaCustomer(EventId, CustomerId); if (physicianIds != null && result.FirstValue > 0 && physicianIds.Count() == 2 && physicianIds.ElementAt(1) == result.FirstValue) { SendToOvereadPhysician = true; } ClientScript.RegisterHiddenField("ResultStatusInputHidden", "4"); pageHeading = "Results Update/Correction"; } if (Mode == EditResultMode.ResultPreAudit) // && isTechTeamConfigured == true) { ClientScript.RegisterHiddenField("ResultStatusInputHidden", "4"); pageHeading = "Results Pre Audit"; saveDivTop.Visible = false; saveDivbottom.Visible = false; if (TestSection.ContainsReviewableTests && !IsNewResultFlow) { skipevaluationdivbottom.Visible = true; } var customerHealthInfo = IoC.Resolve <IHealthAssessmentRepository>().Get(CustomerId, EventId); if (!CaptureHaf || (customerHealthInfo != null && customerHealthInfo.Any())) { ClientScript.RegisterStartupScript(Page.GetType(), "js_setmedicalhistory", "setMedicalHistory();", true); } var defaultPhysician = IoC.Resolve <IPhysicianRepository>().GetDefaultPhysicianforEvent(EventId); ClientScript.RegisterHiddenField("DefaultPhysician", defaultPhysician.ToString()); //var eventCustomerId = IoC.Resolve<IEventCustomerRepository>().Get(EventId, CustomerId).Id; var isCustomerSkipped = IoC.Resolve <IPhysicianEvaluationRepository>().IsMarkedReviewSkip(eventCustomerId); if (isCustomerSkipped) { ClientScript.RegisterStartupScript(Page.GetType(), "js_markcustomerskipped", "$('#skipevaluationcheckbox').attr('checked', true);", true); } } else if (Mode == EditResultMode.ResultEntry) { if (IsNewResultFlow) { ClientScript.RegisterHiddenField("ResultStatusInputHidden", "2"); } else { ClientScript.RegisterHiddenField("ResultStatusInputHidden", "3"); } pageHeading = "Results Edit/Entry"; approveDivtop.Visible = false; approveDivbottom.Visible = false; } HeadingSpan.InnerHtml = pageHeading; if (Request.UrlReferrer.AbsolutePath.ToLower().IndexOf("auditresultentry.aspx") < 0) { Session["ReferredUrlFirstTimeOpen"] = Request.UrlReferrer; } CreateIFJSArrays(); CreateJsArrayforIfuCs(); //var eventCustomerRepository = IoC.Resolve<IEventCustomerRepository>(); var goBackToResultEnteryPage = false; EventCustomerResult eventCustomerResult = IoC.Resolve <IEventCustomerResultRepository>().GetByCustomerIdAndEventId(CustomerId, EventId);; if ((Mode == EditResultMode.ResultEntry)) { if (IsCustomerNoShowOrLeftWithoutScreening(eventCustomer)) { ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerMarkNoShow();", true); goBackToResultEnteryPage = true; } else { var nextCustomerId = new TestResultRepository().GetNextCustomerEntryandAudit(EventId, CustomerId, IsNewResultFlow); ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "setnextCustomerId(" + nextCustomerId + ");", true); } } else { var isChartSignedOff = true; var isQvTestPurchased = purchasedTest != null?purchasedTest.Any(x => x.Id == (long)TestType.Qv) : false; var isHraQuestionnaire = questionnaireType == QuestionnaireType.HraQuestionnaire; if (questionnaireType == QuestionnaireType.ChatQuestionnaire) { isChartSignedOff = isQvTestPurchased || (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue); } else { var isEawvTestNotPerformed = IoC.Resolve <ITestNotPerformedRepository>().IsTestNotPerformed(eventCustomer.Id, (long)TestType.eAWV); isChartSignedOff = (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue) || !isShowHraQuestioner || !iseawvTestPurchased || isEawvTestNotPerformed; } IsChartSignedOff = (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue); if (!IsNewResultFlow || isChartSignedOff) { if (IsCustomerNoShowOrLeftWithoutScreening(eventCustomer)) { ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerMarkNoShow();", true); goBackToResultEnteryPage = true; } else { long nextCustomerId = 0; if (IsNewResultFlow && account != null && (questionnaireType != QuestionnaireType.None)) { nextCustomerId = new TestResultRepository().GetNextCustomerForPreAudit(EventId, CustomerId, isHraQuestionnaire); } else { nextCustomerId = new TestResultRepository().GetNextCustomerEntryandAudit(EventId, CustomerId, IsNewResultFlow); } ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "setnextCustomerId(" + nextCustomerId + ");", true); } } else { ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerChartIsUnsigned();", true); } //if (eventCustomerResult != null && IsNewResultFlow) //{ // var notes = communicationRepository.GetNotesForReversal(eventCustomerResult.Id); // if (!string.IsNullOrWhiteSpace(notes)) // { // revertBackNotes.Visible = true; // ReasonToRevert.InnerText = notes; // } //} } if (!goBackToResultEnteryPage) { if (eventCustomerResult != null) { //LogAudit(ModelType.View, eventCustomerResult); var priorityInQueue = IoC.Resolve <IPriorityInQueueRepository>().GetByEventCustomerResultId(eventCustomerResult.Id); if (priorityInQueue != null && priorityInQueue.InQueuePriority > 0) { if (!CurrentOrgUser.CheckRole((long)Roles.Technician)) { PriorityInQueueCheckbox.Checked = true; } if (priorityInQueue.NoteId == null) { return; } var noteText = IoC.Resolve <INotesRepository>().Get(priorityInQueue.NoteId.Value); if (noteText != null && !string.IsNullOrEmpty(noteText.Text)) { PriorityInQueueText.InnerText = noteText.Text; PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "block"); } else if (!CurrentOrgUser.CheckRole((long)Roles.Technician)) { PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "block"); } } else { PriorityInQueueCheckbox.Checked = false; PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "none"); } } else { PriorityInQueueCheckbox.Checked = false; PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "none"); } } } }
public CommunicationController(MyContext T) { communicationRepository = new CommunicationRepository(T); }
//start private void Start(object sender, EventArgs e) { if (!started) { TimerThread(); started = true; stoppedByUser = false; } System.Diagnostics.Debug.Write("In start"); CommunicationRepository.EmptyDatabase(); theLinkLock = new object(); System.Diagnostics.Debug.Write(" \n invoked timer: " + invokedByTimer); if (button1.Text == "Stop" && invokedByTimer == false) { ts.Cancel(); button1.Text = "Start"; stoppedByUser = true; started = false; return; } if (invokedByTimer == true) { invokedByTimer = false; } listView1.Clear(); Program.newsLinks = new Queue <string>(); Program.newsTitlePlusLink = new Dictionary <string, string>(); ts = new CancellationTokenSource(); var column = listView1.Columns.Add("NEWS"); column.Width = 400; if (checkedListBox1.CheckedItems.Contains("Extra Bladet")) { Task task = Task.Run(() => { ExtraBladetListener crawler = new ExtraBladetListener(this); crawler.crawl(); }); } if (checkedListBox1.CheckedItems.Contains("DR dk")) { Task task = Task.Run(() => { DrListener crawler = new DrListener(this); crawler.crawl(); }); } if (checkedListBox1.CheckedItems.Contains("TV2")) { Task task = Task.Run(() => { Tv2Listener crawler = new Tv2Listener(this); crawler.crawl(); }); } if (checkedListBox1.CheckedItems.Contains("BT")) { Task task = Task.Run(() => { BtListener crawler = new BtListener(this); crawler.crawl(); }); } if (checkedListBox1.CheckedItems.Contains("Dagens")) { Task task = Task.Run(() => { DagensListener crawler = new DagensListener(this); crawler.crawl(); }); } for (int i = 10 - 1; i >= 0; i--) { Task task1 = Task.Run(() => { string searchWord; if (textBox1 != null) { searchWord = textBox1.Text; } else { searchWord = ""; } TitleCrawler titleCrawler = new TitleCrawler(this); titleCrawler.GetTitles(ts.Token, searchWord); }); } button1.Text = "Stop"; }
protected void Page_Load(object sender, EventArgs e) { var settings = IoC.Resolve <ISettings>(); ISystemInformationRepository systemInformationRepository = new SystemInformationRepository(); VersionNumber = systemInformationRepository.GetBuildNumber(); if (!IsPostBack) { if (EventCustomerId > 0) { var eventRepository = new EventCustomerResultRepository(); EventCustomerResult = eventRepository.GetById(EventCustomerId); if (EventCustomerResult != null) { EventId = EventCustomerResult.EventId; CustomerId = EventCustomerResult.CustomerId; SetEventBasicInfo(EventCustomerResult.EventId); TestSection.CustomerId = EventCustomerResult.CustomerId; TestSection.EventId = EventCustomerResult.EventId; } var priorityInQueue = IoC.Resolve <IPriorityInQueueRepository>().GetByEventCustomerResultId(EventCustomerId); if (priorityInQueue != null && priorityInQueue.InQueuePriority > 0 && priorityInQueue.NoteId != null) { var noteText = IoC.Resolve <INotesRepository>().Get(priorityInQueue.NoteId.Value); if (noteText != null && !string.IsNullOrEmpty(noteText.Text)) { PriorityInQueueMessage.ShowSuccessMessage("<b><u>Priority In Queue Reason:</u> </b>" + noteText.Text); PriorityInQueueMessage.Visible = true; } } var customerEventTestStateRepository = IoC.Resolve <ICustomerEventTestStateRepository>(); var isCriticalPatient = customerEventTestStateRepository.IsPatientCritical(EventCustomerId); var eventCustomerCriticalQuestionRepository = IoC.Resolve <IEventCustomerCriticalQuestionRepository>(); var criticalData = eventCustomerCriticalQuestionRepository.GetByEventCustomerId(EventCustomerId); if ((priorityInQueue != null && priorityInQueue.InQueuePriority > 0) || (isCriticalPatient && !criticalData.IsNullOrEmpty())) { ShowCriticalPatientData = true; } } Page.Title = "Evaluation : " + CustomerId; var physicianId = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var physicianRepository = IoC.Resolve <IPhysicianRepository>(); var overReadPhysicianId = physicianRepository.GetOverreadPhysician(EventCustomerId); var physician = physicianRepository.GetPhysician(physicianId); CanPhysicianUpdateResultEntery = physician.UpdateResultEntry; if (physicianId == overReadPhysicianId) { IsforOveread = true; } else { IsforOveread = false; } string messageForPhysician = new CommunicationRepository().GetCommentsforPhysician(CustomerId, EventId, physicianId); if (!string.IsNullOrEmpty(messageForPhysician)) { FranchiseeCommentsMessage.ShowSuccessMessage("<b><u>Technician Comments:</u> </b>" + messageForPhysician); FranchiseeCommentsMessage.Visible = true; } if (overReadPhysicianId > 0) { headerifoverreaddiv.Visible = true; headerifoverreaddiv.InnerHtml = IsforOveread ? "<h2> This study is an Overread, and you are the Second Evaluator! </h2>" : "<h2> This study is an Overread, and you are the First Evaluator! </h2>"; } ClientScript.RegisterClientScriptBlock(Page.GetType(), "js_OverRead", (overReadPhysicianId > 0 ? " var isOverReadAvailable = true; " : " var isOverReadAvailable = false; ") + (overReadPhysicianId == physicianId ? "var isCurrentViewforOverread = true;" : "var isCurrentViewforOverread = false;"), true); var mediaLocation = IoC.Resolve <IMediaRepository>().GetResultMediaFileLocation(CustomerId, EventId); ClientScript.RegisterClientScriptBlock(Page.GetType(), "js_Location_Url", "function getLocationPrefix() { return '" + mediaLocation.PhysicalPath.Replace("\\", "\\\\") + "'; } function getUrlPrefix() { return '" + mediaLocation.Url + "'; }", true); var basicBiometricCutOfDate = settings.BasicBiometricCutOfDate; var hideBasicBiometric = (EventDate.Date >= basicBiometricCutOfDate); BasicBiometric.ShowByCutOffDate = !hideBasicBiometric; ShowHideFastingStatus = (EventDate.Date.Date >= settings.FastingStatusDate); TestSection.SetSectionShowHideEvaluation(EventId, CustomerId, hideBasicBiometric); StartEvaluation(); GetConductedbyData(); CreateIfjsArrays(); CreateJsArrayforIfuCs(); var hospitalPartnerRepository = IoC.Resolve <IHospitalPartnerRepository>(); var eventHospitalPartner = hospitalPartnerRepository.GetEventHospitalPartnersByEventId(EventId); if (eventHospitalPartner != null && eventHospitalPartner.RestrictEvaluation) { var eventPhysicianTestRepository = IoC.Resolve <IEventPhysicianTestRepository>(); var eventPhysicianTests = eventPhysicianTestRepository.GetByEventIdPhysicianId(EventId, physicianId); if (eventPhysicianTests != null && eventPhysicianTests.Any()) { foreach (var eventPhysicianTest in eventPhysicianTests) { ClientScript.RegisterArrayDeclaration("arr_permittedtest", "'" + eventPhysicianTest.TestId + "'"); } } } else { var testIds = physicianRepository.GetPermittedTestIdsForPhysician(physicianId); foreach (var testId in testIds) { ClientScript.RegisterArrayDeclaration("arr_permittedtest", "'" + testId + "'"); } } } var accountRepository = IoC.Resolve <ICorporateAccountRepository>(); var account = accountRepository.GetbyEventId(EventId); CaptureHaf = (account == null || account.CaptureHaf); IsNewResultFlow = EventDate >= settings.ResultFlowChangeDate; QuestionnaireType questionnaireType = QuestionnaireType.None; if (account != null && account.IsHealthPlan) { var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>(); questionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(account.Id, EventDate); } ShowHraLink = "none"; ShowChatLink = "none"; if (EventCustomerResult == null && EventCustomerId > 0) { var eventRepository = new EventCustomerResultRepository(); EventCustomerResult = eventRepository.GetById(EventCustomerId); } if (EventCustomerResult != null) { if (!IsforOveread) { hfIsPdfVerified.Value = EventCustomerResult.ChatPdfReviewedByPhysicianId.HasValue && EventCustomerResult.ChatPdfReviewedByPhysicianDate.HasValue ? "1" : "0"; } else { hfIsPdfVerified.Value = EventCustomerResult.ChatPdfReviewedByOverreadPhysicianId.HasValue && EventCustomerResult.ChatPdfReviewedByOverreadPhysicianDate.HasValue ? "1" : "0"; } } if (account != null && account.IsHealthPlan && (questionnaireType == QuestionnaireType.HraQuestionnaire) && EventCustomerId > 0) { var testResultService = IoC.Resolve <ITestResultService>(); var eventCustomerRepository = IoC.Resolve <IEventCustomerRepository>(); var eventCustomer = eventCustomerRepository.GetById(EventCustomerId); if (IsNewResultFlow) { var isEawvPurchased = testResultService.IsTestPurchasedByCustomer(EventCustomerId, (long)TestType.eAWV); if (isEawvPurchased) { var testResultRepository = new EAwvTestRepository(); var eawvTestResult = testResultRepository.GetTestResult(eventCustomer.CustomerId, eventCustomer.EventId, (int)TestType.eAWV, IsNewResultFlow); bool iseawvTestMarkedTestNotPerformed = eawvTestResult != null && eawvTestResult.TestNotPerformed != null && eawvTestResult.TestNotPerformed.TestNotPerformedReasonId > 0; if (!iseawvTestMarkedTestNotPerformed) { if (eventCustomer.AwvVisitId != null) { MedicareVisitId = eventCustomer.AwvVisitId.Value; Tag = account.Tag; var sessionContext = IoC.Resolve <ISessionContext>(); HraQuestionerAppUrl = settings.HraQuestionerAppUrl; OrganizationNameForHraQuestioner = settings.OrganizationNameForHraQuestioner; HraToken = (Session.SessionID + "_" + sessionContext.UserSession.UserId + "_" + sessionContext.UserSession.CurrentOrganizationRole.RoleId + "_" + sessionContext.UserSession.CurrentOrganizationRole.OrganizationId).Encrypt(); ShowHraLink = "block"; } } } } else { if (eventCustomer.AwvVisitId != null) { MedicareVisitId = eventCustomer.AwvVisitId.Value; Tag = account.Tag; var sessionContext = IoC.Resolve <ISessionContext>(); HraQuestionerAppUrl = settings.HraQuestionerAppUrl; OrganizationNameForHraQuestioner = settings.OrganizationNameForHraQuestioner; HraToken = (Session.SessionID + "_" + sessionContext.UserSession.UserId + "_" + sessionContext.UserSession.CurrentOrganizationRole.RoleId + "_" + sessionContext.UserSession.CurrentOrganizationRole.OrganizationId).Encrypt(); ShowHraLink = "block"; } } } else if (account != null && account.IsHealthPlan && (questionnaireType == QuestionnaireType.ChatQuestionnaire) && EventCustomerId > 0) { ChatQuestionerAppUrl = settings.ChatQuestionerAppUrl; ShowChatLink = "block"; ShowChatAssesmentLink = true; } if (EventDate < settings.ChecklistChangeDate) { ShowCheckListForm = account != null && account.PrintCheckList; } if (IsNewResultFlow) { ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "true"); } else { ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "false"); } }
private void placeOrder(string status, int statuscode) { int agentId = 0; if (Session["AgentUser"] != null) { DataRow dr = (DataRow)Session["AgentUser"]; agentId = Convert.ToInt32(dr[0].ToString()); } Customer customer = new Customer(); customer.FirstName = name.Value; customer.LastName = ""; customer.Email = email.Value; customer.Phone = phone.Value; customer.AgentId = agentId; customer = customerRep.PreInsertCustomer(customer); Orders order = new Orders(); order.Phone = phone.Value; order.Email = email.Value; order.OrderDate = DateTime.Now; order.OrderGuid = new Guid(); order.OrderStatus = status; order.RegisterDate = DateTime.Now; order.OrderStatusCode = statuscode; order.FirstName = name.Value; order.LastName = ""; order.CustomerId = customer.CustomerId; order.AgentId = agentId; decimal amount = 0; DataTable dtSessionCart = (DataTable)Session["Cart"]; for (int i = dtSessionCart.Rows.Count - 1; i >= 0; i--) { DataRow dr = dtSessionCart.Rows[i]; amount += Convert.ToDecimal(dr[1].ToString()); } order.OrderTotal = amount; int OrderNumber = orderRep.InsertOrders(order); for (int i = dtSessionCart.Rows.Count - 1; i >= 0; i--) { DataRow dr = dtSessionCart.Rows[i]; OrderDetail orderDetail = new OrderDetail(); //orderDetail.CustomerId = customer.CustomerId; //orderDetail.OrderNumber = OrderNumber; //orderDetail.ProductId = Convert.ToInt32(dr[0].ToString()); //orderDetail.OrderedProductPrice = Convert.ToDecimal(dr[1].ToString()); //orderDetail.Quantity = Convert.ToInt32(dr[2].ToString()); //orderDetail.OrderedProductName = dr[5].ToString(); //orderDetail.AgentId = agentId; //orderRep.InsertOrdersDetail(orderDetail); orderRep.InsertOrdersDetail(OrderNumber, dr[0].ToString(), dr[1].ToString(), dr[2].ToString(), dr[5].ToString(), agentId, customer.CustomerId); } CommunicationRepository comRep = new CommunicationRepository(); string fromEmail = ConfigurationManager.AppSettings["fromemail"].ToString(); string username = ConfigurationManager.AppSettings["username"].ToString(); string password = ConfigurationManager.AppSettings["password"].ToString(); string toemail = customer.Email; string subject = "Confirm Order Email"; string message = "Your Zuni order has confirmed"; comRep.SendEmail(fromEmail, toemail, subject, 0, message, username, password); comRep.SendMessage(); Session["Cart"] = null; Response.Redirect("Thankyou.aspx"); }