void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ButtonNew = ((Telerik.Windows.Controls.RadButton)(target));
                return;

            case 2:
                this.idcolumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 3:
                this.addressColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 4:
                this.countryColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 5:
                this.cityColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 6:
                this.genderColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #2
0
        /// <summary>
        /// Establece las columnas a mostrar.
        /// </summary>
        /// <param name="columns">Las columnas.</param>
        internal void SetColumns(IEnumerable <QueryColumn> columns)
        {
            // Limpia el filtrado
            radDataFilter1.ItemPropertyDefinitions.Clear();

            // Elimina las columnas innecesarias, dejando sólo la columna de selección
            if (dgData.Columns.Count > 1)
            {
                for (int i = dgData.Columns.Count - 1; i > 0; i--)
                {
                    dgData.Columns.RemoveAt(i);
                }
            }

            // Crea las columnas dinámicamente con la información proprcionada.
            foreach (QueryColumn column in columns)
            {
                TelerikControls.GridViewDataColumn textColumn = new TelerikControls.GridViewDataColumn();
                textColumn.Header            = column.DisplayName;
                textColumn.DataMemberBinding = new Binding(column.Binding);
                textColumn.DataFormatString  = column.StringFormat;
                if (column.Width > 0)
                {
                    textColumn.Width = new TelerikControls.GridViewLength(column.Width);
                }

                dgData.Columns.Add(textColumn);
                if (column.DataType != typeof(DateTime))
                {
                    // TODO: No funciona correctamente el filtro DateTime para el caso de horas.
                    radDataFilter1.ItemPropertyDefinitions.Add(new TelerikDataFilter.ItemPropertyDefinition(column.Binding, column.DataType, column.DisplayName));
                }
            }
        }
Beispiel #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\HRiSUsers.xaml"
                ((HRinformationSystem.HRiSUsers)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.gridUsers = ((Telerik.Windows.Controls.RadGridView)(target));

            #line 24 "..\..\HRiSUsers.xaml"
                this.gridUsers.AddingNewDataItem += new System.EventHandler <Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs>(this.gridUsers_AddingNewDataItem);

            #line default
            #line hidden

            #line 25 "..\..\HRiSUsers.xaml"
                this.gridUsers.RowEditEnded += new System.EventHandler <Telerik.Windows.Controls.GridViewRowEditEndedEventArgs>(this.gridUsers_RowEditEnded);

            #line default
            #line hidden

            #line 26 "..\..\HRiSUsers.xaml"
                this.gridUsers.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.gridUsers_PreviewKeyDown);

            #line default
            #line hidden
                return;

            case 3:
                this.EmpID = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 4:
                this.username = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 5:
                this.password = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 6:
                this.usertype = ((Telerik.Windows.Controls.GridViewComboBoxColumn)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridDepartment = ((Telerik.Windows.Controls.RadGridView)(target));

            #line 19 "..\..\..\Department.xaml"
                this.gridDepartment.AddingNewDataItem += new System.EventHandler <Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs>(this.gridDepartment_AddingNewDataItem);

            #line default
            #line hidden

            #line 20 "..\..\..\Department.xaml"
                this.gridDepartment.RowEditEnded += new System.EventHandler <Telerik.Windows.Controls.GridViewRowEditEndedEventArgs>(this.gridDepartment_RowEditEnded);

            #line default
            #line hidden

            #line 21 "..\..\..\Department.xaml"
                this.gridDepartment.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.gridDepartment_PreviewKeyDown);

            #line default
            #line hidden
                return;

            case 2:
                this.Code = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 3:
                this.Desc = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.StaffDetailUserControl = ((ES.UI.Setups.ucStaffDetailView)(target));
     return;
     case 2:
     this.tabStaffPersionInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
     return;
     case 3:
     this.tabStaffEducationalInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
     return;
     case 4:
     this.btnAddNewEducation = ((Telerik.Windows.Controls.RadButton)(target));
     
     #line 150 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnAddNewEducation.Click += new System.Windows.RoutedEventHandler(this.btnAddNewEducation_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.gvEducationListView = ((Telerik.Windows.Controls.RadGridView)(target));
     return;
     case 6:
     this.colEduInstitution = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 7:
     this.colEduDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 8:
     this.colEduPassingYear = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 9:
     this.colEduScore = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 10:
     this.btnRowEduEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 168 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnRowEduEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowEduEdit_Click);
     
     #line default
     #line hidden
     return;
     case 11:
     this.btnRowEduDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 169 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnRowEduDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowEduDelete_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     this.tabStaffExperienceInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
     return;
     case 13:
     this.btnAddNewExperience = ((Telerik.Windows.Controls.RadButton)(target));
     
     #line 188 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnAddNewExperience.Click += new System.Windows.RoutedEventHandler(this.btnAddNewExperience_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.gvStaffExpListView = ((Telerik.Windows.Controls.RadGridView)(target));
     return;
     case 15:
     this.colExpIntitution = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 16:
     this.colExpDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 17:
     this.colExpStartDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 18:
     this.colExpEndDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 19:
     this.colEXpTotalExperience = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 20:
     this.btnRowExpEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 211 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnRowExpEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowExpEdit_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this.btnRowExpDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 212 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnRowExpDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowExpDelete_Click);
     
     #line default
     #line hidden
     return;
     case 22:
     this.btnStaffSave = ((Telerik.Windows.Controls.RadButton)(target));
     
     #line 270 "..\..\..\..\Setups\ucStaffDetailView.xaml"
     this.btnStaffSave.Click += new System.Windows.RoutedEventHandler(this.btnStaffSave_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
Beispiel #6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.StaffDetailUserControl = ((ES.UI.Setups.ucStaffDetailView)(target));
                return;

            case 2:
                this.tabStaffPersionInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
                return;

            case 3:
                this.tabStaffEducationalInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
                return;

            case 4:
                this.btnAddNewEducation = ((Telerik.Windows.Controls.RadButton)(target));

            #line 150 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnAddNewEducation.Click += new System.Windows.RoutedEventHandler(this.btnAddNewEducation_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.gvEducationListView = ((Telerik.Windows.Controls.RadGridView)(target));
                return;

            case 6:
                this.colEduInstitution = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 7:
                this.colEduDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 8:
                this.colEduPassingYear = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 9:
                this.colEduScore = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 10:
                this.btnRowEduEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 168 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnRowEduEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowEduEdit_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.btnRowEduDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 169 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnRowEduDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowEduDelete_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.tabStaffExperienceInfo = ((Telerik.Windows.Controls.RadTabItem)(target));
                return;

            case 13:
                this.btnAddNewExperience = ((Telerik.Windows.Controls.RadButton)(target));

            #line 188 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnAddNewExperience.Click += new System.Windows.RoutedEventHandler(this.btnAddNewExperience_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.gvStaffExpListView = ((Telerik.Windows.Controls.RadGridView)(target));
                return;

            case 15:
                this.colExpIntitution = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 16:
                this.colExpDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 17:
                this.colExpStartDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 18:
                this.colExpEndDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 19:
                this.colEXpTotalExperience = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 20:
                this.btnRowExpEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 211 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnRowExpEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowExpEdit_Click);

            #line default
            #line hidden
                return;

            case 21:
                this.btnRowExpDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 212 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnRowExpDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnRowExpDelete_Click);

            #line default
            #line hidden
                return;

            case 22:
                this.btnStaffSave = ((Telerik.Windows.Controls.RadButton)(target));

            #line 270 "..\..\..\..\Setups\ucStaffDetailView.xaml"
                this.btnStaffSave.Click += new System.Windows.RoutedEventHandler(this.btnStaffSave_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public static void BuildAnalogousGrid(ViewAnalogousVM anagousReactionVM, RadGridView ConsolidatedGrid, bool NewAnalogous)
        {
            try
            {
                ConsolidatedGrid.ItemsSource = null;
                ConsolidatedGrid.Columns.Clear();
                ConsolidatedGrid.ColumnGroups.Clear();
                ConsolidatedGrid.Items.Clear();

                var mainViewModel = ((MainWindow)(App.Current.MainWindow)).DataContext as MainVM;
                if (anagousReactionVM != null)
                {
                    #region Add Columns

                    var maxProducts = mainViewModel.TanVM.ReactionParticipants.OfReactionOfType(anagousReactionVM.SelectedMasterReaction.Id, ParticipantType.Product).Select(p => p.DisplayOrder).Distinct().OrderByDescending(o => o).FirstOrDefault();
                    var maxStage    = anagousReactionVM.AnalogousReactions.Any() ? anagousReactionVM.AnalogousReactions[0]?.Stages.Count : 0;

                    GridViewDataColumn ReactionIdColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    ReactionIdColumn.Header            = RXNID;
                    ReactionIdColumn.DataMemberBinding = new Binding(RXNID);
                    ReactionIdColumn.IsVisible         = false;
                    ConsolidatedGrid.Columns.Add(ReactionIdColumn);

                    var snoNumberColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    snoNumberColumn.Header            = SNO;
                    snoNumberColumn.DataMemberBinding = new Binding(SNO);
                    snoNumberColumn.IsReadOnly        = true;
                    snoNumberColumn.Width             = 40;
                    ConsolidatedGrid.Columns.Add(snoNumberColumn);

                    var rxnColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    rxnColumn.Header            = RXN;
                    rxnColumn.DataMemberBinding = new Binding(RXN);
                    rxnColumn.IsReadOnly        = true;
                    rxnColumn.Width             = 100;
                    ConsolidatedGrid.Columns.Add(rxnColumn);

                    var cvtColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    cvtColumn.Header            = REACTIONCVT;
                    cvtColumn.DataMemberBinding = new Binding(REACTIONCVT);
                    cvtColumn.IsReadOnly        = true;
                    cvtColumn.Width             = 100;
                    ConsolidatedGrid.Columns.Add(cvtColumn);

                    var FreeTextColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    FreeTextColumn.Header            = REACTIONFREETEXT;
                    FreeTextColumn.DataMemberBinding = new Binding(REACTIONFREETEXT);
                    FreeTextColumn.IsReadOnly        = true;
                    FreeTextColumn.Width             = 100;
                    ConsolidatedGrid.Columns.Add(FreeTextColumn);

                    //for (int productIndex = 1; productIndex <= maxProducts; productIndex++)
                    //{
                    GridViewDataColumn ProductIdColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    ProductIdColumn.Header            = PRODUCT + "ID";
                    ProductIdColumn.DataMemberBinding = new Binding(PRODUCT + "ID");
                    ProductIdColumn.IsVisible         = false;
                    ConsolidatedGrid.Columns.Add(ProductIdColumn);

                    var ProductColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    ProductColumn.Header            = PRODUCT;
                    ProductColumn.DataMemberBinding = new Binding(PRODUCT);
                    ProductColumn.ColumnGroupName   = PRODUCT;
                    ProductColumn.Width             = 100;
                    ConsolidatedGrid.Columns.Add(ProductColumn);
                    //}

                    //for (int productIndex = 1; productIndex <= maxProducts; productIndex++)
                    //{
                    var YieldColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                    YieldColumn.Header            = YIELD;
                    YieldColumn.DataMemberBinding = new Binding(YIELD);
                    YieldColumn.ColumnGroupName   = YIELD;
                    YieldColumn.Width             = 45;
                    ConsolidatedGrid.Columns.Add(YieldColumn);
                    //}

                    for (int stageIndex = 1; stageIndex <= maxStage; stageIndex++)
                    {
                        var stageGroup = new Telerik.Windows.Controls.GridViewColumnGroup {
                            Name = STAGE + stageIndex
                        };
                        ConsolidatedGrid.ColumnGroups.Add(stageGroup);

                        foreach (var participantName in ParticipantHeaders)
                        {
                            GridViewDataColumn IdColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                            IdColumn.Header            = participantName + stageIndex + "ID";
                            IdColumn.DataMemberBinding = new Binding(participantName + stageIndex + "ID");
                            IdColumn.ColumnGroupName   = stageGroup.Name;
                            IdColumn.IsVisible         = false;
                            ConsolidatedGrid.Columns.Add(IdColumn);
                            var participantColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                            participantColumn.Header            = participantName;
                            participantColumn.ColumnGroupName   = stageGroup.Name;
                            participantColumn.DataMemberBinding = new Binding(participantName + stageIndex);
                            participantColumn.Width             = 70;
                            ConsolidatedGrid.Columns.Add(participantColumn);
                        }

                        var Temperature = new Telerik.Windows.Controls.GridViewDataColumn();
                        Temperature.Header            = TEMPERATURE;
                        Temperature.ColumnGroupName   = stageGroup.Name;
                        Temperature.DataMemberBinding = new Binding(TEMPERATURE + stageIndex);
                        Temperature.Width             = 70;
                        Temperature.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(Temperature);

                        var Pressure = new Telerik.Windows.Controls.GridViewDataColumn();
                        Pressure.Header            = PRESSURE;
                        Pressure.ColumnGroupName   = stageGroup.Name;
                        Pressure.DataMemberBinding = new Binding(PRESSURE + stageIndex);
                        Pressure.Width             = 70;
                        Pressure.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(Pressure);

                        var Time = new Telerik.Windows.Controls.GridViewDataColumn();
                        Time.Header            = TIME;
                        Time.ColumnGroupName   = stageGroup.Name;
                        Time.DataMemberBinding = new Binding(TIME + stageIndex);
                        Time.Width             = 70;
                        Time.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(Time);

                        var pH = new Telerik.Windows.Controls.GridViewDataColumn();
                        pH.Header            = PH;
                        pH.ColumnGroupName   = stageGroup.Name;
                        pH.DataMemberBinding = new Binding(PH + stageIndex);
                        pH.Width             = 70;
                        pH.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(pH);

                        var StageCVT = new Telerik.Windows.Controls.GridViewDataColumn();
                        StageCVT.Header            = STAGECVT + stageIndex;
                        StageCVT.ColumnGroupName   = stageGroup.Name;
                        StageCVT.DataMemberBinding = new Binding(STAGECVT + stageIndex);
                        StageCVT.Width             = 70;
                        StageCVT.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(StageCVT);

                        var StageFreeText = new Telerik.Windows.Controls.GridViewDataColumn();
                        StageFreeText.Header            = STAGEFREETEXT;
                        StageFreeText.ColumnGroupName   = stageGroup.Name;
                        StageFreeText.DataMemberBinding = new Binding(STAGEFREETEXT + stageIndex);
                        StageFreeText.Width             = 70;
                        StageFreeText.IsReadOnly        = true;
                        ConsolidatedGrid.Columns.Add(StageFreeText);
                    }
                    ConsolidatedGrid.FrozenColumnCount = 9;
                    foreach (Telerik.Windows.Controls.GridViewDataColumn c in ConsolidatedGrid.Columns)
                    {
                        c.IsFilterable = false;
                    }
                    #endregion

                    foreach (var c in ConsolidatedGrid.Columns)
                    {
                        var dc = (GridViewDataColumn)c;
                    }

                    int rowCount = 1;
                    List <IDictionary <String, Object> > rows = new List <IDictionary <String, Object> >();

                    foreach (var reaction in anagousReactionVM.AnalogousReactions)
                    {
                        var row = (IDictionary <String, Object>) new ExpandoObject();
                        row[AG]    = 1;
                        row[SNO]   = rowCount++;
                        row[RXN]   = reaction.Name;
                        row[RXNID] = reaction.Id;

                        if (NewAnalogous)
                        {
                            var reactionRSN = anagousReactionVM.Rsns.Where(p => p.Reaction.Id == reaction.Id && p.Stage == null).OrderBy(p => p.DisplayOrder);
                            row[PRODUCT]          = string.Empty;
                            row[PRODUCT + "ID"]   = string.Empty;
                            row[YIELD]            = string.Empty;
                            row[REACTIONFREETEXT] = !string.IsNullOrEmpty(string.Join(",", reactionRSN.Select(rsn => rsn.FreeText).ToList())) ? string.Join(",", reactionRSN.Select(rsn => rsn.FreeText).ToList()) : string.Empty;
                            row[REACTIONCVT]      = !string.IsNullOrEmpty(string.Join(",", reactionRSN.Select(rsn => rsn.CvtText).ToList())) ? string.Join(",", reactionRSN.Select(rsn => rsn.CvtText).ToList()) : string.Empty;
                        }
                        else
                        {
                            var products = mainViewModel.TanVM.ReactionParticipants.OfReactionOfType(reaction.Id, ParticipantType.Product).OrderBy(p => p.DisplayOrder);

                            var reactionRSN = mainViewModel.TanVM.Rsns.Where(p => p.Reaction.Id == reaction.Id && p.Stage == null).OrderBy(p => p.DisplayOrder);
                            row[PRODUCT]          = string.Join(",", products.Select(n => n.Num).ToList());
                            row[PRODUCT + "ID"]   = string.Join(",", products.Select(n => n.Id).ToList());
                            row[YIELD]            = string.Join(",", products.Select(n => n.Yield).ToList());
                            row[REACTIONFREETEXT] = !string.IsNullOrEmpty(string.Join(",", reactionRSN.Select(rsn => rsn.FreeText).ToList())) ? string.Join(",", reactionRSN.Select(rsn => rsn.FreeText).ToList()) : string.Empty;
                            row[REACTIONCVT]      = !string.IsNullOrEmpty(string.Join(",", reactionRSN.Select(rsn => rsn.CvtText).ToList())) ? string.Join(",", reactionRSN.Select(rsn => rsn.CvtText).ToList()) : string.Empty;
                        }

                        if (reaction.Stages != null && reaction.Stages.Any())
                        {
                            int stageCount = 1;
                            foreach (var stage in reaction.Stages)
                            {
                                row.Add(STAGEID + stageCount, stage.Id);
                                var stageRsn = NewAnalogous ? anagousReactionVM.Rsns.Where(p => p.Reaction.Id == reaction.Id && p.Stage != null && p.Stage.Id == stage.Id).OrderBy(p => p.DisplayOrder) :
                                               mainViewModel.TanVM.Rsns.Where(p => p.Reaction.Id == reaction.Id && p.Stage != null && p.Stage.Id == stage.Id).OrderBy(p => p.DisplayOrder);

                                foreach (var participantType in ParticipantHeaders)
                                {
                                    if (participantType.Equals(ParticipantType.Reactant.ToString()) && !NewAnalogous)
                                    {
                                        var reactants = mainViewModel.TanVM.ReactionParticipants.OfReactionAndStage(reaction.Id, stage.Id).Where(p => p.ParticipantType.ToString() == participantType).OrderBy(p => p.DisplayOrder);
                                        var csvNames  = String.Join(",", reactants.Select(r => r.Num));
                                        row.Add(participantType.ToString() + stageCount, csvNames);
                                        row.Add(participantType.ToString() + stageCount + "ID", String.Join(",", reactants.Select(r => r.Id)));
                                    }
                                    else
                                    {
                                        var otherParticipants = anagousReactionVM.ReactionParticipants.OfReactionAndStage(reaction.Id, stage.Id).Where(p => p.ParticipantType.ToString() == participantType).OrderBy(p => p.DisplayOrder);
                                        if (otherParticipants.Count() > 0)
                                        {
                                            var csvNames = String.Join(",", otherParticipants.Select(r => r.Num));
                                            row.Add(participantType.ToString() + stageCount, csvNames);
                                            row.Add(participantType.ToString() + stageCount + "ID", String.Join(",", otherParticipants.Select(r => r.Id)));
                                        }
                                        else
                                        {
                                            row.Add(participantType.ToString() + stageCount, string.Empty);
                                            row.Add(participantType.ToString() + stageCount + "ID", string.Empty);
                                        }
                                    }
                                }
                                row.Add(TIME + stageCount, string.Join(",", stage.Conditions.Select(t => t.Time).ToList()));
                                row.Add(TEMPERATURE + stageCount, string.Join(",", stage.Conditions.Select(t => t.Temperature).ToList()));
                                row.Add(PRESSURE + stageCount, string.Join(",", stage.Conditions.Select(t => t.Pressure).ToList()));
                                row.Add(PH + stageCount, string.Join(",", stage.Conditions.Select(t => t.PH).ToList()));
                                row.Add(STAGECVT + stageCount, string.Join(",", stageRsn.Select(t => t.CvtText).ToList()));
                                row.Add(STAGEFREETEXT + stageCount, string.Join(",", stageRsn.Select(t => t.FreeText).ToList()));
                                stageCount++;
                            }
                        }
                        rows.Add(row);
                    }
                    ConsolidatedGrid.ItemsSource = rows;
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
                throw;
            }
        }
        /// <summary>
        /// building grid for the gadget
        /// </summary>
        /// <param name="e"></param>
        void DataContextSource_RelativePerformanceGridBuildEvent(RelativePerformanceGridBuildEventArgs e)
        {
            relativePerformanceSectorInfo = e.RelativePerformanceSectorInfo;

            //clear grid of previous sector info
            for (int columnIndex = 1; columnIndex < this.dgRelativePerformance.Columns.Count - 1;)
            {
                this.dgRelativePerformance.Columns.RemoveAt(columnIndex);
            }

            int cIndex = 0;

            foreach (RelativePerformanceSectorData sectorData in e.RelativePerformanceSectorInfo)
            {
                Telerik.Windows.Controls.GridViewDataColumn dataColumn = new Telerik.Windows.Controls.GridViewDataColumn();
                dataColumn.Header            = sectorData.SectorName;
                dataColumn.UniqueName        = sectorData.SectorName;
                dataColumn.DataMemberBinding = new System.Windows.Data.Binding("RelativePerformanceCountrySpecificInfo[" + cIndex + "]");

                StringBuilder CellTemp = new StringBuilder();
                CellTemp.Append("<DataTemplate");
                CellTemp.Append(" xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'");
                CellTemp.Append(" xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'");

                //Be sure to replace "YourNamespace" and "YourAssembly" with your app's
                //actual namespace and assembly here
                //      Changed the following block to use converter and publish in Basis Points
                CellTemp.Append(" xmlns:lanes='clr-namespace:GreenField.Gadgets.Helpers;assembly=GreenField.Gadgets'");
                CellTemp.Append(" xmlns:local='clr-namespace:GreenField.Gadgets.Views;assembly=GreenField.Gadgets'>");
                CellTemp.Append("<StackPanel Orientation='Horizontal'>");
                CellTemp.Append("<TextBlock>");
                CellTemp.Append("   <TextBlock.Text>");
                CellTemp.Append("       <Binding Path='RelativePerformanceCountrySpecificInfo[" + cIndex + "].Alpha'>");
                CellTemp.Append("           <Binding.Converter>");
                CellTemp.Append("               <lanes:BasisPointsConverter/>");
                CellTemp.Append("           </Binding.Converter>");
                CellTemp.Append("       </Binding>");
                CellTemp.Append("   </TextBlock.Text>");
                CellTemp.Append("</TextBlock>");
                CellTemp.Append("</StackPanel>");
                CellTemp.Append("</DataTemplate>");

                dataColumn.CellTemplate = XamlReader.Load(CellTemp.ToString()) as DataTemplate;

                decimal?aggregateSectorAlphaValue = e.RelativePerformanceInfo.Select(t => t.RelativePerformanceCountrySpecificInfo.ElementAt(cIndex))
                                                    .Sum(t => t.Alpha == null ? 0 : t.Alpha);
                string  aggregateSectorAlpha = aggregateSectorAlphaValue == null ? String.Empty : Decimal.Parse(aggregateSectorAlphaValue.ToString()).ToString();
                decimal?aggregateSectorActiviePositionValue = e.RelativePerformanceInfo.Select(t => t.RelativePerformanceCountrySpecificInfo.ElementAt(cIndex))
                                                              .Sum(t => t.ActivePosition == null ? 0 : t.ActivePosition);
                string aggregateSectorActiviePosition = aggregateSectorActiviePositionValue == null ? String.Empty
                                                                                         : (Decimal.Parse(aggregateSectorActiviePositionValue.ToString())).ToString();

                var aggregateAlphaSumFunction = new AggregateFunction <RelativePerformanceData, string>
                {
                    AggregationExpression = Models => aggregateSectorAlpha,
                    FunctionName          = sectorData.SectorId.ToString()
                };

                dataColumn.FooterTextAlignment = TextAlignment.Right;
                dataColumn.Width = GridViewLength.Auto;
                dataColumn.AggregateFunctions.Add(aggregateAlphaSumFunction);

                TextBlock spFunctions = new TextBlock()
                {
                    Text          = aggregateSectorActiviePosition.ToString(),
                    Tag           = sectorData.SectorId,
                    TextAlignment = TextAlignment.Right,
                    FontSize      = 9
                };

                TextBlock footerText = new TextBlock()
                {
                    Text          = (Convert.ToDecimal(aggregateSectorAlpha) * 10000).ToString("n0"), //Needs to be displayed in basis points
                    Tag           = sectorData.SectorId,
                    TextAlignment = TextAlignment.Right,
                    FontSize      = 9
                };

                ToolTipService.SetToolTip(footerText, spFunctions);
                dataColumn.Footer          = footerText;
                dataColumn.HeaderCellStyle = this.Resources["GridViewHeaderCellClickable"] as Style;
                dataColumn.FooterCellStyle = this.Resources["GridViewCustomFooterCellStyle"] as Style;
                dataColumn.CellStyle       = this.Resources["GridViewCellStyle"] as Style;
                dgRelativePerformance.Columns.Insert(++cIndex, dataColumn);
            }

            RelativePerformanceInfo = e.RelativePerformanceInfo;

            dbInteractivity = (this.DataContext as ViewModelRelativePerformance).dbInteractivity;
            eventAggregator = (this.DataContext as ViewModelRelativePerformance).eventAggregator;

            //design grid for sector specific top alpha security grid

            if (this.dpTopActivePositionSecurity.Children != null)
            {
                this.dpTopActivePositionSecurity.Children.Clear();
            }

            if (e.RelativePerformanceSectorInfo != null)
            {
                ScrollViewer svc = new ScrollViewer()
                {
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    VerticalScrollBarVisibility   = ScrollBarVisibility.Hidden
                };

                Grid grd = new Grid()
                {
                    ShowGridLines = false, UseLayoutRounding = true
                };
                grd.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                grd.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                grd.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                grd.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });

                int sectorNum = 0;

                for (int i = 0; i < e.RelativePerformanceSectorInfo.Count; i++)
                {
                    int securityNum = 1;

                    List <SecurityDetail> sectorSpecificTopAlphaSecurityNames = e.RelativePerformanceSecurityInfo
                                                                                .Where(record => record.SecuritySectorName == e.RelativePerformanceSectorInfo[i].SectorName)
                                                                                .OrderByDescending(record => record.SecurityAlpha)
                                                                                .Take(3)
                                                                                .Select(record => new SecurityDetail()
                    {
                        SecurityName  = record.SecurityName,
                        SecurityAlpha = record.SecurityAlpha == null
                                ? "Null" : String.Format("{0}", record.SecurityAlpha.Value)
                    })
                                                                                .ToList();

                    TextBox sectorHeader = new TextBox()
                    {
                        Text       = e.RelativePerformanceSectorInfo[i].SectorName,
                        FontWeight = FontWeights.Bold,
                        FontFamily = new FontFamily("Arial"),
                        IsReadOnly = true,
                        Background = new SolidColorBrush(Color.FromArgb(255, 203, 212, 241)),
                        Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),
                        FontSize   = 9,
                        Margin     = new Thickness(2)
                    };

                    grd.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    });
                    int colIndex = grd.ColumnDefinitions.Count() - 1;

                    sectorHeader.SetValue(Grid.RowProperty, 0);
                    sectorHeader.SetValue(Grid.ColumnProperty, colIndex);
                    grd.Children.Add(sectorHeader);

                    foreach (SecurityDetail securityName in sectorSpecificTopAlphaSecurityNames)
                    {
                        TextBlock txtSecurityName = new TextBlock()
                        {
                            Text = securityName.SecurityName
                                   + " (" + (Convert.ToDecimal(securityName.SecurityAlpha) * 10000).ToString("n0") + ")", //Needs to be displayed in basis points
                            FontSize   = 9,
                            FontWeight = FontWeights.Normal,
                            FontFamily = new FontFamily("Arial"),
                            Margin     = new Thickness(2)
                        };
                        txtSecurityName.SetValue(Grid.ColumnProperty, sectorNum);
                        txtSecurityName.SetValue(Grid.RowProperty, securityNum);
                        grd.Children.Add(txtSecurityName);
                        securityNum++;
                    }
                    sectorNum++;
                }

                svc.ScrollIntoView(grd);
                svc.Content = grd;
                this.dpTopActivePositionSecurity.Children.Add(svc);
            }
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.StaffUserControl = ((ES.UI.Setups.ucStaffListView)(target));
     return;
     case 2:
     this.ShellHeader = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.WindowHeader = ((System.Windows.Controls.Grid)(target));
     return;
     case 4:
     this.btnAddStaff = ((System.Windows.Controls.Button)(target));
     
     #line 54 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnAddStaff.Click += new System.Windows.RoutedEventHandler(this.btnAddStaff_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.btnDeleteStaff = ((System.Windows.Controls.Button)(target));
     
     #line 59 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnDeleteStaff.Click += new System.Windows.RoutedEventHandler(this.btnDeleteStaff_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.btnRefreshStaff = ((System.Windows.Controls.Button)(target));
     
     #line 65 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnRefreshStaff.Click += new System.Windows.RoutedEventHandler(this.btnRefreshStaff_Click);
     
     #line default
     #line hidden
     return;
     case 7:
     this.UsaserName = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 8:
     this.CloseButton = ((System.Windows.Controls.Button)(target));
     
     #line 95 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.CloseButton.Click += new System.Windows.RoutedEventHandler(this.CloseButton_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.gvStaffListView = ((Telerik.Windows.Controls.RadGridView)(target));
     return;
     case 10:
     this.colDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 11:
     this.coljoiingDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 12:
     this.colContact = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 13:
     this.colAddress = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 14:
     this.btnCMEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 128 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnCMEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMEdit_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.btnCMView = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 129 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnCMView.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMView_Click);
     
     #line default
     #line hidden
     return;
     case 16:
     this.btnCMDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));
     
     #line 130 "..\..\..\..\Setups\ucStaffListView.xaml"
     this.btnCMDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMDelete_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this.radDataPager = ((Telerik.Windows.Controls.RadDataPager)(target));
     return;
     }
     this._contentLoaded = true;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.ButtonNew = ((Telerik.Windows.Controls.RadButton)(target));
     return;
     case 2:
     this.idcolumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 3:
     this.addressColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 4:
     this.countryColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 5:
     this.cityColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     case 6:
     this.genderColumn = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
     return;
     }
     this._contentLoaded = true;
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.StaffUserControl = ((ES.UI.Setups.ucStaffListView)(target));
                return;

            case 2:
                this.ShellHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.WindowHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.btnAddStaff = ((System.Windows.Controls.Button)(target));

            #line 54 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnAddStaff.Click += new System.Windows.RoutedEventHandler(this.btnAddStaff_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.btnDeleteStaff = ((System.Windows.Controls.Button)(target));

            #line 59 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnDeleteStaff.Click += new System.Windows.RoutedEventHandler(this.btnDeleteStaff_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.btnRefreshStaff = ((System.Windows.Controls.Button)(target));

            #line 65 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnRefreshStaff.Click += new System.Windows.RoutedEventHandler(this.btnRefreshStaff_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.UsaserName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.CloseButton = ((System.Windows.Controls.Button)(target));

            #line 95 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.CloseButton.Click += new System.Windows.RoutedEventHandler(this.CloseButton_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.gvStaffListView = ((Telerik.Windows.Controls.RadGridView)(target));
                return;

            case 10:
                this.colDescription = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 11:
                this.coljoiingDate = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 12:
                this.colContact = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 13:
                this.colAddress = ((Telerik.Windows.Controls.GridViewDataColumn)(target));
                return;

            case 14:
                this.btnCMEdit = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 128 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnCMEdit.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMEdit_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.btnCMView = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 129 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnCMView.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMView_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.btnCMDelete = ((Telerik.Windows.Controls.RadMenuItem)(target));

            #line 130 "..\..\..\..\Setups\ucStaffListView.xaml"
                this.btnCMDelete.Click += new Telerik.Windows.RadRoutedEventHandler(this.btnCMDelete_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.radDataPager = ((Telerik.Windows.Controls.RadDataPager)(target));
                return;
            }
            this._contentLoaded = true;
        }