public static void ImportCloudData(this AutoWidget target,
			ServiceConnector.Models.Rest.Wallbin.Settings.AutoWidget source)
		{
			target.Extension = source.Extension;
			target.Inverted = source.Inverted;
			target.Widget = source.OriginalImage;
		}
Example #2
0
        private void GetNhanVien(int manv)
        {
            List <nhanVien> nv  = new List <nhanVien>();
            string          url = "api/nv/id/" + manv.ToString();

            nv = ServiceConnector.GetDataFromServiceByGet <nhanVien>(url, true);
            if (nv.Count > 0)
            {
                txtMaNV.Text       = nv[0].maNhanVien.ToString();
                txtHoTen.Text      = nv[0].hoTen.ToString();
                dtNgaySinh.Text    = nv[0].ngaySinh.ToString("dd/MM/yyyy");
                stDienThoai.Text   = nv[0].soDienThoai.ToString();
                stDCThuongTru.Text = nv[0].diaChi.ToString();
                stTenDangNhap.Text = nv[0].tenDangNhap.ToString();
                _CurrentPassword   = nv[0].matKhau;
                if (nv[0].gioiTinh == true)
                {
                    cbxgioitinh.SelectedIndex = 0;
                }
                else
                {
                    cbxgioitinh.SelectedIndex = 1;
                }
                cbxChiNhanh.SelectedValue = nv[0].maCNLamViec.ToString();
                divLabelMaNV.Visible      = divTextboxMaNV.Visible = true;
            }
        }
        protected void btnRutGoi_Click(object sender, EventArgs e)
        {
            List <khachHang> lskh = GetKH(int.Parse(txtMaKhachHangThiet.Text.Trim().ToString()));
            khachHang        kh   = lskh[0];

            if (_LoaiGiaoDich == 1)
            {
                // Kiểm tra còn tiền rút hay ko
                if (kh.soDuTaiKhoan > double.Parse(txtSoTien.Text.Trim()))
                {
                    ServiceConnector.GetDataFromServiceByPost <giaoDich>("api/gd/add", CreateGiaoDich(), false);
                    kh.soDuTaiKhoan = kh.soDuTaiKhoan - double.Parse(txtSoTien.Text.Trim());
                    UpdateKH(kh);
                    ClearData();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Rút Tiền thành công.');", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Số Tiền Rút Lớn Hơn Số Dư Tài Khoản!');", true);
                }
            }
            else
            {
                if (_LoaiGiaoDich == 2)
                {
                    // Gởi tiền ko cần kiểm tra
                    ServiceConnector.GetDataFromServiceByPost <giaoDich>("api/gd/add", CreateGiaoDich(), false);
                    kh.soDuTaiKhoan = kh.soDuTaiKhoan + double.Parse(txtSoTien.Text.Trim());
                    UpdateKH(kh);
                    ClearData();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Gửi Tiền thành công.');", true);
                }
            }
        }
        public async Task IsProductsReturned()
        {
            ServiceConnector connector = new ServiceConnector();
            ServiceResponse  response  = await connector.GetAllProducts("38c327e06f746809762fff30fc7a8626", "2664");

            Assert.IsTrue(response.Success, "Eror in getting Prducts");
        }
        public async Task IsStoresReturned()
        {
            ServiceConnector connector = new ServiceConnector();
            ServiceResponse  response  = await connector.GetAllStors("38c327e06f746809762fff30fc7a8626");

            Assert.IsTrue(response.Success, "Eror in getting data");
        }
        public async Task IsUserAuthenticated()
        {
            ServiceConnector connector = new ServiceConnector();
            ServiceResponse  response  = await connector.Login("*****@*****.**", "123456");

            Assert.IsTrue(response.Success, "Authentication error");
        }
Example #7
0
        public static AxBaseException WriteSalesValueTransLinesRefresh(DateTime minDate, int actiond)
        {
            Func <DateTime, DateTime> nextPeriod = delegate(DateTime d) { return(d.AddHours(1)); };

            return(ServiceConnector.CallServiceByDate <RetailTransactionSalesLinesDTO>(minDate, actiond, "GetRetailTransLinesByDate",
                                                                                       "AGRRetailTransService", "[ax].[RetailTransactionSalesLines_Increment]", nextPeriod).Result);
        }
Example #8
0
        async void GetBranches(string accessToken, string clientId)
        {
            if (NetworkCheck.IsInternet())
            {
                IsIndicatorLoading = true;
                svcconnector       = new ServiceConnector();
                var response = await svcconnector.GetAllBranches(accessToken, clientId);

                if (response.Success)
                {
                    IsIndicatorLoading = false;

                    Branches = mapper.MapBranchserviceModelToDTOModel(response.ResponseObject as BranchRootObject);
                }
                else
                {
                    IsIndicatorLoading = false;
                    await _displayAlert.DisplayAlertAsync(response.ErrorObject.error.name, response.ErrorObject.error.message, "ok");
                }
            }
            else
            {
                await _displayAlert.DisplayAlertAsync(AppConstants.NoInternetConnection, String.Empty, "ok");
            }
        }
        public static AxBaseException WriteCategories(int actionId)
        {
            var roles = ServiceConnector.CallOdataEndpoint <CategoryRoleDTO>("RetailEcoResCategoryHierarchyRole", "", "[ax].[ECORESCATEGORYHIERARCHYROLE]", actionId).Result;
            //if (roles != null)
            //{
            //    return roles;
            //}
            var hierarchy = ServiceConnector.CallOdataEndpoint <RetailEcoResCategoryHierarchy>("RetailEcoResCategoryHierarchy", "", "[ax].[ECORESCATEGORYHIERARCHY]", actionId).Result;
            //if (hierarchy != null)
            //{
            //    return hierarchy;
            //}

            var category = ServiceConnector.CallOdataEndpoint <RetailEcoResCategory>("RetailEcoResCategory", "", "[ax].[ECORESCATEGORY]", actionId).Result;
            //if (category != null)
            //{
            //    return category;
            //}

            var prodCat = ServiceConnector.CallOdataEndpoint <AGREcoResProductCategory>("AGREcoResProductCategories", "", "[ax].[ECORESPRODUCTCATEGORY]", actionId).Result;

            //if (prodCat != null)
            //{
            //    return prodCat;
            //}
            return(null);
        }
Example #10
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            var post = new
            {
                tenDN   = txtUserName.Text.Trim(),
                matKhau = txtPassword.Text.Trim()
            };
            List <UserLogin> user = ServiceConnector.GetDataFromServiceByPost <UserLogin>("api/nv/dangnhap", post, true);

            if (user != null && user.Count > 0)
            {
                SessionManager.CurrentUser = user[0];
                if (user[0].LoaiNV == 1)
                {
                    Response.Redirect("BaoCaoTKGiaoDich.aspx");
                }
                else
                {
                    Response.Redirect("KhachHang.aspx");
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
Example #11
0
        public async Task <IActionResult> Login(UserLoginViewModel user)
        {
            if (ModelState.IsValid)
            {
                (IActionResult res, bool serviceIsRunning) = await ServiceConnector.Login(user.UserName, user.PasswordString, _myConfig.Value.ServiceUrl);

                if (serviceIsRunning)
                {
                    if (res is OkResult)
                    {
                        HttpContext.Session.SetString("LoggedUserName", user.UserName);

                        return(RedirectToAction("Dialogue"));
                    }
                    else if (res is NotFoundResult)
                    {
                        ModelState.AddModelError(string.Empty, "Incorrect username or password");
                    }

                    return(View(user));
                }
                return(Content("Please, turn on your Dialogue Web Service"));
            }

            ModelState.AddModelError(string.Empty, "Invalid login attempt.");
            return(View(user));
        }
Example #12
0
        async void Login()
        {
            if (NetworkCheck.IsInternet())
            {
                IsIndicatorLoading = true;
                svcconnector       = new ServiceConnector();
                var response = await svcconnector.Login(UserName, Password);

                if (response.Success)
                {
                    IsIndicatorLoading = false;
                    var result = response.ResponseObject as UserAccount;
                    //save the access token in singleton object
                    AccessTokenSingleton.Instance.AccessToken = result.accessToken;
                    var parameter = new NavigationParameters();
                    parameter.Add(AppConstants.AccessToken, result.accessToken);
                    await _navigationservice.NavigateAsync("ClientPage", parameter);
                }
                else
                {
                    IsIndicatorLoading = false;
                    await _displayAlert.DisplayAlertAsync(response.ErrorObject.error.name, response.ErrorObject.error.message, "ok");
                }
            }
            else
            {
                await _displayAlert.DisplayAlertAsync(AppConstants.NoInternetConnection, String.Empty, "ok");
            }
        }
Example #13
0
        protected void btnInsertOrUpdate_Click(object sender, EventArgs e)
        {
            string url = _IsUpdateMode ? "api/nv/up" : "api/nv/add";

            ServiceConnector.InsertOrUpdate <nhanVien>(url, CreateNhanVien(), true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "reload", "parent.closePopupModal(); parent.reloadPage();", true);
        }
Example #14
0
        public async static void CheckMessages()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                User loginUser = StorageManager.GetConnectionInfo().LoginUser;

                string gencall  = "/accesstoken=" + loginUser.AccessToken;
                string usercall = gencall + "/iduser="******"/message/getall" + usercall);

                servMsg.SaveAllToDBWithServerID("IDMessage");

                SQLiteConnection      conn = StorageManager.GetConnection();
                IEnumerable <Message> msgs = conn.Query <Message>("SELECT * FROM message WHERE IDUser="******" AND seen=0 ");
                var notifier = DependencyService.Get <ICrossLocalNotifications>().CreateLocalNotifier();
                foreach (Message msg in msgs)
                {
                    notifier.Notify(new LocalNotification()
                    {
                        Title      = msg.Title,
                        Text       = msg.MessageText,
                        Id         = msg.IDMessage + 30000,
                        NotifyTime = DateTime.Now,
                    });
                    msg.seen = 1;
                    conn.Update(msg);
                    await ServiceConnector.InsertServiceData <ModelService <Message> >("/message/save", msg);
                }
            }
        }
Example #15
0
        public async Task <JsonResult> HandleMessage(string message)
        {
            var username = HttpContext.Session.GetString("LoggedUserName");

            (IActionResult res, bool serviceIsRunning) = await ServiceConnector.AddMessage(username, new MessageDto()
            {
                Author = AuthorId.User, Text = message
            }, _myConfig.Value.ServiceUrl);

            if (serviceIsRunning)
            {
                if (res is OkResult)
                {
                    string response = _chatService.responseToMessage(message);
                    (IActionResult responseFromSiri, bool serviceIsOk) = await ServiceConnector.AddMessage(username,
                                                                                                           new MessageDto()
                    {
                        Author = AuthorId.Siri, Text = response
                    }, _myConfig.Value.ServiceUrl);

                    if (responseFromSiri is OkResult)
                    {
                        return(Json(new { result = response }));
                    }

                    return(Json(new { result = "Siri is in break mode. Try to be more polite!" }));
                }

                return(Json(new { result = "Sorry, we can't handle your message!" }));
            }
            return(Json(new { result = "Please, turn on your Dialogue Web Service" }));
        }
Example #16
0
        public async Task <IActionResult> Register(UserRegisterViewModel user)
        {
            if (ModelState.IsValid)
            {
                (IActionResult res, bool serviceIsRunning) = await ServiceConnector.Register(user, _myConfig.Value.ServiceUrl);

                if (serviceIsRunning)
                {
                    if (res is OkResult)
                    {
                        HttpContext.Session.SetString("LoggedUserName", user.UserName);
                        return(RedirectToAction("Dialogue"));
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, "User with with these credentials already exist.");
                        return(View(user));
                    }
                }

                return(Content("Please, turn on your Dialogue Web Service"));
            }

            ModelState.AddModelError(string.Empty, "Invalid register attempt.");

            return(View(user));
        }
Example #17
0
        public async void AreCredentialsCorrect(User user)
        {
            /* COMMENTED  - FIND USER LOCALLY
             * List<User> usrs = conn.Query<User>("SELECT IdUser,FirstName,LastName,Height,Birthdate,Email,Gender,HeightType,Password, AccessToken FROM User WHERE Email ='" + user.Email + "' AND Password ='******'");
             * if (usrs.Count > 0)
             * {
             *  PerformLogin(usrs[0]);
             *  return;
             * }
             */
            /* e.g. /user/login/[email protected]/password=12345 */
            try
            {
                BeginLogin();
                ModelService <User> srvUser = await ServiceConnector.GetServiceData <ModelService <User> >("/user/login/email=" + user.Email + "/password="******" " + ex.Message;
                EndLogin();
            }
            MessageLabel.Text = Properties.LangResource.wrongcredentials;
        }
Example #18
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Controller.
            Controller controller = new Controller();

            // GUI.
            EnterForm enterForm  = new EnterForm();
            ChatForm  chatWindow = new ChatForm();
            ErrorForm errorForm  = new ErrorForm();

            controller.EnterForm          = enterForm;
            controller.UserList           = chatWindow;
            controller.TextMessageInput   = chatWindow;
            controller.TextMessageOutput  = chatWindow;
            controller.UserJoinHandler    = chatWindow;
            controller.UserLeaveHandler   = chatWindow;
            controller.ErrorMessageOutput = errorForm;

            enterForm.ConnectionController   = controller;
            chatWindow.TextMessageController = controller;
            chatWindow.ConnectionController  = controller;
            chatWindow.SoundInputController  = controller;
            chatWindow.SoundOutputController = controller;

            // Sound.
            AudioOutput <string> audioOutput     = new AudioOutput <string>();
            MicrophoneInput      microphoneInput = new MicrophoneInput();

            controller.SoundOutput = audioOutput;
            controller.SoundInput  = microphoneInput;

            // Networking.
            ServiceConnector serviceConnector = new ServiceConnector();

            controller.TextSender        = serviceConnector;
            controller.SoundSender       = serviceConnector;
            controller.ConnectionHandler = serviceConnector;

            serviceConnector.UserController        = controller;
            serviceConnector.SoundController       = controller;
            serviceConnector.TextMessageController = controller;
            serviceConnector.DisconnectController  = controller;

            // Text processing.
            MessageTransformer  messageTransformer  = new MessageTransformer();
            NicknameTransformer nicknameTransformer = new NicknameTransformer();
            MessageVerifier     messageVerifier     = new MessageVerifier(possibleLength: PossibleLength);
            NicknameVerifier    nicknameVerifier    = new NicknameVerifier();

            controller.MessageTransformer  = messageTransformer;
            controller.NicknameTransformer = nicknameTransformer;
            controller.MessageVerifier     = messageVerifier;
            controller.NicknameVerifier    = nicknameVerifier;

            Application.Run(new MessengerAppContext(enterForm, chatWindow, errorForm));
        }
Example #19
0
        private void BindRefData()
        {
            cbxTruSo.DataSource = ServiceConnector.GetDataFromServiceByGet <TruSo>("api/truso/all", true);
            cbxTruSo.DataBind();

            cbxChiNhanh.DataSource = ServiceConnector.GetDataFromServiceByGet <ChiNhanh>("api/chinhanh/all", true);
            cbxChiNhanh.DataBind();
        }
		public static void ImportCloudData(this Library target,
			ServiceConnector.Models.Rest.Wallbin.Entities.Library source)
		{
			target.ExtId = source.Id;
			target.Name = source.Name;
			target.LastModified = source.LastModified ?? DateTime.Now;
			target.Settings.ImportCloudData(source.Settings);
		}
		public static void ImportCloudData(this LibraryPage target,
			ServiceConnector.Models.Rest.Wallbin.Entities.LibraryPage source)
		{
			target.ExtId = source.Id;
			target.Name = source.Name;
			target.Order = source.Order;

			target.Settings.ImportCloudData(source.Settings);
		}
Example #22
0
        public static AxBaseException WriteLocationsAndVendors(int actionId)
        {
            //var channel = ReadRetailChannel(context);
            var channel = ServiceConnector.CallOdataEndpoint <RetailChannel>("RetailChannels",
                                                                             // "?$filter=ChannelType eq Microsoft.Dynamics.DataEntities.RetailChannelType'RetailStore'",
                                                                             "", "[ax].[RETAILCHANNELTABLE]", actionId).Result;
            //if (channel != null)
            //{
            //    return channel;
            //}

            //var assortment = ReadRetailAssortment(context);
            var assortment = ServiceConnector.CallOdataEndpoint <RetailAssortment>("RetailAssortments",
                                                                                   "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'"
                                                                                   , "[ax].[RETAILASSORTMENTTABLE]", actionId).Result;

            //if (assortment != null)
            //{
            //    return assortment;
            //}
            //var locSetup = context.Locations.ToList().GetDataReader<Location>();
            var locSetup = ServiceConnector.CallOdataEndpoint <Location>("Locations", "", "[ax].[INVENTLOCATION]", actionId).Result;
            //if (locSetup != null)
            //{
            //    return locSetup;
            //}
            //var dir = context.DirParties.ToList().GetDataReader<DirParty>();
            var dir = ServiceConnector.CallOdataEndpoint <DirParty>("DirParties", "", "[ax].[DIRPARTYTABLE]", actionId).Result;
            //if (dir != null)
            //{
            //    return dir;
            //}
            //var vendor = context.Vendors.ToList().GetDataReader<Vendor>();
            var vendor = ServiceConnector.CallOdataEndpointWithPageSize <Vendor>("Vendors", 200, "[ax].[VENDTABLE]", actionId).Result;
            //if (vendor != null)
            //{
            //    return vendor;
            //}

            var channelLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentChannelLine>("RetailAssortmentChannelLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTCHANNELLINE]", actionId)
                               .Result;
            //if (channelLines != null)
            //{
            //    return channelLines;
            //}

            var productLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentProductLine>("RetailAssortmentProductLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTPRODUCTLINE]", actionId)
                               .Result;

            //if (productLines != null)
            //{
            //    return productLines;
            //}
            return(null);
        }
Example #23
0
        public DevicesView()
        {
            this.InitializeComponent();

            this._serviceConnector = ServiceConnector.GetInstance();
            this._viewModel = (DevicesViewModel)this.DataContext;

            this.SetupUpdate();
        }
Example #24
0
        private void SendMessageToUser()
        {
            if (string.IsNullOrEmpty(this._viewModel.SendText))
            {
                return;
            }

            ServiceConnector.GetInstance().SendMessage(this._viewModel.UserItem.ID, this._viewModel.SendText);
            this._viewModel.SendText = string.Empty;
        }
Example #25
0
        public async Task CanListAllEntities()
        {
            var connector = new ServiceConnector(new DemoConnection());

            var service = new MetadataService(connector);

            var metadata = await service.ListAllAsync();

            Assert.IsNotNull(metadata);
        }
        private void InitServiceConnector()
        {
            Logger.Log.Info("Initialize Web Service connector");

            ServiceConnector = new ServiceConnector(new Options {
                BaseAddress = AppConfiguration.StoredParameters.ServiceBaseAddress, ExchangeFormat = RestSharp.DataFormat.Json
            });

            ServiceConnector.RegisterRoute(OperationType.Signup, new Route {
                Path = "api/v1/signup"
            });
            ServiceConnector.RegisterRoute(OperationType.Signin, new Route {
                Path = "api/v1/signin"
            });
            ServiceConnector.RegisterRoute(OperationType.Signout, new Route {
                Path = "api/v1/logout"
            });
            ServiceConnector.RegisterRoute(OperationType.ResetPassword, new Route {
                Path = "api/v1/reset_password"
            });
            ServiceConnector.RegisterRoute(OperationType.UpdateProfileInfo, new Route {
                Path = ""
            });
            ServiceConnector.RegisterRoute(OperationType.GetProfileInfo, new Route {
                Path = "api/v1/profiles/{id}"
            });
            ServiceConnector.RegisterRoute(OperationType.CreateActivity, new Route {
                Path = "api/v1/activities"
            });
            ServiceConnector.RegisterRoute(OperationType.DeleteActivity, new Route {
                Path = "api/v1/activities/{id}"
            });
            ServiceConnector.RegisterRoute(OperationType.UpdateActvity, new Route {
                Path = "api/v1/activities/{id}"
            });
            ServiceConnector.RegisterRoute(OperationType.GetActivity, new Route {
                Path = "api/v1/activities/{id}"
            });
            ServiceConnector.RegisterRoute(OperationType.GetActivities, new Route {
                Path = "api/v1/activities"
            });
            ServiceConnector.RegisterRoute(OperationType.UpdateSettings, new Route {
                Path = "api/v1/profiles/{id}/settings"
            });
            ServiceConnector.RegisterRoute(OperationType.GetSettings, new Route {
                Path = "api/v1/profiles/{id}/settings"
            });
            ServiceConnector.RegisterRoute(OperationType.UpdateProfileAvatar, new Route {
                Path = "api/v1/profiles/{id}/avatar"
            });
            ServiceConnector.RegisterRoute(OperationType.GetProfileAvatar, new Route {
                Path = "api/v1/profiles/{id}/avatar"
            });
        }
Example #27
0
        public MainPresenter(MainForm mainForm, ServiceConnector serviceConnector, ConnectionDialog connectionDialog, ILogger logger)
        {
            _logger           = logger;
            MainForm          = mainForm;
            _serviceManager   = serviceConnector;
            _ConnectionDialog = connectionDialog;
            // Подготовка столбцов DataGrid для списка сотрудников
            mainForm.EmployeeDataGridView.SetUpGrid();

            mainForm.Presenter = this;
            mainForm.Load     += new EventHandler(MainForm_Load);
        }
Example #28
0
        public async Task CanListEntityFields()
        {
            var connector = new ServiceConnector(new DemoConnection());

            var entityLogicalName = "new_car";

            var service = new MetadataService(connector);

            var entityDefinition = await service.GetEntityDefinition(entityLogicalName);

            Assert.IsNotNull(entityDefinition);
        }
        private void GetDataSource()
        {
            var filter = new
            {
                ngayGiaoDich = _NgayGD.ToString("yyyy-MM-dd"),
                maTruSo      = _MaTruSo,
                maChiNhanh   = _MaChiNhanh
            };

            gvDSGiaoDich.DataSource = ServiceConnector.GetDataFromServiceByPost <TKGDDetail>("api/tongketgd/getDSGDByNgay", filter, true);
            gvDSGiaoDich.DataBind();
        }
        public static AxBaseException UpdateProductAttributes(int actionId)
        {
            var ecoResValue = ServiceConnector.CallService <AGREcoResValueDTO>(actionId, "GetValue", "AGRAttributeService", "[ax].[ECORESVALUE]", 10000);

            if (ecoResValue != null)
            {
                return(ecoResValue.Result);
            }
            var ecoResAttribute = ServiceConnector.CallService <AGREcoResAttributeDTO>(actionId, "GetAttribute", "AGRAttributeService", "[ax].[ECORESATTRIBUTE]", 10000);

            if (ecoResAttribute != null)
            {
                return(ecoResAttribute.Result);
            }
            var ecoResAttributeValue = ServiceConnector.CallService <AGREcoResAttributeValueDTO>(actionId, "GetAttributeValue", "AGRAttributeService", "[ax].[ECORESATTRIBUTEVALUE]", 10000);

            if (ecoResAttributeValue != null)
            {
                return(ecoResAttributeValue.Result);
            }
            var ecoResAttributeType = ServiceConnector.CallService <AGREcoResAttributeTypeDTO>(actionId, "GetAttributeType", "AGRAttributeService", "[ax].[ECORESATTRIBUTEType]", 10000);

            if (ecoResAttributeType != null)
            {
                return(ecoResAttributeType.Result);
            }
            var ecoResEnum = ServiceConnector.CallService <AGREcoResEnumerationAttributeValueDTO>(actionId,
                                                                                                  "GetEnumerationAttributeValue", "AGRAttributeService", "[ax].[ECORESENUMERATIONATTRIBUTETYPEVALUE]", 10000);

            if (ecoResEnum != null)
            {
                return(ecoResEnum.Result);
            }
            var ecoResCatAttr = ServiceConnector.CallService <AGREcoResCategoryAttributeDTO>(actionId,
                                                                                             "GetCategoryAttribute", "AGRAttributeService", "[ax].[ECORESCATEGORYATTRIBUTE]", 10000);

            if (ecoResCatAttr != null)
            {
                return(ecoResCatAttr.Result);
            }
            var ecoResProdInstance = ServiceConnector.CallService <AGREcoResProductInstanceDTO>(actionId,
                                                                                                "GetProductInstanceValue", "AGRAttributeService", "[ax].[ECORESPRODUCTINSTANCEVALUE]", 10000);

            if (ecoResProdInstance != null)
            {
                return(ecoResProdInstance.Result);
            }

            //var prodAttributes = ServiceConnector.CallOdataEndpoint<ProductAttribute>("ProductAttributes", null, "[ax].[ProductAttributes]", actionId);
            //var prodAttributeValues = ServiceConnector.CallOdataEndpoint<ProductAttributeValue>("ProductAttributeValues", null, "[ax].[ProductAttributeValues]", actionId);
            return(null);
        }
Example #31
0
        public void ServiceConnectorSendMessageTest()
        {
            // arrange
            IServiceConnector serviceConnector = ServiceConnector.GetInstance();

            serviceConnector.SetAddress("http://localhost:5000/");
            serviceConnector.TrySetUsername("testUser", out var testUser);

            // act
            var result = serviceConnector.SendMessage(_adminUserId, "Hallo test");

            // assert
            Assert.IsNotNull(result);
        }
Example #32
0
        public void ServiceConnectorDeviceGetValueTest()
        {
            // arrange
            IServiceConnector serviceConnector = ServiceConnector.GetInstance();

            serviceConnector.SetAddress("http://localhost:5000/");
            // it must a non exist device
            const long id = 12345678L;
            // act
            var result = serviceConnector.DeviceGetValue(id);

            // assert
            Assert.AreEqual(0, result);
        }
Example #33
0
        public void ServiceConnectorGetAllUsersTest()
        {
            // arrange
            IServiceConnector serviceConnector = ServiceConnector.GetInstance();

            serviceConnector.SetAddress("http://localhost:5000/");

            // act
            var result = serviceConnector.GetAllUsers();

            // assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
		public static void ImportCloudData(this Library.LibrarySettings target,
			ServiceConnector.Models.Rest.Wallbin.Settings.LibrarySettings source)
		{
			target.ApplyAppearanceForAllWindows = source.ApplyAppearanceForAllWindows.HasValue && source.ApplyAppearanceForAllWindows.Value;
			target.ApplyBannerForAllWindows = source.ApplyBannerForAllWindows.HasValue && source.ApplyBannerForAllWindows.Value;
			target.ApplyWidgetForAllWindows = source.ApplyWidgetForAllWindows.HasValue && source.ApplyWidgetForAllWindows.Value;

			target.AutoWidgets.Clear();
			foreach (var sourceAutoWidget in source.AutoWidgets)
			{
				var targetAutoWidget = new AutoWidget();
				targetAutoWidget.ImportCloudData(sourceAutoWidget);
				target.AutoWidgets.Add(targetAutoWidget);
			}
		}
		public static void ImportCloudData(this LibraryPage.LibraryPageSettings target,
			ServiceConnector.Models.Rest.Wallbin.Settings.LibraryPageSettings source)
		{
			target.EnableColumnTitles = source.EnableColumnTitles.HasValue && source.EnableColumnTitles.Value;
			target.ApplyForAllColumnTitles = source.ApplyForAllColumnTitles.HasValue && source.ApplyForAllColumnTitles.Value;
		}