Ejemplo n.º 1
0
        public ClientRequests GetRequest(Guid clientId)
        {
            var clientRequests = new ClientRequests();

            if (clientId == Guid.Empty)
            {
                throw new ArgumentException("Not a valid Id, while requesting for client");
            }

            var client = _clientRepository.Get(clientId);

            if (client == null)
            {
                throw new ItemNotFoundException("Client not found for given Id");
            }

            var requests = _rquestRepository.GetAll(clientId);

            if (requests != null)
            {
                clientRequests.Requests = requests;
            }
            clientRequests.Client = client;


            return(clientRequests);
        }
Ejemplo n.º 2
0
    public bool OnEvent(Context in_ctxt)
    {
        ClientRequests requests = new ClientRequests();

        requests.Process();
        return(false); // return false if we don't want to mute the timer
    }
Ejemplo n.º 3
0
 private void deleteFolderTSMI_Click(object sender, EventArgs e)
 {
     if (MessageService.QuestionMessage(Message.MessageResource.DeleteFolder) == DialogResult.Yes)
     {
         ClientRequests.DeleteFolder(((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedFolder.Id);
     }
 }
Ejemplo n.º 4
0
 public void Refresh()
 {
     filter = ClientRequests.getFilters();
     TypeList.ItemsSource     = filter.types.Select(x => x.type);
     CatagoryList.ItemsSource = filter.categories.Select(x => x.category);
     ServicesList.ItemsSource = filter.services.Select(x => x.name);
 }
Ejemplo n.º 5
0
        public void SetFullLetter(LetterView letterView)
        {
            if (letterView != null)
            {
                LetterType letterType = ClientRequests.GetLetterType(letterView.Type);
                ILetterPropertiesUIPlugin clientUIPlugin;

                disableControls(splitContainer1.Panel2.Controls);

                if (!_letterPropertiesUIPlugins.TryGetValue(letterType.TypeClientUI, out clientUIPlugin))
                {
                    clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(letterType);
                    _letterPropertiesUIPlugins.Add(letterType.TypeClientUI, clientUIPlugin);

                    splitContainer1.Panel2.Controls.Add((Control)clientUIPlugin);
                }

                clientUIPlugin.LetterView = letterView;
                clientUIPlugin.ReadOnly   = true;

                this.Size = new Size(splitContainer2.Size.Width + ((Control)clientUIPlugin).Size.Width, Math.Max(splitContainer2.Size.Height, ((Control)clientUIPlugin).Size.Height));

                enableControl((Control)clientUIPlugin);
            }
        }
Ejemplo n.º 6
0
        public void CheckThatIsPossibleToChangeGeneralInformationByApi()
        {
            Context.Token = new AuthRequests().SendRequestSignUpPost(new ClientSignUpModel
            {
                Email       = USER_EMAIL + DateTime.Now.ToString("ddmmyyyyhhmmss"),
                Password    = PASSWORD,
                FirstName   = "qweqwe",
                LastName    = "qweqweqwe",
                PhoneNumber = "1431231231"
            }).TokenData.Token;

            var expectedIndustry       = "apparel";
            var expectedCompanyWebsite = "http://zaxzax.com";

            var profile = new ClientRequests().SendRequestUpdateProfileInformation(new ClientProfileModel
            {
                CompanyWebsite = expectedCompanyWebsite,
                Industry       = expectedIndustry
            });

            Assert.Multiple(() =>
            {
                Assert.IsTrue(profile.Industry == expectedIndustry);
                Assert.IsTrue(profile.CompanyWebsite == expectedCompanyWebsite);
            });
        }
Ejemplo n.º 7
0
        public TreeNode MakeHierarchy(ref IEnumerable <Folder> allFolders, ref Dictionary <string, TreeNode> existFoldersInTree, Folder folder, FolderType folderType, ref StringBuilder path)
        {
            TreeNode n       = new TreeNode();
            Folder   fParent = new Folder();

            foreach (Folder f in allFolders)
            {
                if (f.Id == folder.ParentId)
                {
                    fParent = f;
                    FolderType newFolderType = ClientRequests.GetFolderType(f.Type);

                    n = MakeHierarchy(ref allFolders, ref existFoldersInTree, f, newFolderType, ref path);
                    break;
                }
            }

            path.Append(folder.Name + "\\");
            foreach (var temp in existFoldersInTree)
            {
                if (temp.Key == path.ToString())
                {
                    return(temp.Value);
                }
            }

            TreeNode newNode = new TreeNode(folder.Name);

            existFoldersInTree.Add(path.ToString(), newNode);
            int count = 0;

            try
            {
                count = ClientRequests.GetCountLetterInFolder(folder.Id);
            }
            catch (Exception ex)
            {
                NLogger.Logger.Trace(ex.ToString());
            }

            if (count > 0)
            {
                newNode.Text    += " " + count.ToString();
                newNode.NodeFont = new Font(foldersTV.Font, FontStyle.Bold);;
            }

            if (folder.ParentId == Guid.Empty)
            {
                foldersTV.Nodes.Add(newNode);
            }
            else
            {
                n.Nodes.Add(newNode);
            }
            _currentPrivateFoldersInTree.Add(newNode.FullPath, folder);
            _currentPrivateFoldersTypeInTree.Add(newNode.FullPath, folderType);

            return(newNode);
        }
Ejemplo n.º 8
0
 public void Connect()
 {
     Open();
     if (IsOpened)
     {
         ClientRequests.SetBroadcastedType <OperandSelectorMessage>();
     }
 }
Ejemplo n.º 9
0
 public MainWindow()
 {
     cr       = new ClientRequests();
     commentv = new CommentView();
     filev    = new FilteView();
     clientv  = new ClientView();
     InitializeComponent();
     DataContext = this;
 }
Ejemplo n.º 10
0
 public CommentView()
 {
     dt          = new DispatcherTimer();
     dt.Tick    += new EventHandler(AutoRefresh);
     dt.Interval = new TimeSpan(0, 5, 0);
     dt.Start();
     InitializeComponent();
     comments = ClientRequests.getComments();
     CommentList.ItemsSource = comments;
 }
Ejemplo n.º 11
0
        private void InitializeFolderPluginUI(object sender)
        {
            FolderType selectedFolderType;

            if (sender == this.comboFolderType)
            {
                selectedFolderType = SelectedFolderType;
            }
            else
            {
                selectedFolderType = ((IFolderPropertiesUIPlugin)sender).FolderType;
            }

            IFolderPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetFolderPropetiesPlugin(selectedFolderType);

            var allWorkersInfo = new FolderProperties();
            var allWorkers     = ClientRequests.GetAllWorkers();

            foreach (string info in allWorkers)
            {
                allWorkersInfo.Properties.Add(info, info);
            }

            clientUIPlugin.FolderProperties = allWorkersInfo;
            clientUIPlugin.OnLoad(ServiceProvider);

            clientUIPlugin.ChangedFolderTypePlugin += new EventHandler(FolderTypeIsChange);

            clientUIPlugin.FolderType.Id                = selectedFolderType.Id;
            clientUIPlugin.FolderType.Name              = selectedFolderType.Name;
            clientUIPlugin.FolderType.TypeClientUI      = selectedFolderType.TypeClientUI;
            clientUIPlugin.FolderType.TypeFolderService = selectedFolderType.TypeFolderService;

            Control newControl = (Control)clientUIPlugin;

            newControl.Location = new Point(0, 0);

            _newButtonsControl.Location = new Point(0, newControl.Size.Height);

            int width = Math.Max(Math.Max(BaseSize.X, newControl.Width), _newButtonsControl.Size.Width);

            this.Size = new Size(width, Math.Max(BaseSize.Y, newControl.Size.Height + _newButtonsControl.Location.Y + _newButtonsControl.Size.Height));

            this.Controls.Clear();
            this.Controls.Add(newControl);
            this.Controls.Add(_newButtonsControl);

            SelectedFolderType.Id   = selectedFolderType.Id;
            SelectedFolderType.Name = selectedFolderType.Name;
            SelectedFolderType.TypeFolderService = selectedFolderType.TypeFolderService;
            SelectedFolderType.TypeClientUI      = selectedFolderType.TypeClientUI;

            ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).CurrentFolderPropertiesPlugin = clientUIPlugin;
            ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedFolder.Name           = clientUIPlugin.FolderProperties.Name;
        }
Ejemplo n.º 12
0
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (ListaKlijenata.SelectedItem == null)
            {
                MessageBox.Show("Please select a client");
                return;
            }
            var klient = clients.ElementAt(ListaKlijenata.SelectedIndex);

            var client = ClientRequests.toogleLockedUser(klient);
        }
Ejemplo n.º 13
0
 public void addCatagory(object sender, RoutedEventArgs arg)
 {
     if (NewCatagory.Text == "")
     {
         MessageBox.Show("Cannot add blank name");
         return;
     }
     ClientRequests.addCatagory(NewCatagory.Text);
     filter = ClientRequests.getFilters();
     CatagoryList.ItemsSource = filter.categories.Select(x => x.category);
 }
Ejemplo n.º 14
0
 private void banComment(object sender, RoutedEventArgs e)
 {
     if (CommentList.SelectedItem == null)
     {
         MessageBox.Show("Please select a comment to decline");
         return;
     }
     ClientRequests.BanComment(comments.ElementAt(CommentList.SelectedIndex));
     comments = ClientRequests.getComments();
     CommentList.ItemsSource = comments;
 }
Ejemplo n.º 15
0
 public void addService(object sender, RoutedEventArgs arg)
 {
     if (NewService.Text == "")
     {
         MessageBox.Show("Cannot add blank name");
         return;
     }
     ClientRequests.addService(NewService.Text);
     filter = ClientRequests.getFilters();
     ServicesList.ItemsSource = filter.services.Select(x => x.name);
 }
Ejemplo n.º 16
0
 public void approveComment(object sender, RoutedEventArgs args)
 {
     if (CommentList.SelectedItem == null)
     {
         MessageBox.Show("Please select a comment to approve");
         return;
     }
     ClientRequests.ApproveComment(comments.ElementAt(CommentList.SelectedIndex));
     comments = ClientRequests.getComments();
     CommentList.ItemsSource = comments;
 }
Ejemplo n.º 17
0
        private void InitializeForm()
        {
            InitializeClientService();
            InitializeMessage();
            databasesNames = ClientRequests.GetDatabasesNames();

            foreach (string databaseName in databasesNames)
            {
                databaseNamesCB.Items.Add(databaseName);
            }
            databaseNamesCB.SelectedItem = databasesNames.First();
        }
Ejemplo n.º 18
0
        static void Main()
        {
            IClientRequests clientRequests = new ClientRequests();

            _serviceContainer.AddService(typeof(IClientRequests), clientRequests);
            _serviceContainer.AddService(typeof(PluginService), new PluginService(_serviceContainer));
            _serviceContainer.AddService(typeof(Message.IMessageService), new Message.MessageService());
            _serviceContainer.AddService(typeof(ApplicationState), new ApplicationState());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Forms.MainWorkerForm(_serviceContainer));
        }
Ejemplo n.º 19
0
 public FilteView()
 {
     InitializeComponent();
     dt          = new DispatcherTimer();
     dt.Tick    += new EventHandler(AutoRefresh);
     dt.Interval = new TimeSpan(0, 5, 0);
     dt.Start();
     filter = ClientRequests.getFilters();
     TypeList.ItemsSource     = filter.types.Select(x => x.type);
     CatagoryList.ItemsSource = filter.categories.Select(x => x.category);
     ServicesList.ItemsSource = filter.services.Select(x => x.name);
     DataContext = this;
 }
        public void ChangeUserEmailWithInvalidEmailApiTest()
        {
            var expectedEmail = $"Jonson{DateTime.Now:ddyyyymmHHmmssffff}@gmail";

            Thread.Sleep(100);
            var user        = new UserConstructor();
            var createdUser = AuthRequests.SendRequestClientSignUpPost(user.User);

            var response = ClientRequests.SendRequestChangeClientEmailWithInvalidDataPost(
                "QWE123qwe!@#", expectedEmail, createdUser.TokenData.Token);

            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
        }
Ejemplo n.º 21
0
        private void DeleteLetter()
        {
            if (_lettersInfo.Count == 0 || briefContentLetterDGV.SelectedCells.Count == 0)
            {
                MessageService.ErrorMessage(Message.MessageResource.LetterNotSelect);
            }
            else

            if (MessageService.QuestionMessage(Message.MessageResource.DeleteLetter) == DialogResult.Yes)
            {
                ClientRequests.DeleteLetter(_lettersInfo[_selectedRowInSelectedFolder[_selectNodeIndex]], ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id);
                InitializeMainWorkerForm();
            }
        }
Ejemplo n.º 22
0
        public ConvertAppContext()
            : base("name=ConvertAppContext")
        {
            if (this.Currencies.Count() == 0)
            {
                ClientRequests cr = new ClientRequests();

                foreach (var current in cr.GetCurrentsAndRates())
                {
                    this.Currencies.AddOrUpdate(current);
                    this.SaveChanges();
                }
            }
        }
Ejemplo n.º 23
0
        private void InitializeNewLetterMenu()
        {
            _letterTypes = ClientRequests.GetAllLetterTypes();

            toolStripComboBox1.SelectedIndexChanged += new EventHandler(toolStripComboBox1_SelectedIndexChanged);

            toolStripComboBox1.Items.Clear();
            foreach (LetterType letterType in _letterTypes)
            {
                toolStripComboBox1.Items.Add(letterType.Name);
                _comboLettersTypes.Add(letterType);
            }
            toolStripComboBox1.SelectedItem = 0;
        }
Ejemplo n.º 24
0
        public void InitializeForm()
        {
            InitializeClientService();
            InitializeMessageService();
            InitializeBaseControls();

            LetterView letterView = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterView;

            LetterType selectedLetterType = ClientRequests.GetLetterType(letterView.Type);

            ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType);

            newControl.LetterView = letterView;

            newControl.ReadOnly = true;

            int tabIndex = 0;

            newControl.OnLoad(ServiceProvider);

            ((Control)newControl).TabIndex = tabIndex;

            int heightSize = 0;
            int locationY  = 0;

            foreach (Control control in BaseControls)
            {
                if (control.Location.Y + control.Size.Height > locationY)
                {
                    locationY = control.Location.Y + control.Size.Height;
                }

                heightSize += control.Size.Height;
            }

            this.Controls.Clear();
            ((Control)newControl).Location = new Point(0, locationY);

            this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Size.Height + heightSize);

            this.Controls.Add(((Control)newControl));

            foreach (Control control in BaseControls)
            {
                ++tabIndex;
                control.TabIndex = tabIndex;
                this.Controls.Add(control);
            }
        }
Ejemplo n.º 25
0
        public void ChangeUserLastNameApiTest()
        {
            var expectedLastName = "Smith";
            var user             = new UserConstructor();
            var createdUser      = AuthRequests.SendRequestClientSignUpPost(user.User);

            var responseModel = ClientRequests.SendRequestChangeClientSelfInfoPatch(
                createdUser.User.FirstName, expectedLastName, createdUser.TokenData.Token);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(expectedLastName, responseModel.Model.LastName);
                Assert.AreEqual(HttpStatusCode.OK, responseModel.Response.StatusCode);
            });
        }
        public void ChangeUserIndustryApiTest()
        {
            var expectedIndustry = "fashion";
            var user             = new UserConstructor();
            var createdUser      = AuthRequests.SendRequestClientSignUpPost(user.User);

            var responseModel = ClientRequests.SendRequestChangeClientProfileInfoPatch(
                expectedIndustry, createdUser.User.ClientProfile.LocationName, createdUser.User.ClientProfile.LocationTimezone, createdUser.TokenData.Token);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(expectedIndustry, responseModel.Model.Industry);
                Assert.AreEqual(HttpStatusCode.OK, responseModel.Response.StatusCode);
            });
        }
Ejemplo n.º 27
0
        private void createFolderTSMI_Click(object sender, EventArgs e)
        {
            using (var createFolderForm = new Forms.CreateFolderForm(ServiceProvider))
            {
                IEnumerable <FolderType> folderTypes = ClientRequests.GetAllFolderTypes();

                createFolderForm.FolderType = folderTypes;

                StringBuilder folderPredicat = new StringBuilder();

                if (createFolderForm.ShowDialog() == DialogResult.OK)
                {
                }
            }
        }
Ejemplo n.º 28
0
        public void ChangeUserPhoneWithInvalidCurrentPasswordApiTest()
        {
            var expectedPhone = $"5556664452";
            var user          = new UserConstructor();
            var createdUser   = AuthRequests.SendRequestClientSignUpPost(user.User);

            var responseModel = ClientRequests.SendRequestChangeClientPhoneNumberPost(
                "QWE123qwe!@#221", expectedPhone, createdUser.TokenData.Token);

            Assert.Multiple(() =>
            {
                Assert.IsNull(responseModel.Model.PhoneNumber);
                Assert.AreEqual(HttpStatusCode.BadRequest, responseModel.Response.StatusCode);
            });
        }
Ejemplo n.º 29
0
        private void InitializeCreateFolderForm()
        {
            using (var createFolderForm = new Forms.CreateFolderForm(ServiceProvider))
            {
                IEnumerable <FolderType> folderTypes = ClientRequests.GetAllFolderTypes();

                createFolderForm.FolderType = folderTypes;

                StringBuilder folderPredicat = new StringBuilder();

                if (createFolderForm.ShowDialog() == DialogResult.OK)
                {
                }
            }
        }
Ejemplo n.º 30
0
 public void modifyType(object sender, RoutedEventArgs arg)
 {
     if (TypeList.SelectedItem == null)
     {
         MessageBox.Show("Please select Type to change");
         return;
     }
     if (ModifyType.Text == "")
     {
         MessageBox.Show("Cannot add blank name");
         return;
     }
     ClientRequests.modifyType((String)TypeList.SelectedItem, ModifyType.Text);
     filter = ClientRequests.getFilters();
     TypeList.ItemsSource = filter.types.Select(x => x.type);
 }