コード例 #1
0
        public ChoseFromAllRolesView()
        {
            InitializeComponent();
            var tempItem = new STabItem();

            tempItem.TabItem = new TabItem
            {
                Header   = (String)this.FindResource("m_tab_Role"),
                Name     = "AllRolesTab",
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = "AllRolesGrid",
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridlRoles(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            tabControl.Items.Add(tempItem.TabItem);
            Style rowStyle = new Style(typeof(DataGridRow));

            rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                 new MouseButtonEventHandler(Handlers.RowRolesRoleView_DoubleClick)));
            tempItem.DataGrid.RowStyle              = rowStyle;
            tempItem.DataGrid.AutoGeneratedColumns += (sender, args) =>
            {
                tempItem.DataGrid.Columns[0].Visibility = Visibility.Collapsed;
                SystemSingleton.CurrentSession.SetCaptionToGrid(this, new KeyValuePair <string, STabItem>("AllRolesTab", tempItem));
            };
        }
コード例 #2
0
 public static void SetInfoToGridOther(ref STabItem tabitem)
 {
     try
     {
         SqlConnection con = new SqlConnection(SystemSingleton.Configuration.ConnectionString);
         SqlCommand    cmd = new SqlCommand(SqlCommands.SetInfoToGridOtherCommand, con);
         cmd.Parameters.Add("@RoleID", SqlDbType.UniqueIdentifier);
         cmd.Parameters["@RoleID"].Value = tabitem.ToRole;
         EnvironmentHelper.SendLogSQL(cmd.CommandText);
         SqlDataAdapter sda = new SqlDataAdapter(cmd);
         DataTable      dt  = new DataTable("Tasks");
         sda.Fill(dt);
         tabitem.DataGrid.ItemsSource = dt.DefaultView;
     }
     catch (Exception ex)
     {
         EnvironmentHelper.SendErrorDialogBox(ex.Message, "SQL Error", ex.StackTrace);
     }
 }
コード例 #3
0
        public static void SetWorkingPlace(TabControl tabControl, Window window)
        {
            var tempItem = new STabItem();

            tempItem.TabItem = new TabItem
            {
                Header   = (String)window.FindResource("m_tab_WorkingTab_CurrentWork"),
                Name     = StaticTypes.CurrentWorkTab,
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = StaticTypes.CurrentWorkGrid,
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridWork(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            SystemSingleton.CurrentSession.TabItems.Add(StaticTypes.CurrentWorkTab, tempItem);
            tabControl.Items.Add(tempItem.TabItem);

            tempItem         = new STabItem();
            tempItem.TabItem = new TabItem
            {
                Header   = (String)window.FindResource("m_tab_WorkingTab_CompletedWork"),
                Name     = StaticTypes.CompletedWorkTab,
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = StaticTypes.CompletedWorkGrid,
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridEndWork(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            SystemSingleton.CurrentSession.TabItems.Add(StaticTypes.CompletedWorkTab, tempItem);
            tabControl.Items.Add(tempItem.TabItem);

            foreach (var item in SystemSingleton.CurrentSession.UserRoles)
            {
                if (item.ID == new Guid("9efcd5cd-bf54-47f3-95e3-2953cb235941"))
                {
                    continue;
                }
                tempItem        = new STabItem();
                tempItem.ToRole = item.ID.Value;
                if (item.Name == StaticTypes.PersonalRole)
                {
                    tempItem.TabItem = new TabItem
                    {
                        Header   = (String)window.FindResource("m_tab_" + StaticTypes.PersonalRole),
                        Name     = item.Name,
                        Height   = 40,
                        FontSize = 14
                    };
                }
                else
                {
                    tempItem.TabItem = new TabItem
                    {
                        Header   = item.Caption,
                        Name     = item.Name,
                        Height   = 40,
                        FontSize = 14
                    };
                }
                tempItem.DataGrid = new DataGrid
                {
                    Name              = item.Name,
                    SelectionMode     = DataGridSelectionMode.Single,
                    CanUserAddRows    = false,
                    CanUserDeleteRows = false,
                    IsReadOnly        = true
                };
                if (item.Name == StaticTypes.PersonalRole)
                {
                    SetInfoToGridPersonal(ref tempItem.DataGrid);
                }
                else
                {
                    SetInfoToGridOther(ref tempItem);
                }
                tempItem.TabItem.Content = tempItem.DataGrid;
                SystemSingleton.CurrentSession.TabItems.Add(item.Name, tempItem);
                tabControl.Items.Add(tempItem.TabItem);
            }
            foreach (var item in SystemSingleton.CurrentSession.TabItems)
            {
                Style rowStyle = new Style(typeof(DataGridRow));
                rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                     new MouseButtonEventHandler(Handlers.Row_DoubleClick)));
                item.Value.DataGrid.RowStyle              = rowStyle;
                item.Value.DataGrid.AutoGeneratedColumns += (sender, args) =>
                {
                    item.Value.DataGrid.Columns[0].Visibility = Visibility.Collapsed;
                    SystemSingleton.CurrentSession.SetCaptionToGrid(window, item);
                };
            }
        }
コード例 #4
0
        public static void SetWorkingPlace(TabControl tabControl, Window window)
        {
            var tempItem = new STabItem();

            tempItem.TabItem = new TabItem
            {
                Header   = (String)window.FindResource("m_tab_PersonalRole"),
                Name     = StaticTypes.PersonalRoleTab,
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = StaticTypes.PersonalRoleGrid,
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridPersonalRole(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            SystemSingleton.CurrentSession.TabItems.Add(StaticTypes.PersonalRoleTab, tempItem);
            tabControl.Items.Add(tempItem.TabItem);


            tempItem         = new STabItem();
            tempItem.TabItem = new TabItem
            {
                Header   = (String)window.FindResource("m_tab_StaticRole"),
                Name     = StaticTypes.StaticRoleTab,
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = StaticTypes.StaticRoleGrid,
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridStaticRole(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            SystemSingleton.CurrentSession.TabItems.Add(StaticTypes.StaticRoleTab, tempItem);
            tabControl.Items.Add(tempItem.TabItem);

            tempItem         = new STabItem();
            tempItem.TabItem = new TabItem
            {
                Header   = (String)window.FindResource("m_tab_DocType"),
                Name     = StaticTypes.DocTypeTab,
                Height   = 40,
                FontSize = 14
            };
            tempItem.DataGrid = new DataGrid
            {
                Name              = StaticTypes.DocTypeGrid,
                SelectionMode     = DataGridSelectionMode.Single,
                CanUserAddRows    = false,
                CanUserDeleteRows = false,
                IsReadOnly        = true
            };
            SetInfoToGridDocType(ref tempItem.DataGrid);
            tempItem.TabItem.Content = tempItem.DataGrid;
            SystemSingleton.CurrentSession.TabItems.Add(StaticTypes.DocTypeTab, tempItem);
            tabControl.Items.Add(tempItem.TabItem);

            foreach (var item in SystemSingleton.CurrentSession.TabItems)
            {
                if (item.Key == StaticTypes.PersonalRoleTab)
                {
                    Style rowStyle = new Style(typeof(DataGridRow));
                    rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                         new MouseButtonEventHandler(Handlers.RowPersonalRole_DoubleClick)));
                    item.Value.DataGrid.RowStyle = rowStyle;
                }
                else if (item.Key == StaticTypes.StaticRoleTab)
                {
                    Style rowStyle = new Style(typeof(DataGridRow));
                    rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                         new MouseButtonEventHandler(Handlers.RowStaticRole_DoubleClick)));
                    item.Value.DataGrid.RowStyle = rowStyle;
                }
                else if (item.Key == StaticTypes.DocTypeTab)
                {
                    Style rowStyle = new Style(typeof(DataGridRow));
                    rowStyle.Setters.Add(new EventSetter(DataGridRow.MouseDoubleClickEvent,
                                                         new MouseButtonEventHandler(Handlers.RowDocType_DoubleClick)));
                    item.Value.DataGrid.RowStyle = rowStyle;
                }
                item.Value.DataGrid.AutoGeneratedColumns += (sender, args) =>
                {
                    item.Value.DataGrid.Columns[0].Visibility = Visibility.Collapsed;
                    SystemSingleton.CurrentSession.SetCaptionToGrid(window, item);
                };
            }
        }