/// <summary Get Collection> /// Get collection of emails. If no records to return, EmailCollection will be null. /// </summary> /// <returns></returns> public static ProjectsCollection GetCollection() { ProjectsCollection tempList = null; using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString)) { using (SqlCommand myCommand = new SqlCommand("usp_GetProjects", myConnection)) { myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection); myConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { if (myReader.HasRows) { tempList = new ProjectsCollection(); while (myReader.Read()) { tempList.Add(FillDataRecord(myReader)); } } myReader.Close(); } } } return tempList; }
private void GetDesignTimeData() { AllProjects = projects; Activities = observableCollectionActivities; SelectedProjects = new ProjectsCollection(projects); SelectedProjects.Add(projects[0]); }
public static async Task <ProjectListViewModel> Init(Guid workspaceId) { var vm = new ProjectListViewModel(workspaceId); var store = ServiceContainer.Resolve <IDataStore> (); var settingsStore = ServiceContainer.Resolve <ISettingsStore> (); // Change settings for a better library like // James Montemagno version and define default // values to avoid this code. if (string.IsNullOrEmpty(settingsStore.SortProjectsBy)) { settingsStore.SortProjectsBy = ProjectsCollection.SortProjectsBy.Clients.ToString(); } var savedSort = Enum.Parse(typeof(ProjectsCollection.SortProjectsBy), settingsStore.SortProjectsBy); vm.ProjectList = await ProjectsCollection.Init((ProjectsCollection.SortProjectsBy) savedSort, workspaceId); vm.WorkspaceList = await store.Table <WorkspaceData> ().Where(r => r.DeletedAt == null) .OrderBy(r => r.Name).ToListAsync(); vm.CurrentWorkspaceIndex = vm.WorkspaceList.IndexOf(p => p.Id == workspaceId); // Search stream Observable.FromEventPattern <string> (ev => vm.onSearch += ev, ev => vm.onSearch -= ev) .Throttle(TimeSpan.FromMilliseconds(300)) .DistinctUntilChanged() .Subscribe (p => ServiceContainer.Resolve <IPlatformUtils> ().DispatchOnUIThread(() => { vm.ProjectList.ProjectNameFilter = p.EventArgs; }), ex => ServiceContainer.Resolve <ILogger> ().Error("Search", ex, null)); return(vm); }
//Create Task private void TaskCreate() { try { DBHelper dbh = new DBHelper(); if (task.Text.Equals("") || taskDetails.Text.Equals("") || taskStarts.Text.Equals("") || taskDeadline.Text.Equals("")) { Toast.MakeText(this, "Fill in all fields!", ToastLength.Long).Show(); } else { if (DateTime.Parse(taskDeadline.Text) <= DateTime.Parse(taskStarts.Text)) { Toast.MakeText(this, "Task deadline should be greater than task start!", ToastLength.Long).Show(); return; } else if (DateTime.Parse(taskDeadline.Text) <= DateTime.Today) { Toast.MakeText(this, "Task deadline should be greater than current date!", ToastLength.Long).Show(); } else { int mproject; if (selProjectId <= 0) { allprojects = ProjectsCollection.GetProjects(); mproject = Convert.ToInt32(allprojects[project.SelectedItemPosition].Id); } else { mproject = selProjectId; } string mtask = DatabaseUtils.SqlEscapeString(task.Text); string mtaskDesc = DatabaseUtils.SqlEscapeString(taskDetails.Text); string mtaskStart = taskStarts.Text; string mtaskDeadline = taskDeadline.Text; decimal mtaskBudget = Convert.ToDecimal(taskBudget.Text); string result = dbh.CreateProjectTask(mtask, mproject, mtaskDesc, mtaskStart, mtaskDeadline, mtaskBudget); if (result.Equals("ok")) { Toast.MakeText(this, "Project task added!", ToastLength.Short).Show(); Finish(); } else { Toast.MakeText(this, "Failed adding project task\n. Error info:" + result, ToastLength.Short).Show(); } } } } catch (Exception ex) { Toast.MakeText(this, "Error:\n" + ex.Message, ToastLength.Long); } }
public TeamCityServiceContext(Uri serviceUri, string username, string password) { _syncRoot = new object(); _serviceUri = serviceUri; _passphrase = GetPassphrase(username, password); _projects = new ProjectsCollection(this); _buildTypes = new BuildTypesCollection(this); _builds = new BuildsCollection(this); }
private double SetAddNewButtonHeight() { if (ProjectsCollection.Any()) { return(15); } else { return(50); } }
/// <summary> /// Updates the Users list of a project. /// </summary> /// <param name="id"></param> /// <param name="model"></param> /// <returns></returns> public ProjectModel Put(string id, IEnumerable <UserRole> model) { var filterId = Builders <ProjectModel> .Filter.Eq(x => x.Id, id); var updateProjectUsers = Builders <ProjectModel> .Update.Set(x => x.Users, model); var project = ProjectsCollection.FindOneAndUpdate(filterId, updateProjectUsers); return(project); }
/// <summary> /// Gets a list of all projects without workflowelementcategories. /// </summary> /// <returns></returns> public IEnumerable <ProjectModel> Get() { var list = ProjectsCollection.Find(EmptyProjectFilter).ToList(); // Parallel so requests will be faster. Parallel.ForEach(list, project => { project.WorkflowElementCategories = null; }); return(list); }
private void AddNewProject(Project project) { if (SelectedTile != null) { // There is a tile selected so add this new project to it's collection of sub projects SelectedTile.SubItems.Add(project); } else { // No selected tile so project must be top level ProjectsCollection.Add(project); } }
private void DeleteProject(Project project) { if (SelectedTile != null) { // There is a tile selected so remove this new project from it's collection of sub projects SelectedTile.SubItems.Remove(project); } else { // No selected tile so project must be top level ProjectsCollection.Remove(project); } }
public MainView Make() { ThreadHelper.ThrowIfNotOnUIThread(); var dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE)); var projectsCollection = new ProjectsCollection(dte); var solutionEvents = new SolutionEvents(dte); var vm = new MainViewModel(projectsCollection, solutionEvents); var view = new MainView { DataContext = vm }; return(view); }
//populate list private async void populateItemsList(View view, int pId) { try { pTasks = ProjectsCollection.GetProjectTasks(pId); adapter = new ProjectTasksAdapter(view.Context, pTasks); mListTasks.Adapter = adapter; } catch (Exception ex) { Toast.MakeText(view.Context, "" + ex.Message, ToastLength.Long).Show(); } }
/// <summary> /// Gets a ProjectModel from its Id. /// </summary> /// <param name="id"></param> /// <returns></returns> public ProjectModel Get(string id) { try { var filterId = Builders <ProjectModel> .Filter.Eq(x => x.Id, id); var project = ProjectsCollection.FindAsync(filterId).Result.First(); return(project); } catch { return(null); } }
/// <summary> /// Updates a workflowelement in a project. /// </summary> /// <param name="projectId"></param> /// <param name="categoryId"></param> /// <param name="workflowElement"></param> /// <returns></returns> public ProjectModel Put(string projectId, string categoryId, WorkflowElement workflowElement) { var project = Get(projectId); var category = project.WorkflowElementCategories.First(x => x.CategoryId == categoryId); var element = category.WorkflowElements.First(x => x.ElementId == workflowElement.ElementId); element.Explanation = workflowElement.Explanation; element.IsDone = workflowElement.IsDone; element.IsRelevant = workflowElement.IsRelevant; element.Description = workflowElement.Description; var newProject = ProjectsCollection.ReplaceOne(x => x.Id == projectId, project); return(project); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application hereDonna Summer (LaDonna Adrian Gaines) SetContentView(Resource.Layout.AddProjectTasks); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); project = FindViewById <Spinner>(Resource.Id.spinTaskProject); task = FindViewById <EditText>(Resource.Id.txtProjectTask); taskDetails = FindViewById <EditText>(Resource.Id.txtProjectTaskDetails); taskStarts = FindViewById <TextView>(Resource.Id.txtProjectTaskStarts); taskDeadline = FindViewById <TextView>(Resource.Id.txtProjectTaskDeadline); taskStartsReset = FindViewById <TextView>(Resource.Id.txtProjectTaskStartsReset); taskDeadlineReset = FindViewById <TextView>(Resource.Id.txtProjectTaskDeadlineReset); taskBudget = FindViewById <EditText>(Resource.Id.txtProjectTaskBudget); allprojects = ProjectsCollection.SpinnerProjects(); adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, allprojects); project.Adapter = adapter; //task start taskStarts.Text = DateTime.Now.ToShortDateString(); taskStarts.Click += TaskStarts_Click; //reset task start taskStartsReset.Click += delegate { taskStarts.Text = DateTime.Now.ToShortDateString(); }; //task deadline taskDeadline.Text = DateTime.Now.ToShortDateString(); taskDeadline.Click += TaskDeadline_Click; //reset task deadline taskDeadlineReset.Click += delegate { taskDeadline.Text = DateTime.Now.ToShortDateString(); }; }
/// <summary> /// Changes the active project. /// </summary> public void ChangeActiveProject(Message.M_SimpleAction msg) { if (msg.SimpleAction == Message.M_SimpleAction.Action.ChangeActiveProject) { if (SelectedTile.IsActiveProject == false) { SelectedTile.IsActiveProject = true; // Unselect all other projects foreach (Project project in ProjectsCollection.Where(proj => proj.Name != SelectedTile.Name)) { project.IsActiveProject = false; project.ChangeIsActiveForSubProjects(SelectedTile.Name); } } } }
/// <summary> /// Initializes a new instance of the ManageProjectsViewModel class. /// </summary> public ManageProjectsViewModel(IProjectRepository projectRepository, IActivityRepository activityRepository) { this.projectRepository = projectRepository; this.activityRepository = activityRepository; if (IsInDesignMode) { GetDesignTimeData(); } else { GetRunTimeData(); SelectedProjects = new ProjectsCollection(); } AddProject = new RelayCommand <Project>(ProjectAdded); RefreshProject = new RelayCommand(ProjectRefreshed); DeleteProject = new RelayCommand <Project>(ProjectDeleted); }
public ProjectModel Post(ProjectModel model) { var template = ProjectsCollection.Find(TemplateProjectFilter).FirstOrDefault(); foreach (WorkflowElementCategory category in template.WorkflowElementCategories.ToList()) { category.WorkflowElements.RemoveAll(x => x.ASVSLevel > model.ASVSLevel); if (category.WorkflowElements.Count <= 0) { template.WorkflowElementCategories.Remove(category); } } model.WorkflowElementCategories = template.WorkflowElementCategories; ProjectsCollection.InsertOne(model); return(model); }
private void RefreshData() { GetRunTimeData(); var selected = new ProjectsCollection(); foreach (var oldProject in SelectedProjects) { //Check if New Project List contains Selected Project //Check if New Activity List contains Selected Project Activity if (AllProjects.Contains(oldProject) && Activities.Contains(oldProject.Activity)) { //Get Project from the server(In case Name or other data were changed) var newProject = AllProjects[AllProjects.IndexOf(oldProject)]; //Add Project to selected List only if Project and Activity are still available selected.Add(newProject); } } SelectedProjects = selected; }
public RedmineServiceContext(Uri serviceUri, string apiKey) { _serviceUri = serviceUri; _apiKey = apiKey; _news = new NewsCollection(this); _projects = new ProjectsCollection(this); _issues = new IssuesCollection(this); _users = new UsersCollection(this); _userRoles = new UserRolesCollection(this); _relations = new IssueRelationsCollection(this); _trackers = new IssueTrackersCollection(this); _statuses = new IssueStatusesCollection(this); _priorities = new IssuePrioritiesCollection(this); _categories = new IssueCategoriesCollection(this); _versions = new ProjectVersionsCollection(this); _attachments = new AttachmentsCollection(this); _customFields = new CustomFieldsCollection(this); _queries = new QueriesCollection(this); _syncRoot = new object(); }
public ProjectModel Put(string id, ProjectModel model) { model.TimeLastEdit = DateTime.Now; var filterId = Builders <ProjectModel> .Filter.Eq(x => x.Id, id); var updateProjectName = Builders <ProjectModel> .Update.Set(x => x.Name, model.Name); var updateProjectDescription = Builders <ProjectModel> .Update.Set(x => x.Description, model.Description); var updateProjectASVSLevel = Builders <ProjectModel> .Update.Set(x => x.ASVSLevel, model.ASVSLevel); var updateProjectIsCompleted = Builders <ProjectModel> .Update.Set(x => x.IsCompleted, model.IsCompleted); var updateProjectUsers = Builders <ProjectModel> .Update.Set(x => x.Users, model.Users); var updateProjectElements = Builders <ProjectModel> .Update.Set(x => x.WorkflowElementCategories, model.WorkflowElementCategories); var updateProjectTimeLastEdit = Builders <ProjectModel> .Update.Set(x => x.TimeLastEdit, model.TimeLastEdit); var updateSSLLabsData = Builders <ProjectModel> .Update.Set(x => x.SSLLabsData, model.SSLLabsData); var updateSSLLabsDataTimeScan = Builders <ProjectModel> .Update.Set(x => x.SSLLabsDataTimeLastScan, model.SSLLabsDataTimeLastScan); var updateCommandResult = Builders <ProjectModel> .Update.Set(x => x.CommandResult, model.CommandResult); var updates = Builders <ProjectModel> .Update.Combine( updateProjectName, updateProjectDescription, updateProjectASVSLevel, updateProjectIsCompleted, updateProjectUsers, updateProjectElements, updateProjectTimeLastEdit, updateSSLLabsData, updateSSLLabsDataTimeScan, updateCommandResult); var project = ProjectsCollection.FindOneAndUpdate(filterId, updates); return(project); }
//check if goal near deadline public void CheckUpdate() { Thread t = new Thread(() => { Thread.Sleep(6000); if (ProjectsCollection.CheckItem(DateTime.Now)) { var nMgr = (NotificationManager)GetSystemService(NotificationService); //Details of notification in previous recipe Notification.Builder builder = new Notification.Builder(this) .SetAutoCancel(true) .SetContentTitle("Project Deadline") .SetNumber(notifyId) .SetContentText("Some project deadline are today. Please check to update progress.") .SetVibrate(new long[] { 100, 200, 300 }) .SetSmallIcon(Resource.Drawable.ic_bell); nMgr.Notify(0, builder.Build()); } }); t.Start(); }
public ProjectListAdapter(RecyclerView owner, ProjectListViewModel viewModel) : base(owner, viewModel.ProjectList) { this.viewModel = viewModel; collectionView = viewModel.ProjectList; }
public void Delete(string id) { var filterId = Builders <ProjectModel> .Filter.Eq(x => x.Id, id); ProjectsCollection.FindOneAndDelete(filterId); }
public void ChangeListSorting (ProjectsCollection.SortProjectsBy sortBy) { ProjectList.SortBy = sortBy; var settingsStore = ServiceContainer.Resolve<ISettingsStore> (); settingsStore.SortProjectsBy = sortBy.ToString (); }
private bool IsEmpty() { var list = ProjectsCollection.Find(EmptyProjectFilter).ToList(); return(list.Any()); }
public ProjectListAdapter(RecyclerView owner, ProjectsCollection collectionView) : base(owner, collectionView) { this.collectionView = collectionView; }
private void Clean() { this.Sysid = null; this.Publicid = null; this.Path = string.Empty; this.Createdate = null; this.Lastmodifieddate = null; this.Active = null; this._projectsCollection = null; }
public static ProjectsCollection GetAll() { resourceSchema.Dal.Projects dbo = null; try { dbo = new resourceSchema.Dal.Projects(); System.Data.DataSet ds = dbo.Projects_Select_All(); ProjectsCollection collection = new ProjectsCollection(); if (GlobalTools.IsSafeDataSet(ds)) { for (int i = 0; (i < ds.Tables[0].Rows.Count); i = (i + 1)) { Projects obj = new Projects(); obj.Fill(ds.Tables[0].Rows[i]); if ((obj != null)) { collection.Add(obj); } } } return collection; } catch (System.Exception ) { throw; } finally { if ((dbo != null)) { dbo.Dispose(); } } }
//populate list private void populateProjectList(View view) { projects = ProjectsCollection.GetProjects(); adapter = new ProjectsAdapter(view.Context, projects); mListProjects.Adapter = adapter; }