Esempio n. 1
0
 static void Main()
 {
     ServiceWrapper service = new ServiceWrapper();
     Console.WriteLine("Setup finished... Press enter to start");
     Console.ReadLine();
     service.doWork(); // Instanciar um ServiceProvider + Working
     service.doWork(); // Working
     service.doWork(); // Working
     GC.Collect();
     service.doWork(); // Instanciar um ServiceProvider + Working
     service.doWork(); // Working
 }
        public static ServiceWrapper <TTenant> AddSubdomainProvider <TTenant>(this ServiceWrapper <TTenant> collection, Action <SubdomainTenantProviderOptions> configureOptions = null)
            where TTenant : class
        {
            var s = collection.ServiceCollection;

            s.AddOptions();
            s.AddSingleton <ITenantProvider <TTenant>, SubdomainTenantProvider <TTenant> >();

            if (configureOptions != null)
            {
                s.Configure(configureOptions);
            }

            return(collection);
        }
Esempio n. 3
0
        public void TestMethod1()
        {
            var getAllResponse = ServiceWrapper.Invoke <IUserService, dynamic>(x => x.GetAll());

            Assert.IsTrue(getAllResponse.Status == ResponseStatus.OK);


            var response = ServiceWrapper.Invoke <ISysParamService, dynamic>(x => x.GetAll());

            Assert.IsTrue(response.Status == ResponseStatus.OK);

            var response1 = ServiceWrapper.Invoke <IItemService, dynamic>(x => x.GetAll());

            Assert.IsTrue(response1.Status == ResponseStatus.OK);
        }
Esempio n. 4
0
        public void GetByItemId_TestMethod()
        {
            int ID             = 817200;
            var getByIdRequest = BuildRequest("GetByItemId", new object[] { ID });

            var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest);

            Assert.True(getByIdResponse.Status == ResponseStatus.OK);

            if (getByIdResponse.Result != null)
            {
                IList <BsItemItemDto> dtos = getByIdResponse.Result as IList <BsItemItemDto>;
                Assert.NotNull(dtos);
            }
        }
Esempio n. 5
0
        public async Task Execute()
        {
            var consumer = new RabbitMqConsumer(_rabbitUsername, _rabbitPassword, "/pay_queue", _rabbitHost);
            var factory  =
                new ImplFactoryDelegate <ResponseServiceDefinition, ResponseServiceImpl>(() => new ResponseServiceImpl());
            var serv = new ServiceWrapper <ResponseServiceDefinition, ResponseServiceImpl>(consumer, factory,
                                                                                           (conf) =>
            {
                conf.UseErrorEventHandling(() => new ErrorHandler());
                conf.UseErrorCommandHandling(() => new ErrorHandler());
            });

            serv.Execute();
            await consumer.WaitPoolFinished();
        }
Esempio n. 6
0
        public void GetById_TestMethod()
        {
            int ID             = 12;
            var getByIdRequest = BuildRequest("GetById", new object[] { ID });

            var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest);

            Assert.True(getByIdResponse.Status == ResponseStatus.OK);

            if (getByIdResponse.Result != null)
            {
                BsDrugFormDto dto = getByIdResponse.Result as BsDrugFormDto;
                Assert.Equal(ID, dto.ID);
            }
        }
Esempio n. 7
0
        public void Test_EngineeringMaintenanceService_Delete()
        {
            int id          = this.Add();
            var getResponse = ServiceWrapper.Invoke <IEngineeringMaintenanceService, EngineeringMaintenanceDTO>(x => x.GetById(id));

            Assert.IsTrue(getResponse.Status == ResponseStatus.OK);

            EngineeringMaintenanceDTO dto = getResponse.Result;

            Assert.IsNotNull(dto);

            var deleteResponse = ServiceWrapper.Invoke <IEngineeringMaintenanceService>(x => x.Delete(dto));

            Assert.IsTrue(deleteResponse.Status == ResponseStatus.OK);
        }
        public void GetByItemId_TestMethod()
        {
            int ID             = 304822;
            var getByIdRequest = BuildRequest("GetByItemId", new object[] { ID });

            var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest);

            Assert.True(getByIdResponse.Status == ResponseStatus.OK);

            if (getByIdResponse.Result != null)
            {
                IList <BsItemLocationDto> dtos = getByIdResponse.Result as IList <BsItemLocationDto>;
                Assert.True(dtos.Count > 0);
            }
        }
 private ApplicationWrapper CreateApp_2StatelessService_SingletonPartition_1Replica(
     string appTypeName,
     string serviceTypeName1,
     string serviceTypeName2,
     out ServiceWrapper service1,
     out ServiceWrapper service2,
     out ReplicaWrapper service1replica,
     out ReplicaWrapper service2replica)
 {
     service1        = CreateService(appTypeName, serviceTypeName1, 1, 1, out var replicas1);
     service2        = CreateService(appTypeName, serviceTypeName2, 1, 1, out var replicas2);
     service1replica = replicas1[0];
     service2replica = replicas2[0];
     Mock_ServicesResponse(new Uri($"fabric:/{appTypeName}"), service1, service2);
     return(SFTestHelpers.FakeApp(appTypeName, appTypeName));
 }
Esempio n. 10
0
        private static ServiceWrapper GetService(bool softdeleteEnabled = true)
        {
            ServiceWrapper service =
                new ServiceWrapper(
                    MockStatelessServiceContextFactory.Default,
                    new EventSourcedPersistenceProvider <DummyModel>("https://db-tt-nexus-dev.documents.azure.com:443/",
                                                                     "TiJJMqAdUQXh1SWw2Zfo8wBW0hpfq4ljQjSuJJrbbetOnCFZ9UMJGVgqzOf67Op23l1ZlPPvhclLEEDJ0BP5hQ==",
                                                                     "Models",
                                                                     "ServiceFabricTest",
                                                                     "DefaultEndpointsProtocol=https;AccountName=loadtestseventsourcing;AccountKey=2f/z5vxrHQM9DASJOfOtiFxngIEmbdJm/K+xAaI71nyysCSr9aMoDIVk/qV+SkEzKiuPf3UA7oXH6StYH0vjlw==;EndpointSuffix=core.windows.net",
                                                                     "eventsourcing",
                                                                     ""),
                    softdeleteEnabled);

            return(service);
        }
        public async Task <ServiceWrapper <List <GetCharacterDTO> > > CreateCharacterService(AddCharacterDTO character)
        {
            ServiceWrapper <List <GetCharacterDTO> > _wrapper = new ServiceWrapper <List <GetCharacterDTO> >();
            Character newChar = _mapper.Map <Character>(character);

            newChar.User = await _context.Users.FirstOrDefaultAsync(u => u.id == GetUserId());

            await _context.Characters.AddAsync(newChar);

            await _context.SaveChangesAsync();

            List <Character> characters = await _context.Characters.Include(c => c.Weapon).Where(c => c.User.id == GetUserId()).ToListAsync();

            _wrapper.Data = characters.Select(c => _mapper.Map <GetCharacterDTO>(c)).ToList();
            return(_wrapper);
        }
Esempio n. 12
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
#if !DEBUG
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new DipsService()
            };
            ServiceBase.Run(ServicesToRun);
#else
            var dipsService = new ServiceWrapper();
            dipsService.Start();
            //Console.WriteLine("Press Enter to stop");
            //Console.ReadLine();
#endif
        }
        public void Test_BulkInsert()
        {
            IList <AdditionalMealDTO> dtoList = new List <AdditionalMealDTO>();
            decimal  unitPrice  = 15;
            int      hospId     = 18;
            int      locationId = 1517;
            DateTime orderDate  = DateTime.Now.AddDays(-3);

            for (int i = 0; i < 10000; i++)
            {
                dtoList.Add(PrepareData(hospId, locationId, orderDate, unitPrice));
            }

            var response = ServiceWrapper.Invoke <IAdditionalMealService>(x => x.BulkInsert(dtoList));

            Assert.IsTrue(response.Status == ResponseStatus.OK);
        }
Esempio n. 14
0
        void ConnectToRemoteServers()
        {
            List <string> remoteServerUris = GetListOfRemoteServers();

            foreach (string uri in remoteServerUris)
            {
                ServiceWrapper remoteService = ServiceFactory.Discover(uri);

                localServer.RegisterSyncIDAPI(remoteService);
                worldSync.RegisterWorldSyncAPI(remoteService);
                domainSync.RegisterDomainSyncAPI(remoteService);
                componentSync.RegisterComponentSyncAPI(remoteService);

                remoteService.OnConnected += ServerSyncTools.ConfigureJsonSerializer;
                remoteService.OnConnected += HandleNewServerConnected;
            }
        }
Esempio n. 15
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main()
        {
#if(!DEBUG)
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
            { 
                new CarService() 
            };
            ServiceBase.Run(ServicesToRun);
#else
            var carService = new ServiceWrapper();
            carService.Start();
            //Console.WriteLine("Press Enter to stop");
            //Console.ReadLine();
#endif
        
        }
Esempio n. 16
0
        public void Test_EngineeringMaintenanceService_Update()
        {
            int id          = this.Add();
            var getResponse = ServiceWrapper.Invoke <IEngineeringMaintenanceService, EngineeringMaintenanceDTO>(x => x.GetById(id));

            Assert.IsTrue(getResponse.Status == ResponseStatus.OK);
            Assert.IsNotNull(getResponse.Result);

            var dto = getResponse.Result;

            dto.Memo   = "数据更新测试...";
            dto.OperId = 6768;

            var updateResponse = ServiceWrapper.Invoke <IEngineeringMaintenanceService>(x => x.Update(dto));

            Assert.IsTrue(updateResponse.Status == ResponseStatus.OK);
        }
        public void Test_StopMealRegisterationService_AddOrUpdate()
        {
            var getResponse = ServiceWrapper.Invoke <IStopMealRegisterationService, IEnumerable <StopMealRegisterationDTO> >(x => x.GetAll());

            List <StopMealRegisterationDTO> addDTOs = new List <StopMealRegisterationDTO>();

            addDTOs.Add(new StopMealRegisterationDTO()
            {
                LocationID = 1510,
                OrderQty   = 100,
                CancelQty  = 10,
                IsAudit    = null,
                OperID     = 999999,
                OperTime   = DateTime.Now
            });

            addDTOs.Add(new StopMealRegisterationDTO()
            {
                LocationID = 1511,
                OrderQty   = 200,
                CancelQty  = 20,
                IsAudit    = null,
                OperID     = 999999,
                OperTime   = DateTime.Now
            });

            List <StopMealRegisterationDTO> addOrUpdateDTOs = new List <StopMealRegisterationDTO>();
            var updateDTOs = getResponse.Result.Where(x => x.OperID == 999999).ToList();

            updateDTOs.ForEach(x =>
            {
                x.IsAudit   = true;
                x.AuditID   = 999999;
                x.AuditTime = DateTime.Now.AddDays(-10);
            });

            addOrUpdateDTOs.AddRange(addDTOs);
            addOrUpdateDTOs.AddRange(updateDTOs);

            var updateResponse = ServiceWrapper.Invoke <IStopMealRegisterationService, Tuple <int, int> >(x => x.AddOrUpdate(addOrUpdateDTOs));

            Assert.IsTrue(updateResponse.Status == ResponseStatus.OK);
            Assert.AreEqual(addDTOs.Count, updateResponse.Result.Item1);
            Assert.AreEqual(updateDTOs.Count, updateResponse.Result.Item2);
        }
Esempio n. 18
0
        public async Task GetNextAppt(IDialogContext context, LuisResult result)
        {
            try
            {
                //you have determined that the user is intending on finding their next patient \
                //so call the workflow function within the ServiceWrapper cs

                Person.Models.Person NextApptPatient = new Person.Models.Person();
                NextApptPatient = await ServiceWrapper.GetNextApptforDoc("GeannieandNicky", "Discharge", "1");

                //string replyText = "Your next appointment is with " + NextApptPatient.FName + " " + NextApptPatient.LastName + " at " + NextApptPatient.NextAppt.ToString();
                //create hero image with reply...


                Activity nextApptCard = (Activity)context.MakeMessage();

                List <CardImage> cardImages = new List <CardImage>();
                cardImages.Add(new CardImage(url: "http://img.s-msn.com/tenant/amp/entityid/AA2snpK?m=2&w=480&h=480&f=PNG&h=480&w=480&m=6&q=60&o=t&l=f"));

                nextApptCard.Recipient   = nextApptCard.Recipient;
                nextApptCard.Type        = "message";
                nextApptCard.Attachments = new List <Attachment>();

                ThumbnailCard patientCard = new ThumbnailCard()
                {
                    Title = "Your next appt. is with  " + NextApptPatient.FName + " " + NextApptPatient.LastName + ".",
                    //Subtitle = "Appointment Date/Time: " + NextApptPatient.NextAppt.ToString(),
                    Images = cardImages
                };

                Attachment patientAttachment = patientCard.ToAttachment();
                nextApptCard.Attachments.Add(patientAttachment);

                //change replyText to activity variable in order to send a card back
                await context.PostAsync(nextApptCard);

                Thread.Sleep(3000);
                //20170411 - Here I need to add code to start a child dialog asking user to set the context of the current user or not
                await context.PostAsync("If you are ready to start logging the visit for this patient, just tell me to add CC");
            }
            catch (Exception)
            {
                await context.PostAsync("Sorry, we couldn't find your next appointment or you don't have one");
            }
        }
        private int Add()
        {
            decimal  unitPrice  = 21;
            int      hospId     = 18;
            int      locationId = 1517;
            DateTime orderDate  = DateTime.Now.AddDays(-3);

            var expectedDto = PrepareData(hospId, locationId, orderDate, unitPrice);

            var response = ServiceWrapper.Invoke <IAdditionalMealService, AdditionalMealDTO>(x => x.Add(expectedDto));

            Assert.IsTrue(response.Status == ResponseStatus.OK);
            Assert.IsNotNull(response.Result);
            Assert.AreNotEqual(0, response.Result.ID);
            Assert.AreEqual(expectedDto.Details.Count, response.Result.Details.Count);

            return(response.Result.ID);
        }
        public void Test_StopMealRegisterationService_Update()
        {
            int id          = this.Add();
            var getResponse = ServiceWrapper.Invoke <IStopMealRegisterationService, StopMealRegisterationDTO>(x => x.GetById(id));

            Assert.IsTrue(getResponse.Status == ResponseStatus.OK);
            Assert.IsNotNull(getResponse.Result);

            var dto = getResponse.Result;

            dto.AuditTime = DateTime.Now;
            dto.AuditID   = 999999;
            dto.IsAudit   = true;
            dto.CancelQty = 2;
            var updateResponse = ServiceWrapper.Invoke <IStopMealRegisterationService>(x => x.Update(dto));

            Assert.IsTrue(updateResponse.Status == ResponseStatus.OK);
        }
Esempio n. 21
0
        public int GetDisbursePension(ProcessPensionInput pension)
        {
            _log4net.Info("Pension Amount is Being Validated");
            PensionerDetail pensionerDetail    = new PensionerDetail();
            ServiceWrapper  getPensionerDetail = new ServiceWrapper(configuration);

            pensionerDetail = getPensionerDetail.GetDetailResponse(pension.AadharNumber);


            if (pensionerDetail == null)
            {
                return(21);
            }
            int bankServiceCharge;

            if (pension.BankType == 1)
            {
                bankServiceCharge = 500;
            }
            else if (pension.BankType == 2)
            {
                bankServiceCharge = 550;
            }
            else
            {
                bankServiceCharge = 0;
            }
            double pensionCalculated;

            pensionCalculated = CalculatePensionLogic(pensionerDetail.SalaryEarned, pensionerDetail.Allowances, bankServiceCharge, pensionerDetail.PensionType);


            int processPensionStatusCode;

            if (Convert.ToDouble(pension.PensionAmount) == pensionCalculated)
            {
                processPensionStatusCode = 10;
            }
            else
            {
                processPensionStatusCode = 21;
            }
            return(processPensionStatusCode);
        }
Esempio n. 22
0
        public async Task SeePatientRecord(IDialogContext context, LuisResult result)
        {
            string patientName = string.Empty;
            string replyText   = string.Empty;
            List <Person.Models.Person> People = new List <Person.Models.Person>();

            try
            {
                if (result.Entities.Count > 0)
                {
                    patientName = result.Entities.FirstOrDefault(e => e.Type == "Patient").Entity;

                    if (!string.IsNullOrWhiteSpace(patientName))
                    {
                        //call API to get Patient here
                        //right now just getting all patients of a service call i know works.
                        //after this go back to a API
                        People = await ServiceWrapper.GetPersonByName(patientName);
                    }

                    try
                    {
                        //need to add patients to a carousel of cards
                        if (People.Count >= 1)
                        {
                            replyText = $"I found the following patients that are a fit... \n\n";
                            foreach (var Person in People)
                            {
                                replyText += $"{Person.FName} {Person.LastName}\n\n";
                            }
                        }
                    }
                    catch (Exception)
                    {
                        replyText = "Sorry I didn't find a file for  " + patientName;
                    }
                    await context.PostAsync(replyText);
                }
            }
            catch (Exception)
            {
                await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong.");
            }
        }
        public void Test_AdditionalMealService_AddBatch()
        {
            IList <AdditionalMealDTO> dtoList = new List <AdditionalMealDTO>();
            decimal  unitPrice  = 21;
            int      hospId     = 18;
            int      locationId = 1517;
            DateTime orderDate  = DateTime.Now.AddDays(-5);

            var expectedDto = this.PrepareData(hospId, locationId, orderDate, unitPrice);

            for (int i = 0; i < 20; i++)
            {
                dtoList.Add(this.PrepareData(hospId, locationId, orderDate, 20));
            }

            var response = ServiceWrapper.Invoke <IAdditionalMealService, int>(x => x.AddBatch(dtoList));

            Assert.IsTrue(response.Status == ResponseStatus.OK);
        }
Esempio n. 24
0
        public void GetByExpressionNode_TestMethod()
        {
            int mzRegId = 12963;
            Expression <Func <OulInvoiceRegDto, bool> > query = (x => x.MzRegId == mzRegId);

            Serialize.Linq.Nodes.ExpressionNode expressionNode = query.ToExpressionNode();

            var getByIdRequest = BuildRequest("Get", new object[] { expressionNode });

            var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest);

            Assert.True(getByIdResponse.Status == ResponseStatus.OK);

            if (getByIdResponse.Result != null)
            {
                IList <OulInvoiceRegDto> dtos = getByIdResponse.Result as IList <OulInvoiceRegDto>;
                Assert.NotNull(dtos);
            }
        }
Esempio n. 25
0
        public async void CallMyService()
        {
            ServiceWrapper serviceWrapper = new ServiceWrapper();
            var            model          = new UserModel {
                Username = "******", Password = "******"
            };

            var result = await serviceWrapper.GetData("test");

            txtMessages.Text = "get call says: " + result;

            result = await serviceWrapper.RegisterUserJsonRequest(model);

            txtMessages.Text = "json post call says: " + result;

            result = await serviceWrapper.RegisterUserFormRequest(model);

            txtMessages.Text = "form post request says: " + result;
        }
Esempio n. 26
0
        private void Login_Load(object sender, EventArgs e)
        {
            this.tbxUserName.Focus();
            string Config = string.Empty;

            try
            {
                //配置文件读取
                Config = System.Configuration.ConfigurationSettings.AppSettings["Itsp2WebServiceNamespace"];
            }
            catch (Exception ex)
            {
                MessageBoxForm.Show("配置不正确,请联系管理员!", MessageBoxButtons.OK);
            }

            ServiceWrapper.Init();
            ServiceWrapper.SetURL(Config);
            //检查更新
            CheckDownlaod();
        }
        private int Add()
        {
            var expectedDto = new StopMealRegisterationDTO()
            {
                LocationID = 1517,
                OrderQty   = 10,
                CancelQty  = 3,
                IsAudit    = null,
                OperID     = 999999,
                OperTime   = DateTime.Now
            };

            var response = ServiceWrapper.Invoke <IStopMealRegisterationService, StopMealRegisterationDTO>(x => x.Add(expectedDto));

            Assert.IsTrue(response.Status == ResponseStatus.OK);
            Assert.IsNotNull(response.Result);
            Assert.AreNotEqual(0, response.Result.ID);

            return(response.Result.ID);
        }
        public void EnableJavascriptDebugger()
        {
            if (m_javascriptDebuggingEnabled)
            {
                return;
            }

            using (var a = new AutoJSContext())
            {
                using (var jsd = new ServiceWrapper <jsdIDebuggerService>("@mozilla.org/js/jsd/debugger-service;1"))
                {
                    jsd.Instance.SetErrorHookAttribute(new JSErrorHandler(this));
                    using (var runtime = new ServiceWrapper <nsIJSRuntimeService>("@mozilla.org/js/xpc/RuntimeService;1"))
                    {
                        jsd.Instance.ActivateDebugger(runtime.Instance.GetRuntimeAttribute());
                    }
                }
            }
            m_javascriptDebuggingEnabled = true;
        }
Esempio n. 29
0
        static void Main(string [] args)
        {
            var proxy = new SampleServiceAsSvcRef1.SampleServiceClient();

            var proxy2 = new SampleServiceAsSvcRef2.SampleServiceClient();


            var response1 = ServiceWrapper <SampleServiceAsSvcRef1.ISampleService> .Use <String> (_ => proxy.UpdateStatus("Frank", 5), _endpointNameForUpdateServiceWithWsdl);

            Console.WriteLine(response1);

            PrintSeparator();

            var response2 = ServiceWrapper <SampleServiceAsSvcRef1.ISampleService> .Use <Client> (_ => proxy.GetClient(3), _endpointNameForUpdateServiceWithWsdl);

            Console.WriteLine(response2.Id);
            Console.WriteLine(response2.Name);
            Console.WriteLine(response2.Company);

            PrintSeparator();

            var response3 = ServiceWrapper <SampleServiceAsSvcRef2.ISampleService> .Use <SampleServiceAsSvcRef2.UpdateStatusResponse> (
                _ => proxy2.UpdateStatus(new SampleServiceAsSvcRef2.UpdateStatusRequest("John", 15)),
                _endpointNameForUpdateServiceWithWsdlAndMessages);

            Console.WriteLine(response3.UpdateStatusResult);

            PrintSeparator();

            var response4 = ServiceWrapper <SampleServiceAsSvcRef2.ISampleService> .Use <SampleServiceAsSvcRef2.GetClientResponse> (
                _ => proxy2.GetClient(new SampleServiceAsSvcRef2.GetClientRequest(4)),
                _endpointNameForUpdateServiceWithWsdlAndMessages);

            Console.WriteLine(response4.GetClientResult.Id);
            Console.WriteLine(response4.GetClientResult.Name);
            Console.WriteLine(response4.GetClientResult.Company);

            PrintSeparator();

            Console.ReadLine();
        }
Esempio n. 30
0
        public TokenModel Logar()
        {
            ServiceWrapper serviceWrapper = new ServiceWrapper();
            UserLoginModel loginModel     = new UserLoginModel(_emailEditText.Text, _passwordEditText.Text);

            _progressDialog = ProgressDialog.Show(this, "Autenticando...", "Checando informações...", true);

            new Thread(new ThreadStart(delegate
            {
                //LOAD METHOD TO GET ACCOUNT INFO
                RunOnUiThread(() => _progressDialog.Show());

                _tokenModel = serviceWrapper.GetAuthorizationToken(loginModel);
                AutenticationOk(_emailEditText.Text, _tokenModel.access_token);

                //HIDE PROGRESS DIALOG
                RunOnUiThread(() => _progressDialog.Hide());
            })).Start();

            return(_tokenModel);
        }
Esempio n. 31
0
        public async Task <ServiceWrapper <int> > Register(User user, string password)
        {
            ServiceWrapper <int> wrapper = new ServiceWrapper <int>();

            if (await UserExist(user.Name))
            {
                wrapper.Message = "User already exist.";
                wrapper.DidSend = false;
                return(wrapper);
            }
            CreatePasswordHash(password, out byte[] passwordHash, out byte[] passwordSalt);
            user.PasswordHash = passwordHash;
            user.PsswordSalt  = passwordSalt;
            await _context.Users.AddAsync(user);

            await _context.SaveChangesAsync();

            wrapper.Data = user.id;

            return(wrapper);
        }
Esempio n. 32
0
        public async Task <ServiceWrapper <string> > Login(string username, string password)
        {
            ServiceWrapper <string> response = new ServiceWrapper <string>();
            User user = await _context.Users.FirstOrDefaultAsync(x => x.Name.ToLower().Equals(username.ToLower()));

            if (user == null)
            {
                response.DidSend = false;
                response.Message = "User Not Found.";
            }
            else if (!VerifyPassword(password, user.PasswordHash, user.PsswordSalt))
            {
                response.DidSend = false;
                response.Message = "Password incorrect.";
            }
            else
            {
                response.Data = CreateToken(user);
            }
            return(response);
        }
		static PrivateBrowsingService()
		{
			_privateBrowsingService = new ServiceWrapper<nsIPrivateBrowsingService>(Contracts.PrivateBrowsing);
		}
 static CertificateDatabase()
 {
     _certDb = new ServiceWrapper<nsIX509CertDB>(Contracts.X509CertDb);
     _certDb2 = new ServiceWrapper<nsIX509CertDB2>(Contracts.X509CertDb);
 }
 static DnsService()
 {
     _dnsService = new ServiceWrapper<nsIDNSService>(Contracts.DnsService);
 }
 static IOService()
 {
     _service = new ServiceWrapper<nsIIOService>( Contracts.NetworkIOService );
 }
 static CookieManager()
 {
     _cookieManager = new ServiceWrapper<nsICookieManager2>( Contracts.CookieManager );
 }