Esempio n. 1
0
        public static void Initialize(TestContext context)
        {
            var config = new TestConfig
            {
                ResetHttpContext = true
            };

            var cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>(config);
            var cartAddRequest  = RequestBuilder.GetCartAddRequestForShoes();
            var cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>();
            cartAddRequest  = RequestBuilder.GetCartAddRequestForAccessories();
            cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            var cartDetail         = new BaseIntegrationTest <CartDetail, CartResponse>();
            var cartDetailRequest  = new EmptyRequest();
            var cartDetailResponse = (Response <CartResponse>)cartDetail.TestObject.Execute(cartDetailRequest);

            var checkoutBegin         = new BaseIntegrationTest <CheckoutBegin, CheckoutResponse>();
            var checkoutBeginRequest  = new EmptyRequest();
            var checkoutBeginResponse = (Response <CheckoutResponse>)checkoutBegin.TestObject.Execute(checkoutBeginRequest);

            var checkoutGuest        = new BaseIntegrationTest <CheckoutGuest, CheckoutResponse>();
            var checkoutGuestRequest = new EmptyRequest();

            _result = (Response <CheckoutResponse>)checkoutGuest.TestObject.Execute(checkoutGuestRequest);

            _testObject = checkoutGuest.TestObject;
        }
 public override Task <Version> GetVersion(EmptyRequest request, ServerCallContext context)
 {
     return(Task.FromResult(new Version
     {
         ApiVersion = "API Version 1.0"
     }));
 }
Esempio n. 3
0
 public override Task <InvertorProducingStatistic> GetAllStationsStatistics(EmptyRequest request, ServerCallContext context)
 {
     try
     {
         InvertorProducingStatistic result = new InvertorProducingStatistic();
         for (int i = 1; i <= 6; i++)
         {
             InvertorProducingStatistic stationResult = null;
             if (db.InvertorProducingStatistics.Where(x => x.StationId == i).ToList().Any())
             {
                 stationResult = db.InvertorProducingStatistics.Where(x => x.StationId == i).ToList().Last();
             }
             if (stationResult != null)
             {
                 stationResult.ErrorCount   = db.Events.Where(x => x.StationId == i).Count();
                 result.ProducedEnergy     += stationResult.ProducedEnergy;
                 result.PredictedProducing += stationResult.PredictedProducing;
                 result.ActivePower        += stationResult.ActivePower;
                 result.ErrorCount         += stationResult.ErrorCount;
             }
         }
         if (powerInMW)
         {
             result.PredictedProducing /= 1000;
             result.ActivePower        /= 1000;
             result.ProducedEnergy     /= 1000;
         }
         return(Task.FromResult(result));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(Task.FromResult(new InvertorProducingStatistic()));
 }
Esempio n. 4
0
 public override Task <EmptyResponse> IsLogin(EmptyRequest request, ServerCallContext context)
 {
     return(Task.FromResult(new EmptyResponse
     {
         Status = ResponseStatus.RsOk
     }));
 }
Esempio n. 5
0
        public IResponseBase Execute(IRequestParameter parameters)
        {
            IResponseBase result = new Response <BoolResponse>();

            try
            {
                _request = (LoginRequest)parameters;

                var LoginForm         = new LoginForm(_core, _errors);
                var LoginFormRequest  = new EmptyRequest();
                var LoginFormResponse = (Response <LoginFormResponse>)LoginForm.Execute(LoginFormRequest);

                if (!_errors.Any())
                {
                    _request.Form = LoginFormResponse.resultset;

                    var communicationRequest = BuildUrl(parameters);
                    _response = Communicate(communicationRequest);
                    result    = ProcessResponse(_response, parameters);
                }
            }
            catch (Exception ex)
            {
                _errors.Add(ex.Handle("Login.Execute", ErrorSeverity.FollowUp, ErrorType.BuildUrl));
            }
            return(result);
        }
Esempio n. 6
0
        public override async Task <EventListResponse> GetList(EmptyRequest request, ServerCallContext context)
        {
            var events = await _ctx.Events.ToListAsync();

            var ret = new EventListResponse();

            ret.Events.AddRange(events);
            var file  = File.ReadAllBytes(".\\cover.jpg");
            var data  = Convert.ToBase64String(file);
            var small = ImageUtils.GetSmallBase64(data);

            for (int i = 0; i < 22; i++)
            {
                ret.Events.Add(new Event
                {
                    EventName = $"Unplugged #{i}",
                    CoverData = small,
                    StartTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                    Type      = EventType.Unplugged,
                    Status    = i < 20 ? EventStatus.Finished : EventStatus.Planning
                });
            }


            return(ret);
        }
Esempio n. 7
0
        public Inventory Any(EmptyRequest request)
        {
            Inventory inventory = new Inventory();

            inventory.success = true;
            SqlDatabase sq    = new SqlDatabase();
            DataTable   table = sq.Fill("GetInventory");
            List <Item> items = new List <Item>();

            foreach (DataRow dr in table.Rows)
            {
                items.Add(new Item()
                {
                    make     = dr["make"].ToString(),
                    model    = dr["model"].ToString(),
                    color    = dr["color"].ToString(),
                    trans    = dr["trans"].ToString(),
                    drive    = dr["drive"].ToString(),
                    miles    = dr["miles"].ToString(),
                    price    = dr["price"].ToString(),
                    car_year = dr["car_year"].ToString(),
                    vin      = dr["vin"].ToString()
                });
            }
            inventory.Table = items;
            return(inventory);
        }
        public override async Task MakeNewBookingGRPC(EmptyRequest request, IServerStreamWriter <LocationRequest> responseStream, ServerCallContext context)
        {
            // lav facade kald her og gør det lig locations istedet
            List <LocationRequest> locationRequests = new List <LocationRequest>();
            List <Location>        locations        = DbFacade.GetAllLocations();

            foreach (var l in locations)
            {
                LocationRequest a = new LocationRequest()
                {
                    Address = l.Address,
                    City    = l.City,
                    Country = l.Country,
                    Id      = l.Id,
                    Zipcode = l.Zipcode
                };

                locationRequests.Add(a);
            }

            foreach (var location in locationRequests)
            {
                // this sends our CarReply class to the client one at a time, until there are no more
                // essentially making this method of type void, as opposed to the previous method that returns a type.

                await responseStream.WriteAsync(location);
            }
        }
Esempio n. 9
0
 public override Task <HelloReply> HelloWorld(EmptyRequest request, ServerCallContext context)
 {
     return(Task.FromResult(new HelloReply
     {
         Message = "Hello " + "covid-19"
     }));
 }
Esempio n. 10
0
        //[Authorize]
        public override async Task <CountriesReply> GetAll(EmptyRequest request, ServerCallContext context)
        {
            //throw new RpcException(new Status(StatusCode.Internal, "Internal error"), "Internal error occured");
            var countries = await _countryService.GetAsync();

            return(_mapper.Map <CountriesReply>(countries));
        }
Esempio n. 11
0
        public override async Task <ContactsResponse> GetContact(EmptyRequest request, ServerCallContext context)
        {
            var companies = _companyService.GetAll();

            if (companies == null)
            {
                _logger.LogError("contacts doesn't found");
                return(null);
            }


            _logger.LogInformation("contacts found");

            List <ContactResponse> contacts = new List <ContactResponse>();

            foreach (var comp in companies)
            {
                foreach (var cont in comp.Contacts)
                {
                    ContactResponse response = _mapper.Map <ContactResponse>(cont);
                    response.CompanyId = comp.Id;
                    contacts.Add(response);
                }
            }


            return(new ContactsResponse
            {
                Contacts = { contacts }
            });
        }
Esempio n. 12
0
 public ValueTask <BoolResponse> IsMaintenanceMode(EmptyRequest request)
 {
     return(ValueTask.FromResult(new BoolResponse
     {
         Value = serverManager.IsMaintenanceMode
     }));
 }
Esempio n. 13
0
        public static void Initialize(TestContext context)
        {
            var config = new TestConfig
            {
                ResetHttpContext = true
            };

            var cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>(config);
            var cartAddRequest  = RequestBuilder.GetCartAddRequestForShoes();
            var cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>();
            cartAddRequest  = RequestBuilder.GetCartAddRequestForGiftCard();
            cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            cartAdd         = new BaseIntegrationTest <CartAdd, CartResponse>();
            cartAddRequest  = RequestBuilder.GetCartAddRequestForAccessories();
            cartAddResponse = (Response <CartResponse>)cartAdd.TestObject.Execute(cartAddRequest);

            var cartDetail         = new BaseIntegrationTest <CartDetail, CartResponse>();
            var cartDetailRequest  = new EmptyRequest();
            var cartDetailResponse = (Response <CartResponse>)cartDetail.TestObject.Execute(cartDetailRequest);

            _itemCountBefore = cartDetailResponse.resultset.Cart.CartItemCount;

            var cartRemove        = new BaseIntegrationTest <CartRemove, CartResponse>();
            var cartRemoveRequest = RequestBuilder.GetCartRemoveRequest(cartDetailResponse.resultset.Cart.CartItems);

            _result = (Response <CartResponse>)cartRemove.TestObject.Execute(cartRemoveRequest);

            _itemCountAfter = _result.resultset.Cart.CartItemCount;
            _testObject     = cartRemove.TestObject;
        }
Esempio n. 14
0
 public ValueTask <BoolResponse> IsClusterOnline(EmptyRequest request)
 {
     return(ValueTask.FromResult(new BoolResponse
     {
         Value = true
     }));
 }
Esempio n. 15
0
        public ListResponse<PizzaNetCommon.DTOs.StockIngredientDTO> GetIngredients(EmptyRequest req)
        {
            try
            {
                using (var db = new PizzaUnitOfWork())
                {
                    return db.inTransaction(uof =>
                        {
                            if (!HasRights(GetUser(req).Data, 2))
                                throw PizzaServiceFault.Create(Messages.NO_PERMISSIONS);

                            return ListResponse.Create(uof.Db.Ingredients.FindAll().ToList()
                                .Select(ingAssembler.ToSimpleDto)
                                .ToList());
                        });
                }
            }
            catch (FaultException<PizzaServiceFault> e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new FaultException(e.Message);
            }
        }
 public override async Task GetLargePayload(EmptyRequest request, IServerStreamWriter <MeteoriteLanding> responseStream, ServerCallContext context)
 {
     foreach (var meteoriteLanding in MeteoriteLandingData.GrpcMeteoriteLandings)
     {
         await responseStream.WriteAsync(meteoriteLanding);
     }
 }
Esempio n. 17
0
        public override async Task <LocationsResponse> GetLocations(EmptyRequest request, ServerCallContext context)
        {
            var companies = _companyService.GetAll();

            if (companies == null)
            {
                _logger.LogError("locations doesn't found");
                return(null);
            }


            _logger.LogInformation("locations found");


            List <LocationResponse> locations = new List <LocationResponse>();

            foreach (var comp in companies)
            {
                foreach (var cont in comp.Locations)
                {
                    LocationResponse response = _mapper.Map <LocationResponse>(cont);
                    response.CompanyId = comp.Id;
                    locations.Add(response);
                }
            }


            return(new LocationsResponse
            {
                Locations = { locations }
            });
        }
Esempio n. 18
0
 public ListResponse<StockIngredientDTO> GetIngredients(EmptyRequest req)
 {
     return ListResponse.Create(new List<StockIngredientDTO>
         {
             new StockIngredientDTO{ StockQuantity=20, PricePerUnit=1M, NormalWeight=2, Name="A", IsPartOfRecipe=true, ExtraWeight=3},
             new StockIngredientDTO{ StockQuantity=25, PricePerUnit=0.5M, NormalWeight=3, Name="B", IsPartOfRecipe=false, ExtraWeight=5}
         });
 }
Esempio n. 19
0
        public override async Task <DiceResult> RollDice(EmptyRequest request, ServerCallContext context)
        {
            var result = await RollDice();

            return(new DiceResult {
                Result = result
            });
        }
 public override Task <ModelLibrary.GRPC.Version> GetVersion(EmptyRequest request, ServerCallContext context)
 {
     Console.WriteLine(">> GetVersion called: {0}", request);
     return(Task.FromResult(new ModelLibrary.GRPC.Version
     {
         ApiVersion = "API Version 1.0"
     }));
 }
Esempio n. 21
0
        public override Task <AtomicCounterReply> GetUdpAtomicCounter(EmptyRequest request, ServerCallContext context)
        {
            AtomicCounterReply atomicCounterReply = new AtomicCounterReply();

            atomicCounterReply.MsgFailCount    = 50;
            atomicCounterReply.MsgSuccessCount = 1111;
            return(Task.FromResult(atomicCounterReply));
        }
Esempio n. 22
0
        public override Task <DeleteReply> DeletePlayer(EmptyRequest request, ServerCallContext context)
        {
            bool succes = _playerService.DeletePlayer(_httpContext.GetUsername());

            return(Task.FromResult(new DeleteReply
            {
                IsDeleted = succes
            }));
        }
Esempio n. 23
0
        public override async Task GetAllTeams(EmptyRequest request, IServerStreamWriter <EquipoReply> responseStream, ServerCallContext context)
        {
            var equipos = MisEquipos();

            foreach (var equipo in equipos)
            {
                await responseStream.WriteAsync(equipo);
            }
        }
Esempio n. 24
0
        public override async Task GetAllStudentIds(EmptyRequest request, IServerStreamWriter <StudentLookupModel> responseStream, ServerCallContext context)
        {
            List <StudentLookupModel> ids = _db.GetAllStudentIds();

            foreach (StudentLookupModel id in ids)
            {
                await responseStream.WriteAsync(id);
            }
        }
Esempio n. 25
0
 public override Task <GetQuoteListResponse> GetQuoteList(EmptyRequest request, ServerCallContext context)
 {
     return(Task.Run(() =>
     {
         var response = new GetQuoteListResponse();
         response.QuoteList.AddRange(_conn.QuotesList);
         return response;
     }));
 }
Esempio n. 26
0
        public override async Task GetAllStudents(EmptyRequest request, IServerStreamWriter <StudentModel> responseStream, ServerCallContext context)
        {
            List <StudentModel> students = _db.GetAllStudents();

            foreach (StudentModel student in students)
            {
                await responseStream.WriteAsync(student);
            }
        }
Esempio n. 27
0
        //Get All
        public override async Task GetAllSmallPayloads(EmptyRequest request, IServerStreamWriter <SmallPayload> responseStream, ServerCallContext context)
        {
            List <SmallPayload> sps = _db.GetAllSmallPayloads();

            foreach (SmallPayload sp in sps)
            {
                await responseStream.WriteAsync(sp);
            }
        }
Esempio n. 28
0
        public override async Task GetAllMediumPayloads(EmptyRequest request, IServerStreamWriter <MediumPayload> responseStream, ServerCallContext context)
        {
            List <MediumPayload> mps = _db.GetAllMediumPayloads();

            foreach (MediumPayload mp in mps)
            {
                await responseStream.WriteAsync(mp);
            }
        }
Esempio n. 29
0
        public override async Task GetAllLargePayloads(EmptyRequest request, IServerStreamWriter <LargePayload> responseStream, ServerCallContext context)
        {
            List <LargePayload> lps = _db.GetAllLargePayloads();

            foreach (LargePayload lp in lps)
            {
                await responseStream.WriteAsync(lp);
            }
        }
Esempio n. 30
0
        public override async Task GetAllDeepPayloads(EmptyRequest request, IServerStreamWriter <DeepPayload> responseStream, ServerCallContext context)
        {
            List <DeepPayload> dps = _db.GetAllDeepPayloads();

            foreach (DeepPayload dp in dps)
            {
                await responseStream.WriteAsync(dp);
            }
        }
Esempio n. 31
0
        public override Task <ResultString> GetFirstPostDescription(EmptyRequest request, ServerCallContext context)
        {
            DbService dbs = new DbService();

            return(Task.FromResult(new ResultString
            {
                Message = dbs.GetPosts()[0].Description
            }));
        }
Esempio n. 32
0
        public void TestGetConfig()
        {
            EmptyRequest req = new EmptyRequest();

            req.CustomerID = "4638b8b9d8c1435e8618f892d44a17a1";
            var rsp = APIClientProxy.CallAPI <EmptyRequestParameter, GetConfigRD>(APITypes.Product, "HtmlApp.Config.GetConfig", req);

            Assert.IsTrue(rsp.IsSuccess);
        }
Esempio n. 33
0
 public ListResponse<OrderDTO> GetOrdersForUser(EmptyRequest req)
 {
     if (req.Login != "Admin") throw new FaultException<PizzaServiceFault>(new PizzaServiceFault("wrong user"));
     return new ListResponse<OrderDTO>(new List<OrderDTO>()
         {
             new OrderDTO()
             {
             }
         });
 }
Esempio n. 34
0
 public ListResponse<ComplaintDTO> GetComplaints(EmptyRequest req)
 {
     using (var db = new PizzaUnitOfWork())
     {
         return db.inTransaction(uow =>
             {
                 return ListResponse.Create(uow.Db.Complaints.FindAll()
                     .Select(complaintAssembler.ToSimpleDto)
                     .ToList());
             });
     }
 }
Esempio n. 35
0
        public void Initialize()
        {
            db = new PizzaUnitOfWork();
            admin = db.Users.Find("Admin");
            emp = db.Users.Find("Employee");
            customer = db.Users.Find("Customer");
            admin.Password = "******";
            emp.Password = "******";
            customer.Password = "******";

            adminRequest = new EmptyRequest { Login = admin.Email, Password = admin.Password };
            empRequest = new EmptyRequest { Login = emp.Email, Password = emp.Password };
            customerRequest = new EmptyRequest { Login = customer.Email, Password = customer.Password };
        }
Esempio n. 36
0
 public ListResponse<OrderDTO> GetOrders(EmptyRequest req)
 {
     return ListResponse.Create(new List<OrderDTO>
     {
         new OrderDTO
         {
             Address="AddressA",
             CustomerPhone=1,
             Date=DateTime.Now,
             State = new StateDTO { StateValue=State.IN_REALISATION},
             OrderDetailsDTO=new List<OrderDetailDTO> {
                 new OrderDetailDTO {
                     Ingredients=new List<OrderIngredientDTO>{
                         new OrderIngredientDTO{ Name="IngredientA", Price=0.1M, Quantity=1},
                         new OrderIngredientDTO{ Name="IngredientC", Price=0.1M, Quantity=3}
                     }
                 },
                 new OrderDetailDTO {
                     Ingredients= new List<OrderIngredientDTO> {
                         new OrderIngredientDTO{ Name="IngredientB", Price=0.2M, Quantity=2}
                     }
                 }
             }
         },
         new OrderDTO
         {
             Address="AddressB",
             CustomerPhone=2,
             Date=DateTime.Now,
             State = new StateDTO{ StateValue=State.NEW},
             OrderDetailsDTO=new List<OrderDetailDTO> {
                 new OrderDetailDTO {
                     Ingredients = new List<OrderIngredientDTO> {
                         new OrderIngredientDTO{ Name="IngredientD", Price =0.15M, Quantity=5}
                     }
                 },
                 new OrderDetailDTO {
                     Ingredients = new List<OrderIngredientDTO> {
                         new OrderIngredientDTO { Name="IngredientE", Price=0.5M, Quantity=20},
                         new OrderIngredientDTO{ Name="IngredientF", Price=0.02M, Quantity=30}
                     }
                 }
             }
         }
     });
 }
Esempio n. 37
0
        public ListResponse<OrderDTO> GetOrdersForUser(EmptyRequest req)
        {
            using (var db = new PizzaUnitOfWork())
            {
                return db.inTransaction(uow =>
                    {
                        if (!HasRights(GetUser(req).Data, 1))
                            throw PizzaServiceFault.Create(Messages.NO_PERMISSIONS);

                        return ListResponse.Create(uow.Db.Orders.FindAllEagerlyWhere(o => o.User.Email == req.Login)
                            .ToList().Select(orderAssembler.ToSimpleDto).ToList());
                    });
            }
        }
Esempio n. 38
0
        public TrioResponse<List<RecipeDTO>, List<SizeDTO>, List<OrderIngredientDTO>> GetRecipeTabData(EmptyRequest req)
        {
            try
            {
                using (var db = new PizzaUnitOfWork())
                {

                    return db.inTransaction(uof =>
                    {
                        if (!HasRights(GetUser(req).Data, 1))
                            throw PizzaServiceFault.Create(Messages.NO_PERMISSIONS);

                        return TrioResponse.Create(uof.Db.Recipies.FindAll().ToList()
                            .Select(recipeAssembler.ToSimpleDto)
                            .ToList(), uof.Db.Sizes.FindAll().ToList()
                            .Select(sizeAssembler.ToSimpleDto)
                            .ToList(), uof.Db.Ingredients.FindAll().ToList()
                            .Select(ingAssembler.ToOrderIngredientDto)
                            .ToList());
                    });
                }
            }
            catch (FaultException<PizzaServiceFault> e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new FaultException(e.Message);
            }
        }
Esempio n. 39
0
 public ListResponse<StockIngredientDTO> GetIngredients(EmptyRequest req)
 {
     throw new NotImplementedException();
 }
Esempio n. 40
0
 public SingleItemResponse<UserDTO> GetUser(EmptyRequest req)
 {
     if (req.Login != "Admin" || req.Password != "123") throw new FaultException<PizzaServiceFault>(new PizzaServiceFault("wrong user"));
     return new SingleItemResponse<UserDTO>(new UserDTO() { Email = "Admin", Password = "******" });
 }
Esempio n. 41
0
        private void m_wylogujButton_Click(object sender, EventArgs e)
        {
            var request = new EmptyRequest();
            string result = client.Logout(request).Message;

            if (result != "Wylogowano pomyślnie")
            {
                MessageBox.Show(result, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            m_wylogujButton.Visible = false;
            m_wylogujButton2.Visible = false;
            m_zalogujButton.Visible = true;
            m_zalogujButton2.Visible = true;
            m_zarejestrujButton.Visible = true;
            m_zarejestrujButton2.Visible = true;
            zamowienieTabPage.Enabled = false;
            zamowienieDataGridView.Rows.Clear();
            updatePriceLabel();
            m_label.Text = "Witaj nieznajomy! Zaloguj się lub zarejestruj!";
            m_label2.Text = m_label.Text;
        }
Esempio n. 42
0
 private static void Logout()
 {
     var request = new EmptyRequest();
     Console.WriteLine(client.Logout(request).Message);
 }
Esempio n. 43
0
 public TrioResponse<List<RecipeDTO>, List<SizeDTO>, List<StockIngredientDTO>> GetRecipeTabData(EmptyRequest req)
 {
     return TrioResponse.Create(
         new List<RecipeDTO>
     {
         new RecipeDTO{
              Ingredients=new List<StockIngredientDTO> {
                     new StockIngredientDTO{ StockQuantity=20, PricePerUnit=1M, NormalWeight=2, Name="C", IsPartOfRecipe=true, ExtraWeight=3},
                     new StockIngredientDTO{ StockQuantity=25, PricePerUnit=0.5M, NormalWeight=3, Name="D", IsPartOfRecipe=true, ExtraWeight=5},
                     new StockIngredientDTO{ StockQuantity=20, PricePerUnit=1M, NormalWeight=2, Name="E", IsPartOfRecipe=true, ExtraWeight=3},
                     new StockIngredientDTO{ StockQuantity=25, PricePerUnit=0.5M, NormalWeight=3, Name="F", IsPartOfRecipe=true, ExtraWeight=5}
              }, Name="RecipeA"
         }
     },
     new List<SizeDTO>
     {
         new SizeDTO{ SizeValue=Size.MEDIUM}
     },
     new List<StockIngredientDTO>
     {
         new StockIngredientDTO{ StockQuantity=20, PricePerUnit=1M, NormalWeight=2, Name="C", IsPartOfRecipe=true, ExtraWeight=3},
                     new StockIngredientDTO{ StockQuantity=25, PricePerUnit=0.5M, NormalWeight=3, Name="D", IsPartOfRecipe=true, ExtraWeight=5},
                     new StockIngredientDTO{ StockQuantity=20, PricePerUnit=1M, NormalWeight=2, Name="E", IsPartOfRecipe=true, ExtraWeight=3},
                     new StockIngredientDTO{ StockQuantity=25, PricePerUnit=0.5M, NormalWeight=3, Name="F", IsPartOfRecipe=true, ExtraWeight=5}
     });
 }
Esempio n. 44
0
        public ListResponse<UserDTO> GetUsers(EmptyRequest req)
        {
            using (var db = new PizzaUnitOfWork())
            {
                return db.inTransaction(uof =>
                    {
                        if (!HasRights(GetUser(req).Data, 3))
                            throw PizzaServiceFault.Create(Messages.NO_PERMISSIONS);

                        return ListResponse.Create(uof.Db.Users.FindAll().ToList()
                            .Select(userAssembler.ToSimpleDto).ToList());
                    });
            }
        }
Esempio n. 45
0
 public SingleItemResponse<UserDTO> GetUser(EmptyRequest req)
 {
     throw new NotImplementedException();
 }
Esempio n. 46
0
 public ListResponse<OrderDTO> GetUndoneOrders(EmptyRequest req)
 {
     return ListResponse.Create(GetOrders(req).Data.Where(o => o.State.StateValue == State.NEW ||
         o.State.StateValue == State.IN_REALISATION)
         .ToList());
 }
Esempio n. 47
0
 public TrioResponse<List<RecipeDTO>, List<SizeDTO>, List<OrderIngredientDTO>> GetRecipeTabData(EmptyRequest req)
 {
     if (req.Login != "Admin") throw new FaultException<PizzaServiceFault>(new PizzaServiceFault("wrong user"));
     List<RecipeDTO> lr = new List<RecipeDTO>()
     {
         new RecipeDTO()
         {
             Ingredients = new List<OrderIngredientDTO>(),
             Name = "MyRecipe",
             RecipeID = 1
         }
     };
     List<SizeDTO> ls = new List<SizeDTO>()
     {
         new SizeDTO()
         {
             SizeID = 0
         },
         new SizeDTO()
         {
             SizeID = 1
         },
         new SizeDTO()
         {
             SizeID = 2
         }
     };
     List<OrderIngredientDTO> lo = new List<OrderIngredientDTO>()
     {
         new OrderIngredientDTO()
         {
             Name = "Ingredient"
         }
     };
     return new TrioResponse<List<RecipeDTO>, List<SizeDTO>, List<OrderIngredientDTO>>(lr, ls, lo);
 }
Esempio n. 48
0
        public BooleanResponse Logout(EmptyRequest request)
        {
            if (!_userSignedIn)
            {
                return new BooleanResponse(Guid.Empty, false)
                    {
                        Message = "Użytkownik nie jest zalogowany"
                    };
            }

            _userSignedIn = false;
            _signedCustomerId = 0;
            return new BooleanResponse(request.Id, true)
                {
                    Message = "Wylogowano pomyślnie"
                };
        }
Esempio n. 49
0
 public ActionResult GetUnfinished(EmptyRequest req)
 {
     // TODO: Change user
     return Json(_testBus.GetUnfinishedTests(1),
         JsonRequestBehavior.AllowGet);
 }
Esempio n. 50
0
        public ListResponse<OrderDTO> GetUndoneOrders(EmptyRequest req)
        {
            try
            {
                using (var db = new PizzaUnitOfWork())
                {
                    return db.inTransaction(uof =>
                    {
                        if (!HasRights(GetUser(req).Data, 2))
                            throw PizzaServiceFault.Create(Messages.NO_PERMISSIONS);

                        if (GetUser(req).Data == null)
                            return null;

                        return ListResponse.Create(db.Orders.FindAllEagerlyWhere(o => o.State.StateValue == State.NEW ||
                            o.State.StateValue == State.IN_REALISATION)
                            .ToList()
                            .Select(orderAssembler.ToSimpleDto)
                            .ToList());
                    });
                }
            }
            catch (Exception e)
            {
                throw new FaultException(e.Message);
            }
        }
Esempio n. 51
0
 public Response<IList<SubjectModel>> Get(EmptyRequest req)
 {
     var items = Get();
     return Response<IList<SubjectModel>>.Success(items);
 }
Esempio n. 52
0
 public SingleItemResponse<UserDTO> GetUser(EmptyRequest req)
 {
     return GetUser((RequestBase)req);
 }
Esempio n. 53
0
 public System.IAsyncResult BegingetAcquiredBy(EmptyRequest getAcquiredBy, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("getAcquiredBy", new object[] {
                 getAcquiredBy}, callback, asyncState);
 }
Esempio n. 54
0
 public ListResponse<OrderDTO> GetOrdersForUser(EmptyRequest req)
 {
     throw new NotImplementedException();
 }
Esempio n. 55
0
 public IMegaRequest CreateFolder(MegaNode targetNode, List<MegaNode> existingNodes, string folderPath, char separator, Action<MegaNode> OnSuccess, Action<int> OnError)
 {
     var result = new EmptyRequest();
     if (string.IsNullOrEmpty(folderPath))
     {
         OnSuccess(targetNode);
         return result;
     }
     result.ResetEvent.Reset();
     var folders = folderPath.Split(new char[]{separator}, StringSplitOptions.RemoveEmptyEntries);
     CreateFolders(
         targetNode, 
         existingNodes,
         folders, 
         (node)=>{OnSuccess(node); result.ResetEvent.Set();},
         (i) => { OnError(i); result.ResetEvent.Set(); });
     return result;
 }
Esempio n. 56
0
		public object Any(EmptyRequest request)
		{
			return new EmptyRequestResponse();
		}
Esempio n. 57
0
 public ListResponse<OrderDTO> GetOrders(EmptyRequest req)
 {
     if (req.Login != "Admin") throw new FaultException<PizzaServiceFault>(new PizzaServiceFault("wrong user"));
     throw new NotImplementedException();
 }
Esempio n. 58
0
 public ListResponse<UserDTO> GetUsers(EmptyRequest req)
 {
     throw new NotImplementedException();
 }
Esempio n. 59
0
 public System.IAsyncResult BegingetLocked(EmptyRequest getLocked, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("getLocked", new object[] {
                 getLocked}, callback, asyncState);
 }