/// <summary> /// Handles the ItemCommand event of the grdPriorities control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void grdPriorities_ItemCommand(object sender, DataGridCommandEventArgs e) { Priority p; var itemIndex = e.Item.ItemIndex; switch (e.CommandName) { case "up": //move row up if (itemIndex == 0) { return; } p = PriorityManager.GetById(Convert.ToInt32(grdPriorities.DataKeys[e.Item.ItemIndex])); p.SortOrder -= 1; PriorityManager.SaveOrUpdate(p); break; case "down": //move row down if (itemIndex == grdPriorities.Items.Count - 1) { return; } p = PriorityManager.GetById(Convert.ToInt32(grdPriorities.DataKeys[e.Item.ItemIndex])); p.SortOrder += 1; PriorityManager.SaveOrUpdate(p); break; } BindPriorities(); }
private int GetPriorityId(int priority) { var prioritymanager = new PriorityManager(); if (priority >= 0 && priority < 2) { return(prioritymanager.FirstOrDefault(p => p.EnglishTitle == "Very Low").PriorityID); } if (priority >= 2 && priority < 4) { return(prioritymanager.FirstOrDefault(p => p.EnglishTitle == "Low").PriorityID); } if (priority >= 4 && priority < 6) { return(prioritymanager.FirstOrDefault(p => p.EnglishTitle == "Normal").PriorityID); } if (priority >= 6 && priority < 8) { return(prioritymanager.FirstOrDefault(p => p.EnglishTitle == "High").PriorityID); } if (priority >= 8) { return(prioritymanager.FirstOrDefault(p => p.EnglishTitle == "Urgent").PriorityID); } return(5); }
void UpdateLabel() { string priorValue = comboBox_priority.SelectedItem.ToString(); int readyForUpdate = PriorityManager.CheckUpdatePriority(priorValue); label_update.Text = "Приоритет будет изменен для: " + readyForUpdate.ToString(); }
public Priority_Form() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedSingle; InitControls(); PriorityManager.CreateConnect(); EventSubscription(); RefreshToolStrip(); }
private void RefreshToolStrip() { int count = PriorityManager.GetCountUpdatedPins("0"); toolStrip_0.Text = count.ToString(); count = PriorityManager.GetCountUpdatedPins("251"); toolStrip_251.Text = count.ToString(); count = PriorityManager.GetCountUpdatedPins("255"); toolStrip_255.Text = count.ToString(); }
private void PopulatePriorityTab() { var priorityManager = new PriorityManager(); rblPriorities.DataSource = priorityManager.GetQuery().Select(p => new { Value = p.Weight, Text = p.Title }); rblPriorities.DataBind(); var ti = SubmitRequestWorkFlow.GetLastStateOfTaskInstance(RequestEntity); SetCurrentPriority(ti.PriorityID); }
public void Run() { var list = GetSampleData(); PriorityManager <PriorityItem <string> > priorityManager = new PriorityManager <PriorityItem <string> >(); var changedItems = priorityManager.MoveUp(list, 3); PrintList(changedItems, "Changed Items are:"); PrintList(list.ToList(), "New List:"); }
// ReSharper restore EventNeverSubscribedTo.Global #endregion public DissonanceComms() { _playbackPool = new PlaybackPool(_codecSettings, (IPriorityManager)this, (IVolumeProvider)this); _playerChannels = new PlayerChannels((IChannelPriorityProvider)this); _roomChannels = new RoomChannels((IChannelPriorityProvider)this); _text = new TextChat(() => _net); _autoChannelDuck = new OpenChannelVolumeDuck(_roomChannels, _playerChannels); _playerTrackers = new PlayerTrackerManager(_players); _playbackPriorityManager = new PriorityManager(_players); _capture = new CapturePipelineManager(_codecSettings, _roomChannels, _playerChannels, Players); }
/// <summary> /// Binds the priorities. /// </summary> void BindPriorities() { grdPriorities.Columns[1].HeaderText = GetGlobalResourceObject("SharedResources", "Priority").ToString(); grdPriorities.Columns[2].HeaderText = GetGlobalResourceObject("SharedResources", "Image").ToString(); grdPriorities.Columns[3].HeaderText = GetGlobalResourceObject("SharedResources", "Order").ToString(); grdPriorities.DataSource = PriorityManager.GetByProjectId(ProjectId); grdPriorities.DataKeyField = "Id"; grdPriorities.DataBind(); grdPriorities.Visible = grdPriorities.Items.Count != 0; }
/// <summary> /// Deletes the priority. /// </summary> /// <param name="s">The s.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void grdPriorities_Delete(Object s, DataGridCommandEventArgs e) { var id = (int)grdPriorities.DataKeys[e.Item.ItemIndex]; string cannotDeleteMessage; if (!PriorityManager.Delete(id, out cannotDeleteMessage)) { ActionMessage.ShowErrorMessage(cannotDeleteMessage); return; } BindPriorities(); }
/// <summary> /// Binds the options. /// </summary> private void BindOptions() { List <ITUser> users = UserManager.GetUsersByProjectId(ProjectId, true); //Get Type DropIssueType.DataSource = IssueTypeManager.GetByProjectId(ProjectId); DropIssueType.DataBind(); //Get Priority DropPriority.DataSource = PriorityManager.GetByProjectId(ProjectId); DropPriority.DataBind(); //Get Resolutions DropResolution.DataSource = ResolutionManager.GetByProjectId(ProjectId); DropResolution.DataBind(); //Get categories var categories = new CategoryTree(); DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId); DropCategory.DataBind(); //Get milestones DropMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId); DropMilestone.DataBind(); DropAffectedMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId); DropAffectedMilestone.DataBind(); //Get Users DropAssignedTo.DataSource = users; DropAssignedTo.DataBind(); DropOwned.DataSource = users; DropOwned.DataBind(); DropStatus.DataSource = StatusManager.GetByProjectId(ProjectId); DropStatus.DataBind(); lblDateCreated.Text = DateTime.Now.ToString("f"); lblLastModified.Text = DateTime.Now.ToString("f"); if (!User.Identity.IsAuthenticated) { return; } lblReporter.Text = Security.GetDisplayName(); lblLastUpdateUser.Text = Security.GetDisplayName(); }
public String[] GetPriorities(int ProjectId) { if (ProjectManager.GetById(ProjectId).AccessType == Common.ProjectAccessType.Private && !ProjectManager.IsUserProjectMember(UserName, ProjectId)) { throw new UnauthorizedAccessException(string.Format(LoggingManager.GetErrorMessageResource("ProjectAccessDenied"), UserName)); } List <Priority> priorites = PriorityManager.GetByProjectId(ProjectId); List <String> returnval = new List <String>(); foreach (Priority item in priorites) { returnval.Add(item.Name.ToString()); } return(returnval.ToArray()); }
private void button_priority_report_Click(object sender, EventArgs e) { DateTime startDate = dateTimePicker1.Value.Date; DateTime stopDate = dateTimePicker2.Value.Date; int dif = stopDate.Day - startDate.Day; if (dif < 0 || stopDate > DateTime.Now) { MessageBox.Show("Некорректный диапазон дат.", "Ooops...", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string start = startDate.ToString("dd/MM/yyyy"); string stop = stopDate.ToString("dd/MM/yyyy"); PriorityManager.CreateExcelReport(start, stop); }
private void button_open_file_priority_Click(object sender, EventArgs e) { Reset(); if (comboBox_priority.Text.Length < 1) { MessageBox.Show("Выберите приоритет.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Stream myStream = null; OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Open Text File"; ofd.Filter = "TXT files|*.txt"; ofd.InitialDirectory = @"C:\"; if (ofd.ShowDialog() == DialogResult.OK) { try { _pathToFile = ofd.FileName; if ((myStream = ofd.OpenFile()) != null) { List <Deal> pinList = new List <Deal>(); using (myStream) { var lines = File.ReadLines(ofd.FileName); foreach (var line in lines) { Deal deal = new Deal { DealId = Convert.ToDecimal(line) }; pinList.Add(deal); } } int allCount = pinList.Count; label_all.Text = "Дел в файле: " + allCount.ToString(); PriorityManager.AddPinFromFile(pinList); } } catch (Exception ex) { MessageBox.Show("Не удается прочитать файл. " + ex.Message); PriorityLoger.AddRecordToLog("Не удается прочитать файл. " + ex.Message); } } }
/// <summary> /// Handles the Update event of the grdPriority control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void grdPriorities_Update(object sender, DataGridCommandEventArgs e) { var txtPriorityName = (TextBox)e.Item.FindControl("txtPriorityName"); var pickimg = (PickImage)e.Item.FindControl("lstEditImages"); if (txtPriorityName.Text.Trim() == "") { throw new ArgumentNullException("Priorty Name is empty."); } var p = PriorityManager.GetById(Convert.ToInt32(grdPriorities.DataKeys[e.Item.ItemIndex])); p.Name = txtPriorityName.Text.Trim(); p.ImageUrl = pickimg.SelectedValue; PriorityManager.SaveOrUpdate(p); grdPriorities.EditItemIndex = -1; BindPriorities(); }
/// <summary> /// Binds the options. /// </summary> private void BindOptions() { List <ITUser> users = UserManager.GetUsersByProjectId(ProjectId, true); //Get Type DropIssueType.DataSource = IssueTypeManager.GetByProjectId(ProjectId); DropIssueType.DataBind(); //Get Priority DropPriority.DataSource = PriorityManager.GetByProjectId(ProjectId); DropPriority.DataBind(); //Get Resolutions DropResolution.DataSource = ResolutionManager.GetByProjectId(ProjectId); DropResolution.DataBind(); //Get categories var categories = new CategoryTree(); DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId); DropCategory.DataBind(); //Get milestones DropMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId, false); DropMilestone.DataBind(); DropAffectedMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId); DropAffectedMilestone.DataBind(); //Get Users DropAssignedTo.DataSource = users; DropAssignedTo.DataBind(); DropOwned.DataSource = users; DropOwned.DataBind(); DropOwned.SelectedValue = User.Identity.Name; DropStatus.DataSource = StatusManager.GetByProjectId(ProjectId); DropStatus.DataBind(); }
/// <summary> /// Adds the priority. /// </summary> /// <param name="s">The s.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void AddPriority(Object s, EventArgs e) { var newName = txtName.Text.Trim(); if (newName == String.Empty) { return; } var newPriority = new Priority { ProjectId = ProjectId, Name = newName, ImageUrl = lstImages.SelectedValue }; if (PriorityManager.SaveOrUpdate(newPriority)) { txtName.Text = ""; lstImages.SelectedValue = String.Empty; BindPriorities(); } else { ActionMessage.ShowErrorMessage(LoggingManager.GetErrorMessageResource("SavePriorityError")); } }
/// <summary> /// When the user changes the selected field type, show the corresponding list /// of possible values. /// </summary> /// <param name="s">The s.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void dropFieldSelectedIndexChanged(Object s, EventArgs e) { dropValue.Items.Clear(); dropValue.Visible = false; txtValue.Visible = false; DateValue.Visible = false; switch (dropField.SelectedValue) { case "IssueId": case "IssueTitle": case "IssueDescription": case "IssueVotes": case "IssueProgress": case "IssueEstimation": case "TimeLogged": txtValue.Visible = true; break; case "IssuePriorityId": dropValue.Visible = true; dropValue.DataSource = PriorityManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueTypeId": dropValue.Visible = true; dropValue.DataSource = IssueTypeManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueMilestoneId": dropValue.Visible = true; dropValue.DataSource = MilestoneManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueAffectedMilestoneId": dropValue.Visible = true; dropValue.DataSource = MilestoneManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueResolutionId": dropValue.Visible = true; dropValue.DataSource = ResolutionManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueCategoryId": dropValue.Visible = true; var objCats = new CategoryTree(); dropValue.DataSource = objCats.GetCategoryTreeByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueStatusId": dropValue.Visible = true; dropValue.DataSource = StatusManager.GetByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueAssignedUserId": dropValue.Visible = true; dropValue.DataSource = UserManager.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; case "IssueOwnerUserId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = UserManager.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; case "IssueCreatorUserId": dropValue.Visible = true; dropValue.DataSource = UserManager.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; case "DateCreatedAsDate": case "LastUpdateAsDate": case "IssueDueDate": DateValue.Visible = true; break; case "CustomFieldName": dropValue.Visible = false; txtValue.Visible = true; //show the text value field. Not needed. CustomFieldSelected = true; if (CustomFieldManager.GetByProjectId(ProjectId).Count > 0) { dropField.DataSource = CustomFieldManager.GetByProjectId(ProjectId); dropField.DataTextField = "Name"; dropField.DataValueField = "Name"; dropField.DataBind(); // bind to the new data source. dropField.Items.Add(GetGlobalResourceObject("SharedResources", "DropDown_ResetFields").ToString()); dropField.Items.Insert(0, new ListItem(GetGlobalResourceObject("SharedResources", "DropDown_SelectCustomField").ToString(), "0")); } break; default: if (dropField.SelectedItem.Text.Equals(GetGlobalResourceObject("SharedResources", "DropDown_SelectCustomField").ToString())) { return; } // The user decides to reset the fields if (dropField.SelectedItem.Text.Equals(GetGlobalResourceObject("SharedResources", "DropDown_ResetFields").ToString())) { dropField.DataSource = null; dropField.DataSource = RequiredFieldManager.GetRequiredFields(); dropField.DataTextField = "Name"; dropField.DataValueField = "Value"; dropField.DataBind(); } //RW Once the list is populated with any varying type of name, //we just default to this case, because we know it is not a standard field. else { //check the type of this custom field and load the appropriate values. var cf = CustomFieldManager.GetByProjectId(ProjectId).Find(c => c.Name == dropField.SelectedValue); if (cf == null) { return; } CustomFieldSelected = true; CustomFieldId = cf.Id; CustomFieldDataType = cf.DataType; switch (cf.FieldType) { case CustomFieldType.DropDownList: dropValue.Visible = true; dropValue.DataSource = CustomFieldSelectionManager.GetByCustomFieldId(cf.Id); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Value"; break; case CustomFieldType.Date: DateValue.Visible = true; break; case CustomFieldType.YesNo: dropValue.Visible = true; dropValue.Items.Add(new ListItem(GetGlobalResourceObject("SharedResources", "DropDown_SelectOne").ToString())); dropValue.Items.Add(new ListItem(GetGlobalResourceObject("SharedResources", "Yes").ToString(), Boolean.TrueString)); dropValue.Items.Add(new ListItem(GetGlobalResourceObject("SharedResources", "No").ToString(), Boolean.FalseString)); break; default: txtValue.Visible = true; break; } } break; } try { dropValue.DataBind(); } catch { } }
/// <summary> /// Binds a data source to the invoked server control and all its child controls. /// </summary> public new void DataBind() { //Private issue check DataSource = IssueManager.StripPrivateIssuesForRequestor(DataSource, Security.GetUserName()).ToList(); if (DataSource.Count > 0) { gvIssues.Visible = true; pager.Visible = true; ScrollPanel.Visible = true; OptionsContainerPanel.Visible = true; var pId = Request.QueryString.Get("pid", -1); //get custom fields for project if (pId > Globals.NEW_ID) { var customFields = CustomFieldManager.GetByProjectId(pId); var nrColumns = FIXED_COLUMNS; //checks if its initial load to add custom controls and checkboxes if (gvIssues.Columns.Count <= nrColumns + 1) { var firstIssue = DataSource[0]; //if there is custom fields add them if (firstIssue.IssueCustomFields.Count > 0) { foreach (var value in firstIssue.IssueCustomFields) { //increments nr of columns nrColumns++; //create checkbox item var lstValue = new ListItem(value.FieldName, nrColumns.ToString()); //find custom controls that has been checked and check them var selected = Array.IndexOf(_arrIssueColumns, nrColumns.ToString()) >= 0; if (selected) { lstValue.Selected = true; } //add item to checkbox list lstIssueColumns.Items.Add(lstValue); //create column for custom control var tf = new TemplateField { HeaderText = value.FieldName, SortExpression = value.DatabaseFieldName.Replace(" ", "[]") }; tf.HeaderStyle.Wrap = false; gvIssues.Columns.Add(tf); } } } } DisplayColumns(); SelectColumnsPanel.Visible = true; lblResults.Visible = false; if (ShowProjectColumn) { gvIssues.Columns[0].Visible = false; LeftButtonContainerPanel.Visible = false; } else { gvIssues.Columns[4].Visible = false; lstIssueColumns.Items.Remove(lstIssueColumns.Items.FindByValue("4")); var projectId = _dataSource[0].ProjectId; //hide votes column if issue voting is disabled if (!ProjectManager.GetById(projectId).AllowIssueVoting) { gvIssues.Columns[4].Visible = false; lstIssueColumns.Items.Remove(lstIssueColumns.Items.FindByValue("4")); } if (Page.User.Identity.IsAuthenticated && UserManager.HasPermission(projectId, Common.Permission.EditIssue.ToString())) { LeftButtonContainerPanel.Visible = true; // performance enhancement // WRH 2012-04-06 // only load these if the user has permission to do so var categories = new CategoryTree(); dropCategory.DataSource = categories.GetCategoryTreeByProjectId(projectId); dropCategory.DataBind(); dropMilestone.DataSource = MilestoneManager.GetByProjectId(projectId); dropMilestone.DataBind(); dropAffectedMilestone.DataSource = dropMilestone.DataSource; dropAffectedMilestone.DataBind(); dropOwner.DataSource = UserManager.GetUsersByProjectId(projectId); dropOwner.DataBind(); dropPriority.DataSource = PriorityManager.GetByProjectId(projectId); dropPriority.DataBind(); dropStatus.DataSource = StatusManager.GetByProjectId(projectId); dropStatus.DataBind(); dropType.DataSource = IssueTypeManager.GetByProjectId(projectId); dropType.DataBind(); dropAssigned.DataSource = UserManager.GetUsersByProjectId(projectId); dropAssigned.DataBind(); dropResolution.DataSource = ResolutionManager.GetByProjectId(projectId); dropResolution.DataBind(); chkDueDateReset.Checked = false; } else { //hide selection column for unauthenticated users gvIssues.Columns[0].Visible = false; LeftButtonContainerPanel.Visible = false; } } foreach (var item in _arrIssueColumns.Select(colIndex => lstIssueColumns.Items.FindByValue(colIndex)).Where(item => item != null)) { item.Selected = true; } gvIssues.DataSource = DataSource; gvIssues.DataBind(); } else { ScrollPanel.Visible = false; OptionsContainerPanel.Visible = false; lblResults.Visible = true; gvIssues.Visible = false; pager.Visible = false; } }
/// <summary> /// Returns a valid project Priority. /// </summary> /// <param name="p">A Project</param> /// <returns>Random Priority</returns> public Priority GetPriority() { List <Priority> prs = PriorityManager.GetByProjectId(p.Id); return(prs[rng.Next(0, prs.Count)]); }
private void button_upd_prior_Click(object sender, EventArgs e) { string priorValue = comboBox_priority.SelectedItem.ToString(); PriorityManager.UpdatePriority(priorValue); }