Ejemplo n.º 1
0
        /// <summary>
        /// Bind lookup code columns/grids to their respecitve lookup codes
        /// </summary>
        private void BuildStageStageEventsAndAttributes()
        {
            SetColorAttributeId();

            string sortExpr = LookupCode.LkpOrder + " ASC";

            ProjectTypeGrid.DataSource = GetSortedGridDataSource("ProjectType");
            ProjectTypeGrid.DataBind();

            StagesGrid.DataSource = GetSortedGridDataSource("ProjectStages");
            StagesGrid.DataBind();

            EventsGrid.DataSource = GetSortedGridDataSource("ProjectStageEvents");
            EventsGrid.DataBind();

            AttributesGrid.DataSource = GetSortedGridDataSource("ProjectEventAttributes");
            AttributesGrid.DataBind();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the Stage record as well as child events and their atttibutes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void UpdateStageRecord(object sender, EventArgs e)
        {
            // Register script must be called here, as no stage id has been assinged,i.e., new record
            RegisterUpdateScript(sender, e);

            // Determine if an insert/update
            ProjectStage stageBiz = new ProjectStage();

            // Only do update/insert on Stage record if dirty
            if (recordIsDirty)
            {
                if (recordIsDirty && !string.IsNullOrEmpty(StageId.Value))
                {
                    stageBiz.Get(int.Parse(StageId.Value));
                }
                // Set stage fields
                stageBiz[ProjectStage.ProjectId] = projectId;
                if (!string.IsNullOrEmpty(OrganizationId))
                {
                    stageBiz[ProjectStage.OrganizationId] = OrganizationId;
                }
                stageBiz[ProjectStage.Name]      = StageName.Value;
                stageBiz[ProjectStage.ColorCode] = ColorCode.Value;
                stageBiz.Save();

                string bizStageId = stageBiz[ProjectStage.StageId].ToString();
                StageId.Value = bizStageId;
            }
            // Run save on Events and Details grid only if a parent stage record exits
            if (!string.IsNullOrEmpty(StageId.Value))
            {
                int stageId = int.Parse(StageId.Value);
                EventsGrid.Save(stageId);
                BindStageRecord();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Binds the field to Stage record and grid to child events and attributes
        /// </summary>
        private void BindStageRecord()
        {
            int stageId = int.Parse(StageId.Value);

            ProjectStage biz = new ProjectStage();

            biz.Get(stageId);
            StageName.Value = biz[ProjectStage.Name].ToString();
            string color = biz[ProjectStage.ColorCode].ToString();

            ColorCode.Value = color;
            if (!string.IsNullOrEmpty(color))
            {
                ColorCodeBox.Style[HtmlTextWriterStyle.BackgroundColor] = color;
                ColorCodeBox.ToolTip = "Color: " + color;
            }

            //ProjectStageEvent projectEventsBiz = new ProjectStageEvent();
            //projectEventsBiz.GetByParent(stageId);

            //EventsGrid.DataSource = projectEventsBiz.DataSourceView;
            EventsGrid.DataSource = BusinessObject.GetByParentAsDataView <ProjectStageEvent>(stageId);
            EventsGrid.DataBind();
        }
        private void SearchForString()
        {
            int totalfound = 0;
            int onfound    = 0;

            try
            {
                string search    = SearchStringTB.Text.ToUpper();
                bool   newsearch = !search.Equals(LastSearchString);

                int nextfound = -1;
                if (!newsearch && LastSearchIndex >= 0)
                {
                    nextfound = LastSearchIndex;
                }

                int index = 0;
                foreach (EventItem ei in _FilteredEventItems)
                {
                    ei.IsCurrentSearchItem = false;
                    if (search.Length > 0)
                    {
                        if (ei.Event != null)
                        {
                            if (ei.ProcessID.ToString().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.ProcessName.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.Event.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.Inputs.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.Result.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.Outputs.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else if (ei.Caller.ToUpper().Contains(search))
                            {
                                ei.IsHighlighted = true;
                            }
                            else
                            {
                                ei.IsHighlighted = false;
                            }
                        }
                        else
                        {
                            ei.IsHighlighted = false;
                        }
                    }
                    else
                    {
                        ei.IsHighlighted = false;
                    }
                    if (ei.IsHighlighted)
                    {
                        totalfound++;
                        if (!ei.IsHidden)
                        {
                            if (newsearch && nextfound == -1)
                            {
                                nextfound = index;
                                ei.IsCurrentSearchItem = true;
                                onfound = totalfound;
                            }
                            else if (!newsearch && nextfound <= LastSearchIndex)
                            {
                                nextfound = index;
                                ei.IsCurrentSearchItem = true;
                                onfound = totalfound;
                            }
                        }
                    }
                    index++;
                }
                EventsGrid.Items.Refresh();
                if (nextfound >= 0)
                {
                    EventsGrid.ScrollIntoView(_FilteredEventItems[nextfound]);
                }

                if (totalfound > 0)
                {
                    SearchFoundCount.Text = onfound.ToString() + " of " + totalfound.ToString();
                }
                else
                {
                    SearchFoundCount.Text = "0 found";
                }

                LastSearchIndex  = nextfound;
                LastSearchString = search;
            }
            catch (Exception ex)
            {
                if (MessageBox.Show(UnexpectedErrorPrompt, ProgramTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.Cancel)
                {
                    throw ex;
                }
            }
        }