Exemplo n.º 1
0
        public HttpResponseMessage GetLogiSession(string officeNum, string companyId)
        {
            var content = new LogiDashboard();

            try
            {
                AccessControl.VerifyUserAccessToMultiLocationOffice(officeNum);
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                throw new HttpResponseException(HttpStatusCode.Forbidden);
            }

            try
            {
                // get the url from properties, then connect and retrieve data
                var authorizationTicketHelper = new AuthorizationTicketHelper();
                var user   = authorizationTicketHelper.GetUserInfo();
                var userId = user.Id;
                content = this.logiIntegrationManager.GetLogiSession(companyId, userId);
            }
            catch (Exception e)
            {
                Logger.Error("HomeController:GetLogiSession(): " + e);
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK, content));
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="OtherItemsController" /> class.
        /// </summary>
        public OtherItemsController()
        {
            this.otherItemsManager = new OtherItemsIt2Manager();
            var user = new AuthorizationTicketHelper().GetUserInfo();

            this.companyId = user.CompanyId;
        }
Exemplo n.º 3
0
        /// <summary>
        /// The inventory.
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult Inventory()
        {
            var authorizationTicketHelper = new AuthorizationTicketHelper();
            var user = authorizationTicketHelper.GetUserInfo();

            return(this.View(user));
        }
        /// <summary>
        /// The get.
        /// </summary>
        /// <param name="officeNumber">
        /// The office number.
        /// </param>
        /// <param name="report">
        /// The report.
        /// </param>
        /// <returns>
        /// The <see cref="SalesReportCriteria"/>.
        /// </returns>
        public HttpResponseMessage Get(string officeNumber, string report)
        {
            try
            {
                AccessControl.VerifyUserAccessToOffice(officeNumber);
            }
            catch (Exception ex)
            {
                var          message          = ex.Message;
                const string ValidationString = "You do not have security permission to access this area.<br/><br/> " +
                                                "Please contact your Office Manager or Office Administrator if you believe this is an error.";
                return(this.Request.CreateResponse(HttpStatusCode.Forbidden, new { validationmessage = ValidationString }));
            }

            try
            {
                var user           = new AuthorizationTicketHelper().GetUserInfo();
                var officeEmployee = this.employeeServices.GetOfficeEmployeeByUserId(user.Id);
                return(Request.CreateResponse(HttpStatusCode.OK, this.it2Manager.GetReportCriteria(officeNumber, report, officeEmployee)));
            }
            catch (Exception ex)
            {
                var msg = string.Format("Get(officeNumber = {0}, {1}, {2}", officeNumber, "\n", ex);
                return(HandleExceptions.LogExceptions(msg, Logger, ex));
            }
        }
        /// <summary>
        ///     The doctor schedule.
        /// </summary>
        /// <returns>
        ///     The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult ResourceSchedule()
        {
            var authorizationTicketHelper = new AuthorizationTicketHelper();
            var user = authorizationTicketHelper.GetUserInfo();

            return(this.View(user));
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AccessoriesController" /> class.
        /// </summary>
        public AccessoriesController()
        {
            this.accessoriesManager = new AccessoriesIt2Manager();
            var user = new AuthorizationTicketHelper().GetUserInfo();

            this.companyId = user.CompanyId;
        }
Exemplo n.º 7
0
        public HttpResponseMessage GetUserRoles()
        {
            bool hasDashBoardRole = false;

            try
            {
                var authorizationTicketHelper = new AuthorizationTicketHelper();
                var user          = authorizationTicketHelper.GetUserInfo();
                var userId        = user.Id;
                var isLogiEnabled = this.logiIntegrationManager.GetLogiFeatureAvailability(user.CompanyId);
                if (!isLogiEnabled.IsAvailable)
                {
                    return(this.Request.CreateResponse(HttpStatusCode.OK, false));
                }

                var content = new Security().GetUserRoles(userId, true).ToList().Find(a => a.Key == 66 || a.Key == 67 || a.Key == 63);
                if (content != null)
                {
                    hasDashBoardRole = true;
                }
            }
            catch (Exception e)
            {
                Logger.Error("HomeController:GetUserRoles(): " + e);
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK, hasDashBoardRole));
        }
Exemplo n.º 8
0
        public byte[] GetDocumentContent(int id, string uploadsLocation, int patientId)
        {
            var authorizationTicketHelper = new AuthorizationTicketHelper();
            var userOfficeId = Convert.ToInt32(authorizationTicketHelper.GetOfficeId());
            var user         = authorizationTicketHelper.GetUserInfo();

            return(this.it2Business.GetDocumentContent(id, uploadsLocation, this.companyId, patientId, user));
        }
Exemplo n.º 9
0
        public HttpResponseMessage UpdateEgFrameRetailPrice([FromBody] EyeglassOrderFrameVm frameDisplay, string officeNumber, string retailPrice)
        {
            var token  = new AuthorizationTicketHelper().GetToken();
            var price  = Convert.ToDouble(retailPrice);
            var errMsg = this.frameIt2Manager.UpdateSelectedEgFrame(this.companyId, officeNumber, price, frameDisplay, token);

            return(errMsg == string.Empty ? Request.CreateResponse(HttpStatusCode.OK, "Frame retail price saved.") : Request.CreateResponse(HttpStatusCode.BadRequest, errMsg));
        }
Exemplo n.º 10
0
        /////// <summary>
        /////// The PAtient Manager
        /////// </summary>
        ////private readonly new Business.Patient.PatientManager patientManager;

        /// <summary>Initializes a new instance of the <see cref="DocumentController"/> class.</summary>
        public DocumentController()
        {
            this.it2Business = new DocumentIt2Manager();
            var user = new AuthorizationTicketHelper().GetUserInfo();

            this.companyId = user.CompanyId;
            this.userId    = user.Id;
        }
Exemplo n.º 11
0
        public EyeglassLensController()
        {
            this.eyeglassLensIt2Manager = new EyeglassLensIt2Manager();
            this.productsManager        = new ProductsManager();
            var user = new AuthorizationTicketHelper().GetUserInfo();

            this.companyId = user.CompanyId;
        }
Exemplo n.º 12
0
        public HttpResponseMessage GetEgFrameByFrame(int orderType, int frameId, string officeNumber, string upcCode, string productCode)
        {
            var token                = new AuthorizationTicketHelper().GetToken();
            var upcCode1             = string.Format("{0}", System.Web.HttpUtility.UrlDecode(upcCode));
            var jobsonProductCode    = string.Format("{0}", System.Web.HttpUtility.UrlDecode(productCode));
            var selectedFrameDisplay = this.frameIt2Manager.GetEgFrameByFrame(token, this.companyId, officeNumber, upcCode1.Trim(), jobsonProductCode.Trim(), frameId, orderType, token);

            return(selectedFrameDisplay == null?Request.CreateResponse(HttpStatusCode.BadRequest, selectedFrameDisplay) : Request.CreateResponse(HttpStatusCode.OK, selectedFrameDisplay));
        }
Exemplo n.º 13
0
        public FrameController()
        {
            this.frameIt2Manager = new FrameIt2Manager();
            this.productsManager = new ProductsManager();
            var user = new AuthorizationTicketHelper().GetUserInfo();

            this.companyId    = user.CompanyId;
            this.dataSourceId = this.frameIt2Manager.LookupDataSourceIdByCompany(this.companyId);
        }
Exemplo n.º 14
0
        public void KeepAlive()
        {
            var authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            FormsAuthenticationTicket ticketOld = null;

            if (authCookie != null)
            {
                ticketOld = FormsAuthentication.Decrypt(authCookie.Value);
            }

            FormsAuthenticationTicket ticketNew = null;

            if (ticketOld == null)
            {
                return;
            }

            if (FormsAuthentication.SlidingExpiration)
            {
                ticketNew = FormsAuthentication.RenewTicketIfOld(ticketOld);
            }

            if (ticketNew == null)
            {
                return;
            }

            var hash = FormsAuthentication.Encrypt(ticketNew);

            if (ticketNew.IsPersistent)
            {
                authCookie.Expires = ticketNew.Expiration;
            }

            var authHelper   = new AuthorizationTicketHelper();
            var token        = authHelper.GetToken();
            var refreshToken = authHelper.GetRefreshToken();

            if (!string.IsNullOrEmpty(token))
            {
                var newhash = this.GetNewHashWithUpdatedToken(refreshToken, ticketNew, token);

                authCookie.Value = newhash;
            }
            else
            {
                authCookie.Value = hash;
            }

            authCookie.HttpOnly = true;
            authCookie.Secure   = FormsAuthentication.RequireSSL;
            authCookie.Domain   = FormsAuthentication.CookieDomain;
            authCookie.Path     = FormsAuthentication.FormsCookiePath;

            HttpContext.Current.Response.Cookies.Add(authCookie);
        }
Exemplo n.º 15
0
        public HttpResponseMessage ImportPatientFromDocument(string officeNumber, int patientId)
        {
            var message = "Success";

            var user = new AuthorizationTicketHelper().GetUserInfo();

            var list = this.patientDocumentIt2Manager.ImportPatientFromDocument(officeNumber, patientId, user.Id);

            return(Request.CreateResponse(HttpStatusCode.OK, message));
        }
Exemplo n.º 16
0
        /// <summary>
        /// The data.
        /// </summary>
        /// <param name="userId">
        /// The user Id.
        /// </param>
        /// <param name="officeId">
        /// The office Id.
        /// </param>
        /// <param name="from">
        /// The from.
        /// </param>
        /// <param name="to">
        /// The to.
        /// </param>
        /// <returns>
        /// The <see cref="ContentResult"/>.
        /// </returns>
        public ContentResult Data(int userId, int officeId, string from, string to)
        {
            var employeeId = this.appointmentManager.GetEmployeeIdByUserId(userId).GetValueOrDefault();
            var startDate  = DateTime.Parse(from);
            var endDate    = DateTime.Parse(to);
            var authorizationTicketHelper = new AuthorizationTicketHelper();
            var companyId = authorizationTicketHelper.GetUserInfo().CompanyId;
            var items     = this.appointmentManager.GetAllAppointments(officeId, (int)employeeId, startDate, endDate, companyId);
            var data      = new SchedulerAjaxData(items);

            return(this.Content(data, "text/json"));
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientController"/> class.
        /// </summary>
        public PatientLedgerController()
        {
            this.patientLedgerManager = new PatientLedgerIt2Manager();
            if (!this.User.Identity.IsAuthenticated)
            {
                return;
            }

            var authorizationTicketHelper = new AuthorizationTicketHelper();

            this.practiceLocationId = authorizationTicketHelper.GetPracticeLocationId();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AppointmentController"/> class.
        /// </summary>
        public AppointmentController()
        {
            if (User.Identity.IsAuthenticated)
            {
                var authorizationTicketHelper = new AuthorizationTicketHelper();

                this.companyId = authorizationTicketHelper.GetCompanyId();
            }

            this.appointmentManager = new AppointmentManager();
            this.examServiceManager = new ExamServiceManager();
        }
Exemplo n.º 19
0
        public HttpResponseMessage GetOffices(string companyId)
        {
            AccessControl.VerifyUserAccessToCompany(companyId);
            var authorizationTicketHelper = new AuthorizationTicketHelper();

            if (companyId != authorizationTicketHelper.GetCompanyId())
            {
                return(this.Request.CreateResponse(HttpStatusCode.Unauthorized));
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK, this.officeIt2Manager.GetOfficesForCompany(companyId)));
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientController"/> class.
        /// </summary>
        public PatientOrderController()
        {
            this.manager = new PatientOrderWorkInProgressManager();
            if (!this.User.Identity.IsAuthenticated)
            {
                return;
            }

            var authorizationTicketHelper = new AuthorizationTicketHelper();

            this.companyId = authorizationTicketHelper.GetCompanyId();
            this.officeNum = authorizationTicketHelper.GetPracticeLocationId();
            this.userId    = authorizationTicketHelper.GetUserInfo().Id;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientController"/> class.
        /// </summary>
        public PatientExamsController()
        {
            this.patientExamsIt2Manager = new PatientExamsIt2Manager();
            if (!this.User.Identity.IsAuthenticated)
            {
                return;
            }

            var authorizationTicketHelper = new AuthorizationTicketHelper();

            this.practiceLocationId = authorizationTicketHelper.GetPracticeLocationId();
            this.companyId          = authorizationTicketHelper.GetCompanyId();
            this.userId             = authorizationTicketHelper.GetUserInfo().Id;
        }
Exemplo n.º 22
0
 public HttpResponseMessage DeleteCustomFrameItem(string officeNumber, int frameItemId)
 {
     try
     {
         var token = new AuthorizationTicketHelper().GetToken();
         this.frameIt2Manager.DeleteCustomFrameItem(frameItemId, this.companyId, token);
         return(new HttpResponseMessage(HttpStatusCode.NoContent));
     }
     catch (Exception ex)
     {
         var msg = string.Format("DeleteCustomFrameItem\n {0}", ex);
         return(HandleExceptions.LogExceptions(msg, Logger, ex));
     }
 } // DeleteCustomFramesItems
        /// <summary>
        /// Initializes a new instance of the <see cref="ContactLensOrderController"/> class.
        /// </summary>
        public ContactLensOrderController()
        {
            this.contactLensOrderIt2Manager = new ContactLensOrderIt2Manager();
            this.patientInsuranceManager    = new PatientInsuranceManager();
            if (!this.User.Identity.IsAuthenticated)
            {
                return;
            }

            var authorizationTicketHelper = new AuthorizationTicketHelper();

            this.companyId    = authorizationTicketHelper.GetCompanyId();
            this.officeNumber = authorizationTicketHelper.GetPracticeLocationId();
            this.userId       = authorizationTicketHelper.GetUserInfo().Id;
        }
Exemplo n.º 24
0
        public HttpResponseMessage SaveCustomFrame(string officeNumber, FrameDetails items)
        {
            var token = new AuthorizationTicketHelper().GetToken();
            var frame = this.frameIt2Manager.SaveCustomFrameItems(items, this.companyId, this.dataSourceId, token);

            ////return Request.CreateResponse(HttpStatusCode.OK, frame);
            return(Request.CreateResponse(
                       HttpStatusCode.OK,
                       new
            {
                ManufacturerId = frame.Style.Collection.Manufacturer.ID,
                CollectionId = frame.Style.Collection.ID,
                ModelId = frame.Style.ID,
                ItemId = frame.ID
            }));
        }
Exemplo n.º 25
0
        public HttpResponseMessage Put([FromBody] MarketingRecall marketingRecall)
        {
            var recallIt2Manager = new RecallReportsIt2Manager();
            var user             = new AuthorizationTicketHelper().GetUserInfo();
            var officeNumber     = user.OfficeNum;

            try
            {
                var recall = recallIt2Manager.UpdateMarketingRecallReport(marketingRecall, officeNumber);
                return(this.Request.CreateResponse(HttpStatusCode.OK, recall));
            }
            catch (Exception ex)
            {
                var msg = string.Format("Put(id = {0}, {1}, {2}", marketingRecall.Id, "\n", ex);
                return(HandleExceptions.LogExceptions(msg, Logger, ex));
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientController"/> class.
        /// </summary>
        public PatientDocumentController()
        {
            this.lookupServices          = Container.Resolve <ILookupServices>();
            this.miscellaneousServices   = Container.Resolve <IMiscellaneousServices>();
            this.patientServices         = Container.Resolve <IPatientServices>();
            this.patientDocumentServices = Container.Resolve <IPatientDocumentServices>();

            this.patientDocumentIt2Manager = new PatientDocumentIt2Manager(this.lookupServices, this.miscellaneousServices, this.patientServices, this.patientDocumentServices);
            this.documentManager           = new DocumentIt2Manager();

            if (!this.User.Identity.IsAuthenticated)
            {
                return;
            }

            var authorizationTicketHelper = new AuthorizationTicketHelper();

            this.practiceLocationId = authorizationTicketHelper.GetPracticeLocationId();
        }
        public HttpResponseMessage AddVspInsurancePlansToMemberPatient(string officeNumber, AddVspInsurancePlansToMemberPatientParameters parameters)
        {
            var patientId = parameters.PatientId;
            var ssn       = parameters.Ssn;

            AccessControl.VerifyUserAccessToPatient(patientId);

            var userId = new AuthorizationTicketHelper().GetUserInfo().Id;

            try
            {
                int selectedInsurance;
                var addedCount    = this.patientInsuranceManager.AddVspInsurancesToPatientThatIsTheMember(officeNumber, patientId, userId, out selectedInsurance, ssn);
                var insuranceList = this.patientInsuranceManager.GetPatientInsurancesForScheduler(patientId, true);
                return(this.Request.CreateResponse(HttpStatusCode.OK, new { error = string.Empty, addedCount = addedCount, insuranceList = insuranceList, selectedInsurance = selectedInsurance }));
            }
            catch (ApplicationException ex)
            {
                return(this.Request.CreateResponse(HttpStatusCode.OK, new { error = ex.Message, addedCount = 0 }));
            }
        }
Exemplo n.º 28
0
        public HttpResponseMessage SaveLabSetupMapping(string officeNumber, IEnumerable <LabSetupSearchResults> mappings)
        {
            var planNames = new List <string>();

            AccessControl.VerifyUserAccessToMultiLocationOffice(officeNumber);
            var gedi   = new List <string>();
            int userId = new AuthorizationTicketHelper().GetUserInfo().Id;

            foreach (var mapping in mappings)
            {
                if (mapping.IsMapped)
                {
                    this.labsIt2Manager.MapLabsToCompany(officeNumber, mapping);
                }
                else
                {
                    this.labsIt2Manager.UnmapLabsToCompany(officeNumber, mapping);
                }
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK, planNames));
        }
Exemplo n.º 29
0
        public HttpResponseMessage LoadOrUpdateOfficeDashboard(string officeNum, string companyId)
        {
            var resourceIDs = string.Empty;

            try
            {
                var common = new Business.Admin.Common();
                var authorizationTicketHelper = new AuthorizationTicketHelper();
                var userOfficeId = Convert.ToInt32(authorizationTicketHelper.GetOfficeId());
                var user         = authorizationTicketHelper.GetUserInfo();
                var employeeId   = this.appointmentManager.GetEmployeeIdByUserId(user.Id).GetValueOrDefault();
                var resources    = this.appointmentManager.GetResources(userOfficeId, (int)employeeId).ToList();
                resourceIDs = resources.Aggregate(resourceIDs, (current, resource) => current + (resource.Id.GetValueOrDefault() + ","));
                resourceIDs = resourceIDs.Substring(0, resourceIDs.Length - 1);
                common.LoadOrUpdateOfficeDashboard(officeNum, companyId, resourceIDs);
            }
            catch (Exception e)
            {
                Logger.Error("HomeController:LoadOrUpdateOfficeDashboard(): " + e);
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK, "OK"));
        }
Exemplo n.º 30
0
        } // GetFramesByUpcCode

        public HttpResponseMessage GetEgFrameBySearchCriteria(string searchCriteria, string officeNumber)
        {
            var token    = new AuthorizationTicketHelper().GetToken();
            var status   = string.Empty;
            var criteria = searchCriteria.Trim();
            var frames   = this.frameIt2Manager.GetEgFrameBySearchCriteria(criteria, token, this.companyId, ref status);

            ////Customer supplied frame
            if (status == string.Empty && criteria == "PatientOwnFrame")
            {
                var upcCode = frames[0].UPCCode;
                var frameId = frames[0].Id;
                var selectedFrameDisplay = this.frameIt2Manager.GetEgFrameByFrame(token, this.companyId, officeNumber, upcCode, string.Empty, frameId, 2, token);
                ////ALSL-8077 VSP claim submission fails when non-stock frame is oversize
                if (selectedFrameDisplay != null)
                {
                    selectedFrameDisplay.Eye = null;
                }

                return(Request.CreateResponse(HttpStatusCode.OK, selectedFrameDisplay));
            }

            return(status == string.Empty ? Request.CreateResponse(HttpStatusCode.OK, frames) : Request.CreateResponse(HttpStatusCode.BadRequest, status));
        }