Ejemplo n.º 1
0
        public bool Gener(ref List <Project> Projects, out string message)
        {
            try
            {
                if (Projects == null)
                {
                    Projects = new List <Project>();
                }

                Projects.Add(new Project()
                {
                    NameProject = "Varvarinskiy GOK"
                });
                Projects[0].Mawines = GenerMawines(out message);

                Projects.Add(new Project()
                {
                    NameProject = "Karagandiskaya shahta"
                });
                Projects[1].Mawines = GenerMawines(out message);

                Projects.Add(new Project()
                {
                    NameProject = "SS GOK"
                });
                Projects[2].Mawines = GenerMawines(out message);
                message             = "Proekty dobavleny uspewno";
                return(true);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void voegGebruikerAanProject(Project project)
        {
            ProjectEmployee pe = new ProjectEmployee(project, this);

            project.addEmployeeToProject(pe);
            Projects.Add(pe);
        }
Ejemplo n.º 3
0
        public MainViewModel()
        {
            Instance = this;

            ProjectsListWidth = new GridLength(App.Settings?.ProjectsListWidth ?? 150);
            FilesListWidth    = new GridLength(App.Settings?.FilesListWidth ?? 300);

            if (App.Settings != null)
            {
                foreach (string projectPath in App.Settings.ProjectDirectories)
                {
                    var project = new Project(projectPath);
                    Projects.Add(project);
                    if (projectPath == App.Settings.SelectedProjectDirectory)
                    {
                        SelectedProject = project;
                    }
                    project.PropertyChanged += Project_PropertyChanged;
                }
                SortProjects();
                UpdateStatus();

                App.Settings.PropertyChanged += Settings_PropertyChanged;
            }
        }
Ejemplo n.º 4
0
        public void OpenProject(string filename)
        {
            var p = ReadProjectFile(filename);

            Projects.Add(p.ProjName, p);
            PopulateTreeView();
        }
        private void Filter()
        {
            Projects.Clear();
            DBRepository <Project>     dBProject = new DBRepository <Project>(new BuildEntities());
            DBRepository <User>        dBUser    = new DBRepository <User>(new BuildEntities());
            DBRepository <UserProject> dbUP      = new DBRepository <UserProject>(new BuildEntities());

            if (CurUser == null)
            {
                foreach (var item in dbUP.GetAll().ToList())
                {
                    var user    = dBUser.GetAll().First(s => s.ID_User == item.ID_User);
                    var project = dBProject.GetAll().First(s => s.ID_Project == item.ID_Project);
                    if (user.Login.Contains(Find) || project.ID_Project.ToString().Contains(Find) || project.Project_name.Contains(Find) || project.Date_of_change.ToString().Contains(find))
                    {
                        Projects.Add(new UserProj(dBUser.GetAll().First(s => s.ID_User == item.ID_User), dBProject.GetAll().First(s => s.ID_Project == item.ID_Project)));
                    }
                }
            }
            else
            {
                foreach (var item in dbUP.GetAll().Where(s => s.ID_User == CurUser.ID_User))
                {
                    var project = dBProject.GetAll().First(s => s.ID_Project == item.ID_Project);
                    if (CurUser.Login.Contains(Find) || project.ID_Project.ToString().Contains(Find) || project.Project_name.Contains(Find) || project.Date_of_change.ToString().Contains(find))
                    {
                        Projects.Add(new UserProj(dBUser.GetAll().First(s => s.ID_User == item.ID_User), dBProject.GetAll().First(s => s.ID_Project == item.ID_Project)));
                    }
                }
            }
            dBProject.Dispose();
            dBUser.Dispose();
            dbUP.Dispose();
        }
        async Task InitData()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy   = true;
            HasError = false;
            Error    = null;

            var result = await projectService.FindProjects();

            if (result.HasError)
            {
                HasError = true;
                Error    = result.Error;
                IsBusy   = false;
                return;
            }
            IsBusy = false;
            foreach (var item in result.Model)
            {
                Projects.Add(item);
            }
            if (Projects.Count != 0)
            {
                SelectedProject = ServiceContext.Instance.CurrentProject;
            }
        }
Ejemplo n.º 7
0
            public void Refresh()
            {
                WaveguideDB wgDB = new WaveguideDB();

                bool success = wgDB.GetAllProjects(ShowArchivedProjects);

                if (success)
                {
                    Projects.Clear();

                    for (int i = 0; i < wgDB.m_projectList.Count(); i++)
                    {
                        ProjectItem pitem = new ProjectItem();
                        pitem.ProjectName = wgDB.m_projectList[i].Description;
                        pitem.ProjectID   = wgDB.m_projectList[i].ProjectID;
                        pitem.Archived    = wgDB.m_projectList[i].Archived;
                        pitem.TimeStamp   = wgDB.m_projectList[i].TimeStamp;

                        bool IsAssigned = new bool();
                        IsAssigned = false;
                        success    = wgDB.IsUserAssignedToProject(User.UserID, pitem.ProjectID, ref IsAssigned);
                        if (success)
                        {
                            pitem.AssignedToProject = IsAssigned;
                        }

                        Projects.Add(pitem);
                    }
                }
            }
        private async Task OnSaveProject()
        {
            if (_selectedProject.ValidateModel())
            {
                try
                {
                    if (SelectedProject.ProjectId == Guid.Empty)
                    {
                        SelectedProject = await _adminService.CreateProjectAsync(_selectedProject);

                        _canCreateNewProject = await _adminService.CanCreateNewProject(Company.CompanyId);

                        NewProject.RaiseCanExecuteChanged();
                    }
                    else
                    {
                        await _adminService.UpdateProjectAsync(_selectedProject);
                    }
                    if (!Projects.Contains(SelectedProject))
                    {
                        Projects.Add(SelectedProject);
                    }
                    IsProjectEditorVisible = false;
                }
                catch (TimeoutException timeoutEx)
                {
                    _eventAggregator.GetEvent <TimeoutErrorEvent>().Publish(timeoutEx);
                }
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Projects.Clear();
                var items = await ProjectDataStore.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Projects.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 10
0
        public async void OnLoad()
        {
            var service = new StreetPayService();

            IsLoading = true;
            var response = await service.GetProjects();

            IsLoading = false;

            if (response == null)
            {
                return;
            }

            if (response.StatusCode != System.Net.HttpStatusCode.OK || response.Data == null)
            {
                ShowMessage("Error cargando proyectos: {0}, {1}", response.StatusCode, response.Content);
                return;
            }

            if (Projects != null)
            {
                foreach (var proj in response.Data)
                {
                    if (!Projects.Any(x => x.Id == proj.Id))
                    {
                        Projects.Add(proj);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Projects.Clear();

                var client   = new WebClient();
                var response = await client.GetProjects();

                IsVisibleProjects = response.Response.Items.Count > 0;

                foreach (var item in response.Response.Items)
                {
                    Projects.Add(ProjectConverter.Convert(item));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 12
0
        private void CollectProjectsFromSolution()
        {
            string line;

            using (StreamReader stream = File.OpenText(FileFullName))
            {
                while (!stream.EndOfStream)
                {
                    line = stream.ReadLine().Trim();
                    if (line.StartsWith("Project(\""))
                    {
                        Project project = new Project();
                        if (project.ReadSolutionProjects(line))
                        {
                            Projects.Add(project);
                        }
                    }

                    if (line.StartsWith("SolutionGuid"))
                    {
                        string[] array = line.Split('=');
                        SolutionGuid = array[1].Trim();
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private async Task ExecuteLoadProjectsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                string uriString    = "/DefaultCollection/_apis/projects/";
                var    responseBody = await HttpClientHelper.RequestVSO(uriString);

                Projects allProjects = JsonConvert.DeserializeObject <Projects>(responseBody);

                var projectImage = new Image {
                    Source = new FileImageSource {
                        File = "prj.png"
                    }
                };
                foreach (var prj in allProjects.value)
                {
                    prj.ImageUri = projectImage.Source;
                    Projects.Add(prj);
                }
            }
            catch (Exception ex)
            {
                var page   = new ContentPage();
                var result = page.DisplayAlert("Error", "Unable to load Visual Studio Online projects.", "OK", null);
            }

            IsBusy = false;
        }
Ejemplo n.º 14
0
        internal void Add(string revitProject, string bimProject)
        {
            // input validation
            if (string.IsNullOrEmpty(revitProject))
            {
                throw new IcnException("Parameter revitProject is not set to a value or reference", 20, "KnownProjects.Add");
            }

            if (!File.Exists(revitProject))
            {
                throw new IcnException($"Parameter revitProject '{revitProject}' does not exist", 20, "KnownProjects.Add");
            }

            if (string.IsNullOrEmpty(bimProject))
            {
                throw new IcnException("Parameter bimProject is not set to a value or reference", 20, "KnownProjects.Add");
            }

            if (!ProjectsDict.ContainsKey(revitProject))
            {
                ProjectsDict.Add(revitProject, bimProject);
                Projects.Add(revitProject);
                _modified = true;
                return;
            }

            ProjectsDict[revitProject] = bimProject;
            _modified = true;
        }
Ejemplo n.º 15
0
        public async void Initialize(ViewRequest viewRequest)
        {
            model.GetConfiguration((viewRequest as KanbanViewRequest)?.ConfigurtaionName);

            var filtersData = await Task
                              .Run(() => model.LoadFiltersData())
                              .ConfigureAwait(true);

            Projects.Clear();
            foreach (var project in filtersData.Projects)
            {
                Projects.Add(project);
            }


            Priorities.Clear();
            foreach (var priority in filtersData.Priorities)
            {
                Priorities.Add(priority);
            }


            if (model.Configuration != null &&
                model.Configuration.ProjectId.HasValue)
            {
                CurrentProject = Projects.FirstOrDefault(x => x.Id == model.Configuration.ProjectId);
            }

            await DoRefresh();
        }
Ejemplo n.º 16
0
        private void OpenFileDialog(object sender, RoutedEventArgs e)
        {
            if (Projects.Count != 0)
            {
                MessageBox.Show("Существующий проект будет закрыт!");
            }

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.DefaultExt = "ras";
            openFileDialog.Filter     = "Файлы ReliabilityAnalysis|*.ras";
            openFileDialog.ShowDialog();



            if (openFileDialog.FileName != "")
            {
                var project = Project.OpenProject(openFileDialog.FileName);
                if (project != null)
                {
                    Projects.Clear();
                    Projects.Add(project);
                    TreeViewElements.ItemsSource = Projects;
                    GridProp.ItemsSource         = Projects[0].Property.Concat(Projects[0].Results);
                    GridProp.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Ошибка чтения файла");
                }
            }
        }
Ejemplo n.º 17
0
        private void UpdateShowingProjects()
        {
            Projects.Clear();

            var showingProjects = _projects.Where(p =>
            {
                if (SearchText == "")
                {
                    return(true);
                }
                if (p.Name.Contains(SearchText))
                {
                    return(true);
                }
                else if (p.Key.Contains(SearchText))
                {
                    return(true);
                }
                return(false);
            });

            if (CanCreateProject)
            {
                Projects.Add(null);
            }
            Projects.AddRange(showingProjects);
        }
Ejemplo n.º 18
0
        private void ImportProjects()
        {
            Projects.Clear();
            var projectsData = group == null?projects.GetProjects() : projects.GetProjects(group.ID);

            foreach (var project in projectsData)
            {
                string gpName = string.Empty;
                if (group == null)
                {
                    var gp = project.GroupID > 0 ? groupService.GetGroup(project.GroupID) : null;
                    if (gp != null)
                    {
                        gpName = gp.Name;
                    }
                }
                Projects.Add(new Controls.ItemSelect.Models.ItemModel
                {
                    ID          = project.ID,
                    Title       = project.ProjectName,
                    Description = project.ProjectDescription,
                    Icon        = project.Icon,
                    Tag         = gpName
                });
            }
        }
Ejemplo n.º 19
0
 //Добавление в поток уже созданного проекта, isSetup = false - добавление при настройке другого потока
 public void PasteProject(Project project)
 {
     AddEvent("Добавление проекта", "Проект " + project.Code + " из потока " + project.ThreadCalc.Id);
     try
     {
         project.ThreadCalc = this;
         Projects.Add(project.Code, project);
         ProjectsList.Add(project);
         var list = project.Providers.Values.Select(p => p.Copy(this)).ToList();
         project.Providers.Clear();
         foreach (var p in list)
         {
             if (ProvidersDic.ContainsKey(p.Name))
             {
                 project.Providers.Add(p.Name, ProvidersDic[p.Name]);
             }
             else
             {
                 project.Providers.Add(p.Name, p);
                 ProvidersDic.Add(p.Name, p);
             }
             ProvidersDic[p.Name].Projects.Add(project.Code);
         }
     }
     catch (Exception ex)
     {
         AddError("Ошибка при добавлении проекта", ex);
     }
     MakeProviders();
     MakeProjectString();
 }
Ejemplo n.º 20
0
        public bool SaveProject(DATA.Project Content, bool Upsert = false)
        {
            if (Content == null || string.IsNullOrWhiteSpace(Content.Name) || string.IsNullOrWhiteSpace(Content.Source))
            {
                return(false);
            }

            Projects.TryGetValue(Content.Name, out DATA.Project found);

            if (found != null && Upsert == false)
            {
                return(false);
            }

            if (!File.Exists(Content.Source))
            {
                return(false);
            }

            Projects.Remove(Content.Name);
            Projects.Add(Content.Name, Content);

            Save();

            return(false);
        }
Ejemplo n.º 21
0
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Projects.Clear();
                var projects = await ApiClient.Instance.GetProjects();

                if (projects.Count > 0)
                {
                    foreach (var item in projects)
                    {
                        if (item.uuid != null)
                        {
                            Projects.Add(item);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 22
0
 public void AddProject()
 {
     Projects.Add(new Project(this)
     {
         Name = Resources.НовыйПроект
     });
 }
Ejemplo n.º 23
0
        async Task ExecuteLoadProjectsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Projects.Clear();
                var projects = await DataStore.GetProjectsAsync();

                foreach (var project in projects)
                {
                    Projects.Add(project);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 24
0
        private async Task LoadProjectsAsync()
        {
            statusModel.UpdateStatus("Loading projects ..");
            var config = await configurationService.GetAsync();

            var rootPath = config.RootDirectory;

            await delayService.DelayAsync(); // stupid delay to see something happening ;-)

            var items = CreateProjectViewModelsFromDirectory(rootPath).ToList();

            foreach (var item in items)
            {
                Projects.Add(item);
                await delayService.DelayAsync(); // stupid delay to see something happening ;-)
            }

            switch (items.Count)
            {
            case 0:
                statusModel.UpdateStatus("Could not load any projects");
                break;

            case 1:
                statusModel.UpdateStatus("One project loaded.");
                break;

            default:
                statusModel.UpdateStatus($"{items.Count} Projects loaded.");
                break;
            }
        }
        /// <summary>
        /// Loads data
        /// </summary>
        public async void Initialize()
        {
            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization =
                    new System.Net.Http.Headers.AuthenticationHeaderValue(
                        "Bearer",
                        App.AccessToken);

                var loginResult =
                    await httpClient.GetAsync($"{App.API_PREFIX}project/my?{App.AccessToken}");

                if (loginResult.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    IsErrorMessageVisible = true;
                }
                else
                {
                    IsErrorMessageVisible = false;
                    var projects = JsonConvert.DeserializeObject <IEnumerable <Project> >(
                        await loginResult.Content.ReadAsStringAsync());

                    foreach (var project in projects)
                    {
                        Projects.Add(new ProjectViewModel(project));
                    }
                }
            }
        }
Ejemplo n.º 26
0
            public MockConfigurationManager()
            {
                var projectNames   = new[] { "Namespace.FirstProject", "Namespace.SecondProject" };
                var platforms      = new[] { "Any CPU", "x86" };
                var configurations = new[] { "Debug", "Release" };

                foreach (string name in projectNames)
                {
                    var project = new Project {
                        Name = name
                    };
                    foreach (string platform in platforms)
                    {
                        foreach (string configuration in configurations)
                        {
                            project.AvailableConfigurations.Add(new Configuration
                            {
                                SolutionConfiguration          = configuration,
                                SolutionPlatform               = platform,
                                ProjectConfiguration           = configuration,
                                AvailableProjectConfigurations = configurations,
                                ProjectPlatform           = platform,
                                AvailableProjectPlatforms = platforms
                            });
                        }
                    }
                    Projects.Add(project);
                }
                ActiveSolutionConfiguration = "Debug";
                ActiveSolutionPlatform      = "Any CPU";
            }
Ejemplo n.º 27
0
 public void ReadProject(string projFilePath, string dir)
 {
     if (File.Exists(projFilePath) && !IsProjectOpen(dir)) //TODO Check if project already open
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Project));
         using (TextReader reader = new StreamReader(projFilePath))
         {
             try
             {
                 Project proj = (Project)serializer.Deserialize(reader);
                 // Create new project with defined path (project file does not contain location)
                 Projects.Add(new Project(dir, proj.ProjectFile, proj.Language, proj.Type, proj.Framework, proj.Author, proj.Version, proj.IgnoredItems));
             }
             catch
             {
                 //TODO Write to pop-up
                 Console.WriteLine("Error! Project failed deserializing!");
             }
         }
     }
     else
     {
         //TODO Error pop-up
         Console.WriteLine("Error! No project file or project already open!");
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Loads the records from the DbSet into the ViewModel. This function designed for recursive use
        /// </summary>
        /// <returns>Observable collection of Projects</returns>
        private void Load()
        {
            using (EDBEntities eDB = new EDBEntities())
            {
                try
                {
                    foreach (tblProject Rec in (from o in eDB.tblProjects select o))
                    {
                        ProjectModel projectItem = new ProjectModel
                        {
                            ID           = Rec.ID,
                            ProjectName  = Rec.ProjectName,
                            ContractNo   = Rec.ContractNo,
                            CustomerName = Rec.CustomerName,
                            Logo         = Rec.Logo,
                            LastOpened   = Rec.LastOpened,
                            LastOpenedBy = Rec.LastOpenedBy
                        };

                        Projects.Add(projectItem);
                    }
                }
                catch (Exception ex)
                {
                    RadWindow.Alert(ex.Message);
                }
            }
        }
Ejemplo n.º 29
0
        private void PopulateFieldData()
        {
            var role = Claims[3].Value.ToString();

            Enum.TryParse(role, out Role userRole);
            if (userRole == Role.User)
            {
                Users.Clear();
                Projects.Clear();
                Users.Add(UserRepository.GetUser(Claims[0].Value.ToString()));
                var assignedProject = ProjectUserRepository.GetAssignedProject(Claims[0].Value.ToString());
                if (assignedProject != null)
                {
                    Projects.Add(assignedProject.ProjectRef);
                }
            }
            else
            {
                Users    = UserRepository.GetUsers();
                Projects = ProjectRepository.GetProjects();
            }
            LogHistoryFilterModel.StartDate = DateTime.Now.AddDays(-7);
            LogHistoryFilterModel.EndDate   = DateTime.Now;
            var project = ProjectUserRepository.GetAssignedProject(Claims[0].Value);

            if (project != null)
            {
                LogHistoryFilterModel.Project = project.ProjectRef.Name ?? project.ProjectRef.Name;
            }
            LogHistoryFilterModel.UserName = Claims[1].Value;
        }
Ejemplo n.º 30
0
 public virtual void AddProject(Project project)
 {
     if (!HasProject(project))
     {
         Projects.Add(project);
     }
 }
Ejemplo n.º 31
0
 internal static Projects LoadUserProjects(string username)
 {
     if (username != "")
     {
         SqlCommand cmd = new SqlCommand("select p.ProjectID, p.OwnerName, p.Name, p.Description, p.CreatedDate, p.EndDate from UserProject as up inner join Project as p on p.ProjectID = up.ProjectID where up.Username = @un", Main.GetConnection());
         cmd.Parameters.Add(new SqlParameter("un", username));
         SqlDataReader reader = cmd.ExecuteReader();
         Projects userProjects = new Projects();
         while (reader.Read())
         {
             Project p = new Project();
             p.ID = reader.GetString(0);
             p.OwnerName = reader.GetString(1);
             p.Name = reader.GetString(2);
             p.Description = reader.GetString(3);
             p.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
             p.EndDate = Convert.ToDateTime(reader["EndDate"]);
             userProjects.Add(p);
         }
         return userProjects;
     }
     else return null;
 }