コード例 #1
0
        internal override void OnMessage(string method, JsonElement?serverParams)
        {
            switch (method)
            {
            case "close":
                Close?.Invoke(this, EventArgs.Empty);
                break;

            case "bindingCall":
                BindingCall?.Invoke(
                    this,
                    new BindingCallEventArgs
                {
                    BidingCall = serverParams?.GetProperty("binding").ToObject <BindingCallChannel>(Connection.GetDefaultJsonSerializerOptions()).Object,
                });
                break;

            case "route":
                Route?.Invoke(
                    this,
                    new RouteEventArgs
                {
                    Route   = serverParams?.GetProperty("route").ToObject <RouteChannel>(Connection.GetDefaultJsonSerializerOptions()).Object,
                    Request = serverParams?.GetProperty("request").ToObject <RequestChannel>(Connection.GetDefaultJsonSerializerOptions()).Object,
                });
                break;

            case "page":
                Page?.Invoke(
                    this,
                    new BrowserContextPageEventArgs
                {
                    PageChannel = serverParams?.GetProperty("page").ToObject <PageChannel>(Connection.GetDefaultJsonSerializerOptions()),
                });
                break;

            case "crBackgroundPage":
                BackgroundPage?.Invoke(
                    this,
                    new BrowserContextPageEventArgs
                {
                    PageChannel = serverParams?.GetProperty("page").ToObject <PageChannel>(Connection.GetDefaultJsonSerializerOptions()),
                });
                break;

            case "crServiceWorker":
                ServiceWorker?.Invoke(
                    this,
                    new WorkerChannelEventArgs
                {
                    WorkerChannel = serverParams?.GetProperty("worker").ToObject <WorkerChannel>(Connection.GetDefaultJsonSerializerOptions()),
                });
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static void Main(string[] args)
        {
            Console.WriteLine("András Ács's solution to the Collector Service problem.");
            Console.WriteLine($"Address: {AppSettings.Settings.ProviderServiceAddress}");
            Console.WriteLine($"Max parallel requests: {AppSettings.Settings.ThresholdOfParallelRequests}{Environment.NewLine}");

            FieldGatewayClient fieldGatewayClient = new FieldGatewayClient();
            var serviceWorker = new ServiceWorker(fieldGatewayClient);

            serviceWorker.Process();
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Specialization,FirstName,SecondName")] ServiceWorker serviceWorker)
        {
            if (ModelState.IsValid)
            {
                db.ServiceWorkers.Add(serviceWorker);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(serviceWorker));
        }
コード例 #4
0
 public TestWorker(string storageConnectionString, string requestQueueName, TimeSpan requestTimeout, int messagesPerRequest) 
 {
     serviceWorker = new ServiceWorker<TestRequest, TestResponse>(storageConnectionString, 
         requestQueueName,
         ProcessRequest)
     {
         MaxProcessingTimeout = requestTimeout,
         MessagesPerRequest = messagesPerRequest,
         DelayWhenNothingInQueue = TimeSpan.FromMilliseconds(100),
         DequeueCountPoisonMessageLimit = 5
     };
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: Wraithname/LPKService
        static void Main(string[] args)
        {
            IServiceWork working = new ServiceWorker();

            //Запуск как сервис
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new LPKService(working)
            };
            ServiceBase.Run(ServicesToRun);
        }
コード例 #6
0
 public TestWorker(string storageConnectionString, string requestQueueName, TimeSpan requestTimeout, int messagesPerRequest)
 {
     serviceWorker = new ServiceWorker <TestRequest, TestResponse>(storageConnectionString,
                                                                   requestQueueName,
                                                                   ProcessRequest)
     {
         MaxProcessingTimeout           = requestTimeout,
         MessagesPerRequest             = messagesPerRequest,
         DelayWhenNothingInQueue        = TimeSpan.FromMilliseconds(100),
         DequeueCountPoisonMessageLimit = 5
     };
 }
コード例 #7
0
        // GET: Fb
        public ActionResult Index(string code)
        {
            var absoluteUri = "http://" + Request.Url.Authority + "/Fb/";

            Session["code"] = code;

            string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&client_secret={2}&code={3}",
                                       ConfigurationManager.AppSettings["ClientId"], absoluteUri, ConfigurationManager.AppSettings["ClientSecret"], code);

            Session["access_token"] = ServiceWorker.GetFromAccessTokenUrl(url);

            return(RedirectToAction("FbActivity"));
        }
コード例 #8
0
        // GET: ServiceWorkers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceWorker serviceWorker = db.ServiceWorkers.Find(id);

            if (serviceWorker == null)
            {
                return(HttpNotFound());
            }
            return(View(serviceWorker));
        }
コード例 #9
0
        internal ChromiumBrowserContext(IChannelOwner parent, string guid, BrowserContextInitializer initializer) : base(parent, guid, initializer)
        {
            if (initializer.CrBackgroundPages != null)
            {
                foreach (var pageChannel in initializer.CrBackgroundPages)
                {
                    var page = ((PageChannel)pageChannel).Object;
                    _crBackgroundPages.Add(page);
                    page.BrowserContext = this;
                    BackgroundPage?.Invoke(this, new PageEventArgs {
                        Page = page
                    });
                }
            }

            Channel.BackgroundPage += (sender, e) =>
            {
                var page = e.PageChannel.Object;
                page.BrowserContext = this;
                _crBackgroundPages.Add(page);
                BackgroundPage?.Invoke(this, new PageEventArgs {
                    Page = page
                });
            };

            if (initializer.CrServiceWorkers != null)
            {
                foreach (var workerChannel in initializer.CrServiceWorkers)
                {
                    var worker = ((WorkerChannel)workerChannel).Object;
                    ServiceWorkersList.Add(worker);
                    worker.BrowserContext = this;
                    ServiceWorker?.Invoke(this, new WorkerEventArgs(worker));
                }
            }

            Channel.ServiceWorker += (sender, e) =>
            {
                var worker = e.WorkerChannel.Object;
                ServiceWorkersList.Add(worker);
                worker.BrowserContext = this;
                ServiceWorker?.Invoke(this, new WorkerEventArgs(worker));
            };
        }
コード例 #10
0
        public void Automapper_ConvertFromServiceWorkerInEmployeeEntity_IsValid()
        {
            var serviceWorker = new ServiceWorker()
            {
                ID           = 1,
                ManagerID    = 2,
                DepartmentID = 12,
                Sex          = Sex.Female,
                FirstName    = "Name1",
                MiddleName   = null,
                LastName     = "LastName1",
                TypeOfWorker = Profession.SystemAdministrator
            };

            var employeeEntity = _mapper.Map <ServiceWorker, EmployeeEntity>(serviceWorker);

            AssertPropertyValue(serviceWorker, employeeEntity);
            Assert.That(employeeEntity.Profession, Is.EqualTo(serviceWorker.TypeOfWorker));
        }
コード例 #11
0
    // Called when the Object is initialized
    void Awake()
    {
        // if it doesn't exists
        if (instance == null)
        {
            instance = this;
        }

        // There can only be a single instance of the game manager
        else if (instance != this)
        {
            // destroy the current object, so there is just one manager
            Destroy(gameObject);
        }

        // dont destroy this object when loading scenes
        DontDestroyOnLoad(gameObject);
        Instantiate(playerPrefab, new Vector3(0, 1, 0), Quaternion.identity);
    }
コード例 #12
0
        public ActionResult FbActivity()
        {
            string url   = "https://graph.facebook.com/me?fields=id,name,email&access_token=" + Session["access_token"];
            var    model = ServiceWorker.GetFromUrlClient <FacebookUserModel>(url);

            if (Session["currentUser"] == null)
            {
                Session["currentUser"] = model.email;
            }
            else
            {
                if (Session["currentUser"] as string != model.email)
                {
                    Session["currentUser"] = null;
                    var absoluteUrl = "http://" + Request.Url.Authority + "/Fb/";

                    ViewBag.url = new MvcHtmlString(string.Format("https://www.facebook.com/v2.10/dialog/oauth?client_id={0}&redirect_uri={1}", ConfigurationManager.AppSettings["ClientId"], absoluteUrl));
                    return(View("LogoutHelper"));
                }
            }

            return(View(model));
        }
コード例 #13
0
        static void Main(string[] args)
        {
            var serviceWorker = new ServiceWorker();

            serviceWorker.ProcessQueueMessage();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: UlanUlan/Workers
        static void menu()
        {
            ServiceWorker   serviceWorker  = new ServiceWorker(null);
            ServicePosition servicePostion = new ServicePosition(null);

            while (true)
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("С каким справочником будем работать?");
                    Console.WriteLine("1 - Сотрудники");
                    Console.WriteLine("2 - Должности");
                    Console.WriteLine("0 - Выход");
                    switch (Int32.Parse(Console.ReadLine()))
                    {
                    case 1:
                        Console.Clear();
                        Console.WriteLine("-----------Меню сотрудников------------");
                        Console.WriteLine("1 - Отображение списка всех сотрудников.");
                        Console.WriteLine("2 - Прием на работу нового сотрудника.");
                        Console.WriteLine("3 - Редактирование карточки сотрудника");
                        Console.WriteLine("4 - Увольнение сотрудника.");
                        Console.WriteLine("5 - Поиск сотрудника по имени.");
                        Console.WriteLine("6 - Отображение статистики.");
                        Console.WriteLine("0 - Назад.");
                        switch (Int32.Parse(Console.ReadLine()))
                        {
                        case 1: serviceWorker.ShowWorkers(); Console.ReadKey(); break;

                        case 2:
                            if (serviceWorker.AddWorker())
                            {
                                Console.WriteLine("Сотрудник успешно добавлен"); Console.ReadKey();
                            }
                            else
                            {
                                Console.WriteLine("Сотрудник не добавлен"); Console.ReadKey();
                            }
                            break;

                        case 3:
                            if (serviceWorker.EditWorker())
                            {
                                Console.WriteLine("Сотрудник успешно редактирован"); Console.ReadKey();
                            }
                            else
                            {
                                Console.WriteLine("Сотрудник не редактирован"); Console.ReadKey();
                            }
                            break;

                        case 4:
                            if (serviceWorker.RemoveWorker())
                            {
                                Console.WriteLine("Сотрудник успешно уволен"); Console.ReadKey();
                            }
                            else
                            {
                                Console.WriteLine("Сотрудник не уволен"); Console.ReadKey();
                            }
                            break;

                        case 5: serviceWorker.SearchWorkerByName(); Console.ReadKey(); break;

                        case 6: serviceWorker.ShowStatistics(); Console.ReadKey(); break;

                        case 0: break;

                        default: break;
                        }
                        break;

                    case 2:
                        Console.Clear();
                        Console.WriteLine("-----------Меню должностей------------");
                        Console.WriteLine("1 - Отображение списка всех должностей.");
                        Console.WriteLine("2 - Добавление новой должности.");
                        Console.WriteLine("3 - Редактирование должности");
                        Console.WriteLine("4 - Поиск должности по имени.");
                        Console.WriteLine("5 - Отображение статистики.");
                        Console.WriteLine("0 - Назад.");
                        switch (Int32.Parse(Console.ReadLine()))
                        {
                        case 1: servicePostion.ShowPositions(); Console.ReadKey(); break;

                        case 2:
                            if (servicePostion.AddPosition())
                            {
                                Console.WriteLine("Должность успешно добавлена"); Console.ReadKey();
                            }
                            else
                            {
                                Console.WriteLine("Должность не добавлена"); Console.ReadKey();
                            }
                            break;

                        case 3:
                            if (servicePostion.EditPosition())
                            {
                                Console.WriteLine("Должность успешно редактирована"); Console.ReadKey();
                            }
                            else
                            {
                                Console.WriteLine("Должность не редактирована"); Console.ReadKey();
                            }
                            break;

                        case 4: servicePostion.SearchPoisitionByName(); Console.ReadKey(); break;

                        case 5: servicePostion.ShowStatistics(); Console.ReadKey(); break;

                        case 0: break;

                        default: break;
                        }
                        break;

                    case 0: return;

                    default: break;
                    }
                }
                catch (Exception ex) { Console.WriteLine(ex.Message); }
            }
        }
コード例 #15
0
 protected override void OnStart(string[] args)
 {
     base.OnStart(args);
     service = new ServiceWorker();
     service.Start();
 }
コード例 #16
0
 public RFIDCOMSERVICE()
 {
     InitializeComponent();
     worker = new ServiceWorker();
 }
コード例 #17
0
        public List <ServiceWorkerBE> WorkesWhitServices(out int totalRecords, BoardPatient data)
        {
            int groupDocTypeId = (int)Enumeratores.DataHierarchy.TypeDoc;
            int genderId       = (int)Enumeratores.Parameters.Gender;
            int skip           = (data.Index - 1) * data.Take;

            string filterPacient = string.IsNullOrWhiteSpace(data.Patient) ? "" : data.Patient;

            //AMC____
            var protocols = (from a in _ctx.ProtocolSystemUser
                             join b in _ctx.Protocol on a.v_ProtocolId equals b.v_ProtocolId
                             where (data.SystemUserId == -1 || a.i_SystemUserId == data.SystemUserId) &&
                             (b.v_CustomerOrganizationId == data.SystemUserByOrganizationId || b.v_EmployerOrganizationId == data.SystemUserByOrganizationId || b.v_WorkingOrganizationId == data.SystemUserByOrganizationId)
                             select a.v_ProtocolId).ToList();

            protocols = protocols.GroupBy(g => g).Select(s => s.First()).ToList();

            var services = (from a in _ctx.Service
                            join b in _ctx.Person on a.v_PersonId equals b.v_PersonId
                            join c in _ctx.DataHierarchy on new { a = b.i_DocTypeId.Value, b = groupDocTypeId } equals new { a = c.i_ItemId, b = c.i_GroupId }
                            join d in _ctx.SystemParameter on new { a = b.i_SexTypeId.Value, b = genderId } equals new { a = d.i_ParameterId, b = d.i_GroupId }
                            join e in _ctx.Protocol on a.v_ProtocolId equals e.v_ProtocolId
                            join f in _ctx.Organization on e.v_EmployerOrganizationId equals f.v_OrganizationId
                            join g in _ctx.Vigilancia on a.v_PersonId equals g.v_PersonId into gJoin
                            from g in gJoin.DefaultIfEmpty()
                            join h in _ctx.PlanVigilancia on g.v_PlanVigilanciaId equals h.v_PlanVigilanciaId into hJoin
                            from h in hJoin.DefaultIfEmpty()
                            where protocols.Contains(a.v_ProtocolId) &&
                            ((b.v_FirstName + " " + b.v_FirstLastName + " " + b.v_SecondLastName).Contains(filterPacient) ||
                             b.v_DocNumber.Contains(filterPacient)) &&
                            (data.PlanVigilanciaId == "-1" || g.v_PlanVigilanciaId == data.PlanVigilanciaId) &&
                            (g.i_StateVigilanciaId != (int)Enumeratores.StateVigilancia.Finalizado)
                            select new Patients
            {
                ServiceId = a.v_ServiceId,
                PatientId = a.v_PersonId,
                PatientFullName = b.v_FirstName + " " + b.v_FirstLastName + " " + b.v_SecondLastName,
                DocumentType = c.v_Value1,
                DocumentNumber = b.v_DocNumber,
                Occupation = b.v_CurrentOccupation,
                Birthdate = b.d_Birthdate,
                Gender = d.v_Value1,
                StatusVigilanciaId = a.i_StatusVigilanciaId.Value,
                OrganizationLocation = f.v_Name,
                IsRevisedHistoryId = a.i_IsRevisedHistoryId.Value,
                ProtocolId = e.v_ProtocolId,
                ServiceDate = a.d_ServiceDate,
                PlanVigilancia = h.v_Name,
                VigilanciaId = g.v_VigilanciaId
            }).ToList();

            //.. lógica para filtar por UsuarioEmpresa

            var workers = services.GroupBy(g => g.PatientId).Select(s => s.First()).ToList();
            var list    = new List <ServiceWorkerBE>();

            totalRecords = workers.Count;

            var patientses = new List <Patients>();

            if (data.Take > 0)
            {
                patientses = workers.Skip(skip).Take(data.Take).ToList();
            }


            foreach (var worker in patientses)
            {
                var oServiceWorkerBE = new ServiceWorkerBE();

                oServiceWorkerBE.PatientId       = worker.PatientId;
                oServiceWorkerBE.PatientFullName = worker.PatientFullName;
                oServiceWorkerBE.DocumentType    = worker.DocumentType;
                oServiceWorkerBE.DocumentNumber  = worker.DocumentNumber;
                oServiceWorkerBE.Occupation      = worker.Occupation;
                oServiceWorkerBE.Birthdate       = worker.Birthdate;
                oServiceWorkerBE.Gender          = worker.Gender;
                oServiceWorkerBE.PlanVigilancia  = worker.PlanVigilancia;
                oServiceWorkerBE.VigilanciaId    = worker.VigilanciaId;
                oServiceWorkerBE.Age             = Common.Utils.GetAge(worker.Birthdate.Value);
                var servicesByWorker = services.FindAll(p => p.PatientId == worker.PatientId).ToList();

                var oServices = new List <ServiceWorker>();
                foreach (var service in servicesByWorker)
                {
                    var oServiceWorker = new ServiceWorker();
                    oServiceWorker.ServiceId           = service.ServiceId;
                    oServiceWorker.ServiceDate         = service.ServiceDate;
                    oServiceWorker.ProtocolId          = service.ProtocolId;
                    oServiceWorker.IsRevisedHistoryId  = service.IsRevisedHistoryId;
                    oServiceWorker.StatusVigilanciaId  = service.StatusVigilanciaId;
                    oServiceWorker.ListDiseasesService = (from a in _ctx.DiagnosticRepository
                                                          where a.v_ServiceId == service.ServiceId &&
                                                          a.i_FinalQualificationId == (int)Enumeratores.FinalQualification.Definitivo
                                                          select new DiseasesService
                    {
                        ServiceId = a.v_ServiceId,
                        DiseasesId = a.v_DiseasesId
                    }).ToList();
                    oServices.Add(oServiceWorker);
                }

                oServiceWorkerBE.Services = oServices;

                list.Add(oServiceWorkerBE);
            }


            //if (data.Take > 0)
            //    list = list.Skip(skip).Take(data.Take).ToList();

            return(list);
        }
コード例 #18
0
 public LicenseValidator()
 {
     _serviceWorker = new ServiceWorker(new HttpClientContainer());
 }